OGS
MeshGeoToolsLib::MeshNodesAlongPolyline Class Reference

Detailed Description

This class computes the ids of the mesh nodes along a polyline.

The mesh nodes are sorted as follow: [ ids of sorted nodes according to their distance to the starting point of ply ]

Definition at line 28 of file MeshNodesAlongPolyline.h.

#include <MeshNodesAlongPolyline.h>

Collaboration diagram for MeshGeoToolsLib::MeshNodesAlongPolyline:
[legend]

Public Member Functions

 MeshNodesAlongPolyline (MeshLib::Mesh const &mesh, GeoLib::Polyline const &ply, double epsilon_radius, SearchAllNodes search_all_nodes)
MeshLib::Mesh const & getMesh () const
 return the mesh object
std::vector< std::size_t > const & getNodeIDs () const
GeoLib::Polyline const & getPolyline () const

Private Attributes

MeshLib::Mesh const & _mesh
GeoLib::Polyline const & _ply
std::vector< std::size_t > _msh_node_ids
std::vector< double > _dist_of_proj_node_from_ply_start

Constructor & Destructor Documentation

◆ MeshNodesAlongPolyline()

MeshGeoToolsLib::MeshNodesAlongPolyline::MeshNodesAlongPolyline ( MeshLib::Mesh const & mesh,
GeoLib::Polyline const & ply,
double epsilon_radius,
SearchAllNodes search_all_nodes )

Constructor of object, that search mesh nodes along a GeoLib::Polyline polyline within a given search radius. So the polyline is something like a tube.

Parameters
meshMesh the search will be performed on.
plyAlong the GeoLib::Polyline ply the mesh nodes are searched.
epsilon_radiusSearch / tube radius
search_all_nodesswitch between searching all mesh nodes and searching the base nodes.

Definition at line 16 of file MeshNodesAlongPolyline.cpp.

20 : _mesh(mesh), _ply(ply)
21{
22 assert(epsilon_radius > 0);
23 const std::size_t n_nodes(search_all_nodes == SearchAllNodes::Yes
24 ? _mesh.getNumberOfNodes()
25 : _mesh.computeNumberOfBaseNodes());
26 auto& mesh_nodes = _mesh.getNodes();
27 // loop over all nodes
28 for (std::size_t i = 0; i < n_nodes; i++)
29 {
30 double dist =
31 _ply.getDistanceAlongPolyline(*mesh_nodes[i], epsilon_radius);
32 if (dist >= 0.0)
33 {
34 _msh_node_ids.push_back(mesh_nodes[i]->getID());
36 }
37 }
38
39 // sort the nodes along the polyline according to their distances
43}
void quicksort(It1 first1, It1 last1, It2 first2, Comparator compare)
Definition quicksort.h:17

References _dist_of_proj_node_from_ply_start, _mesh, _msh_node_ids, _ply, BaseLib::quicksort(), and MeshGeoToolsLib::Yes.

Member Function Documentation

◆ getMesh()

MeshLib::Mesh const & MeshGeoToolsLib::MeshNodesAlongPolyline::getMesh ( ) const

return the mesh object

Definition at line 45 of file MeshNodesAlongPolyline.cpp.

46{
47 return _mesh;
48}

References _mesh.

◆ getNodeIDs()

std::vector< std::size_t > const & MeshGeoToolsLib::MeshNodesAlongPolyline::getNodeIDs ( ) const

Access the vector of mesh node ids.

Returns
The vector of mesh node ids calculated in the constructor

Definition at line 50 of file MeshNodesAlongPolyline.cpp.

51{
52 return _msh_node_ids;
53}

References _msh_node_ids.

Referenced by MeshGeoToolsLib::appendLinesAlongPolylines().

◆ getPolyline()

GeoLib::Polyline const & MeshGeoToolsLib::MeshNodesAlongPolyline::getPolyline ( ) const

Deploying this method the user can get access to the underlying GeoLib::Polyline.

Returns
the underlying GeoLib::Polyline

Definition at line 55 of file MeshNodesAlongPolyline.cpp.

56{
57 return _ply;
58}

References _ply.

Referenced by MeshGeoToolsLib::MeshNodeSearcher::getMeshNodeIDs().

Member Data Documentation

◆ _dist_of_proj_node_from_ply_start

std::vector<double> MeshGeoToolsLib::MeshNodesAlongPolyline::_dist_of_proj_node_from_ply_start
private

Definition at line 66 of file MeshNodesAlongPolyline.h.

Referenced by MeshNodesAlongPolyline().

◆ _mesh

MeshLib::Mesh const& MeshGeoToolsLib::MeshNodesAlongPolyline::_mesh
private

Definition at line 63 of file MeshNodesAlongPolyline.h.

Referenced by MeshNodesAlongPolyline(), and getMesh().

◆ _msh_node_ids

std::vector<std::size_t> MeshGeoToolsLib::MeshNodesAlongPolyline::_msh_node_ids
private

Definition at line 65 of file MeshNodesAlongPolyline.h.

Referenced by MeshNodesAlongPolyline(), and getNodeIDs().

◆ _ply

GeoLib::Polyline const& MeshGeoToolsLib::MeshNodesAlongPolyline::_ply
private

Definition at line 64 of file MeshNodesAlongPolyline.h.

Referenced by MeshNodesAlongPolyline(), and getPolyline().


The documentation for this class was generated from the following files: