OGS
GeoLib::Grid< POINT > Class Template Referencefinal

Detailed Description

template<typename POINT>
class GeoLib::Grid< POINT >

Definition at line 21 of file Grid.h.

#include <Grid.h>

Inheritance diagram for GeoLib::Grid< POINT >:
[legend]
Collaboration diagram for GeoLib::Grid< POINT >:
[legend]

Public Member Functions

template<typename InputIterator>
 Grid (InputIterator first, InputIterator last, std::size_t max_num_per_grid_cell=1)
 The constructor of the grid object takes a vector of points or nodes. Furthermore the user can specify the average maximum number of points per grid cell.
 Grid (Grid const &)=delete
Gridoperator= (Grid const &)=delete
 ~Grid ()
template<typename P>
POINTgetNearestPoint (P const &pnt) const
template<typename P>
std::vector< std::size_t > getPointsInEpsilonEnvironment (P const &pnt, double eps) const
template<typename P>
std::vector< std::vector< POINT * > const * > getPntVecsOfGridCellsIntersectingCube (P const &center, double half_len) const
std::vector< std::vector< POINT * > const * > getPntVecsOfGridCellsIntersectingCuboid (Eigen::Vector3d const &min_pnt, Eigen::Vector3d const &max_pnt) const
void createGridGeometry (GeoLib::GEOObjects *geo_obj) const
Public Member Functions inherited from GeoLib::AABB
template<typename PNT_TYPE>
 AABB (std::vector< PNT_TYPE * > const &pnts, std::vector< std::size_t > const &ids)
template<typename InputIterator>
 AABB (InputIterator first, InputIterator last)
template<typename PNT_TYPE>
bool update (PNT_TYPE const &p)
template<typename T>
bool containsPoint (T const &pnt, double eps) const
template<typename T>
bool containsPointXY (T const &pnt) const
MinMaxPoints getMinMaxPoints () const
Eigen::Vector3d const & getMinPoint () const
Eigen::Vector3d const & getMaxPoint () const
bool containsAABB (AABB const &other_aabb) const

Private Member Functions

void initNumberOfSteps (std::size_t n_per_cell, std::size_t n_pnts, std::array< double, 3 > const &extensions)
template<typename T>
std::array< std::size_t, 3 > getGridCoords (T const &pnt) const
template<typename P>
std::array< double, 6 > getPointCellBorderDistances (P const &pnt, std::array< std::size_t, 3 > const &coords) const
template<typename P>
bool calcNearestPointInGridCell (P const &pnt, std::array< std::size_t, 3 > const &coords, double &sqr_min_dist, POINT *&nearest_pnt) const

Static Private Member Functions

static POINTcopyOrAddress (POINT &p)
static POINT const * copyOrAddress (POINT const &p)
static POINTcopyOrAddress (POINT *p)

Private Attributes

std::array< std::size_t, 3 > _n_steps = {{1, 1, 1}}
std::array< double, 3 > _step_sizes = {{0.0, 0.0, 0.0}}
std::vector< POINT * > * _grid_cell_nodes_map = nullptr

Constructor & Destructor Documentation

◆ Grid() [1/2]

template<typename POINT>
template<typename InputIterator>
GeoLib::Grid< POINT >::Grid ( InputIterator first,
InputIterator last,
std::size_t max_num_per_grid_cell = 1 )

The constructor of the grid object takes a vector of points or nodes. Furthermore the user can specify the average maximum number of points per grid cell.

The number of grid cells are computed with the following formula \(\frac{n_{points}}{n_{cells}} \le n_{max\_per\_cell}\)

In order to limit the memory wasting the maximum number of points per grid cell (in the average) should be a power of two (since std::vector objects resize itself with this step size).

Parameters
first,lastthe range of elements to examine
max_num_per_grid_cell(input) max number per grid cell in the average

Definition at line 184 of file Grid.h.

187{
188 auto const n_pnts(std::distance(first, last));
189
190 auto const& max{getMaxPoint()};
191 auto const& min{getMinPoint()};
193 {max[0] - min[0], max[1] - min[1], max[2] - min[2]}};
194
195 // enlarge delta
196 constexpr double direction = std::numeric_limits<double>::max();
198 [](double const d) { return std::nextafter(d, direction); });
199
200 assert(n_pnts > 0);
202 delta);
203
204 const std::size_t n_plane(_n_steps[0] * _n_steps[1]);
206
207 // some frequently used expressions to fill the grid vectors
208 for (std::size_t k(0); k < 3; k++)
209 {
211 {
213 }
214 _step_sizes[k] = delta[k] / _n_steps[k];
215 }
216
217 // fill the grid vectors
219 while (it != last)
220 {
222 if (coords < _n_steps)
223 {
224 std::size_t const pos(coords[0] + coords[1] * _n_steps[0] +
225 coords[2] * n_plane);
226 _grid_cell_nodes_map[pos].push_back(
227 const_cast<POINT*>(copyOrAddress(*it)));
228 }
229 else
230 {
231 ERR("Grid constructor: error computing indices [{:d}, {:d}, {:d}], "
232 "max indices [{:d}, {:d}, {:d}].",
233 coords[0], coords[1], coords[2], _n_steps[0], _n_steps[1],
234 _n_steps[2]);
235 }
236 it++;
237 }
238}
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
Eigen::Vector3d const & getMaxPoint() const
Definition AABB.h:176
Eigen::Vector3d const & getMinPoint() const
Definition AABB.h:169
std::array< std::size_t, 3 > getGridCoords(T const &pnt) const
Definition Grid.h:412
static POINT * copyOrAddress(POINT &p)
Definition Grid.h:170
std::array< std::size_t, 3 > _n_steps
Definition Grid.h:174
std::array< double, 3 > _step_sizes
Definition Grid.h:175
std::vector< POINT * > * _grid_cell_nodes_map
Definition Grid.h:179
void initNumberOfSteps(std::size_t n_per_cell, std::size_t n_pnts, std::array< double, 3 > const &extensions)
Definition Grid.h:559

References GeoLib::AABB::AABB(), _grid_cell_nodes_map, _n_steps, _step_sizes, copyOrAddress(), ERR(), getGridCoords(), GeoLib::AABB::getMaxPoint(), GeoLib::AABB::getMinPoint(), initNumberOfSteps(), and GeoLib::POINT.

Referenced by Grid(), and operator=().

◆ Grid() [2/2]

template<typename POINT>
GeoLib::Grid< POINT >::Grid ( Grid< POINT > const & )
delete

References Grid().

◆ ~Grid()

template<typename POINT>
GeoLib::Grid< POINT >::~Grid ( )
inline

This is the destructor of the class. It deletes the internal data structures not including the pointers to the points.

Definition at line 51 of file Grid.h.

51{ delete[] _grid_cell_nodes_map; }

References _grid_cell_nodes_map.

Member Function Documentation

◆ calcNearestPointInGridCell()

template<typename POINT>
template<typename P>
bool GeoLib::Grid< POINT >::calcNearestPointInGridCell ( P const & pnt,
std::array< std::size_t, 3 > const & coords,
double & sqr_min_dist,
POINT *& nearest_pnt ) const
private

Definition at line 636 of file Grid.h.

641{
642 const std::size_t grid_idx(coords[0] + coords[1] * _n_steps[0] +
643 coords[2] * _n_steps[0] * _n_steps[1]);
647 if (pnts.empty())
648 {
649 return false;
650 }
651
652 const std::size_t n_pnts(pnts.size());
654 (pnts[0]->asEigenVector3d() - pnt.asEigenVector3d()).squaredNorm();
655 nearest_pnt = pnts[0];
656 for (std::size_t i(1); i < n_pnts; i++)
657 {
658 const double sqr_dist(
659 (pnts[i]->asEigenVector3d() - pnt.asEigenVector3d()).squaredNorm());
661 {
663 nearest_pnt = pnts[i];
664 }
665 }
666 return true;
667}

References _grid_cell_nodes_map, _n_steps, and GeoLib::POINT.

Referenced by getNearestPoint().

◆ copyOrAddress() [1/3]

template<typename POINT>
POINT * GeoLib::Grid< POINT >::copyOrAddress ( POINT & p)
inlinestaticprivate

Definition at line 170 of file Grid.h.

170{ return &p; }

References GeoLib::POINT.

Referenced by Grid().

◆ copyOrAddress() [2/3]

template<typename POINT>
POINT * GeoLib::Grid< POINT >::copyOrAddress ( POINT * p)
inlinestaticprivate

Definition at line 172 of file Grid.h.

172{ return p; }

References GeoLib::POINT.

◆ copyOrAddress() [3/3]

template<typename POINT>
POINT const * GeoLib::Grid< POINT >::copyOrAddress ( POINT const & p)
inlinestaticprivate

Definition at line 171 of file Grid.h.

171{ return &p; }

References GeoLib::POINT.

◆ createGridGeometry()

template<typename POINT>
void GeoLib::Grid< POINT >::createGridGeometry ( GeoLib::GEOObjects * geo_obj) const

Method creates a geometry for every mesh grid box. Additionally it creates one geometry containing all the box geometries.

Parameters
geo_obj

Definition at line 306 of file Grid.h.

307{
309
310 GeoLib::Point const& llf(getMinPoint());
311 GeoLib::Point const& urb(getMaxPoint());
312
313 const double dx((urb[0] - llf[0]) / _n_steps[0]);
314 const double dy((urb[1] - llf[1]) / _n_steps[1]);
315 const double dz((urb[2] - llf[2]) / _n_steps[2]);
316
317 // create grid names and grid boxes as geometry
318 for (std::size_t i(0); i < _n_steps[0]; i++)
319 {
320 for (std::size_t j(0); j < _n_steps[1]; j++)
321 {
322 for (std::size_t k(0); k < _n_steps[2]; k++)
323 {
324 std::string name("Grid-");
326 name += "-";
328 name += "-";
330 grid_names.push_back(name);
331
332 {
334 points.push_back(new GeoLib::Point(
335 llf[0] + i * dx, llf[1] + j * dy, llf[2] + k * dz));
336 points.push_back(new GeoLib::Point(llf[0] + i * dx,
337 llf[1] + (j + 1) * dy,
338 llf[2] + k * dz));
339 points.push_back(new GeoLib::Point(llf[0] + (i + 1) * dx,
340 llf[1] + (j + 1) * dy,
341 llf[2] + k * dz));
342 points.push_back(new GeoLib::Point(llf[0] + (i + 1) * dx,
343 llf[1] + j * dy,
344 llf[2] + k * dz));
345 points.push_back(new GeoLib::Point(llf[0] + i * dx,
346 llf[1] + j * dy,
347 llf[2] + (k + 1) * dz));
348 points.push_back(new GeoLib::Point(llf[0] + i * dx,
349 llf[1] + (j + 1) * dy,
350 llf[2] + (k + 1) * dz));
351 points.push_back(new GeoLib::Point(llf[0] + (i + 1) * dx,
352 llf[1] + (j + 1) * dy,
353 llf[2] + (k + 1) * dz));
354 points.push_back(new GeoLib::Point(llf[0] + (i + 1) * dx,
355 llf[1] + j * dy,
356 llf[2] + (k + 1) * dz));
357 geo_obj->addPointVec(std::move(points), grid_names.back());
358 }
359
361 auto const& points = *geo_obj->getPointVec(grid_names.back());
362
363 auto* ply0(new GeoLib::Polyline(points));
364 for (std::size_t l(0); l < 4; l++)
365 {
366 ply0->addPoint(l);
367 }
368 ply0->addPoint(0);
369 plys.push_back(ply0);
370
371 auto* ply1(new GeoLib::Polyline(points));
372 for (std::size_t l(4); l < 8; l++)
373 {
374 ply1->addPoint(l);
375 }
376 ply1->addPoint(4);
377 plys.push_back(ply1);
378
379 auto* ply2(new GeoLib::Polyline(points));
380 ply2->addPoint(0);
381 ply2->addPoint(4);
382 plys.push_back(ply2);
383
384 auto* ply3(new GeoLib::Polyline(points));
385 ply3->addPoint(1);
386 ply3->addPoint(5);
387 plys.push_back(ply3);
388
389 auto* ply4(new GeoLib::Polyline(points));
390 ply4->addPoint(2);
391 ply4->addPoint(6);
392 plys.push_back(ply4);
393
394 auto* ply5(new GeoLib::Polyline(points));
395 ply5->addPoint(3);
396 ply5->addPoint(7);
397 plys.push_back(ply5);
398
399 geo_obj->addPolylineVec(std::move(plys), grid_names.back(),
401 }
402 }
403 }
405
406 geo_obj->mergeGeometries(grid_names, merged_geo_name);
407}
std::map< std::string, std::size_t > NameIdMap
Definition TemplateVec.h:30

References _n_steps, GeoLib::GEOObjects::addPointVec(), GeoLib::GEOObjects::addPolylineVec(), GeoLib::AABB::getMaxPoint(), GeoLib::AABB::getMinPoint(), GeoLib::GEOObjects::getPointVec(), and GeoLib::GEOObjects::mergeGeometries().

◆ getGridCoords()

template<typename POINT>
template<typename T>
std::array< std::size_t, 3 > GeoLib::Grid< POINT >::getGridCoords ( T const & pnt) const
private

Method calculates the grid cell coordinates for the given point pnt. If the point is located outside of the bounding box the coordinates of the grid cell on the border that is nearest to given point will be returned.

Parameters
pnt(input) the coordinates of the point
Returns
the coordinates of the grid cell

Definition at line 412 of file Grid.h.

413{
414 auto const [min_point, max_point] = getMinMaxPoints();
415
417 for (std::size_t k(0); k < 3; k++)
418 {
419 if (pnt[k] < min_point[k])
420 {
421 continue;
422 }
423 if (pnt[k] >= max_point[k])
424 {
425 coords[k] = _n_steps[k] - 1;
426 continue;
427 }
428 coords[k] = static_cast<std::size_t>(
429 std::floor((pnt[k] - min_point[k]) /
432 }
433 return coords;
434}
MinMaxPoints getMinMaxPoints() const
Definition AABB.h:163

References _n_steps, _step_sizes, and GeoLib::AABB::getMinMaxPoints().

Referenced by Grid(), getNearestPoint(), getPntVecsOfGridCellsIntersectingCube(), and getPntVecsOfGridCellsIntersectingCuboid().

◆ getNearestPoint()

template<typename POINT>
template<typename P>
POINT * GeoLib::Grid< POINT >::getNearestPoint ( P const & pnt) const

The method calculates the grid cell the given point is belonging to, i.e., the (internal) coordinates of the grid cell are computed. The method searches the actual grid cell and all its neighbors for the POINT object which has the smallest distance. A pointer to this object is returned.

If there is not such a point, i.e., all the searched grid cells do not contain any POINT object a nullptr is returned.

Parameters
pntsearch point
Returns
a pointer to the point with the smallest distance within the grid cells that are outlined above or nullptr

Definition at line 462 of file Grid.h.

463{
465 auto const& min_point{getMinPoint()};
466 auto const& max_point{getMaxPoint()};
467
469 POINT* nearest_pnt(nullptr);
470
472
474 {
476 if (dists[0] >= min_dist && dists[1] >= min_dist &&
477 dists[2] >= min_dist && dists[3] >= min_dist &&
478 dists[4] >= min_dist && dists[5] >= min_dist)
479 {
480 return nearest_pnt;
481 }
482 }
483 else
484 {
485 // search in all border cells for at least one neighbor
486 double sqr_min_dist_tmp;
487 POINT* nearest_pnt_tmp(nullptr);
489
490 while (nearest_pnt == nullptr)
491 {
493 {coords[0] < offset ? 0 : coords[0] - offset,
494 coords[1] < offset ? 0 : coords[1] - offset,
495 coords[2] < offset ? 0 : coords[2] - offset}};
496 for (; ijk[0] < coords[0] + offset; ijk[0]++)
497 {
498 for (; ijk[1] < coords[1] + offset; ijk[1]++)
499 {
500 for (; ijk[2] < coords[2] + offset; ijk[2]++)
501 {
502 // do not check the origin grid cell twice
503 if (ijk[0] == coords[0] && ijk[1] == coords[1] &&
504 ijk[2] == coords[2])
505 {
506 continue;
507 }
508 // check if temporary grid cell coordinates are valid
509 if (ijk[0] >= _n_steps[0] || ijk[1] >= _n_steps[1] ||
510 ijk[2] >= _n_steps[2])
511 {
512 continue;
513 }
514
517 {
519 {
522 }
523 }
524 } // end k
525 } // end j
526 } // end i
527 offset++;
528 } // end while
529 } // end else
530
531 double const len(
532 (pnt.asEigenVector3d() - nearest_pnt->asEigenVector3d()).norm());
533 // search all other grid cells within the cube with the edge nodes
536
537 const std::size_t n_vecs(vecs_of_pnts.size());
538 for (std::size_t j(0); j < n_vecs; j++)
539 {
541 const std::size_t n_pnts(pnts.size());
542 for (std::size_t k(0); k < n_pnts; k++)
543 {
544 const double sqr_dist(
545 (pnt.asEigenVector3d() - pnts[k]->asEigenVector3d())
546 .squaredNorm());
548 {
550 nearest_pnt = pnts[k];
551 }
552 }
553 }
554
555 return nearest_pnt;
556}
std::array< double, 6 > getPointCellBorderDistances(P const &pnt, std::array< std::size_t, 3 > const &coords) const
Definition Grid.h:438
std::vector< std::vector< POINT * > const * > getPntVecsOfGridCellsIntersectingCube(P const &center, double half_len) const
Definition Grid.h:243
bool calcNearestPointInGridCell(P const &pnt, std::array< std::size_t, 3 > const &coords, double &sqr_min_dist, POINT *&nearest_pnt) const
Definition Grid.h:636

References _n_steps, calcNearestPointInGridCell(), getGridCoords(), GeoLib::AABB::getMaxPoint(), GeoLib::AABB::getMinPoint(), getPntVecsOfGridCellsIntersectingCube(), getPointCellBorderDistances(), and GeoLib::POINT.

◆ getPntVecsOfGridCellsIntersectingCube()

template<typename POINT>
template<typename P>
std::vector< std::vector< POINT * > const * > GeoLib::Grid< POINT >::getPntVecsOfGridCellsIntersectingCube ( P const & center,
double half_len ) const

Method fetches the vectors of all grid cells intersecting the axis aligned cuboid defined by two points. The first point with minimal coordinates in all directions. The second point with maximal coordinates in all directions.

Parameters
center(input) the center point of the axis aligned cube
half_len(input) half of the edge length of the axis aligned cube
Returns
vector of vectors of points within grid cells that intersects the axis aligned cube

Definition at line 243 of file Grid.h.

245{
246 Eigen::Vector3d const c{center[0], center[1], center[2]};
249
251 pnts.reserve(
254 .prod());
255
257 for (std::size_t c0 = min_coords[0]; c0 < max_coords[0] + 1; c0++)
258 {
259 for (std::size_t c1 = min_coords[1]; c1 < max_coords[1] + 1; c1++)
260 {
262 for (std::size_t c2 = min_coords[2]; c2 < max_coords[2] + 1; c2++)
263 {
264 pnts.push_back(
266 c2 * steps0_x_steps1]));
267 }
268 }
269 }
270 return pnts;
271}

References _grid_cell_nodes_map, _n_steps, and getGridCoords().

Referenced by MeshToolsLib::MeshRevision::collapseNodeIndices(), getNearestPoint(), and getPointsInEpsilonEnvironment().

◆ getPntVecsOfGridCellsIntersectingCuboid()

template<typename POINT>
std::vector< std::vector< POINT * > const * > GeoLib::Grid< POINT >::getPntVecsOfGridCellsIntersectingCuboid ( Eigen::Vector3d const & min_pnt,
Eigen::Vector3d const & max_pnt ) const

◆ getPointCellBorderDistances()

template<typename POINT>
template<typename P>
std::array< double, 6 > GeoLib::Grid< POINT >::getPointCellBorderDistances ( P const & pnt,
std::array< std::size_t, 3 > const & coords ) const
private

point numbering of the grid cell is as follow

7 -------- 6
/: /|
/ : / |
/ : / |
/ : / |
4 -------- 5 |
| 3 ....|... 2
| . | /
| . | /
| . | /
|. |/
0 -------- 1

the face numbering is as follow: face nodes 0 0,3,2,1 bottom 1 0,1,5,4 front 2 1,2,6,5 right 3 2,3,7,6 back 4 3,0,4,7 left 5 4,5,6,7 top

Parameters
pnt(input) coordinates of the point
coordsof the grid cell
Returns
squared distances of the point to the faces of the grid cell ordered in the same sequence as above described

