OGS 6.1.0-1721-g6382411ad
BoundaryElementsAtPoint.cpp
Go to the documentation of this file.
1 
10 
11 #include "GeoLib/Point.h"
13 #include "MeshLib/Elements/Point.h"
14 #include "MeshLib/Mesh.h"
16 #include "MeshLib/Node.h"
17 
19 
20 namespace MeshGeoToolsLib
21 {
23  MeshLib::Mesh const& mesh, MeshNodeSearcher const& mshNodeSearcher,
24  GeoLib::Point const& point)
25  : _mesh(mesh), _point(point)
26 {
27  auto const node_ids = mshNodeSearcher.getMeshNodeIDs(_point);
28  if (node_ids.empty())
29  OGS_FATAL(
30  "BoundaryElementsAtPoint: the mesh node searcher was unable to "
31  "locate the point (%f, %f, %f) in the mesh.",
32  _point[0], _point[1], _point[2]);
33  if (node_ids.size() > 1)
34  OGS_FATAL(
35  "BoundaryElementsAtPoint: the mesh node searcher found %d points "
36  "near the requested point (%f, %f, %f) in the mesh, while exactly "
37  "one is expected.",
38  node_ids.size(), _point[0], _point[1], _point[2]);
39 
40  std::array<MeshLib::Node*, 1> const nodes = {{
41  const_cast<MeshLib::Node*>(_mesh.getNode(node_ids[0]))}};
42 
43  _boundary_elements.push_back(new MeshLib::Point{nodes, node_ids[0]});
44 }
45 
47 {
48  for (auto p : _boundary_elements)
49  delete p;
50 }
51 } // MeshGeoToolsLib
Implementation of heuristic search length strategy.
Definition of the Point class.
const Node * getNode(std::size_t idx) const
Get the node with the given index.
Definition: Mesh.h:84
Definition of the Node class.
BoundaryElementsAtPoint(MeshLib::Mesh const &mesh, MeshNodeSearcher const &mshNodeSearcher, GeoLib::Point const &point)
Definition of the Mesh class.
std::vector< std::size_t > getMeshNodeIDs(GeoLib::GeoObject const &geoObj) const
#define OGS_FATAL(fmt,...)
Definition: Error.h:71
Definition of the Element class.
std::vector< MeshLib::Element * > _boundary_elements