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 49 of file convertMeshToGeo.cpp.

52{
53 if (e.getGeomType() == MeshLib::MeshElemType::TRIANGLE)
54 {
55 surface.addTriangle(id_map[getNodeIndex(e, 0)],
56 id_map[getNodeIndex(e, 1)],
57 id_map[getNodeIndex(e, 2)]);
58 return;
59 }
60 if (e.getGeomType() == MeshLib::MeshElemType::QUAD)
61 {
62 surface.addTriangle(id_map[getNodeIndex(e, 0)],
63 id_map[getNodeIndex(e, 1)],
64 id_map[getNodeIndex(e, 2)]);
65 surface.addTriangle(id_map[getNodeIndex(e, 0)],
66 id_map[getNodeIndex(e, 2)],
67 id_map[getNodeIndex(e, 3)]);
68 return;
69 }
70 // all other element types are ignored (i.e. lines)
71};
void addTriangle(std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c)
Definition Surface.cpp:49

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 31 of file convertMeshToGeo.cpp.

34{
35 std::vector<GeoLib::Point*> points;
36 points.reserve(mesh.getNumberOfNodes());
37
38 std::transform(begin(mesh.getNodes()), end(mesh.getNodes()),
39 std::back_inserter(points),
40 [](MeshLib::Node const* node_ptr)
41 { return new GeoLib::Point(*node_ptr, node_ptr->getID()); });
42
43 auto geoobject_name = mesh.getName(); // Possibly modified when adding
44 // points to the geo objects.
45 geo_objects.addPointVec(std::move(points), geoobject_name, {}, eps);
46 return geoobject_name;
47}
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().