
The member function read() can be used to read the complete file at once or just the header. Once the data is read, you can access the various member variables and retrieve the output data in a convenient way.
The following example illustrates the principle usage:
Delphin5OutputData data; string filename = "..."; // set filename // now read the data // (if the second argument were true, we'd only be reading the file header) if (!data.read(filename, false, errmsg)) { cerr << errmsg << endl; // print error message } // now the data structure contains a lot of information to be used // for analysis and post-processing.
Definition at line 50 of file delphin5_output.h.
Public Types | |
| enum | type_t { T_FIELD_OUTPUT, T_FLUX_OUTPUT, NUM_T } |
| The principle type of the output file (field/state variables per element or flux across sides). More... | |
| enum | spaceType_t { ST_SINGLE, ST_MEAN, ST_INTEGRAL, NUM_ST } |
| enum | timeType_t { TT_NONE, TT_MEAN, TT_INTEGRAL, NUM_TT } |
| enum | dataFormat_t { DF_2D, DF_3D, DF_4D, DF_4D_FLUX, NUM_DF } |
| Used to indicate the format of the data. More... | |
Public Member Functions | |
| Delphin5OutputData () | |
| Default constructor. | |
| void | clear () |
| Empty all vectors and reset member variables. | |
| bool | read (const std::string &fname, bool header_only, std::string &errmsg, bool generate_postproc_info=true, ReadNotification *notify=NULL) |
| Read all function, essentially combines readHeader() and readData() and reads the complete output file into the member variables. | |
| bool | writeHeader (std::ostream &out, bool write_geometry, std::string &errmsg) const |
| Writes the header of the output file including geometry data into the output stream 'out'. | |
| bool | write (std::ostream &out, std::string &errmsg) |
| The function detects whether the output stream is a binary stream or ASCII stream and writes the data accordingly. | |
| bool | generatePostprocInfo (std::string &errmsg) |
| Generates the information usable by the postprocessing. | |
| std::vector< LineData > & | constructionLines () |
| Returns a vector with construction lines (lines that separate different layers of the structure). | |
| std::vector< LineData > & | boundaryLines () |
| Returns a vector with boundary lines (lines that enclose the structure). | |
Public Attributes | |
| std::string | m_filename |
| Filename of the output file (only set if read using the first read function). | |
| type_t | m_type |
| 0 = field, 1 = flux | |
| std::string | m_projectFile |
| Project file string. | |
| std::string | m_quantity |
| Quantity description string. | |
| spaceType_t | m_spaceType |
| 0 = SINGLE, 1 = MEAN, 2 = INTEGRAL | |
| timeType_t | m_timeType |
| 0 = NONE, 1 = INTEGRAL | |
| std::string | m_valueUnit |
| Unit string for values. | |
| std::string | m_timeUnit |
| Unit string for time points. | |
| bool | m_isBinary |
| Flag indicating, whether the file is in binary format. | |
| std::vector< MaterialDef > | m_matDefs |
| The material definition table. | |
| Grid | m_grid |
| Grid information. | |
| std::vector< ElementGeometry > | m_elementsVec |
| Element geometry data. | |
| std::vector< SidesGeometry > | m_sidesVec |
| Sides geometry data. | |
| std::vector< int > | m_nums |
| std::vector< double > | m_timepoints |
| Vector with index numbers of elements (field outputs) or sides (flux outputs). | |
| std::vector< std::vector < double > > | m_values |
| Vector with values. | |
| dataFormat_t | m_dataFormat |
| Calculated parameter for output data format: 0 = 2D, 1 = 3D, 2 = 4D field, 3 = 4D flux As long as m_dataFormat == NUM_DF please DO NOT access any of the variables below, because their values cannot be trusted. | |
| std::vector< std::vector< int > > | m_elementMapping |
| Generated structure matrix of selected grid region (only for 2D grids). | |
| std::vector< std::vector< int > > | m_valueMapping |
| Generated structure matrix of selected grid region (only for 2D grids). | |
| rectangle< unsigned int > | m_gridLocation |
| Column and row indices defining the location of the selected grid region with respect to the total grid. | |
| rectangle< double > | m_coordinateLimits |
| The vector stores the minimum and maximum coordinates of the actually selected grid region in real coordinates (bottom is a smaller y-value than top). | |
Private Member Functions | |
| bool | readData (std::istream &in, std::string &errmsg, ReadNotification *notify) |
| Reads the data section of the output file. | |
| bool | readHeader (std::istream &in, std::string &errmsg, bool generate_postproc_info, ReadNotification *notify) |
| Reads only the header of the output file (including geometry section) into the member variables. | |
| bool | readBinaryHeader (std::istream &in, std::string &errmsg, bool generate_postproc_info, ReadNotification *notify) |
| Works essentially as the function above, but reads the header of a binary file. | |
| bool | parseHeader (std::istream &in, std::string &geometry_data, std::string &errmsg, ReadNotification *notify) |
| Parses the header of an ASCII mode output file and stops after the line with the ELEMENTS or SIDES tag. | |
| bool | parseHeader (std::FILE *in, char *geometry_data, size_t size, ReadNotification *notify) |
| Works as the function above, but reads in C-style. | |
| bool | parseGeometryData (std::istream &in, std::string &errmsg, ReadNotification *notify) |
| Parses the geometry data from an ASCII input stream. | |
| bool | parseGeometryData (const char *geodata, std::string &errmsg, ReadNotification *notify) |
| Works as the function above, but reads in C-style. | |
| void | writeGeometryData (std::ostream &out) const |
| Writes the geometry data currently stored in the member variables matDefs, grid, eVec and sVec. | |
| bool | readBinaryGeometryData (std::istream &in, std::string &errmsg, ReadNotification *notify) |
| Reads a geometry section in binary format. | |
| void | writeBinaryGeometryData (std::ostream &out) const |
| Same as writeGeometryData(), only it writes out the data in binary mode. | |
| void | generateConstructionLines () |
| Generates vectors with lines that can be used to visualize the construction and boundaries. | |
Private Attributes | |
| std::vector< LineData > | m_constructionLines |
| List with lines around and between materials. | |
| std::vector< LineData > | m_boundaryLines |
| List with lines around the construction (boundary lines). | |
| std::size_t | m_fileSize |
| Used during reading to report the progress. | |
| std::string | m_binaryFileVersion |
| Version of the binary file, currently support tag: 'binary 5.0'. | |
The principle type of the output file (field/state variables per element or flux across sides).
Definition at line 53 of file delphin5_output.h.
| DELPHIN::Delphin5OutputData::Delphin5OutputData | ( | ) |
| void DELPHIN::Delphin5OutputData::clear | ( | ) |
Empty all vectors and reset member variables.
| bool DELPHIN::Delphin5OutputData::read | ( | const std::string & | fname, | |
| bool | header_only, | |||
| std::string & | errmsg, | |||
| bool | generate_postproc_info = true, |
|||
| ReadNotification * | notify = NULL | |||
| ) |
Read all function, essentially combines readHeader() and readData() and reads the complete output file into the member variables.
This function also detects wether the output file is a binary file or not and calls the appropriate read* functions.
| fname | The full path to the file name to be read. | |
| header_only | If true, reads only the header information and not the data part of the file. | |
| errmsg | Used to store error messages if any. | |
| generate_postproc_info | If true, populates auxiliry data elements for use in post-processing applications. | |
| notify | Pass a pointer to a class derived from ReadNotification that handles notification events during reading of long data files. |
| bool DELPHIN::Delphin5OutputData::writeHeader | ( | std::ostream & | out, | |
| bool | write_geometry, | |||
| std::string & | errmsg | |||
| ) | const |
Writes the header of the output file including geometry data into the output stream 'out'.
In order to write a complete header, store the appropriate information in the member variables info, matDefs, grid, eVec and sVec. The function detects whether the output stream is a binary stream or ASCII stream and writes the data accordingly.
| out | The output stream. | |
| write_geometry | If true, the geometry section is written, otherwise not. | |
| errmsg | Used to store error messages. |
| bool DELPHIN::Delphin5OutputData::write | ( | std::ostream & | out, | |
| std::string & | errmsg | |||
| ) |
The function detects whether the output stream is a binary stream or ASCII stream and writes the data accordingly.
| bool DELPHIN::Delphin5OutputData::generatePostprocInfo | ( | std::string & | errmsg | ) |
Generates the information usable by the postprocessing.
| std::vector<LineData>& DELPHIN::Delphin5OutputData::constructionLines | ( | ) |
Returns a vector with construction lines (lines that separate different layers of the structure).
Only available for 2D structures, for others the vector is empty.
| std::vector<LineData>& DELPHIN::Delphin5OutputData::boundaryLines | ( | ) |
Returns a vector with boundary lines (lines that enclose the structure).
Only available for 2D structures, for others the vector is empty.
| bool DELPHIN::Delphin5OutputData::readData | ( | std::istream & | in, | |
| std::string & | errmsg, | |||
| ReadNotification * | notify | |||
| ) | [private] |
Reads the data section of the output file.
The input stream 'in' is expected to be positioned at the begin of the data section.
| bool DELPHIN::Delphin5OutputData::readHeader | ( | std::istream & | in, | |
| std::string & | errmsg, | |||
| bool | generate_postproc_info, | |||
| ReadNotification * | notify | |||
| ) | [private] |
Reads only the header of the output file (including geometry section) into the member variables.
The input stream 'in' is expected to be positioned at the begin of an output file header. After the header is read, the stream will positioned directly after the header and the begin of the data section.
| bool DELPHIN::Delphin5OutputData::readBinaryHeader | ( | std::istream & | in, | |
| std::string & | errmsg, | |||
| bool | generate_postproc_info, | |||
| ReadNotification * | notify | |||
| ) | [private] |
Works essentially as the function above, but reads the header of a binary file.
| bool DELPHIN::Delphin5OutputData::parseHeader | ( | std::istream & | in, | |
| std::string & | geometry_data, | |||
| std::string & | errmsg, | |||
| ReadNotification * | notify | |||
| ) | [private] |
Parses the header of an ASCII mode output file and stops after the line with the ELEMENTS or SIDES tag.
| bool DELPHIN::Delphin5OutputData::parseHeader | ( | std::FILE * | in, | |
| char * | geometry_data, | |||
| size_t | size, | |||
| ReadNotification * | notify | |||
| ) | [private] |
Works as the function above, but reads in C-style.
| bool DELPHIN::Delphin5OutputData::parseGeometryData | ( | std::istream & | in, | |
| std::string & | errmsg, | |||
| ReadNotification * | notify | |||
| ) | [private] |
Parses the geometry data from an ASCII input stream.
| bool DELPHIN::Delphin5OutputData::parseGeometryData | ( | const char * | geodata, | |
| std::string & | errmsg, | |||
| ReadNotification * | notify | |||
| ) | [private] |
Works as the function above, but reads in C-style.
| void DELPHIN::Delphin5OutputData::writeGeometryData | ( | std::ostream & | out | ) | const [private] |
Writes the geometry data currently stored in the member variables matDefs, grid, eVec and sVec.
| bool DELPHIN::Delphin5OutputData::readBinaryGeometryData | ( | std::istream & | in, | |
| std::string & | errmsg, | |||
| ReadNotification * | notify | |||
| ) | [private] |
Reads a geometry section in binary format.
| void DELPHIN::Delphin5OutputData::writeBinaryGeometryData | ( | std::ostream & | out | ) | const [private] |
Same as writeGeometryData(), only it writes out the data in binary mode.
| void DELPHIN::Delphin5OutputData::generateConstructionLines | ( | ) | [private] |
Generates vectors with lines that can be used to visualize the construction and boundaries.
| std::string DELPHIN::Delphin5OutputData::m_filename |
Filename of the output file (only set if read using the first read function).
Definition at line 135 of file delphin5_output.h.
| std::string DELPHIN::Delphin5OutputData::m_projectFile |
| std::string DELPHIN::Delphin5OutputData::m_quantity |
| std::string DELPHIN::Delphin5OutputData::m_valueUnit |
| std::string DELPHIN::Delphin5OutputData::m_timeUnit |
Flag indicating, whether the file is in binary format.
Definition at line 146 of file delphin5_output.h.
| std::vector<MaterialDef> DELPHIN::Delphin5OutputData::m_matDefs |
Grid information.
Definition at line 151 of file delphin5_output.h.
| std::vector<SidesGeometry> DELPHIN::Delphin5OutputData::m_sidesVec |
| std::vector<int> DELPHIN::Delphin5OutputData::m_nums |
| std::vector<double> DELPHIN::Delphin5OutputData::m_timepoints |
Vector with index numbers of elements (field outputs) or sides (flux outputs).
Vector with time points.
Definition at line 159 of file delphin5_output.h.
| std::vector< std::vector<double> > DELPHIN::Delphin5OutputData::m_values |
Vector with values.
Definition at line 160 of file delphin5_output.h.
Calculated parameter for output data format: 0 = 2D, 1 = 3D, 2 = 4D field, 3 = 4D flux As long as m_dataFormat == NUM_DF please DO NOT access any of the variables below, because their values cannot be trusted.
Definition at line 168 of file delphin5_output.h.
| std::vector< std::vector<int> > DELPHIN::Delphin5OutputData::m_elementMapping |
Generated structure matrix of selected grid region (only for 2D grids).
Each element in element_mat[col][row] contains the number of its assigned element (in the m_elementsVec vector) or -1 for VOID elements. This element number corresponds to the index in the m_elementsVec vector. Use this matrix to retrive the coordinates for an element at location [col][row] from the Grid struct.
Definition at line 176 of file delphin5_output.h.
| std::vector< std::vector<int> > DELPHIN::Delphin5OutputData::m_valueMapping |
Generated structure matrix of selected grid region (only for 2D grids).
Each element in selected_element_mat[col][row] contains the number of the corresponding output value or -1 for VOID elements. This element number corresponds to the index in the m_nums vector. Use this matrix to retrive the value for an element at location [col][row].
Definition at line 183 of file delphin5_output.h.
| rectangle<unsigned int> DELPHIN::Delphin5OutputData::m_gridLocation |
Column and row indices defining the location of the selected grid region with respect to the total grid.
Definition at line 187 of file delphin5_output.h.
The vector stores the minimum and maximum coordinates of the actually selected grid region in real coordinates (bottom is a smaller y-value than top).
Definition at line 191 of file delphin5_output.h.
std::vector<LineData> DELPHIN::Delphin5OutputData::m_constructionLines [private] |
std::vector<LineData> DELPHIN::Delphin5OutputData::m_boundaryLines [private] |
List with lines around the construction (boundary lines).
Definition at line 235 of file delphin5_output.h.
std::size_t DELPHIN::Delphin5OutputData::m_fileSize [private] |
std::string DELPHIN::Delphin5OutputData::m_binaryFileVersion [private] |
Version of the binary file, currently support tag: 'binary 5.0'.
Definition at line 238 of file delphin5_output.h.
1.5.5