Definition at line 438 of file Grid.h.

440{
441 auto const& min_point{getMinPoint()};
443 dists[0] =
444 std::abs(pnt[2] - min_point[2] + coords[2] * _step_sizes[2]); // bottom
445 dists[5] = std::abs(pnt[2] - min_point[2] +
446 (coords[2] + 1) * _step_sizes[2]); // top
447
448 dists[1] =
449 std::abs(pnt[1] - min_point[1] + coords[1] * _step_sizes[1]); // front
450 dists[3] = std::abs(pnt[1] - min_point[1] +
451 (coords[1] + 1) * _step_sizes[1]); // back
452
453 dists[4] =
454 std::abs(pnt[0] - min_point[0] + coords[0] * _step_sizes[0]); // left
455 dists[2] = std::abs(pnt[0] - min_point[0] +
456 (coords[0] + 1) * _step_sizes[0]); // right
457 return dists;
458}

References _step_sizes, and GeoLib::AABB::getMinPoint().

Referenced by getNearestPoint().

◆ getPointsInEpsilonEnvironment()

template<typename POINT>
template<typename P>
std::vector< std::size_t > GeoLib::Grid< POINT >::getPointsInEpsilonEnvironment ( P const & pnt,
double eps ) const

Definition at line 671 of file Grid.h.

673{
676
677 double const sqr_eps(eps * eps);
678
680 for (auto vec : vec_pnts)
681 {
682 for (auto const p : *vec)
683 {
684 if ((p->asEigenVector3d() - pnt.asEigenVector3d()).squaredNorm() <=
685 sqr_eps)
686 {
687 pnts.push_back(p->getID());
688 }
689 }
690 }
691
692 return pnts;
693}

References getPntVecsOfGridCellsIntersectingCube().

Referenced by MeshGeoToolsLib::MeshNodesOnPoint::MeshNodesOnPoint().

◆ initNumberOfSteps()

template<typename POINT>
void GeoLib::Grid< POINT >::initNumberOfSteps ( std::size_t n_per_cell,
std::size_t n_pnts,
std::array< double, 3 > const & extensions )
private

Computes the number of grid cells per spatial dimension the objects (points or mesh nodes) will be sorted in. On the one hand the number of grid cells should be small to reduce the management overhead. On the other hand the number should be large such that each grid cell contains only a small number of objects. Under the assumption that the points are distributed equidistant in space the grid cells should be as cubical as possible. At first it is necessary to determine the spatial dimension the grid should have. The dimensions are computed from the spatial extensions Let \(\max\) be the largest spatial extension. The grid will have a spatial dimension if the ratio of the corresponding spatial extension and the maximal extension is \(\ge 10^{-4}\). The second step consists of computing the number of cells per dimension.

