Workspace 6.21.5
Public Member Functions | List of all members
PartitionConstantGrid< T > Class Template Reference

#include <Mesh/DataStructures/partitionconstantgrid.h>

Inheritance diagram for PartitionConstantGrid< T >:
[legend]

Public Member Functions

template<typename IterType >
 PartitionConstantGrid (const IterType &itemsBegin, const IterType &itemsEnd, const Vector3d &minDim, const Vector3d &maxDim, double spacing)
 
 PartitionConstantGrid (const Vector3d &minDim, const Vector3d &maxDim, double spacing)
 
 ~PartitionConstantGrid () override=default
 
void Add (T *cellItem) override
 
void Add (typename NumberedObjectList< T >::iterator itemsBegin, typename NumberedObjectList< T >::iterator itemsEnd) override
 
void Add (typename std::vector< T * >::iterator itemsBegin, typename std::vector< T * >::iterator itemsEnd) override
 
template<typename ContainerType >
void AddItems (const ContainerType &nIterMarkers)
 
template<typename IterType >
void AddItems (const IterType &itemsBegin, const IterType &itemsEnd)
 
void AddToCells (T &cellItem)
 Add cellItem to its appropriate cell.
 
void AddToCellsWithCheck (T &cellItem)
 Add cellItem to its appropriate cell only if it is not already in the cell.
 
template<typename ContentsType >
void FindNearby (const Node &node, std::vector< ContentsType > &container) const
 
template<typename ContentsType >
void FindNearby (const Vector3d &pos, std::vector< ContentsType > &container) const
 Add the contents of all neighbouring cells and the cell for pos to container.
 
void FindWithinRadius (const Vector3d &center, double radius, std::vector< ShellElement * > &container) const
 
void FindWithinRadius (const Vector3d &center, double radius, std::vector< T * > &container) const override
 
void Remove (T *cellItem) override
 
void RemoveAll () override
 
void RemoveFromCells (T &cellItem)
 Remove cellItem from its corresponding cell.
 
void RemoveFromCellsWithCheck (T &cellItem)
 Remove cellItem from its corresponding cell, if it is present.
 
- Public Member Functions inherited from SearchRegion< T >
virtual ~SearchRegion ()=default
 
virtual void Add (T *cellItem)=0
 
virtual void Add (typename NumberedObjectList< T >::iterator itemsBegin, typename NumberedObjectList< T >::iterator itemsEnd)
 
virtual void Add (typename std::vector< T * >::iterator itemsBegin, typename std::vector< T * >::iterator itemsEnd)
 
virtual void FindWithinRadius (const Vector3d &center, double radius, std::vector< T * > &container) const =0
 
virtual void Remove (T *cellItem)=0
 
virtual void Remove (typename NumberedObjectList< T >::iterator itemsBegin, typename NumberedObjectList< T >::iterator itemsEnd)
 
virtual void Remove (typename std::vector< T * >::iterator itemsBegin, typename std::vector< T * >::iterator itemsEnd)
 
virtual void RemoveAll ()=0
 
- Public Member Functions inherited from PartitionConstantBase
 PartitionConstantBase (const Vector3d &minDim, const Vector3d &maxDim, double spacing)
 
double GetGridSpacing () const
 
long GetKey (const Vector3d &v) const
 
long GetKey (long x, long y, long z) const
 
const Vector3dGetMaxControlVolume () const
 
const Vector3dGetMinControlVolume () const
 
long GetNumCellsX () const
 
long GetNumCellsY () const
 
long GetNumCellsZ () const
 
bool ValidIndexes (long x, long y, long z) const
 
- Public Member Functions inherited from MapStorage< T >
bool TestExistence (long key) const
 
- Public Member Functions inherited from PartitionConstantTraits< T, std::map< long, std::vector< T * > > >
reference back ()
 
const_reference back () const
 
iterator begin ()
 
const_iterator begin () const
 
void clear ()
 
unsigned count (long key) const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
reference front ()
 
const_reference front () const
 
iterator lower_bound (long key)
 
const_iterator lower_bound (long key) const
 
size_type max_size () const
 
void push_back (const value_type &c)
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
void reserve (size_type s)
 Reserve space for s items (if the data type supports it).
 
size_type size () const
 
iterator upper_bound (long key)
 
const_iterator upper_bound (long key) const
 

Additional Inherited Members

- Public Types inherited from PartitionConstantTraits< T, std::map< long, std::vector< T * > > >
typedef std::vector< T * > CellType
 
using const_iterator = typename container_type::const_iterator
 
using const_reference = typename container_type::const_reference
 
using const_reverse_iterator = typename container_type::const_reverse_iterator
 
using container_type = std::map< long, std::vector< T * > >
 Make the type of this array easy to refer to in client code.
 
using iterator = typename container_type::iterator
 
using reference = typename container_type::reference
 
using reverse_iterator = typename container_type::reverse_iterator
 
using size_type = typename container_type::size_type
 
using value_type = typename container_type::value_type
 
- Protected Member Functions inherited from PartitionConstantData< T, MapStorage< T > >
 PartitionConstantData (const Vector3d &minDim, const Vector3d &maxDim, double spacing)
 Construct the array without initializing each element.
 
StoragePolicy::iterator erase (typename StoragePolicy::iterator iter)
 
bool Exists (long x, long y, long z) const
 
- Protected Member Functions inherited from PartitionConstantBase
long FindCellIndex (const Vector3d &pos, int axis) const
 Find the axis index of the cell that encompasses pos.
 
long FindCellIndex (double d, int axis) const
 Find the axis index of the cell that encompasses d, which is the co-ordinate in the axis direction.
 
- Protected Member Functions inherited from PartitionConstantTraits< T, std::map< long, std::vector< T * > > >
iterator erase (iterator iter)
 
iterator FindKeyCell (long key)
 
const_iterator FindKeyCell (long key) const
 
CellTypeGetKeyCell (long key)
 
const CellTypeGetKeyCell (long key) const
 

Constructor & Destructor Documentation

◆ PartitionConstantGrid() [1/2]

PartitionConstantGrid ( const Vector3d minDim,
const Vector3d maxDim,
double  spacing 
)
inline

This constructor prepares the object for adding items. It creates an empty partitioned model and checks to ensure a license has been obtained.

◆ PartitionConstantGrid() [2/2]

PartitionConstantGrid ( const IterType &  itemsBegin,
const IterType &  itemsEnd,
const Vector3d minDim,
const Vector3d maxDim,
double  spacing 
)
inline

The constructor takes a container and builds a complete partitioned model with the container objects allocated to one or more cells at the requested spacing. Nodes are assigned to one cell only. Elements are assigned to possibly more than one cell. A license check is made before anything is added.

This constructor is equivalent to calling PartitionConstantGrid(minDim,maxDim,spacing) followed by a call to AddItems(itemsBegin,itemsEnd). It exists to facilitate easier initialization of other class' data members in their constructors.

◆ ~PartitionConstantGrid()

~PartitionConstantGrid ( )
overridedefault

Member Function Documentation

◆ Add() [1/3]

void Add ( T *  cellItem)
inlineoverridevirtual

Implements SearchRegion< T >.

◆ Add() [2/3]

void Add ( typename NumberedObjectList< T >::iterator  itemsBegin,
typename NumberedObjectList< T >::iterator  itemsEnd 
)
inlineoverride

◆ Add() [3/3]

void Add ( typename std::vector< T * >::iterator  itemsBegin,
typename std::vector< T * >::iterator  itemsEnd 
)
inlineoverride

◆ AddItems() [1/2]

void AddItems ( const ContainerType &  nIterMarkers)
Parameters
nIterMarkersA container holding iterators marking the start of item sections to be processed as separate threads. The first element in the container is the start of the first section. The second element is one after the last element in the first section, as well as the first element in the second section. This pattern continues for the whole container except for the last entry, which is only an end-of-section marker. Thus, the size of the container must be one more than the number of threads to be used.

Add the items specified by the iterators to the partitioned model. Nodes are assigned to one cell only. Elements are assigned to possibly more than one cell. This is the multi-threaded version. If only one thread is being used, the other overloaded version will be used internally because it will be quicker.

◆ AddItems() [2/2]

void AddItems ( const IterType &  itemsBegin,
const IterType &  itemsEnd 
)

Add the items specified by the iterators itemsBegin and itemsEnd to the partitioned model. Nodes are assigned to one cell only. Elements are assigned to possibly more than one cell. This is the single-threaded version.

◆ AddToCells()

void AddToCells ( T &  cellItem)
inline

◆ AddToCellsWithCheck()

void AddToCellsWithCheck ( T &  cellItem)
inline

◆ FindNearby() [1/2]

void FindNearby ( const Node node,
std::vector< ContentsType > &  container 
) const
inline

Add the contents of all neighbouring cells and the cell for node to container. This function checks to make sure that node itself is not added to container. Obviously, this function only makes sense when the cells hold nodes and not some other type, such as shell elements!

◆ FindNearby() [2/2]

void FindNearby ( const Vector3d pos,
std::vector< ContentsType > &  container 
) const
inline

◆ FindWithinRadius() [1/2]

void FindWithinRadius ( const Vector3d center,
double  radius,
std::vector< ShellElement * > &  container 
) const
inline

◆ FindWithinRadius() [2/2]

void FindWithinRadius ( const Vector3d center,
double  radius,
std::vector< T * > &  container 
) const
inlineoverridevirtual

This is similar to the one parameter overloaded version except it is more stringent. It only returns neighbours that are within a distance of radius from center, rather than all neighbours that are within a box surrounding the sphere this represents.

Implements SearchRegion< T >.

◆ Remove()

void Remove ( T *  cellItem)
inlineoverridevirtual

Implements SearchRegion< T >.

◆ RemoveAll()

void RemoveAll ( )
inlineoverridevirtual

Implements SearchRegion< T >.

◆ RemoveFromCells()

void RemoveFromCells ( T &  cellItem)
inline

◆ RemoveFromCellsWithCheck()

void RemoveFromCellsWithCheck ( T &  cellItem)
inline