.. index:: pair: class; gpr::io::FileManager .. _doxid-classgpr_1_1io_1_1_file_manager: class gpr::io::FileManager ========================== .. toctree:: :hidden: Overview ~~~~~~~~ Responsible for generic IO operations. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class FileManager { public: // construction :target:`FileManager`(); virtual :target:`~FileManager`(); // methods void :ref:`readInputFile`(const std::string file_name, :ref:`gpr::InputParameters`& parameters); template void :ref:`readDataFile`(const std::string file_name, std::map& data); template bool :ref:`readFromPlainFile`(const std::string file_name, T& field); template bool :target:`writePlainFile`(const std::string file_name, const T& field, std::ios::openmode mode); bool :target:`writeXYZFile`(const std::string file_name, const :ref:`gpr::Coord`& field, std::ios::openmode mode); }; .. _details-classgpr_1_1io_1_1_file_manager: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Responsible for generic IO operations. Methods ------- .. index:: pair: function; readInputFile .. _doxid-classgpr_1_1io_1_1_file_manager_1acc6d2f06956701bebe12dea479d28bc3: .. ref-code-block:: cpp :class: doxyrest-title-code-block void readInputFile(const std::string file_name, :ref:`gpr::InputParameters`& parameters) Read data from the input file and populates structure of *parameters*. The input file may have empty lines and in-line comments that should start with "%" character. The values should be assigned to variable using the assignment operator "=". .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file_name - Name of the input file. * - parameters - Structure of parameters .. index:: pair: function; readDataFile .. _doxid-classgpr_1_1io_1_1_file_manager_1acb6d677bd6956a6a2c7f047a644f0384: .. ref-code-block:: cpp :class: doxyrest-title-code-block template void readDataFile(const std::string file_name, std::map& data) Read data file. The method reads data file written in ASCII format. The values of *data* should point to fields that supposed to be populated. The keys in *data* should have names of fields from the data file. .. note:: Template *T* should be of type :ref:`Coord ` or *Field*. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file_name - Name of the data file. * - data - Map of fields names and pointers to the fields objects. .. index:: pair: function; readFromPlainFile .. _doxid-classgpr_1_1io_1_1_file_manager_1ac0cb9ec2b16bcdda68d2cdc05bcacd8a: .. ref-code-block:: cpp :class: doxyrest-title-code-block template bool readFromPlainFile(const std::string file_name, T& field) Read plain ASCII data file. This function reads data line-by-line from a plain text file. No memory allocation and no range chacks are invoked during the execution of the function. .. warning:: *field* should be pre-allocated! .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file_name - File name * - field - 2D field of data .. rubric:: Returns: EXIT_SUCCESS or EXIT_FAILURE codes