Commit 036f560a authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1344 OutputDeformedMesh: generalize it so that format others than Medit might be accepted.

parent 56db0411
......@@ -17,7 +17,7 @@ RUN apt-get install --no-install-recommends -y ninja-build nano less
RUN curl -O https://cmake.org/files/v3.12/cmake-3.12.1-Linux-x86_64.sh \
&& sh cmake-3.12.1-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir \
&& rm -f cmake-3.12.1-Linux-x86_64.sh
# ================================================================================================================
# Clone the MoReFEM repository.
......
......@@ -35,7 +35,6 @@ namespace MoReFEM
const unsigned int numbering_subset_id,
Internal::MeshNS::MeshManager& mesh_manager,
const Mesh& mesh,
MeshNS::Format initial_format,
const Domain& domain,
const unsigned int output_mesh_index,
const std::string& output_name,
......@@ -158,51 +157,29 @@ namespace MoReFEM
{
const auto coord_index_old = geom_elt.GetCoord(j).GetIndex();
unsigned int coord_index_new = coords_index_list_old_to_new[coord_index_old];
const auto it = coords_index_list_old_to_new.find(coord_index_old);
assert(it != coords_index_list_old_to_new.cend());
unsigned int coord_index_new = it->second;
vertices.push_back(coord_index_new);
assert(coord_index_new - 1 < Nnodes_new);
}
const auto& geometric_elt_factory = ::MoReFEM::Advanced::GeometricEltFactory::CreateOrGetInstance(__FILE__, __LINE__);
if (initial_format == MeshNS::Format::Medit)
{
const auto& medit_type_list = geometric_elt_factory.MeditRefGeomEltList();
for (auto type : medit_type_list)
{
const auto& type_code = type.first; // alias
const auto medit_identifier = geom_elt.GetMeditIdentifier();
if (type_code == medit_identifier)
{
const auto& createGeometricEltFunction = type.second;
GeometricElt::shared_ptr new_geom_elmt_ptr(createGeometricEltFunction(unique_id_output_mesh));
new_geom_elmt_ptr->SetCoordsList(coords_list, std::move(vertices));
new_geom_elmt_ptr->SetIndex(Nelement_created);
new_geom_elmt_ptr->SetMeshLabel(mesh_label_ptr);
new_output_mesh_geom_elemts.push_back(new_geom_elmt_ptr);
++Nelement_created;
break;
}
else
{
continue;
}
}
}
else
{
throw Exception("Not done yet for another format than Medit for the input mesh.",
__FILE__, __LINE__);
}
const auto& geometric_elt_factory =
::MoReFEM::Advanced::GeometricEltFactory::CreateOrGetInstance(__FILE__, __LINE__);
GeometricElt::shared_ptr new_geom_elmt_ptr(geometric_elt_factory.CreateFromIdentifier(geom_elt.GetIdentifier(),
unique_id_output_mesh));
decltype(auto) new_geom_elmt = *new_geom_elmt_ptr;
new_geom_elmt.SetCoordsList(coords_list, std::move(vertices));
new_geom_elmt.SetIndex(Nelement_created);
new_geom_elmt.SetMeshLabel(mesh_label_ptr);
new_output_mesh_geom_elemts.push_back(new_geom_elmt_ptr);
++Nelement_created;
}
MeshLabel::vector_const_shared_ptr new_label_list;
......
......@@ -71,7 +71,6 @@ namespace MoReFEM
const unsigned int numbering_subset_id,
Internal::MeshNS::MeshManager& mesh_manager,
const Mesh& mesh,
MeshNS::Format format,
const Domain& domain,
const unsigned int output_mesh_index,
const std::string& output_name,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment