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 36 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 More...
 
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 24 of file MeshNodesAlongPolyline.cpp.

28  : _mesh(mesh), _ply(ply)
29 {
30  assert(epsilon_radius > 0);
31  const std::size_t n_nodes(search_all_nodes == SearchAllNodes::Yes
34  auto& mesh_nodes = _mesh.getNodes();
35  // loop over all nodes
36  for (std::size_t i = 0; i < n_nodes; i++)
37  {
38  double dist =
39  _ply.getDistanceAlongPolyline(*mesh_nodes[i], epsilon_radius);
40  if (dist >= 0.0)
41  {
42  _msh_node_ids.push_back(mesh_nodes[i]->getID());
43  _dist_of_proj_node_from_ply_start.push_back(dist);
44  }
45  }
46 
47  // sort the nodes along the polyline according to their distances
48  BaseLib::quicksort<double>(_dist_of_proj_node_from_ply_start, 0,
51 }
double getDistanceAlongPolyline(const MathLib::Point3d &pnt, const double epsilon_radius) const
Definition: Polyline.cpp:353
std::size_t getNumberOfBaseNodes() const
Get the number of base nodes.
Definition: Mesh.cpp:214
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition: Mesh.h:95
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition: Mesh.h:89

References _dist_of_proj_node_from_ply_start, _mesh, _msh_node_ids, _ply, GeoLib::Polyline::getDistanceAlongPolyline(), MeshLib::Mesh::getNodes(), MeshLib::Mesh::getNumberOfBaseNodes(), MeshLib::Mesh::getNumberOfNodes(), and MeshGeoToolsLib::Yes.

Member Function Documentation

◆ getMesh()

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

return the mesh object

Definition at line 53 of file MeshNodesAlongPolyline.cpp.

54 {
55  return _mesh;
56 }

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 58 of file MeshNodesAlongPolyline.cpp.

59 {
60  return _msh_node_ids;
61 }

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 63 of file MeshNodesAlongPolyline.cpp.

64 {
65  return _ply;
66 }

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 74 of file MeshNodesAlongPolyline.h.

Referenced by MeshNodesAlongPolyline().

◆ _mesh

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

Definition at line 71 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 73 of file MeshNodesAlongPolyline.h.

Referenced by MeshNodesAlongPolyline(), and getNodeIDs().

◆ _ply

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

Definition at line 72 of file MeshNodesAlongPolyline.h.

Referenced by MeshNodesAlongPolyline(), and getPolyline().


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