Go to the documentation of this file.
34 : element_data_values_(element_data_values),
39 std::shared_ptr<BaseMeshReader> reader_ptr;
41 reader_ptr = std::make_shared<GmshMeshReader>(file_name);
42 }
else if ( file_name.
extension() ==
".vtu" ) {
43 reader_ptr = std::make_shared<VtkMeshReader>(file_name);
44 }
else if ( file_name.
extension() ==
".pvd" ) {
45 reader_ptr = std::make_shared<PvdMeshReader>(file_name);
47 THROW(ExcWrongExtension() << EI_FileExtension(file_name.
extension()) << EI_MeshFile((
string)file_name) );
56 Mesh * mesh =
new Mesh( input_mesh_rec );
59 auto file = input_mesh_rec.
val<
FilePath>(
"mesh_file");
61 reader->read_physical_names(mesh);
62 if (input_mesh_rec.
opt_val(
"regions", region_list)) {
65 reader->read_raw_mesh(mesh);
66 }
INPUT_CATCH(FilePath::ExcFileOpen, FilePath::EI_Address_String, input_mesh_rec)
75 ASSERT_PTR(mesh).error(
"Argument mesh is NULL.\n");
76 tok_.set_position( Tokenizer::Position() );
97 unsigned int expected_n_components,
unsigned int boundary_begin) {
99 .error(
"Vector of mapping VTK to GMSH element is not initialized. Did you call check_compatible_mesh?");
105 (*element_data_values_)[field_name] = std::make_shared< ElementDataCache<T> >();
109 if ( !
it->second->is_actual(header.
time, field_name) ) {
111 if (header.
n_entities != expected_n_entities) {
112 WarningOut().fmt(
"In file '{}', '{}' section for field '{}', time: {}.\nDifferent number of entities: {}, computation needs {}.\n",
117 WarningOut().fmt(
"In file '{}', '{}' section for field '{}', time: {}.\nWrong number of components: {}, expected: {} .\n",
119 THROW(ExcWrongComponentsCount() << EI_FieldName(field_name) << EI_Time(header.
time) << EI_MeshFile(
tok_.f_name()) );
122 (*element_data_values_)[field_name] = std::make_shared< ElementDataCache<T> >(
123 field_name, header.
time,
124 expected_n_components*expected_n_entities, boundary_begin);
135 #define MESH_READER_GET_ELEMENT_DATA(TYPE) \
136 template typename ElementDataCache<TYPE>::CacheData BaseMeshReader::get_element_data<TYPE>( \
137 MeshDataHeader header, unsigned int n_entities, \
138 unsigned int n_components, unsigned int boundary_begin);
Tokenizer tok_
Tokenizer used for reading ASCII file format.
#define MESH_READER_GET_ELEMENT_DATA(TYPE)
vector< LongIdx > boundary_elements_id_
static std::shared_ptr< BaseMeshReader > reader_factory(const FilePath &file_name)
Dedicated class for storing path to input and output files.
virtual void read_nodes(Mesh *mesh)=0
void set_element_ids(const Mesh &mesh)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
void read_regions_from_input(Input::Array region_list)
std::shared_ptr< ElementDataFieldMap > element_data_values_
Cache with last read element data.
virtual void read_element_data(ElementDataCacheBase &data_cache, MeshDataHeader header)=0
static Mesh * mesh_factory(const Input::Record &input_mesh_rec)
CacheData get_data()
Return underlying vector of element data.
void elements_id_maps(vector< LongIdx > &bulk_elements_id, vector< LongIdx > &boundary_elements_id) const
const std::vector< int > & get_element_ids(bool boundary_domain)
BaseMeshReader(const FilePath &file_name)
Constructor.
virtual void read_elements(Mesh *mesh)=0
std::shared_ptr< std::vector< T > > CacheData
#define WarningOut()
Macro defining 'warning' record of log.
void read_raw_mesh(Mesh *mesh)
std::string data_section_name_
Store name of field data section specify for type of mesh file.
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
bool has_compatible_mesh_
#define START_TIMER(tag)
Starts a timer with specified tag.
vector< LongIdx > bulk_elements_id_
ElementDataCache< T >::CacheData get_element_data(MeshDataHeader header, unsigned int expected_n_entities, unsigned int expected_n_components, unsigned int boundary_begin)