The MeshGrid allows to divide a global mesh object into smaller regions of elements (e.g. More...
#include <Grid.h>
Public Member Functions | |
Search | |
virtual unsigned long | Inside (const Base::BoundBox3f &rclBB, std::vector< ElementIndex > &raulElements, bool bDelDoubles=true) const |
Searches for elements lying in the intersection area of the grid and the bounding box. More... | |
virtual unsigned long | Inside (const Base::BoundBox3f &rclBB, std::set< ElementIndex > &raulElementss) const |
Searches for elements lying in the intersection area of the grid and the bounding box. More... | |
virtual unsigned long | Inside (const Base::BoundBox3f &rclBB, std::vector< ElementIndex > &raulElements, const Base::Vector3f &rclOrg, float fMaxDist, bool bDelDoubles=true) const |
Searches for elements lying in the intersection area of the grid and the bounding box. More... | |
void | SearchNearestFromPoint (const Base::Vector3f &rclPt, std::set< ElementIndex > &rclInd) const |
Searches for the nearest grids that contain elements from a point, the result are grid indices. More... | |
Getters | |
unsigned long | GetElements (unsigned long ulX, unsigned long ulY, unsigned long ulZ, std::set< ElementIndex > &raclInd) const |
Returns the indices of the elements in the given grid. More... | |
unsigned long | GetElements (const Base::Vector3f &rclPoint, std::vector< ElementIndex > &aulFacets) const |
virtual void | GetGridLengths (float &rfLenX, float &rfLenY, float &rfLenZ) const |
Returns the lengths of the grid elements in x,y and z direction. More... | |
virtual void | GetCtGrids (unsigned long &rulX, unsigned long &rulY, unsigned long &rulZ) const |
Returns the number of grid elements in x,y and z direction. More... | |
Boundings | |
class | MeshGridIterator |
virtual void | InitGrid () |
Initializes the size of the internal structure. More... | |
virtual void | Clear () |
Deletes the grid structure. More... | |
virtual void | CalculateGridLength (unsigned long ulCtGrid, unsigned long ulMaxGrids) |
Calculates the grid length dependent on maximum number of grids. More... | |
virtual void | CalculateGridLength (int iCtGridPerAxis) |
Calculates the grid length dependent on the number of grids per axis. More... | |
virtual void | RebuildGrid ()=0 |
Rebuilds the grid structure. More... | |
virtual unsigned long | HasElements () const =0 |
Returns the number of stored elements. More... | |
Base::BoundBox3f | GetBoundBox (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const |
Returns the bounding box of a given grid element. More... | |
Base::BoundBox3f | GetBoundBox () const |
Returns the bounding box of the whole. More... | |
Base::BoundBox3f | GetMeshBoundBox () const |
Returns an extended bounding box of the mesh object. More... | |
unsigned long | GetIndexToPosition (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const |
Returns an index for the given grid position. More... | |
bool | GetPositionToIndex (unsigned long id, unsigned long &ulX, unsigned long &ulY, unsigned long &ulZ) const |
Returns the grid position to the given index. More... | |
unsigned long | GetCtElements (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const |
Returns the number of elements in a given grid. More... | |
virtual void | Validate (const MeshKernel &rclM)=0 |
Validates the grid structure and rebuilds it if needed. More... | |
virtual bool | Verify () const =0 |
Verifies the grid structure and returns false if inconsistencies are found. More... | |
bool | CheckPosition (const Base::Vector3f &rclPoint, unsigned long &rulX, unsigned long &rulY, unsigned long &rulZ) const |
Checks whether the point is inside the grid. More... | |
virtual void | Position (const Base::Vector3f &rclPoint, unsigned long &rulX, unsigned long &rulY, unsigned long &rulZ) const |
Returns the indices of the grid this point lies in. More... | |
bool | CheckPos (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const |
Checks if this is a valid grid position. More... | |
void | GetHull (unsigned long ulX, unsigned long ulY, unsigned long ulZ, unsigned long ulDistance, std::set< ElementIndex > &raclInd) const |
Get the indices of all elements lying in the grids around a given grid with distance ulDistance. More... | |
Construction | |
MeshGrid (const MeshKernel &rclM) | |
Construction. More... | |
MeshGrid () | |
Construction. More... | |
virtual | ~MeshGrid () |
Destruction. More... | |
virtual void | Attach (const MeshKernel &rclM) |
Attaches the mesh kernel to this grid, an already attached mesh gets detached. More... | |
virtual void | Rebuild (unsigned long ulPerGrid=MESH_CT_GRID, unsigned long ulMaxGrid=MESH_MAX_GRIDS) |
Rebuilds the grid structure. More... | |
virtual void | Rebuild (int iCtGridPerAxis=MESH_CT_GRID_PER_AXIS) |
Rebuilds the grid structure. More... | |
virtual void | Rebuild (unsigned long ulX, unsigned long ulY, unsigned long ulZ) |
Rebuilds the grid structure. More... | |
The MeshGrid allows to divide a global mesh object into smaller regions of elements (e.g.
facets, points or edges) depending on the resolution of the grid. All grid elements in the grid structure have the same size.
Grids can be used within algorithms to avoid to iterate through all elements, so grids can speed up algorithms dramatically.
|
protected |
Construction.
|
protected |
Construction.
|
virtual |
Destruction.
|
virtual |
Attaches the mesh kernel to this grid, an already attached mesh gets detached.
The grid gets rebuilt automatically.
References RebuildGrid().
Referenced by MeshCore::MeshFacetGrid::Validate(), and MeshCore::MeshPointGrid::Validate().
|
protectedvirtual |
Calculates the grid length dependent on the number of grids per axis.
Reimplemented in Inspection::MeshInspectGrid.
References Base::BoundBox3< _Precision >::CalcDiagonalLength(), CalculateGridLength(), Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), and Base::BoundBox3< _Precision >::LengthZ().
|
protectedvirtual |
Calculates the grid length dependent on maximum number of grids.
Reimplemented in Inspection::MeshInspectGrid.
References Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), and Base::BoundBox3< _Precision >::LengthZ().
Referenced by CalculateGridLength(), InitGrid(), and Rebuild().
bool MeshCore::MeshGrid::CheckPos | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ | ||
) | const |
Checks if this is a valid grid position.
Referenced by GetIndexToPosition(), and GetPositionToIndex().
bool MeshGrid::CheckPosition | ( | const Base::Vector3f & | rclPoint, |
unsigned long & | rulX, | ||
unsigned long & | rulY, | ||
unsigned long & | rulZ | ||
) | const |
Checks whether the point is inside the grid.
In case it is inside true is returned with the grid position, otherwise false is returned and the grid position is undefined.
References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by GetElements().
|
protectedvirtual |
Deletes the grid structure.
Base::BoundBox3f MeshCore::MeshGrid::GetBoundBox | ( | ) | const |
Returns the bounding box of the whole.
Referenced by Inspection::MeshInspectGrid::AddFacet(), MeshCore::MeshFacetGrid::AddFacet(), Inside(), MeshCore::MeshFacetGrid::SearchNearestFromPoint(), and SearchNearestFromPoint().
Base::BoundBox3f MeshCore::MeshGrid::GetBoundBox | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ | ||
) | const |
Returns the bounding box of a given grid element.
unsigned long MeshCore::MeshGrid::GetCtElements | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ | ||
) | const |
Returns the number of elements in a given grid.
|
virtual |
Returns the number of grid elements in x,y and z direction.
Referenced by MeshCore::MeshEvalSelfIntersection::Evaluate(), and MeshCore::MeshEvalSelfIntersection::GetIntersections().
unsigned long MeshGrid::GetElements | ( | const Base::Vector3f & | rclPoint, |
std::vector< ElementIndex > & | aulFacets | ||
) | const |
References CheckPosition().
unsigned long MeshGrid::GetElements | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ, | ||
std::set< ElementIndex > & | raclInd | ||
) | const |
Returns the indices of the elements in the given grid.
Referenced by MeshCore::MeshEvalPointOnEdge::Evaluate(), MeshCore::MeshPointGrid::FindElements(), MeshCore::MeshAlgorithm::FirstFacetToVertex(), and GetHull().
|
virtual |
Returns the lengths of the grid elements in x,y and z direction.
void MeshGrid::GetHull | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ, | ||
unsigned long | ulDistance, | ||
std::set< ElementIndex > & | raclInd | ||
) | const |
Get the indices of all elements lying in the grids around a given grid with distance ulDistance.
References GetElements().
Referenced by SearchNearestFromPoint().
unsigned long MeshGrid::GetIndexToPosition | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ | ||
) | const |
Returns an index for the given grid position.
If the specified triple is not a valid grid position ULONG_MAX is returned. If the index is valid than its value is between zero and the number of grid elements. For each different grid position a different index is returned.
References CheckPos().
Base::BoundBox3f MeshCore::MeshGrid::GetMeshBoundBox | ( | ) | const |
Returns an extended bounding box of the mesh object.
References Base::BoundBox3< _Precision >::Enlarge().
bool MeshGrid::GetPositionToIndex | ( | unsigned long | id, |
unsigned long & | ulX, | ||
unsigned long & | ulY, | ||
unsigned long & | ulZ | ||
) | const |
Returns the grid position to the given index.
If the index is equal to or higher than the number of grid elements false is returned and the triple is set to ULONG_MAX.
References CheckPos().
|
protectedpure virtual |
Returns the number of stored elements.
Must be implemented in sub-classes.
Implemented in MeshCore::MeshFacetGrid, MeshCore::MeshPointGrid, and Inspection::MeshInspectGrid.
Referenced by Rebuild().
|
protectedvirtual |
Initializes the size of the internal structure.
Reimplemented in Inspection::MeshInspectGrid.
References CalculateGridLength(), Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), Base::BoundBox3< _Precision >::LengthZ(), Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, and Base::BoundBox3< _Precision >::MinZ.
Referenced by MeshCore::MeshFacetGrid::RebuildGrid(), and MeshCore::MeshPointGrid::RebuildGrid().
|
virtual |
Searches for elements lying in the intersection area of the grid and the bounding box.
References Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MaxZ, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, Base::BoundBox3< _Precision >::MinZ, and Position().
|
virtual |
Searches for elements lying in the intersection area of the grid and the bounding box.
References Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MaxZ, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, Base::BoundBox3< _Precision >::MinZ, and Position().
Referenced by MeshCore::MeshIntersection::getIntersection(), MeshCore::MeshAlgorithm::SearchFacetsFromPolyline(), and MeshCore::MeshFacetGrid::SearchNearestFromPoint().
|
virtual |
Searches for elements lying in the intersection area of the grid and the bounding box.
References Base::BoundBox3< _Precision >::CalcDiagonalLength(), Base::DistanceP2(), GetBoundBox(), Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MaxZ, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, Base::BoundBox3< _Precision >::MinZ, and Position().
|
virtual |
Returns the indices of the grid this point lies in.
If the point is outside the grid the indices of the nearest grid element are taken.
References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by Inside(), MeshCore::MeshFacetGrid::SearchNearestFromPoint(), and SearchNearestFromPoint().
|
virtual |
Rebuilds the grid structure.
References CalculateGridLength(), HasElements(), and RebuildGrid().
|
virtual |
Rebuilds the grid structure.
References CalculateGridLength(), HasElements(), and RebuildGrid().
Referenced by MeshCore::MeshFacetGrid::MeshFacetGrid(), Inspection::MeshInspectGrid::MeshInspectGrid(), and MeshCore::MeshPointGrid::MeshPointGrid().
|
virtual |
Rebuilds the grid structure.
References HasElements(), and RebuildGrid().
|
protectedpure virtual |
Rebuilds the grid structure.
Must be implemented in sub-classes.
Implemented in MeshCore::MeshFacetGrid, MeshCore::MeshPointGrid, and Inspection::MeshInspectGrid.
void MeshGrid::SearchNearestFromPoint | ( | const Base::Vector3f & | rclPt, |
std::set< ElementIndex > & | rclInd | ||
) | const |
Searches for the nearest grids that contain elements from a point, the result are grid indices.
References Base::BoundBox3< _Precision >::BACK, Base::BoundBox3< _Precision >::BOTTOM, Base::BoundBox3< _Precision >::FRONT, GetBoundBox(), Base::BoundBox3< _Precision >::GetCenter(), GetHull(), Base::BoundBox3< _Precision >::GetSideFromRay(), Base::BoundBox3< _Precision >::IsInBox(), Base::BoundBox3< _Precision >::LEFT, Position(), Base::BoundBox3< _Precision >::RIGHT, and Base::BoundBox3< _Precision >::TOP.
|
pure virtual |
Validates the grid structure and rebuilds it if needed.
Must be implemented in sub-classes.
Implemented in Inspection::MeshInspectGrid, MeshCore::MeshFacetGrid, and MeshCore::MeshPointGrid.
|
pure virtual |
Verifies the grid structure and returns false if inconsistencies are found.
Implemented in Inspection::MeshInspectGrid, MeshCore::MeshFacetGrid, and MeshCore::MeshPointGrid.
|
friend |