31std::vector<std::unique_ptr<MeshNodeSearcher>>
36 std::unique_ptr<MeshGeoToolsLib::SearchLength>&& search_length_algorithm,
40 _search_length_algorithm(std::move(search_length_algorithm)),
41 _search_all_nodes(search_all_nodes)
63template <
typename CacheType,
typename GeometryType>
65 std::vector<CacheType*>& cached_elements,
66 std::function<GeometryType(CacheType
const&)> getCachedItem,
71 if (
auto const it = find_if(cbegin(cached_elements), cend(cached_elements),
72 [&](
auto const& element)
73 {
return getCachedItem(*element) == item; });
74 it != cend(cached_elements))
76 return (*it)->getNodeIDs();
79 if constexpr (std::is_convertible<GeometryType, GeoLib::Point>::value)
81 cached_elements.push_back(
new CacheType(
82 mesh, mesh_grid, item, search_length, search_all_nodes));
86 cached_elements.push_back(
87 new CacheType(mesh, item, search_length, search_all_nodes));
89 return cached_elements.back()->getNodeIDs();
95 std::vector<std::size_t> vec_nodes;
134 std::vector<MathLib::Point3dWithID*>
const& points)
const
138 std::vector<std::size_t> node_ids;
139 node_ids.reserve(points.size());
141 for (
auto const*
const p_ptr : points)
143 auto const& p = *p_ptr;
144 std::vector<std::size_t>
const ids =
149 "No nodes could be found in the mesh for point {:d} : ({:g}, "
150 "{:g}, {:g}) in {:g} epsilon radius in the mesh '{:s}'",
151 p.getID(), p[0], p[1], p[2], epsilon_radius,
_mesh.
getName());
155 std::stringstream ss;
157 for (
auto const id : ids)
159 ss <<
"- bulk node: " << (*bulk_nodes[id])[0] <<
", "
160 << (*bulk_nodes[
id])[1] <<
", " << (*bulk_nodes[id])[2]
165 "Found {:d} nodes in the mesh for point {:d} : ({:g}, {:g}, "
166 "{:g}) in {:g} epsilon radius in the mesh '{:s}'. Expected to "
167 "find exactly one node.\n{:s}",
168 ids.size(), p.getID(), p[0], p[1], p[2], epsilon_radius,
171 node_ids.push_back(ids.front());
178 std::unique_ptr<MeshGeoToolsLib::SearchLength>&& search_length_algorithm)
180 std::size_t
const mesh_id = mesh.
getID();
191 if (
typeid(m._search_length_algorithm) ==
192 typeid(search_length_algorithm) &&
193 m._search_length_algorithm->getSearchLength() ==
194 search_length_algorithm->getSearchLength())
201 std::make_unique<MeshGeoToolsLib::MeshNodeSearcher>(
Definition of the Element class.
Definition of the Point class.
Interface for heuristic search length strategy.
std::vector< std::size_t > getNodes(GeoLib::Point const &pnt, std::vector< MeshLib::Node * > const &nodes, MeshLib::PropertyVector< int > const &mat_ids, std::pair< int, int > const &mat_limits, std::pair< double, double > const &elevation_limits, MeshLib::Mesh const &mesh)
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the Mesh class.
Definition of the Node class.
Definition of the PolyLine class.
std::vector< std::size_t > getPointsInEpsilonEnvironment(P const &pnt, double eps) const
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
A Surface is represented by Triangles. It consists of a reference to a vector of (pointers to) points...
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
std::size_t getID() const
Get id of the mesh.
const std::string getName() const
Get name of the mesh.
double sqrDist(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
virtual GEOTYPE getGeoType() const =0
return a geometry type