OGS
MeshNodesAlongSurface.cpp
Go to the documentation of this file.
1 
13 #include "MeshNodesAlongSurface.h"
14 
15 #include <algorithm>
16 
17 #include "BaseLib/quicksort.h"
18 #include "GeoLib/Surface.h"
19 #include "MathLib/MathTools.h"
20 #include "MeshLib/Mesh.h"
21 #include "MeshLib/Node.h"
22 
23 namespace MeshGeoToolsLib
24 {
26  GeoLib::Surface const& sfc,
27  double epsilon_radius,
28  SearchAllNodes search_all_nodes)
29  : _mesh(mesh), _sfc(sfc)
30 {
31  auto const& mesh_nodes = _mesh.getNodes();
32  const std::size_t n_nodes(search_all_nodes == SearchAllNodes::Yes
35  // loop over all nodes
36  for (std::size_t i = 0; i < n_nodes; i++)
37  {
38  auto* node = mesh_nodes[i];
39  if (!sfc.isPntInBoundingVolume(*node, epsilon_radius))
40  {
41  continue;
42  }
43  if (sfc.isPntInSfc(*node, epsilon_radius))
44  {
45  _msh_node_ids.push_back(node->getID());
46  }
47  }
48 }
49 
51 {
52  return _mesh;
53 }
54 
55 std::vector<std::size_t> const& MeshNodesAlongSurface::getNodeIDs() const
56 {
57  return _msh_node_ids;
58 }
59 
61 {
62  return _sfc;
63 }
64 
65 } // end namespace MeshGeoToolsLib
Definition of the Mesh class.
Definition of the Node class.
A Surface is represented by Triangles. It consists of a reference to a vector of (pointers to) points...
Definition: Surface.h:34
bool isPntInBoundingVolume(MathLib::Point3d const &pnt, double eps) const
Definition: Surface.cpp:93
bool isPntInSfc(MathLib::Point3d const &pnt, double eps) const
Definition: Surface.cpp:99
std::vector< std::size_t > const & getNodeIDs() const
MeshLib::Mesh const & getMesh() const
return the mesh object
GeoLib::Surface const & getSurface() const
MeshNodesAlongSurface(MeshLib::Mesh const &mesh, GeoLib::Surface const &sfc, double epsilon_radius, SearchAllNodes search_all_nodes)
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
Definition of the quicksort function.