31 for (std::size_t k(0); k < 3; ++k)
33 double const tolerance(
34 std::nexttoward(max[k], std::numeric_limits<double>::max()) -
36 if (std::abs(max[k] - min[k]) > tolerance)
44 auto const [min_pnt, max_pnt] = _aabb.getMinMaxPoints();
47 std::array<double, 3>
const delta{{max_pnt[0] - min_pnt[0],
48 max_pnt[1] - min_pnt[1],
49 max_pnt[2] - min_pnt[2]}};
51 const std::size_t n_eles(mesh.getNumberOfElements());
52 const std::size_t n_eles_per_cell(100);
61 auto sc_ceil = [](
double v)
62 {
return static_cast<std::size_t
>(std::ceil(v)); };
68 sc_ceil(std::cbrt(n_eles * delta[0] * delta[0] /
69 (n_eles_per_cell * delta[1] * delta[2])));
71 sc_ceil(_n_steps[0] * std::min(delta[1] / delta[0], 100.0));
73 sc_ceil(_n_steps[0] * std::min(delta[2] / delta[0], 100.0));
78 _n_steps[0] = sc_ceil(std::sqrt(n_eles * delta[0] /
79 (n_eles_per_cell * delta[2])));
80 _n_steps[2] = sc_ceil(_n_steps[0] * delta[2] / delta[0]);
82 else if (dim[0] && dim[1])
84 _n_steps[0] = sc_ceil(std::sqrt(n_eles * delta[0] /
85 (n_eles_per_cell * delta[1])));
86 _n_steps[1] = sc_ceil(_n_steps[0] * delta[1] / delta[0]);
88 else if (dim[1] && dim[2])
90 _n_steps[1] = sc_ceil(std::sqrt(n_eles * delta[1] /
91 (n_eles_per_cell * delta[2])));
93 sc_ceil(n_eles * delta[2] / (n_eles_per_cell * delta[1]));
97 for (std::size_t k(0); k < 3; ++k)
102 sc_ceil(
static_cast<double>(n_eles) / n_eles_per_cell);
109 for (std::size_t k(0); k < 3; k++)
111 _step_sizes[k] = delta[k] / _n_steps[k];
112 _inverse_step_sizes[k] = 1.0 / _step_sizes[k];
115 _elements_in_grid_box.resize(_n_steps[0] * _n_steps[1] * _n_steps[2]);
116 sortElementsInGridCells(mesh);
143 std::array<std::size_t, 3> min{};
144 std::array<std::size_t, 3> max{};
167 for (std::size_t j(0); j < 3; ++j)
169 if (min[j] > c.second[j])
171 min[j] = c.second[j];
173 if (max[j] < c.second[j])
175 max[j] = c.second[j];
186 for (std::size_t k(0); k < 3; ++k)
188 max[k] = std::min(
_n_steps[k] - 1, max[k]);
192 for (std::size_t i(min[0]); i <= max[0]; i++)
194 for (std::size_t j(min[1]); j <= max[1]; j++)
196 for (std::size_t k(min[2]); k <= max[2]; k++)
199 .push_back(&element);
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)