OGS
|
#include <Grid.h>
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 | |
Grid & | operator= (Grid const &)=delete |
virtual | ~Grid () |
template<typename P > | |
POINT * | getNearestPoint (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 ¢er, 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 POINT * | copyOrAddress (POINT &p) |
static POINT const * | copyOrAddress (POINT const &p) |
static POINT * | copyOrAddress (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 |
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).
first,last | the range of elements to examine |
max_num_per_grid_cell | (input) max number per grid cell in the average |
Definition at line 195 of file Grid.h.
References GeoLib::Grid< POINT >::_grid_cell_nodes_map, GeoLib::Grid< POINT >::_n_steps, GeoLib::Grid< POINT >::_step_sizes, GeoLib::Grid< POINT >::copyOrAddress(), ERR(), GeoLib::Grid< POINT >::getGridCoords(), GeoLib::AABB::getMaxPoint(), GeoLib::AABB::getMinPoint(), GeoLib::Grid< POINT >::initNumberOfSteps(), and GeoLib::POINT.
|
delete |
|
inlinevirtual |
This is the destructor of the class. It deletes the internal data structures not including the pointers to the points.
Definition at line 62 of file Grid.h.
References GeoLib::Grid< POINT >::_grid_cell_nodes_map.
|
private |
Definition at line 643 of file Grid.h.
|
inlinestaticprivate |
|
inlinestaticprivate |
|
inlinestaticprivate |
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.
geo_obj |
Definition at line 317 of file Grid.h.
References GeoLib::GEOObjects::addPointVec(), GeoLib::GEOObjects::addPolylineVec(), GeoLib::GEOObjects::getPointVec(), and GeoLib::GEOObjects::mergeGeometries().
|
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.
pnt | (input) the coordinates of the point |
Definition at line 419 of file Grid.h.
Referenced by GeoLib::Grid< POINT >::Grid().
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.
pnt | search point |
Definition at line 469 of file Grid.h.
References GeoLib::POINT.
Referenced by MeshGeoToolsLib::GeoMapper::getMeshElevation().
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.
center | (input) the center point of the axis aligned cube |
half_len | (input) half of the edge length of the axis aligned cube |
Definition at line 254 of file Grid.h.
Referenced by MeshToolsLib::MeshRevision::collapseNodeIndices().
std::vector< std::vector< POINT * > const * > GeoLib::Grid< POINT >::getPntVecsOfGridCellsIntersectingCuboid | ( | Eigen::Vector3d const & | min_pnt, |
Eigen::Vector3d const & | max_pnt ) const |
Definition at line 286 of file Grid.h.
Referenced by MeshToolsLib::Mesh2MeshPropertyInterpolation::interpolatePropertiesForMesh().
|
private |
point numbering of the grid cell is as follow
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
pnt | (input) coordinates of the point |
coords | of the grid cell |
Definition at line 445 of file Grid.h.
std::vector< std::size_t > GeoLib::Grid< POINT >::getPointsInEpsilonEnvironment | ( | P const & | pnt, |
double | eps ) const |
Definition at line 676 of file Grid.h.
Referenced by MeshGeoToolsLib::MeshNodesOnPoint::MeshNodesOnPoint(), and MeshGeoToolsLib::MeshNodeSearcher::getMeshNodeIDs().
|
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 566 of file Grid.h.
Referenced by GeoLib::Grid< POINT >::Grid().
|
private |
This is an array that stores pointers to POINT objects.
Definition at line 190 of file Grid.h.
Referenced by GeoLib::Grid< POINT >::Grid(), and GeoLib::Grid< POINT >::~Grid().
|
private |
|
private |
Definition at line 186 of file Grid.h.
Referenced by GeoLib::Grid< POINT >::Grid().