Flow123d
jenkins-Flow123d-windows-release-multijob-285
|
#include <msh_gmshreader.h>
Public Types | |
typedef std::map< std::string, std::vector< GMSH_DataHeader > > | HeaderTable |
Public Member Functions | |
TYPEDEF_ERR_INFO (EI_FieldName, std::string) | |
TYPEDEF_ERR_INFO (EI_GMSHFile, std::string) | |
TYPEDEF_ERR_INFO (EI_Time, double) | |
DECLARE_INPUT_EXCEPTION (ExcFieldNameNotFound,<< "No data for field: "<< EI_FieldName::qval<< " and time: "<< EI_Time::val<< " in the input file: "<< EI_GMSHFile::qval) | |
GmshMeshReader (const FilePath &file_name) | |
GmshMeshReader (std::istream &in) | |
~GmshMeshReader () | |
void | read_mesh (Mesh *mesh, const RegionDB::MapElementIDToRegionID *el_to_reg_map=NULL) |
template<typename T > | |
ElementDataCache< T >::ComponentDataPtr | get_element_data (GMSH_DataHeader &search_header, std::vector< int > const &el_ids, unsigned int component_idx) |
template<typename T > | |
ElementDataCache< T >::ComponentDataPtr | get_element_data (GMSH_DataHeader &search_header, std::vector< int > const &el_ids, unsigned int component_idx) |
Private Member Functions | |
void | read_physical_names (Tokenizer &in, Mesh *mesh) |
void | read_nodes (Tokenizer &in, Mesh *) |
void | read_elements (Tokenizer &in, Mesh *, const RegionDB::MapElementIDToRegionID *el_to_reg_map=NULL) |
void | read_data_header (Tokenizer &tok, GMSH_DataHeader &head) |
void | make_header_table () |
GMSH_DataHeader & | find_header (double time, std::string field_name) |
Private Attributes | |
Tokenizer | tok_ |
Tokenizer used for reading ASCII GMSH file format. More... | |
HeaderTable | header_table_ |
Table with data of ElementData headers. More... | |
ElementDataCacheBase * | current_cache_ |
Cache with last read element data. More... | |
Definition at line 91 of file msh_gmshreader.h.
typedef std::map< std::string, std::vector<GMSH_DataHeader> > GmshMeshReader::HeaderTable |
Map of ElementData sections in GMSH file.
For each field_name contains vector of GMSH_DataHeader. Headers are sorted by time in ascending order.
Definition at line 107 of file msh_gmshreader.h.
GmshMeshReader::GmshMeshReader | ( | const FilePath & | file_name | ) |
Construct the GMSH format reader from given filename. This opens the file for reading.
Definition at line 51 of file msh_gmshreader.cc.
GmshMeshReader::GmshMeshReader | ( | std::istream & | in | ) |
Construct the GMSH format reader from given input stream. The input stream should be correctly opened. To get correct information about line numbers there should be no previous reading from the stream.
Definition at line 61 of file msh_gmshreader.cc.
GmshMeshReader::~GmshMeshReader | ( | ) |
Destructor close the file if opened.
Definition at line 71 of file msh_gmshreader.cc.
GmshMeshReader::DECLARE_INPUT_EXCEPTION | ( | ExcFieldNameNotFound | , |
<< "No data for field: "<< EI_FieldName::qval<< " and time: "<< EI_Time::val<< " in the input file: "<< EI_GMSHFile::qval | |||
) |
|
private |
Finds GMSH data header for ElementData given by time and field_name and return it as the first parameter.
Definition at line 430 of file msh_gmshreader.cc.
ElementDataCache<T>::ComponentDataPtr GmshMeshReader::get_element_data | ( | GMSH_DataHeader & | search_header, |
std::vector< int > const & | el_ids, | ||
unsigned int | component_idx | ||
) |
Reads ElementData sections of opened GMSH file. The file is serached for the \$ElementData section with header that match the given search_header
(same field_name, time of the next section is the first greater then that given in the search_header
). 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 search_header.n_components
* search_header.n_entities
. Indexes in the map must be smaller then search_header.n_entities
. If the data
buffer is updated we set search_header.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.
ElementDataCache<T>::ComponentDataPtr GmshMeshReader::get_element_data | ( | GMSH_DataHeader & | search_header, |
std::vector< int > const & | el_ids, | ||
unsigned int | component_idx | ||
) |
Definition at line 306 of file msh_gmshreader.cc.
|
private |
Reads table of ElementData headers from the tokenizer file.
Definition at line 402 of file msh_gmshreader.cc.
|
private |
Reads the header from the tokenizer tok
and return it as the second parameter.
Definition at line 249 of file msh_gmshreader.cc.
|
private |
Method for reading of elements. Optional map el_to_reg_map can be used to override region of some elements provided by GMSH file. Input of the mesh allows changing regions within the input CON file.
Definition at line 119 of file msh_gmshreader.cc.
void GmshMeshReader::read_mesh | ( | Mesh * | mesh, |
const RegionDB::MapElementIDToRegionID * | el_to_reg_map = NULL |
||
) |
Reads mesh
from the GMSH file. Optional map el_to_reg_map can be used to override region of some elements provided by GMSH file. Input of the mesh allows changing regions within the input CON file.
Definition at line 76 of file msh_gmshreader.cc.
|
private |
private method for reading of nodes
Definition at line 87 of file msh_gmshreader.cc.
|
private |
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.
Definition at line 220 of file msh_gmshreader.cc.
GmshMeshReader::TYPEDEF_ERR_INFO | ( | EI_FieldName | , |
std::string | |||
) |
GmshMeshReader::TYPEDEF_ERR_INFO | ( | EI_GMSHFile | , |
std::string | |||
) |
GmshMeshReader::TYPEDEF_ERR_INFO | ( | EI_Time | , |
double | |||
) |
|
private |
Cache with last read element data.
Definition at line 189 of file msh_gmshreader.h.
|
private |
Table with data of ElementData headers.
Definition at line 187 of file msh_gmshreader.h.
|
private |
Tokenizer used for reading ASCII GMSH file format.
Definition at line 185 of file msh_gmshreader.h.