FreeCAD C++
|
#include <Mod/Mesh/App/Core/Grid.h>
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.
Public Member Functions | |
virtual | ~MeshGrid (void) |
Destruction. | |
virtual void | Attach (const MeshKernel &rclM) |
virtual void | Rebuild (unsigned long ulPerGrid=MESH_CT_GRID, unsigned long ulMaxGrid=MESH_MAX_GRIDS) |
virtual void | Rebuild (int iCtGridPerAxis=MESH_CT_GRID_PER_AXIS) |
virtual void | Rebuild (unsigned long ulX, unsigned long ulY, unsigned long ulZ) |
virtual void | GetGridLengths (float &rfLenX, float &rfLenY, float &rfLenZ) const |
virtual void | GetCtGrids (unsigned long &rulX, unsigned long &rulY, unsigned long &rulZ) const |
unsigned long | GetIndexToPosition (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const |
bool | GetPositionToIndex (unsigned long id, unsigned long &ulX, unsigned long &ulY, unsigned long &ulZ) const |
unsigned long | GetCtElements (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const |
virtual void | Validate (const MeshKernel &rclM)=0 |
virtual bool | Verify () const =0 |
bool | CheckPosition (const Base::Vector3f &rclPoint, unsigned long &rulX, unsigned long &rulY, unsigned long &rulZ) const |
virtual void | Position (const Base::Vector3f &rclPoint, unsigned long &rulX, unsigned long &rulY, unsigned long &rulZ) const |
bool | CheckPos (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const |
void | GetHull (unsigned long ulX, unsigned long ulY, unsigned long ulZ, unsigned long ulDistance, std::set< unsigned long > &raclInd) const |
Search | |
virtual unsigned long | Inside (const Base::BoundBox3f &rclBB, std::vector< unsigned long > &raulElements, bool bDelDoubles=true) const |
virtual unsigned long | Inside (const Base::BoundBox3f &rclBB, std::set< unsigned long > &raulElementss) const |
virtual unsigned long | Inside (const Base::BoundBox3f &rclBB, std::vector< unsigned long > &raulElements, const Base::Vector3f &rclOrg, float fMaxDist, bool bDelDoubles=true) const |
void | SearchNearestFromPoint (const Base::Vector3f &rclPt, std::set< unsigned long > &rclInd) const |
Getters | |
unsigned long | GetElements (unsigned long ulX, unsigned long ulY, unsigned long ulZ, std::set< unsigned long > &raclInd) const |
unsigned long | GetElements (const Base::Vector3f &rclPoint, std::vector< unsigned long > &aulFacets) const |
Boundings | |
Base::BoundBox3f | GetBoundBox (unsigned long ulX, unsigned long ulY, unsigned long ulZ) const |
Base::BoundBox3f | GetBoundBox (void) const |
Base::BoundBox3f | GetMeshBoundBox (void) const |
Protected Member Functions | |
virtual void | InitGrid (void) |
virtual void | Clear (void) |
virtual void | CalculateGridLength (unsigned long ulCtGrid, unsigned long ulMaxGrids) |
virtual void | CalculateGridLength (int iCtGridPerAxis) |
virtual void | RebuildGrid (void)=0 |
virtual unsigned long | HasElements (void) const =0 |
Construction | |
MeshGrid (const MeshKernel &rclM) | |
Construction. | |
MeshGrid (void) | |
Construction. | |
Protected Attributes | |
std::vector< std::vector< std::vector< std::set< unsigned long > > > > | _aulGrid |
const MeshKernel * | _pclMesh |
unsigned long | _ulCtElements |
unsigned long | _ulCtGridsX |
unsigned long | _ulCtGridsY |
unsigned long | _ulCtGridsZ |
float | _fGridLenX |
float | _fGridLenY |
float | _fGridLenZ |
float | _fMinX |
float | _fMinY |
float | _fMinZ |
|
virtual |
Attaches the mesh kernel to this grid, an already attached mesh gets detached. The grid gets rebuilt automatically.
|
protectedvirtual |
Calculates the grid length dependent on maximum number of grids.
|
protectedvirtual |
Calculates the grid length dependent on the number of grids per axis.
bool MeshCore::MeshGrid::CheckPos | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ | ||
) | const |
Checks if this is a valid grid position.
bool MeshCore::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.
|
protectedvirtual |
Deletes the grid structure.
Base::BoundBox3f MeshCore::MeshGrid::GetBoundBox | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ | ||
) | const |
Returns the bounding box of a given grid element.
Base::BoundBox3f MeshCore::MeshGrid::GetBoundBox | ( | void | ) | const |
Returns the bounding box of the whole.
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.
unsigned long MeshCore::MeshGrid::GetElements | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ, | ||
std::set< unsigned long > & | raclInd | ||
) | const |
Returns the indices of the elements in the given grid.
|
virtual |
Returns the lengths of the grid elements in x,y and z direction.
void MeshCore::MeshGrid::GetHull | ( | unsigned long | ulX, |
unsigned long | ulY, | ||
unsigned long | ulZ, | ||
unsigned long | ulDistance, | ||
std::set< unsigned long > & | raclInd | ||
) | const |
Get the indices of all elements lying in the grids around a given grid with distance ulDistance.
unsigned long MeshCore::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.
Base::BoundBox3f MeshCore::MeshGrid::GetMeshBoundBox | ( | void | ) | const |
Returns an extended bounding box of the mesh object.
bool MeshCore::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.
|
protectedpure virtual |
Returns the number of stored elements. Must be implemented in sub-classes.
Implemented in MeshCore::MeshPointGrid, and MeshCore::MeshFacetGrid.
|
protectedvirtual |
Initializes the size of the internal structure.
|
virtual |
Searches for elements lying in the intersection area of the grid and the bounding box.
|
virtual |
Searches for elements lying in the intersection area of the grid and the bounding box.
|
virtual |
Searches for elements lying in the intersection area of the grid and the bounding box.
|
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.
|
virtual |
Rebuilds the grid structure.
|
virtual |
Rebuilds the grid structure.
|
virtual |
Rebuilds the grid structure.
|
protectedpure virtual |
Rebuilds the grid structure. Must be implemented in sub-classes.
Implemented in MeshCore::MeshPointGrid, and MeshCore::MeshFacetGrid.
void MeshCore::MeshGrid::SearchNearestFromPoint | ( | const Base::Vector3f & | rclPt, |
std::set< unsigned long > & | rclInd | ||
) | const |
Searches for the nearest grids that contain elements from a point, the result are grid indices.
|
pure virtual |
Validates the grid structure and rebuilds it if needed. Must be implemented in sub-classes.
Implemented in MeshCore::MeshPointGrid, and MeshCore::MeshFacetGrid.
|
pure virtual |
Verifies the grid structure and returns false if inconsistencies are found.
Implemented in MeshCore::MeshPointGrid, and MeshCore::MeshFacetGrid.
|
protected |
Grid data structure.
|
protected |
Length of grid elements in x.
|
protected |
Length of grid elements in y.
|
protected |
Length of grid elements in z.
|
protected |
Grid null position in x.
|
protected |
Grid null position in y.
|
protected |
Grid null position in z.
|
protected |
The mesh kernel.
|
protected |
Number of grid elements for validation issues.
|
protected |
Number of grid elements in z.
|
protected |
Number of grid elements in z.
|
protected |
Number of grid elements in z.