MeshCore::MeshGrid Class Referenceabstract

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MeshGrid() [1/2]

MeshGrid::MeshGrid ( const MeshKernel rclM)
protected

Construction.

◆ MeshGrid() [2/2]

MeshGrid::MeshGrid ( )
protected

Construction.

◆ ~MeshGrid()

virtual MeshCore::MeshGrid::~MeshGrid ( )
virtual

Destruction.

Member Function Documentation

◆ Attach()

void MeshGrid::Attach ( const MeshKernel rclM)
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().

◆ CalculateGridLength() [1/2]

void MeshGrid::CalculateGridLength ( int  iCtGridPerAxis)
protectedvirtual

◆ CalculateGridLength() [2/2]

void MeshGrid::CalculateGridLength ( unsigned long  ulCtGrid,
unsigned long  ulMaxGrids 
)
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().

◆ CheckPos()

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().

◆ CheckPosition()

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().

◆ Clear()

void MeshGrid::Clear ( void  )
protectedvirtual

Deletes the grid structure.

◆ GetBoundBox() [1/2]

◆ GetBoundBox() [2/2]

Base::BoundBox3f MeshCore::MeshGrid::GetBoundBox ( unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ 
) const

Returns the bounding box of a given grid element.

◆ GetCtElements()

unsigned long MeshCore::MeshGrid::GetCtElements ( unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ 
) const

Returns the number of elements in a given grid.

◆ GetCtGrids()

virtual void MeshCore::MeshGrid::GetCtGrids ( unsigned long &  rulX,
unsigned long &  rulY,
unsigned long &  rulZ 
) const
virtual

Returns the number of grid elements in x,y and z direction.

Referenced by MeshCore::MeshEvalSelfIntersection::Evaluate(), and MeshCore::MeshEvalSelfIntersection::GetIntersections().

◆ GetElements() [1/2]

unsigned long MeshGrid::GetElements ( const Base::Vector3f rclPoint,
std::vector< ElementIndex > &  aulFacets 
) const

References CheckPosition().

◆ GetElements() [2/2]

unsigned long MeshGrid::GetElements ( unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ,
std::set< ElementIndex > &  raclInd 
) const

◆ GetGridLengths()

virtual void MeshCore::MeshGrid::GetGridLengths ( float &  rfLenX,
float &  rfLenY,
float &  rfLenZ 
) const
virtual

Returns the lengths of the grid elements in x,y and z direction.

◆ GetHull()

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().

◆ GetIndexToPosition()

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().

◆ GetMeshBoundBox()

Base::BoundBox3f MeshCore::MeshGrid::GetMeshBoundBox ( ) const

Returns an extended bounding box of the mesh object.

References Base::BoundBox3< _Precision >::Enlarge().

◆ GetPositionToIndex()

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().

◆ HasElements()

virtual unsigned long MeshCore::MeshGrid::HasElements ( ) const
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().

◆ InitGrid()

◆ Inside() [1/3]

unsigned long MeshGrid::Inside ( const Base::BoundBox3f rclBB,
std::set< ElementIndex > &  raulElementss 
) const
virtual

◆ Inside() [2/3]

unsigned long MeshGrid::Inside ( const Base::BoundBox3f rclBB,
std::vector< ElementIndex > &  raulElements,
bool  bDelDoubles = true 
) const
virtual

◆ Inside() [3/3]

unsigned long MeshGrid::Inside ( const Base::BoundBox3f rclBB,
std::vector< ElementIndex > &  raulElements,
const Base::Vector3f rclOrg,
float  fMaxDist,
bool  bDelDoubles = true 
) const
virtual

◆ Position()

void MeshGrid::Position ( const Base::Vector3f rclPoint,
unsigned long &  rulX,
unsigned long &  rulY,
unsigned long &  rulZ 
) const
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().

◆ Rebuild() [1/3]

void MeshGrid::Rebuild ( int  iCtGridPerAxis = MESH_CT_GRID_PER_AXIS)
virtual

Rebuilds the grid structure.

References CalculateGridLength(), HasElements(), and RebuildGrid().

◆ Rebuild() [2/3]

void MeshGrid::Rebuild ( unsigned long  ulPerGrid = MESH_CT_GRID,
unsigned long  ulMaxGrid = MESH_MAX_GRIDS 
)
virtual

◆ Rebuild() [3/3]

void MeshGrid::Rebuild ( unsigned long  ulX,
unsigned long  ulY,
unsigned long  ulZ 
)
virtual

Rebuilds the grid structure.

References HasElements(), and RebuildGrid().

◆ RebuildGrid()

virtual void MeshCore::MeshGrid::RebuildGrid ( )
protectedpure virtual

Rebuilds the grid structure.

Must be implemented in sub-classes.

Implemented in MeshCore::MeshFacetGrid, MeshCore::MeshPointGrid, and Inspection::MeshInspectGrid.

Referenced by Attach(), and Rebuild().

◆ SearchNearestFromPoint()

◆ Validate()

virtual void MeshCore::MeshGrid::Validate ( const MeshKernel rclM)
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.

◆ Verify()

virtual bool MeshCore::MeshGrid::Verify ( ) const
pure virtual

Verifies the grid structure and returns false if inconsistencies are found.

Implemented in Inspection::MeshInspectGrid, MeshCore::MeshFacetGrid, and MeshCore::MeshPointGrid.

Friends And Related Function Documentation

◆ MeshGridIterator

friend class MeshGridIterator
friend

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