44 if ( (*it).second.mesh_ ==
nullptr ) {
45 (*it).second.mesh_ = std::make_shared<Mesh>(
Input::Record() );
46 (*it).second.reader_->read_physical_names( (*it).second.mesh_.get() );
47 (*it).second.reader_->read_raw_mesh( (*it).second.mesh_.get() );
51 return (*it).second.mesh_;
59 reader_data.
reader_ = std::make_shared<GmshMeshReader>(file_path);
60 }
else if ( file_path.
extension() ==
".vtu" ) {
61 reader_data.
reader_ = std::make_shared<VtkMeshReader>(file_path);
62 }
else if ( file_path.
extension() ==
".pvd" ) {
63 reader_data.
reader_ = std::make_shared<PvdMeshReader>(file_path);
65 THROW(BaseMeshReader::ExcWrongExtension()
66 << BaseMeshReader::EI_FileExtension(file_path.
extension()) << BaseMeshReader::EI_MeshFile((
string)file_path) );
76 reader_ptr->set_element_ids(mesh);
95 Mesh *computational_mesh) {
98 auto &reader_data = (*it).second;
99 if ( reader_data.target_mesh_element_map_ ==
nullptr ) {
105 reader_data.reader_->set_element_ids(*computational_mesh);
106 std::shared_ptr<EquivalentMeshMap> map_ptr =
107 std::make_shared<EquivalentMeshMap>(computational_mesh->
n_elements(),
109 _set_identic_mesh_map(map_ptr->bulk, reader_data.reader_->get_element_ids(
false), computational_mesh);
112 reader_data.target_mesh_element_map_ = map_ptr;
114 return reader_data.target_mesh_element_map_;
119 Mesh *computational_mesh) {
122 auto &reader_data = (*it).second;
124 if ( reader_data.target_mesh_element_map_ ==
nullptr ) {
125 reader_data.reader_->set_element_ids(*source_mesh);
126 reader_data.target_mesh_element_map_ = computational_mesh->
check_compatible_mesh( *((*it).second.mesh_.get()) );
128 return reader_data.target_mesh_element_map_;
Dedicated class for storing path to input and output files.
Base class for Mesh and BCMesh.
int elem_index(int elem_id) const
For element of given elem_id returns index in element_vec_ or (-1) if element doesn't exist.
unsigned int n_elements() const
static const unsigned int undef_idx
BCMesh * bc_mesh() const override
Implement MeshBase::bc_mesh(), getter of boundary mesh.
std::shared_ptr< EquivalentMeshMap > check_compatible_mesh(Mesh &input_mesh) override
static std::shared_ptr< EquivalentMeshMap > identic_mesh_map(const FilePath &file_path, Mesh *computational_mesh)
ReaderCache()
Constructor.
ReaderTable reader_table_
Table of readers.
static std::shared_ptr< EquivalentMeshMap > eqivalent_mesh_map(const FilePath &file_path, Mesh *computational_mesh)
static void get_element_ids(const FilePath &file_path, const Mesh &mesh)
static ReaderTable::iterator get_reader_data(const FilePath &file_path)
Returns instance of given FilePath. If reader doesn't exist, creates new ReaderData object.
static ReaderCache * instance()
Returns singleton instance.
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.
const unsigned int undef_idx
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
void _set_identic_mesh_map(std::vector< int > &map, std::vector< int > ids, const MeshBase *mesh)
std::shared_ptr< BaseMeshReader > reader_