28 GeoLib::Point const& point,
const bool multiple_nodes_allowed)
34 std::size_t
const number_of_found_nodes_at_rank = node_ids.size();
35 std::size_t number_of_total_found_nodes = 0;
37 MPI_Allreduce(&number_of_found_nodes_at_rank, &number_of_total_found_nodes,
38 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD);
40 if (number_of_total_found_nodes == 0)
43 "BoundaryElementsAtPoint: the mesh node searcher was unable to "
44 "locate the point ({:f}, {:f}, {:f}) in the mesh.",
48 if (number_of_found_nodes_at_rank == 0)
56 "BoundaryElementsAtPoint: the mesh node searcher was unable to "
57 "locate the point ({:f}, {:f}, {:f}) in the mesh.",
62 if (node_ids.size() == 1)
64 std::array<MeshLib::Node*, 1>
const nodes = {
72 const_cast<std::vector<MeshLib::Node*>&
>(mesh.
getNodes());
73 std::size_t
const nearest_node_id =
74 *std::min_element(node_ids.begin(), node_ids.end(),
75 [&mesh_nodes, &point](
auto id0,
auto id1)
77 return MathLib::sqrDist(*mesh_nodes[id0], point) <
78 MathLib::sqrDist(*mesh_nodes[id1], point);
81 if (!multiple_nodes_allowed)
84 "BoundaryElementsAtPoint: the mesh node searcher found {:d} points "
85 "near the requested point ({:f}, {:f}, {:f}) in the mesh, while "
86 "exactly one is expected. Node (id={:d}) ({:f}, {:f}, {:f}) has "
89 mesh_nodes[nearest_node_id]->
getID(),
90 (*mesh_nodes[nearest_node_id])[0],
91 (*mesh_nodes[nearest_node_id])[1],
92 (*mesh_nodes[nearest_node_id])[2],
96 "BoundaryElementsAtPoint: the mesh node searcher found {:d} points "
97 "near the requested point ({:f}, {:f}, {:f}) in the mesh, while "
98 "exactly one is expected. Node (id={:d}) ({:f}, {:f}, {:f}) has "
101 mesh_nodes[nearest_node_id]->
getID(), (*mesh_nodes[nearest_node_id])[0],
102 (*mesh_nodes[nearest_node_id])[1], (*mesh_nodes[nearest_node_id])[2],
105 std::array<MeshLib::Node*, 1>
const nodes = {