Flow123d
release_2.2.0-36-g163dc99
|
#include <msh_vtkreader.hh>
Public Types | |
enum | DataSections { points, cells, cell_data } |
Possible data sections in UnstructuredGrid - Piece node. More... | |
enum | DataFormat { ascii, binary_uncompressed, binary_zlib } |
Type of data formats - ascii, binary or compressed with zLib. More... | |
typedef std::map< std::string, MeshDataHeader > | HeaderTable |
Public Member Functions | |
TYPEDEF_ERR_INFO (EI_VTKFile, std::string) | |
TYPEDEF_ERR_INFO (EI_ExpectedFormat, std::string) | |
TYPEDEF_ERR_INFO (EI_ErrMessage, std::string) | |
TYPEDEF_ERR_INFO (EI_SectionTypeName, std::string) | |
TYPEDEF_ERR_INFO (EI_TagType, std::string) | |
TYPEDEF_ERR_INFO (EI_TagName, std::string) | |
DECLARE_EXCEPTION (ExcInvalidFormat,<< "Invalid format of DataArray "<< EI_FieldName::val<< ", expected "<< EI_ExpectedFormat::val<< "\n"<< "in the input file: "<< EI_VTKFile::qval) | |
DECLARE_EXCEPTION (ExcUnknownFormat,<< "Unsupported or missing format of DataArray "<< EI_FieldName::val<< "\n"<< "in the input file: "<< EI_VTKFile::qval) | |
DECLARE_EXCEPTION (ExcWrongType,<< EI_ErrMessage::val<< " data type of "<< EI_SectionTypeName::val<< "\n"<< "in the input file: "<< EI_VTKFile::qval) | |
DECLARE_EXCEPTION (ExcIncompatibleMesh,<< "Incompatible meshes, "<< EI_ErrMessage::val<< "\n"<< "for VTK input file: "<< EI_VTKFile::qval) | |
DECLARE_EXCEPTION (ExcMissingTag,<< "Missing "<< EI_TagType::val<< " "<< EI_TagName::val<< "\n"<< " in the input file: "<< EI_VTKFile::qval) | |
VtkMeshReader (const FilePath &file_name) | |
~VtkMeshReader () | |
Destructor. More... | |
void | read_physical_names (Mesh *mesh) override |
void | check_compatible_mesh (Mesh &mesh) 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_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) |
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) |
std::vector< int > const & | get_element_vector (bool boundary_domain) |
Protected Member Functions | |
void | read_nodes (Mesh *mesh) |
void | read_elements (Mesh *mesh) |
MeshDataHeader & | find_header (double time, std::string field_name) override |
void | make_header_table () override |
Reads table of DataArray headers through pugixml interface. More... | |
MeshDataHeader | create_header (pugi::xml_node node, unsigned int n_entities, Tokenizer::Position pos) |
Helper method that create DataArray header of given xml node (used from make_header_table ) More... | |
DataType | get_data_type (std::string type_str) |
Get DataType by value of string. More... | |
unsigned int | type_value_size (DataType data_type) |
Return size of value of data_type. More... | |
void | parse_ascii_data (ElementDataCacheBase &data_cache, unsigned int n_components, unsigned int n_entities, Tokenizer::Position pos, bool boundary_domain) |
Parse ascii data to data cache. More... | |
void | parse_binary_data (ElementDataCacheBase &data_cache, unsigned int n_components, unsigned int n_entities, Tokenizer::Position pos, bool boundary_domain, DataType value_type) |
Parse binary data to data cache. More... | |
void | parse_compressed_data (ElementDataCacheBase &data_cache, unsigned int n_components, unsigned int n_entities, Tokenizer::Position pos, bool boundary_domain, DataType value_type) |
Uncompress and parse binary compressed data to data cache. More... | |
void | read_base_vtk_attributes (pugi::xml_node vtk_node, unsigned int &n_nodes, unsigned int &n_elements) |
Set base attributes of VTK and get count of nodes and elements. More... | |
Tokenizer::Position | get_appended_position () |
Get position of AppendedData tag in VTK file. More... | |
void | read_element_data (ElementDataCacheBase &data_cache, MeshDataHeader actual_header, unsigned int n_components, bool boundary_domain) override |
bool | compare_points (arma::vec3 &p1, arma::vec3 &p2) |
Protected Attributes | |
DataType | header_type_ |
header type of VTK file (only for appended data) More... | |
DataFormat | data_format_ |
variants of data format (ascii, appended, compressed appended) More... | |
HeaderTable | header_table_ |
Table with data of DataArray headers. More... | |
std::istream * | data_stream_ |
input stream allow read appended data, used only if this tag exists More... | |
unsigned int | n_read_ |
store count of read entities 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... | |
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_ |
Static Protected Attributes | |
static const double | point_tolerance = 1E-10 |
Tolerance during comparison point data with GMSH nodes. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from BaseMeshReader | |
static std::shared_ptr< BaseMeshReader > | reader_factory (const FilePath &file_name) |
static Mesh * | mesh_factory (const Input::Record &input_mesh_rec) |
Protected Types inherited from BaseMeshReader | |
typedef std::shared_ptr< ElementDataCacheBase > | ElementDataPtr |
typedef std::map< string, ElementDataPtr > | ElementDataFieldMap |
Definition at line 29 of file msh_vtkreader.hh.
typedef std::map< std::string, MeshDataHeader > VtkMeshReader::HeaderTable |
Map of DataArray sections in VTK file.
For each field_name contains MeshDataHeader.
Definition at line 64 of file msh_vtkreader.hh.
Type of data formats - ascii, binary or compressed with zLib.
Enumerator | |
---|---|
ascii | |
binary_uncompressed | |
binary_zlib |
Definition at line 55 of file msh_vtkreader.hh.
Possible data sections in UnstructuredGrid - Piece node.
Enumerator | |
---|---|
points | |
cells | |
cell_data |
Definition at line 50 of file msh_vtkreader.hh.
VtkMeshReader::VtkMeshReader | ( | const FilePath & | file_name | ) |
Construct the VTK format reader from given FilePath. This opens the file for reading.
Definition at line 63 of file msh_vtkreader.cc.
VtkMeshReader::~VtkMeshReader | ( | ) |
Destructor.
Definition at line 73 of file msh_vtkreader.cc.
|
overridevirtual |
Check if nodes and elements of VTK mesh is compatible with mesh
.
bulk_elements_id_
get_element_data
Implements BaseMeshReader.
Definition at line 394 of file msh_vtkreader.cc.
|
protected |
Compare two points representing by armadillo vector.
check_compatible_mesh
methodpoint_tolerance
parameter Definition at line 509 of file msh_vtkreader.cc.
|
protected |
Helper method that create DataArray header of given xml node (used from make_header_table
)
Definition at line 141 of file msh_vtkreader.cc.
VtkMeshReader::DECLARE_EXCEPTION | ( | ExcInvalidFormat | , |
<< "Invalid format of DataArray "<< EI_FieldName::val<< " | , | ||
expected"<< EI_ExpectedFormat::val<< "\n"<< "in the input file:"<< EI_VTKFile::qval | |||
) |
VtkMeshReader::DECLARE_EXCEPTION | ( | ExcUnknownFormat | , |
<< "Unsupported or missing format of DataArray "<< EI_FieldName::val<< "\n"<< "in the input file: "<< EI_VTKFile::qval | |||
) |
VtkMeshReader::DECLARE_EXCEPTION | ( | ExcWrongType | , |
<< EI_ErrMessage::val<< " data type of "<< EI_SectionTypeName::val<< "\n"<< "in the input file: "<< EI_VTKFile::qval | |||
) |
VtkMeshReader::DECLARE_EXCEPTION | ( | ExcIncompatibleMesh | , |
<< "Incompatible | meshes, | ||
"<< EI_ErrMessage::val<< "\n"<< "for VTK input file:"<< EI_VTKFile::qval | |||
) |
VtkMeshReader::DECLARE_EXCEPTION | ( | ExcMissingTag | , |
<< "Missing "<< EI_TagType::val<< " "<< EI_TagName::val<< "\n"<< " in the input file: "<< EI_VTKFile::qval | |||
) |
|
overrideprotectedvirtual |
Find header of DataArray section of VTK file given by field_name.
Note: time
has no effect (it is only for continuity with GMSH reader).
Implements BaseMeshReader.
Definition at line 221 of file msh_vtkreader.cc.
|
protected |
Get position of AppendedData tag in VTK file.
Definition at line 111 of file msh_vtkreader.cc.
|
protected |
Get DataType by value of string.
Definition at line 235 of file msh_vtkreader.cc.
|
overrideprotectedvirtual |
Reads table of DataArray headers through pugixml interface.
Implements BaseMeshReader.
Definition at line 181 of file msh_vtkreader.cc.
|
protected |
Parse ascii data to data cache.
Definition at line 305 of file msh_vtkreader.cc.
|
protected |
Parse binary data to data cache.
Definition at line 324 of file msh_vtkreader.cc.
|
protected |
Uncompress and parse binary compressed data to data cache.
Definition at line 339 of file msh_vtkreader.cc.
|
protected |
Set base attributes of VTK and get count of nodes and elements.
Definition at line 80 of file msh_vtkreader.cc.
|
overrideprotectedvirtual |
Implements BaseMeshReader::read_element_data
.
Implements BaseMeshReader.
Definition at line 272 of file msh_vtkreader.cc.
|
protectedvirtual |
Method for reading of elements. Input of the mesh allows changing regions within the input file.
Implements BaseMeshReader.
Definition at line 527 of file msh_vtkreader.cc.
|
protectedvirtual |
private method for reading of nodes
Implements BaseMeshReader.
Definition at line 521 of file msh_vtkreader.cc.
|
overridevirtual |
Read regions from the VTK 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 516 of file msh_vtkreader.cc.
|
protected |
Return size of value of data_type.
Definition at line 263 of file msh_vtkreader.cc.
VtkMeshReader::TYPEDEF_ERR_INFO | ( | EI_VTKFile | , |
std::string | |||
) |
VtkMeshReader::TYPEDEF_ERR_INFO | ( | EI_ExpectedFormat | , |
std::string | |||
) |
VtkMeshReader::TYPEDEF_ERR_INFO | ( | EI_ErrMessage | , |
std::string | |||
) |
VtkMeshReader::TYPEDEF_ERR_INFO | ( | EI_SectionTypeName | , |
std::string | |||
) |
VtkMeshReader::TYPEDEF_ERR_INFO | ( | EI_TagType | , |
std::string | |||
) |
VtkMeshReader::TYPEDEF_ERR_INFO | ( | EI_TagName | , |
std::string | |||
) |
|
protected |
variants of data format (ascii, appended, compressed appended)
Definition at line 163 of file msh_vtkreader.hh.
|
protected |
input stream allow read appended data, used only if this tag exists
Definition at line 169 of file msh_vtkreader.hh.
|
protected |
Table with data of DataArray headers.
Definition at line 166 of file msh_vtkreader.hh.
|
protected |
header type of VTK file (only for appended data)
Definition at line 160 of file msh_vtkreader.hh.
|
protected |
store count of read entities
Definition at line 172 of file msh_vtkreader.hh.
|
staticprotected |
Tolerance during comparison point data with GMSH nodes.
Definition at line 157 of file msh_vtkreader.hh.