Flow123d  release_2.2.0-19-g1279b7e
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
BaseMeshReader Class Referenceabstract

#include <msh_basereader.hh>

Inheritance diagram for BaseMeshReader:
Inheritance graph
[legend]
Collaboration diagram for BaseMeshReader:
Collaboration graph
[legend]

Public Member Functions

 TYPEDEF_ERR_INFO (EI_FieldName, std::string)
 
 TYPEDEF_ERR_INFO (EI_Time, double)
 
 TYPEDEF_ERR_INFO (EI_MeshFile, std::string)
 
 TYPEDEF_ERR_INFO (EI_Type, std::string)
 
 TYPEDEF_ERR_INFO (EI_TokenizerMsg, std::string)
 
 TYPEDEF_ERR_INFO (EI_FileExtension, std::string)
 
 DECLARE_INPUT_EXCEPTION (ExcFieldNameNotFound,<< "No data for field: "<< EI_FieldName::qval<< " and time: "<< EI_Time::val<< " in the input file: "<< EI_MeshFile::qval)
 
 DECLARE_EXCEPTION (ExcWrongFormat,<< "Wrong format of "<< EI_Type::val<< ", "<< EI_TokenizerMsg::val<< "\n"<< "in the input file: "<< EI_MeshFile::qval)
 
 DECLARE_EXCEPTION (ExcWrongExtension,<< "Unsupported extension "<< EI_FileExtension::qval<< " of the input file: "<< EI_MeshFile::qval)
 
 BaseMeshReader (const FilePath &file_name)
 Constructor. More...
 
void read_raw_mesh (Mesh *mesh)
 
virtual void read_physical_names (Mesh *mesh)=0
 
template<typename T >
ElementDataCache< T >::ComponentDataPtr get_element_data (std::string field_name, double time, unsigned int n_entities, unsigned int n_components, bool boundary_domain, unsigned int component_idx)
 
virtual void check_compatible_mesh (Mesh &mesh)=0
 
std::vector< int > const & get_element_vector (bool boundary_domain)
 

Static Public Member Functions

static std::shared_ptr< BaseMeshReaderreader_factory (const FilePath &file_name)
 
static Meshmesh_factory (const Input::Record &input_mesh_rec)
 

Protected Types

typedef std::shared_ptr< ElementDataCacheBaseElementDataPtr
 
typedef std::map< string, ElementDataPtrElementDataFieldMap
 

Protected Member Functions

virtual void read_nodes (Mesh *mesh)=0
 
virtual void read_elements (Mesh *mesh)=0
 
virtual MeshDataHeaderfind_header (double time, std::string field_name)=0
 
virtual void make_header_table ()=0
 
virtual void read_element_data (ElementDataCacheBase &data_cache, MeshDataHeader actual_header, unsigned int n_components, bool boundary_domain)=0
 

Protected Attributes

bool has_compatible_mesh_
 
std::string data_section_name_
 Store name of field data section specify for type of mesh file. More...
 
ElementDataFieldMap element_data_values_
 Cache with last read element data. More...
 
Tokenizer tok_
 Tokenizer used for reading ASCII file format. More...
 
Input::Record input_mesh_rec_
 Input record accessor of mesh. More...
 
vector< int > bulk_elements_id_
 
vector< int > boundary_elements_id_
 

Detailed Description

Abstract parent of mesh readers.

Supported are:

Definition at line 88 of file msh_basereader.hh.

Member Typedef Documentation

Definition at line 171 of file msh_basereader.hh.

typedef std::shared_ptr<ElementDataCacheBase> BaseMeshReader::ElementDataPtr
protected

Definition at line 170 of file msh_basereader.hh.

Constructor & Destructor Documentation

BaseMeshReader::BaseMeshReader ( const FilePath file_name)

Constructor.

Definition at line 26 of file msh_basereader.cc.

Member Function Documentation

virtual void BaseMeshReader::check_compatible_mesh ( Mesh mesh)
pure virtual

Check if nodes and elements of reader mesh is compatible with mesh.

Implemented in VtkMeshReader, and GmshMeshReader.

BaseMeshReader::DECLARE_EXCEPTION ( ExcWrongFormat  ,
<< "Wrong format of "<< EI_Type::val<< "  ,
"<< EI_TokenizerMsg::val<< "\n"<< "in the input file:"<< EI_MeshFile::qval   
)
BaseMeshReader::DECLARE_EXCEPTION ( ExcWrongExtension  ,
<< "Unsupported extension "<< EI_FileExtension::qval<< " of the input file: "<< EI_MeshFile::qval   
)
BaseMeshReader::DECLARE_INPUT_EXCEPTION ( ExcFieldNameNotFound  ,
<< "No data for field: "<< EI_FieldName::qval<< " and time: "<< EI_Time::val<< " in the input file: "<< EI_MeshFile::qval   
)
virtual MeshDataHeader& BaseMeshReader::find_header ( double  time,
std::string  field_name 
)
protectedpure virtual

Find data header for given time and field.

Implemented in VtkMeshReader, and GmshMeshReader.

Here is the caller graph for this function:

template<typename T >
ElementDataCache< T >::ComponentDataPtr BaseMeshReader::get_element_data ( std::string  field_name,
double  time,
unsigned int  n_entities,
unsigned int  n_components,
bool  boundary_domain,
unsigned int  component_idx 
)

Reads ElementData sections of opened mesh file. The file is searched for the \$ElementData (GMSH) or DataArray (VTK) section with header that match the given field_name and time of the next section is the first greater then that given in input parameters). If such section has not been yet read, we read the data section into raw buffer data. The map id_to_idx is used to convert IDs that marks individual input rows/entities into indexes to the raw buffer. The buffer must have size at least n_components * n_entities. Indexes in the map must be smaller then n_entities. If the data buffer is updated we set actual to true.

Possible optimizations: If the map ID lookup seem slow, we may assume that IDs are in increasing order, use simple array of IDs instead of map and just check that they comes in in correct order.

Parameters
field_namefield name
timesearched time
n_entitiescount of entities (elements)
n_componentscount of components (size of returned data is given by n_entities*n_components)
boundary_domainflag determines that data is read for boundary or bulk elements
component_idxcomponent index of MultiField

Definition at line 76 of file msh_basereader.cc.

std::vector< int > const & BaseMeshReader::get_element_vector ( bool  boundary_domain)

Returns vector of boundary or bulk element ids by parameter boundary_domain

Definition at line 70 of file msh_basereader.cc.

Here is the caller graph for this function:

virtual void BaseMeshReader::make_header_table ( )
protectedpure virtual

Reads table of data headers specific for each descendants.

Implemented in VtkMeshReader, and GmshMeshReader.

Mesh * BaseMeshReader::mesh_factory ( const Input::Record input_mesh_rec)
static

This static method gets accessor to record with function input, dispatch to correct constructor and initialize appropriate function object from the input. Returns pointer to Mesh.

Definition at line 42 of file msh_basereader.cc.

Here is the caller graph for this function:

virtual void BaseMeshReader::read_element_data ( ElementDataCacheBase data_cache,
MeshDataHeader  actual_header,
unsigned int  n_components,
bool  boundary_domain 
)
protectedpure virtual

Read element data to data cache

Implemented in VtkMeshReader, and GmshMeshReader.

Here is the caller graph for this function:

virtual void BaseMeshReader::read_elements ( Mesh mesh)
protectedpure virtual

Method for reading of elements.

Implemented in VtkMeshReader, and GmshMeshReader.

Here is the caller graph for this function:

virtual void BaseMeshReader::read_nodes ( Mesh mesh)
protectedpure virtual

private method for reading of nodes

Implemented in VtkMeshReader, and GmshMeshReader.

Here is the caller graph for this function:

virtual void BaseMeshReader::read_physical_names ( Mesh mesh)
pure virtual

Read regions from the mesh file and save the physical sections as regions in the RegionDB.

Implemented in VtkMeshReader, and GmshMeshReader.

void BaseMeshReader::read_raw_mesh ( Mesh mesh)

Reads raw data of mesh (only nodes and elements) from the GMSH or VTKfile. Input of the mesh allows changing regions within the input file.

Definition at line 62 of file msh_basereader.cc.

std::shared_ptr< BaseMeshReader > BaseMeshReader::reader_factory ( const FilePath file_name)
static

This static method gets file path object of reader, dispatch to correct constructor and initialize appropriate function object from the input. Returns shared pointer to BaseMeshReader.

Definition at line 30 of file msh_basereader.cc.

Here is the caller graph for this function:

BaseMeshReader::TYPEDEF_ERR_INFO ( EI_FieldName  ,
std::string   
)
BaseMeshReader::TYPEDEF_ERR_INFO ( EI_Time  ,
double   
)
BaseMeshReader::TYPEDEF_ERR_INFO ( EI_MeshFile  ,
std::string   
)
BaseMeshReader::TYPEDEF_ERR_INFO ( EI_Type  ,
std::string   
)
BaseMeshReader::TYPEDEF_ERR_INFO ( EI_TokenizerMsg  ,
std::string   
)
BaseMeshReader::TYPEDEF_ERR_INFO ( EI_FileExtension  ,
std::string   
)

Member Data Documentation

vector<int> BaseMeshReader::boundary_elements_id_
protected

Definition at line 220 of file msh_basereader.hh.

vector<int> BaseMeshReader::bulk_elements_id_
protected

Vector of both bulk and boundary IDs. Bulk elements come first, then boundary elements, but only the portion that appears in input mesh file and has ID assigned.

Definition at line 220 of file msh_basereader.hh.

std::string BaseMeshReader::data_section_name_
protected

Store name of field data section specify for type of mesh file.

Definition at line 207 of file msh_basereader.hh.

ElementDataFieldMap BaseMeshReader::element_data_values_
protected

Cache with last read element data.

Definition at line 210 of file msh_basereader.hh.

bool BaseMeshReader::has_compatible_mesh_
protected

Flag stores that check of compatible mesh was performed.

This flag has effect only for VTK reader.

Definition at line 204 of file msh_basereader.hh.

Input::Record BaseMeshReader::input_mesh_rec_
protected

Input record accessor of mesh.

Definition at line 216 of file msh_basereader.hh.

Tokenizer BaseMeshReader::tok_
protected

Tokenizer used for reading ASCII file format.

Definition at line 213 of file msh_basereader.hh.


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