OGS
MeshNodesAlongSurface.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6#include <algorithm>
7
8#include "BaseLib/quicksort.h"
9#include "GeoLib/Surface.h"
10#include "MathLib/MathTools.h"
11#include "MeshLib/Mesh.h"
12#include "MeshLib/Node.h"
13
14namespace MeshGeoToolsLib
15{
17 GeoLib::Surface const& sfc,
18 double epsilon_radius,
19 SearchAllNodes search_all_nodes)
20 : _mesh(mesh), _sfc(sfc)
21{
22 auto const& mesh_nodes = _mesh.getNodes();
23 const std::size_t n_nodes(search_all_nodes == SearchAllNodes::Yes
24 ? _mesh.getNumberOfNodes()
25 : _mesh.computeNumberOfBaseNodes());
26 // loop over all nodes
27 for (std::size_t i = 0; i < n_nodes; i++)
28 {
29 auto const* const node = mesh_nodes[i];
30 if (!sfc.isPntInBoundingVolume(*node, epsilon_radius))
31 {
32 continue;
33 }
34 if (sfc.isPntInSfc(*node, epsilon_radius))
35 {
36 _msh_node_ids.push_back(node->getID());
37 }
38 }
39}
40
42{
43 return _mesh;
44}
45
46std::vector<std::size_t> const& MeshNodesAlongSurface::getNodeIDs() const
47{
48 return _msh_node_ids;
49}
50
52{
53 return _sfc;
54}
55
56} // end namespace MeshGeoToolsLib
A Surface is represented by Triangles. It consists of a reference to a vector of (pointers to) points...
bool isPntInBoundingVolume(MathLib::Point3d const &pnt, double eps) const
Definition Surface.cpp:87
bool isPntInSfc(MathLib::Point3d const &pnt, double eps) const
Definition Surface.cpp:93
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)