Definition at line 559 of file Grid.h.

561{
562 double const max_extension(
563 *std::max_element(extensions.cbegin(), extensions.cend()));
564
565 std::bitset<3> dim; // all bits set to zero
566 for (std::size_t k(0); k < 3; ++k)
567 {
568 // set dimension if the ratio kth-extension/max_extension >= 1e-4
569 if (extensions[k] >= 1e-4 * max_extension)
570 {
571 dim[k] = true;
572 }
573 }
574
575 // structured grid: n_cells = _n_steps[0] * _n_steps[1] * _n_steps[2]
576 // *** condition: n_pnts / n_cells < n_per_cell
577 // => n_pnts / n_per_cell < n_cells
578 // _n_steps[1] = _n_steps[0] * extensions[1]/extensions[0],
579 // _n_steps[2] = _n_steps[0] * extensions[2]/extensions[0],
580 // => n_cells = _n_steps[0]^3 * extensions[1]/extensions[0] *
581 // extensions[2]/extensions[0],
582 // => _n_steps[0] = cbrt(n_cells * extensions[0]^2 /
583 // (extensions[1]*extensions[2]))
584 auto sc_ceil = [](double v) { return static_cast<std::size_t>(ceil(v)); };
585
586 switch (dim.count())
587 {
588 case 3: // 3d case
589 _n_steps[0] = sc_ceil(
591 (extensions[0] / extensions[2]) / n_per_cell));
592 _n_steps[1] = sc_ceil(
593 _n_steps[0] * std::min(extensions[1] / extensions[0], 100.0));
594 _n_steps[2] = sc_ceil(
595 _n_steps[0] * std::min(extensions[2] / extensions[0], 100.0));
596 break;
597 case 2: // 2d cases
598 if (dim[0] && dim[1])
599 { // xy
601 (n_per_cell * extensions[1])));
602 _n_steps[1] =
603 sc_ceil(_n_steps[0] *
604 std::min(extensions[1] / extensions[0], 100.0));
605 }
606 else if (dim[0] && dim[2])
607 { // xz
609 (n_per_cell * extensions[2])));
610 _n_steps[2] =
611 sc_ceil(_n_steps[0] *
612 std::min(extensions[2] / extensions[0], 100.0));
613 }
614 else if (dim[1] && dim[2])
615 { // yz
617 (n_per_cell * extensions[2])));
618 _n_steps[2] =
619 sc_ceil(std::min(extensions[2] / extensions[1], 100.0));
620 }
621 break;
622 case 1: // 1d cases
623 for (std::size_t k(0); k < 3; ++k)
624 {
625 if (dim[k])
626 {
627 _n_steps[k] =
628 sc_ceil(static_cast<double>(n_pnts) / n_per_cell);
629 }
630 }
631 }
632}

References _n_steps.

Referenced by Grid().

◆ operator=()

template<typename POINT>
Grid & GeoLib::Grid< POINT >::operator= ( Grid< POINT > const & )
delete

References Grid().

Member Data Documentation

◆ _grid_cell_nodes_map

template<typename POINT>
std::vector<POINT*>* GeoLib::Grid< POINT >::_grid_cell_nodes_map = nullptr
private

This is an array that stores pointers to POINT objects.

Definition at line 179 of file Grid.h.

Referenced by Grid(), ~Grid(), calcNearestPointInGridCell(), getPntVecsOfGridCellsIntersectingCube(), and getPntVecsOfGridCellsIntersectingCuboid().

◆ _n_steps

template<typename POINT>
std::array<std::size_t, 3> GeoLib::Grid< POINT >::_n_steps = {{1, 1, 1}}
private

◆ _step_sizes

template<typename POINT>
std::array<double, 3> GeoLib::Grid< POINT >::_step_sizes = {{0.0, 0.0, 0.0}}
private

Definition at line 175 of file Grid.h.

175{{0.0, 0.0, 0.0}};

Referenced by Grid(), getGridCoords(), and getPointCellBorderDistances().


The documentation for this class was generated from the following file: