31 std::shared_ptr<BaseMeshReader> reader_ptr;
33 reader_ptr = std::make_shared<GmshMeshReader>(file_name);
34 }
else if ( file_name.
extension() ==
".vtu" ) {
35 reader_ptr = std::make_shared<VtkMeshReader>(file_name);
37 THROW(ExcWrongExtension() << EI_FileExtension(file_name.
extension()) << EI_MeshFile((
string)file_name) );
46 Mesh * mesh =
new Mesh( input_mesh_rec );
50 reader->read_physical_names(mesh);
51 if (input_mesh_rec.
opt_val(
"regions", region_list)) {
54 reader->read_raw_mesh(mesh);
55 }
INPUT_CATCH(FilePath::ExcFileOpen, FilePath::EI_Address_String, input_mesh_rec)
63 ASSERT(mesh).error(
"Argument mesh is NULL.\n");
64 tok_.set_position( Tokenizer::Position() );
77 unsigned int n_entities,
unsigned int n_components,
bool boundary_domain,
unsigned int component_idx) {
79 .error(
"Vector of mapping VTK to GMSH element is not initialized. Did you call check_compatible_mesh?");
88 if ( !it->second->is_actual(actual_header.
time, field_name) ) {
89 unsigned int size_of_cache;
93 WarningOut().fmt(
"In file '{}', '{}' section for field '{}', time: {}.\nWrong number of entities: {}, using {} instead.\n",
98 if (n_components == 1) {
107 WarningOut().fmt(
"In file '{}', '{}' section for field '{}', time: {}.\nWrong number of components: {}, using {} instead.\n",
114 = std::make_shared< ElementDataCache<T> >(actual_header, size_of_cache, n_components*n_entities);
115 this->
read_element_data(*(it->second), actual_header, n_components, boundary_domain );
118 if (component_idx == std::numeric_limits<unsigned int>::max()) component_idx = 0;
125 #define MESH_READER_GET_ELEMENT_DATA(TYPE) \ 126 template typename ElementDataCache<TYPE>::ComponentDataPtr BaseMeshReader::get_element_data<TYPE>(std::string field_name, double time, \ 127 unsigned int n_entities, unsigned int n_components, bool boundary_domain, unsigned int component_idx);
std::shared_ptr< std::vector< T > > ComponentDataPtr
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)
vector< int > bulk_elements_id_
void read_raw_mesh(Mesh *mesh)
virtual void read_elements(Mesh *mesh)=0
#define START_TIMER(tag)
Starts a timer with specified tag.
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 read_element_data(ElementDataCacheBase &data_cache, MeshDataHeader actual_header, unsigned int n_components, bool boundary_domain)=0
virtual MeshDataHeader & find_header(double time, std::string field_name)=0
Dedicated class for storing path to input and output files.
vector< int > boundary_elements_id_
ComponentDataPtr get_component_data(unsigned int component_idx)
Return vector of element data for get component.
#define WarningOut()
Macro defining 'warning' record of log.
bool has_compatible_mesh_
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)