Flow123d  DF_patch_fe_data_tables-b828b90
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
GmshMeshReader Class Reference

#include <msh_gmshreader.h>

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

Public Member Functions

 TYPEDEF_ERR_INFO (EI_GMSHFile, std::string)
 
 TYPEDEF_ERR_INFO (EI_Section, std::string)
 
 TYPEDEF_ERR_INFO (EI_ElementId, int)
 
 TYPEDEF_ERR_INFO (EI_ElementType, int)
 
 TYPEDEF_ERR_INFO (EI_Position, std::string)
 
 DECLARE_EXCEPTION (ExcMissingSection,<< "Missing section "<< EI_Section::qval<< " in the GMSH input file: "<< EI_GMSHFile::qval)
 
 DECLARE_EXCEPTION (ExcUnsupportedType,<< "Element "<< EI_ElementId::val<< "in the GMSH input file "<< EI_GMSHFile::qval<< " is of the unsupported type "<< EI_ElementType::val)
 
 DECLARE_EXCEPTION (ExcZeroNodes,<< "Zero number of nodes, "<< EI_Position::val<< ".\n")
 
 DECLARE_EXCEPTION (ExcZeroElements,<< "Zero number of elements, "<< EI_Position::val<< ".\n")
 
 DECLARE_EXCEPTION (ExcTooManyElementTags,<< "At least two element tags have to be defined for element with id="<< EI_ElementId::val<< ", "<< EI_Position::val<< ".\n")
 
 GmshMeshReader (const FilePath &file_name)
 
virtual ~GmshMeshReader ()
 
void read_physical_names (Mesh *mesh) override
 
MeshDataHeaderfind_header (HeaderQuery &header_query) override
 
- Public Member Functions inherited from BaseMeshReader
 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_INPUT_EXCEPTION (ExcMissingFieldDiscretization,<< "Missing data type specification for field: "<< EI_FieldName::qval<< " and time: "<< EI_Time::val<< " in the input file: "<< EI_MeshFile::qval<< "\nPlease, add value of key 'input_discretization'.")
 
 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)
 
 DECLARE_EXCEPTION (ExcWrongComponentsCount,<< "Wrong number of components of field "<< EI_FieldName::qval<< " at time "<< EI_Time::val<< " in the input file: "<< EI_MeshFile::qval)
 
 BaseMeshReader (const FilePath &file_name)
 Constructor. More...
 
void read_raw_mesh (Mesh *mesh)
 
template<typename T >
ElementDataCache< T >::CacheData get_element_data (MeshDataHeader header, unsigned int expected_n_entities, unsigned int expected_n_components, unsigned int boundary_begin)
 
void set_element_ids (const Mesh &mesh)
 
std::vector< int > const & get_element_ids (bool boundary_domain)
 

Protected Types

typedef std::map< std::string, std::vector< MeshDataHeader > > HeaderTable
 
- Protected Types inherited from BaseMeshReader
typedef std::shared_ptr< ElementDataCacheBaseElementDataPtr
 
typedef std::map< string, ElementDataPtrElementDataFieldMap
 

Protected Member Functions

void read_nodes (Mesh *mesh)
 
void read_elements (Mesh *mesh)
 
void read_data_header (MeshDataHeader &head)
 
void make_header_table () override
 
void read_element_data (ElementDataCacheBase &data_cache, MeshDataHeader header) override
 
- Protected Member Functions inherited from BaseMeshReader
 BaseMeshReader (const FilePath &file_name, std::shared_ptr< ElementDataFieldMap > element_data_values)
 Constructor. More...
 

Protected Attributes

HeaderTable header_table_
 Table with data of ElementData headers. More...
 
- Protected Attributes inherited from BaseMeshReader
bool has_compatible_mesh_
 
std::string data_section_name_
 Store name of field data section specify for type of mesh file. More...
 
std::shared_ptr< ElementDataFieldMapelement_data_values_
 Cache with last read element data. More...
 
Tokenizer tok_
 Tokenizer used for reading ASCII file format. More...
 
vector< LongIdxbulk_elements_id_
 
vector< LongIdxboundary_elements_id_
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseMeshReader
static std::shared_ptr< BaseMeshReaderreader_factory (const FilePath &file_name)
 
static Meshmesh_factory (const Input::Record &input_mesh_rec)
 

Detailed Description

Definition at line 35 of file msh_gmshreader.h.

Member Typedef Documentation

◆ HeaderTable

typedef std::map< std::string, std::vector<MeshDataHeader> > GmshMeshReader::HeaderTable
protected

Map of ElementData sections in GMSH file.

For each field_name contains vector of MeshDataHeader. Headers are sorted by time in ascending order.

Definition at line 85 of file msh_gmshreader.h.

Constructor & Destructor Documentation

◆ GmshMeshReader()

GmshMeshReader::GmshMeshReader ( const FilePath file_name)

Construct the GMSH format reader from given FilePath. This opens the file for reading.

Definition at line 39 of file msh_gmshreader.cc.

