43 if ( (*it).second.mesh_ ==
nullptr ) {
44 (*it).second.mesh_ = std::make_shared<Mesh>(
Input::Record() );
45 (*it).second.reader_->read_physical_names( (*it).second.mesh_.get() );
46 (*it).second.reader_->read_raw_mesh( (*it).second.mesh_.get() );
50 return (*it).second.mesh_;
58 reader_data.
reader_ = std::make_shared<GmshMeshReader>(file_path);
59 }
else if ( file_path.
extension() ==
".vtu" ) {
60 reader_data.
reader_ = std::make_shared<VtkMeshReader>(file_path);
61 }
else if ( file_path.
extension() ==
".pvd" ) {
62 reader_data.
reader_ = std::make_shared<PvdMeshReader>(file_path);
64 THROW(BaseMeshReader::ExcWrongExtension()
65 << BaseMeshReader::EI_FileExtension(file_path.
extension()) << BaseMeshReader::EI_MeshFile((
string)file_path) );
75 reader_ptr->has_compatible_mesh_ =
true;
76 mesh.
elements_id_maps(reader_ptr->bulk_elements_id_, reader_ptr->boundary_elements_id_);
81 ASSERT( (*it).second.mesh_ !=
nullptr ).error(
"Mesh is not created. Did you call 'ReaderCache::get_mesh(file_path)'?\n");
82 if ( (*it).second.target_mesh_element_map_ ==
nullptr ) {
83 (*it).second.target_mesh_element_map_ = computational_mesh->
check_compatible_mesh( *((*it).second.mesh_.get()) );
85 return (*it).second.target_mesh_element_map_;
static void get_element_ids(const FilePath &file_path, const Mesh &mesh)
virtual std::shared_ptr< std::vector< LongIdx > > check_compatible_mesh(Mesh &input_mesh)
ReaderCache()
Constructor.
static ReaderCache * instance()
Returns singleton instance.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
std::shared_ptr< BaseMeshReader > reader_
static ReaderTable::iterator get_reader_data(const FilePath &file_path)
Returns instance of given FilePath. If reader doesn't exist, creates new ReaderData object...
void elements_id_maps(vector< LongIdx > &bulk_elements_id, vector< LongIdx > &boundary_elements_id) const
Dedicated class for storing path to input and output files.
ReaderTable reader_table_
Table of readers.
static std::shared_ptr< Mesh > get_mesh(const FilePath &file_path)
static std::shared_ptr< BaseMeshReader > get_reader(const FilePath &file_path)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
static std::shared_ptr< std::vector< LongIdx > > get_target_mesh_element_map(const FilePath &file_path, Mesh *computational_mesh)