OGS
anonymous_namespace{convertMeshToGeo.cpp} Namespace Reference

Functions

std::string convertMeshNodesToGeoPoints (MeshLib::Mesh const &mesh, double const eps, GeoLib::GEOObjects &geo_objects)
void addElementToSurface (MeshLib::Element const &e, std::vector< std::size_t > const &id_map, GeoLib::Surface &surface)

Function Documentation

◆ addElementToSurface()

void anonymous_namespace{convertMeshToGeo.cpp}::addElementToSurface ( MeshLib::Element const & e,
std::vector< std::size_t > const & id_map,
GeoLib::Surface & surface )

Definition at line 38 of file convertMeshToGeo.cpp.

41{
42 if (e.getGeomType() == MeshLib::MeshElemType::TRIANGLE)
43 {
44 surface.addTriangle(id_map[getNodeIndex(e, 0)],
45 id_map[getNodeIndex(e, 1)],
46 id_map[getNodeIndex(e, 2)]);
47 return;
48 }
49 if (e.getGeomType() == MeshLib::MeshElemType::QUAD)
50 {
51 surface.addTriangle(id_map[getNodeIndex(e, 0)],
52 id_map[getNodeIndex(e, 1)],
53 id_map[getNodeIndex(e, 2)]);
54 surface.addTriangle(id_map[getNodeIndex(e, 0)],
55 id_map[getNodeIndex(e, 2)],
56 id_map[getNodeIndex(e, 3)]);
57 return;
58 }
59 // all other element types are ignored (i.e. lines)
60};
void addTriangle(std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c)
Definition Surface.cpp:43

References GeoLib::Surface::addTriangle(), MeshLib::Element::getGeomType(), MeshLib::QUAD, and MeshLib::TRIANGLE.

◆ convertMeshNodesToGeoPoints()

std::string anonymous_namespace{convertMeshToGeo.cpp}::convertMeshNodesToGeoPoints ( MeshLib::Mesh const & mesh,
double const eps,
GeoLib::GEOObjects & geo_objects )

Convert and add mesh nodes to the geo_objects. A new name of the geo object is returned.

Definition at line 20 of file convertMeshToGeo.cpp.

23{
24 std::vector<GeoLib::Point*> points;
25 points.reserve(mesh.getNumberOfNodes());
26
27 std::transform(begin(mesh.getNodes()), end(mesh.getNodes()),
28 std::back_inserter(points),
29 [](MeshLib::Node const* node_ptr)
30 { return new GeoLib::Point(*node_ptr, node_ptr->getID()); });
31
32 auto geoobject_name = mesh.getName(); // Possibly modified when adding
33 // points to the geo objects.
34 geo_objects.addPointVec(std::move(points), geoobject_name, {}, eps);
35 return geoobject_name;
36}
void addPointVec(std::vector< Point * > &&points, std::string &name, PointVec::NameIdMap &&pnt_id_name_map, double const eps=std::sqrt(std::numeric_limits< double >::epsilon()))

References GeoLib::GEOObjects::addPointVec(), MeshLib::Mesh::getName(), MeshLib::Mesh::getNodes(), and MeshLib::Mesh::getNumberOfNodes().