◆ ~GmshMeshReader()

GmshMeshReader::~GmshMeshReader ( )
virtual

Destructor close the file if opened.

Definition at line 50 of file msh_gmshreader.cc.

Member Function Documentation

◆ DECLARE_EXCEPTION() [1/5]

GmshMeshReader::DECLARE_EXCEPTION ( ExcMissingSection  ,
<< "Missing section "<< EI_Section::qval<< " in the GMSH input file: "<< EI_GMSHFile::qval   
)

◆ DECLARE_EXCEPTION() [2/5]

GmshMeshReader::DECLARE_EXCEPTION ( ExcTooManyElementTags  ,
<< "At least two element tags have to be defined for element with  id = "<< EI_ElementId::val<< ",
"<< EI_Position::val<< ".\n"   
)

◆ DECLARE_EXCEPTION() [3/5]

GmshMeshReader::DECLARE_EXCEPTION ( ExcUnsupportedType  ,
<< "Element "<< EI_ElementId::val<< "in the GMSH input file "<< EI_GMSHFile::qval<< " is of the unsupported type "<< EI_ElementType::val   
)

◆ DECLARE_EXCEPTION() [4/5]

GmshMeshReader::DECLARE_EXCEPTION ( ExcZeroElements  ,
<< "Zero number of  elements,
"<< EI_Position::val<< ".\n"   
)

◆ DECLARE_EXCEPTION() [5/5]

GmshMeshReader::DECLARE_EXCEPTION ( ExcZeroNodes  ,
<< "Zero number of  nodes,
"<< EI_Position::val<< ".\n"   
)

◆ find_header()

BaseMeshReader::MeshDataHeader & GmshMeshReader::find_header ( BaseMeshReader::HeaderQuery header_query)
overridevirtual

Finds GMSH data header for ElementData given by time and field_name.

Implements BaseMeshReader.

Definition at line 334 of file msh_gmshreader.cc.

◆ make_header_table()

void GmshMeshReader::make_header_table ( )
overrideprotectedvirtual

Reads table of ElementData headers from the tokenizer file.

Implements BaseMeshReader.

Definition at line 307 of file msh_gmshreader.cc.

Here is the caller graph for this function:

◆ read_data_header()

void GmshMeshReader::read_data_header ( MeshDataHeader head)
protected

Reads the header from the tokenizer tok and return it as the second parameter.

Definition at line 195 of file msh_gmshreader.cc.

Here is the caller graph for this function:

◆ read_element_data()

void GmshMeshReader::read_element_data ( ElementDataCacheBase data_cache,
MeshDataHeader  header 
)
overrideprotectedvirtual

Implements BaseMeshReader::read_element_data.

Implements BaseMeshReader.

Definition at line 252 of file msh_gmshreader.cc.

◆ read_elements()

void GmshMeshReader::read_elements ( Mesh mesh)
protectedvirtual

Method for reading of elements. Input of the mesh allows changing regions within the input CON file. Read section '$PhysicalNames' of the GMSH file and save the physical sections to general data structure.

Region Labels starting with '!' are treated as boundary regions. Elements of these regions are used just to assign regions to the boundary and are not used in actual FEM computations.

Implements BaseMeshReader.

Definition at line 89 of file msh_gmshreader.cc.

◆ read_nodes()

void GmshMeshReader::read_nodes ( Mesh mesh)
protectedvirtual

private method for reading of nodes

Implements BaseMeshReader.

Definition at line 55 of file msh_gmshreader.cc.

◆ read_physical_names()

void GmshMeshReader::read_physical_names ( Mesh mesh)
overridevirtual

Read section '$PhysicalNames' of the GMSH file and save the physical sections as regions in the RegionDB.

Region Labels starting with '!' are treated as boundary regions. Elements of these regions are used just to assign regions to the boundary and are not used in actual FEM computations.

Implements BaseMeshReader.

Definition at line 164 of file msh_gmshreader.cc.

◆ TYPEDEF_ERR_INFO() [1/5]

GmshMeshReader::TYPEDEF_ERR_INFO ( EI_ElementId  ,
int   
)

◆ TYPEDEF_ERR_INFO() [2/5]

GmshMeshReader::TYPEDEF_ERR_INFO ( EI_ElementType  ,
int   
)

◆ TYPEDEF_ERR_INFO() [3/5]

GmshMeshReader::TYPEDEF_ERR_INFO ( EI_GMSHFile  ,
std::string   
)

◆ TYPEDEF_ERR_INFO() [4/5]

GmshMeshReader::TYPEDEF_ERR_INFO ( EI_Position  ,
std::string   
)

◆ TYPEDEF_ERR_INFO() [5/5]

GmshMeshReader::TYPEDEF_ERR_INFO ( EI_Section  ,
std::string   
)

Member Data Documentation

◆ header_table_

HeaderTable GmshMeshReader::header_table_
protected

Table with data of ElementData headers.

Definition at line 115 of file msh_gmshreader.h.


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