OGS 6.2.0-97-g4a610c866
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  {
30  OGS_FATAL(
31  "BoundaryElementsAtPoint: the mesh node searcher was unable to "
32  "locate the point (%f, %f, %f) in the mesh.",
33  _point[0], _point[1], _point[2]);
34  }
35  if (node_ids.size() > 1)
36  {
37  OGS_FATAL(
38  "BoundaryElementsAtPoint: the mesh node searcher found %d points "
39  "near the requested point (%f, %f, %f) in the mesh, while exactly "
40  "one is expected.",
41  node_ids.size(), _point[0], _point[1], _point[2]);
42  }
43 
44  std::array<MeshLib::Node*, 1> const nodes = {{
45  const_cast<MeshLib::Node*>(_mesh.getNode(node_ids[0]))}};
46 
47  _boundary_elements.push_back(new MeshLib::Point{nodes, node_ids[0]});
48 }
49 
51 {
52  for (auto p : _boundary_elements)
53  {
54  delete p;
55  }
56 }
57 } // namespace 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:63
Definition of the Element class.
std::vector< MeshLib::Element * > _boundary_elements