OGS
MeshNodesAlongPolyline.cpp
Go to the documentation of this file.
1
13
14#include <algorithm>
15
16#include "BaseLib/quicksort.h"
17#include "GeoLib/Polyline.h"
18#include "MathLib/MathTools.h"
19#include "MeshLib/Mesh.h"
20#include "MeshLib/Node.h"
21
22namespace MeshGeoToolsLib
23{
25 GeoLib::Polyline const& ply,
26 double epsilon_radius,
27 SearchAllNodes search_all_nodes)
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());
44 }
45 }
46
47 // sort the nodes along the polyline according to their distances
51}
52
54{
55 return _mesh;
56}
57
58std::vector<std::size_t> const& MeshNodesAlongPolyline::getNodeIDs() const
59{
60 return _msh_node_ids;
61}
62
67} // end namespace MeshGeoToolsLib
Definition of the Mesh class.
Definition of the Node class.
Definition of the PolyLine class.
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
Definition Polyline.h:40
double getDistanceAlongPolyline(const MathLib::Point3d &pnt, const double epsilon_radius) const
Definition Polyline.cpp:315
std::vector< std::size_t > const & getNodeIDs() const
GeoLib::Polyline const & getPolyline() const
MeshLib::Mesh const & getMesh() const
return the mesh object
MeshNodesAlongPolyline(MeshLib::Mesh const &mesh, GeoLib::Polyline const &ply, double epsilon_radius, SearchAllNodes search_all_nodes)
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition Mesh.h:106
std::size_t computeNumberOfBaseNodes() const
Get the number of base nodes.
Definition Mesh.cpp:238
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition Mesh.h:100
void quicksort(It1 first1, It1 last1, It2 first2, Comparator compare)
Definition quicksort.h:26
Definition of the quicksort function.