DELPHIN::Delphin5OutputData Class Reference

Collaboration diagram for DELPHIN::Delphin5OutputData:

Collaboration graph
[legend]

List of all members.


Detailed Description

This class stores all output data from a Delphin 5 output file.

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.
Examples:

simple_reading_example.cpp.

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< MaterialDefm_matDefs
 The material definition table.
Grid m_grid
 Grid information.
std::vector< ElementGeometrym_elementsVec
 Element geometry data.
std::vector< SidesGeometrym_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< LineDatam_constructionLines
 List with lines around and between materials.
std::vector< LineDatam_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'.

Member Enumeration Documentation

The principle type of the output file (field/state variables per element or flux across sides).

Enumerator:
T_FIELD_OUTPUT 
T_FLUX_OUTPUT 
NUM_T 

Definition at line 53 of file delphin5_output.h.

Enumerator:
ST_SINGLE 
ST_MEAN 
ST_INTEGRAL 
NUM_ST 

Definition at line 59 of file delphin5_output.h.

Enumerator:
TT_NONE 
TT_MEAN 
TT_INTEGRAL 
NUM_TT 

Definition at line 66 of file delphin5_output.h.

Used to indicate the format of the data.

Enumerator:
DF_2D 
DF_3D 
DF_4D 
DF_4D_FLUX 
NUM_DF 

Definition at line 74 of file delphin5_output.h.


Constructor & Destructor Documentation

DELPHIN::Delphin5OutputData::Delphin5OutputData (  ) 

Default constructor.

Definition at line 83 of file delphin5_output.h.


Member Function Documentation

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.

Returns:
True if file was read successfully, false if not (in this case 'errmsg' contains a description of the error encountered).
Parameters:
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.
Examples:
simple_reading_example.cpp.

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.

Parameters:
out The output stream.
write_geometry If true, the geometry section is written, otherwise not.
errmsg Used to store error messages.
Returns:
Returns 'true' if successful, otherwise 'false'. If writing failed, an error message is stored in 'errmsg'.

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.


Member Data Documentation

Filename of the output file (only set if read using the first read function).

Definition at line 135 of file delphin5_output.h.

0 = field, 1 = flux

Definition at line 139 of file delphin5_output.h.

Project file string.

Definition at line 140 of file delphin5_output.h.

Quantity description string.

Definition at line 141 of file delphin5_output.h.

0 = SINGLE, 1 = MEAN, 2 = INTEGRAL

Definition at line 142 of file delphin5_output.h.

0 = NONE, 1 = INTEGRAL

Definition at line 143 of file delphin5_output.h.

Unit string for values.

Definition at line 144 of file delphin5_output.h.

Unit string for time points.

Definition at line 145 of file delphin5_output.h.

Flag indicating, whether the file is in binary format.

Definition at line 146 of file delphin5_output.h.

The material definition table.

Definition at line 150 of file delphin5_output.h.

Grid information.

Examples:
simple_reading_example.cpp.

Definition at line 151 of file delphin5_output.h.

Element geometry data.

Definition at line 152 of file delphin5_output.h.

Sides geometry data.

Definition at line 153 of file delphin5_output.h.

Examples:
simple_reading_example.cpp.

Definition at line 157 of file delphin5_output.h.

Vector with index numbers of elements (field outputs) or sides (flux outputs).

Vector with time points.

Examples:
simple_reading_example.cpp.

Definition at line 159 of file delphin5_output.h.

std::vector< std::vector<double> > DELPHIN::Delphin5OutputData::m_values

Vector with values.

Examples:
simple_reading_example.cpp.

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].

Examples:
simple_reading_example.cpp.

Definition at line 183 of file delphin5_output.h.

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.

List with lines around and between materials.

Definition at line 234 of file delphin5_output.h.

List with lines around the construction (boundary lines).

Definition at line 235 of file delphin5_output.h.

Used during reading to report the progress.

Definition at line 237 of file delphin5_output.h.

Version of the binary file, currently support tag: 'binary 5.0'.

Definition at line 238 of file delphin5_output.h.


The documentation for this class was generated from the following file:

Generated on Tue Mar 24 18:12:08 2009 for Delphin 5 Outputs Library by  doxygen 1.5.5