38 std::shared_ptr<BaseMeshReader> reader_ptr;
40 reader_ptr = std::make_shared<GmshMeshReader>(file_name);
41 }
else if ( file_name.
extension() ==
".vtu" ) {
42 reader_ptr = std::make_shared<VtkMeshReader>(file_name);
43 }
else if ( file_name.
extension() ==
".pvd" ) {
44 reader_ptr = std::make_shared<PvdMeshReader>(file_name);
46 THROW(ExcWrongExtension() << EI_FileExtension(file_name.
extension()) << EI_MeshFile((
string)file_name) );
55 Mesh * mesh =
new Mesh( input_mesh_rec );
59 reader->read_physical_names(mesh);
60 if (input_mesh_rec.
opt_val(
"regions", region_list)) {
63 reader->read_raw_mesh(mesh);
64 }
INPUT_CATCH(FilePath::ExcFileOpen, FilePath::EI_Address_String, input_mesh_rec)
72 ASSERT(mesh).error(
"Argument mesh is NULL.\n");
73 tok_.set_position( Tokenizer::Position() );
87 bool boundary_domain,
unsigned int component_idx) {
89 .error(
"Vector of mapping VTK to GMSH element is not initialized. Did you call check_compatible_mesh?");
96 (*element_data_values_)[field_name] = std::make_shared< ElementDataCache<T> >();
101 unsigned int size_of_cache;
105 WarningOut().fmt(
"In file '{}', '{}' section for field '{}', time: {}.\nWrong number of entities: {}, using {} instead.\n",
110 if (n_components == 1) {
119 WarningOut().fmt(
"In file '{}', '{}' section for field '{}', time: {}.\nWrong number of components: {}, using {} instead.\n",
125 (*element_data_values_)[field_name]
126 = std::make_shared< ElementDataCache<T> >(field_name,
actual_header_.
time, size_of_cache, n_components*n_entities);
132 if (component_idx == std::numeric_limits<unsigned int>::max()) component_idx = 0;
139 #define MESH_READER_GET_ELEMENT_DATA(TYPE) \ 140 template typename ElementDataCache<TYPE>::ComponentDataPtr BaseMeshReader::get_element_data<TYPE>(unsigned int n_entities, \ 141 unsigned int n_components, bool boundary_domain, unsigned int component_idx);
std::shared_ptr< std::vector< T > > ComponentDataPtr
std::shared_ptr< ElementDataFieldMap > element_data_values_
Cache with last read element data.
BaseMeshReader(const FilePath &file_name)
Constructor.
std::string data_section_name_
Store name of field data section specify for type of mesh file.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
#define MESH_READER_GET_ELEMENT_DATA(TYPE)
virtual void read_nodes(Mesh *mesh)=0
void read_regions_from_input(Input::Array region_list)
static Mesh * mesh_factory(const Input::Record &input_mesh_rec)
void read_raw_mesh(Mesh *mesh)
virtual void read_elements(Mesh *mesh)=0
#define START_TIMER(tag)
Starts a timer with specified tag.
vector< IdxInt > boundary_elements_id_
virtual void read_element_data(ElementDataCacheBase &data_cache, MeshDataHeader actual_header, unsigned int n_components, bool boundary_domain)=0
Dedicated class for storing path to input and output files.
vector< IdxInt > bulk_elements_id_
ComponentDataPtr get_component_data(unsigned int component_idx)
Return vector of element data for get component.
MeshDataHeader actual_header_
Header of actual loaded data.
#define WarningOut()
Macro defining 'warning' record of log.
bool has_compatible_mesh_
ElementDataCache< T >::ComponentDataPtr get_element_data(unsigned int n_entities, unsigned int n_components, bool boundary_domain, unsigned int component_idx)
static std::shared_ptr< BaseMeshReader > reader_factory(const FilePath &file_name)
Tokenizer tok_
Tokenizer used for reading ASCII file format.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
std::vector< int > const & get_element_vector(bool boundary_domain)