23std::vector<std::unique_ptr<MeshNodeSearcher>>
28 std::unique_ptr<MeshGeoToolsLib::SearchLength>&& search_length_algorithm,
35 DBUG(
"The search length for mesh '{:s}' is {:e}.",
_mesh.getName(),
55template <
typename CacheType,
typename GeometryType>
57 std::vector<CacheType*>& cached_elements,
58 std::function<GeometryType(CacheType
const&)> getCachedItem,
63 if (
auto const it = find_if(cbegin(cached_elements), cend(cached_elements),
64 [&](
auto const& element)
65 {
return getCachedItem(*element) == item; });
66 it != cend(cached_elements))
68 return (*it)->getNodeIDs();
71 if constexpr (std::is_convertible<GeometryType, GeoLib::Point>::value)
73 cached_elements.push_back(
new CacheType(
74 mesh, mesh_grid, item, search_length, search_all_nodes));
78 cached_elements.push_back(
79 new CacheType(mesh, item, search_length, search_all_nodes));
81 return cached_elements.back()->getNodeIDs();
87 std::vector<std::size_t> vec_nodes;
126 std::vector<MathLib::Point3dWithID*>
const& points)
const
130 std::vector<std::size_t> node_ids(points.size());
132 auto const number_of_points = std::ssize(points);
134 for (std::ptrdiff_t i = 0; i < number_of_points; ++i)
136 auto const& p = *points[i];
137 std::vector<std::size_t>
const ids =
138 _mesh_grid.getPointsInEpsilonEnvironment(p, epsilon_radius);
142 "No nodes could be found in the mesh for point {:d} : ({:g}, "
143 "{:g}, {:g}) in {:g} epsilon radius in the mesh '{:s}'",
144 p.getID(), p[0], p[1], p[2], epsilon_radius,
_mesh.getName());
148 std::stringstream ss;
149 auto const& bulk_nodes =
_mesh.getNodes();
150 for (
auto const id : ids)
152 ss <<
"- bulk node: " << (*bulk_nodes[id])[0] <<
", "
153 << (*bulk_nodes[
id])[1] <<
", " << (*bulk_nodes[id])[2]
158 "Found {:d} nodes in the mesh for point {:d} : ({:g}, {:g}, "
159 "{:g}) in {:g} epsilon radius in the mesh '{:s}'. Expected to "
160 "find exactly one node.\n{:s}",
161 ids.size(), p.getID(), p[0], p[1], p[2], epsilon_radius,
162 _mesh.getName(), ss.str());
164 node_ids[i] = ids.front();
171 std::unique_ptr<MeshGeoToolsLib::SearchLength>&& search_length_algorithm)
173 std::size_t
const mesh_id = mesh.
getID();
184 if (
typeid(m._search_length_algorithm) ==
185 typeid(search_length_algorithm) &&
186 m._search_length_algorithm->getSearchLength() ==
187 search_length_algorithm->getSearchLength())
194 std::make_unique<MeshGeoToolsLib::MeshNodeSearcher>(
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)
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::size_t getID() const
Get id of the mesh.
double sqrDist(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
virtual GEOTYPE getGeoType() const =0
return a geometry type