Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
ObsoleteBoxCollection< DIM > Class Template Reference

#include <ObsoleteBoxCollection.hpp>

+ Inheritance diagram for ObsoleteBoxCollection< DIM >:
+ Collaboration diagram for ObsoleteBoxCollection< DIM >:

Public Member Functions

 ObsoleteBoxCollection (double boxWidth, c_vector< double, 2 *DIM > domainSize, bool isPeriodicInX=false, bool isPeriodicInY=false, bool isPeriodicInZ=false)
 
void EmptyBoxes ()
 
unsigned CalculateContainingBox (Node< DIM > *pNode)
 
unsigned CalculateContainingBox (c_vector< double, DIM > &rLocation)
 
Box< DIM > & rGetBox (unsigned boxIndex)
 
unsigned GetNumBoxes ()
 
void SetupLocalBoxesHalfOnly ()
 
void SetupAllLocalBoxes ()
 
std::set< unsigned > & rGetLocalBoxes (unsigned boxIndex)
 
const c_vector< double, 2 *DIM > & rGetDomainSize () const
 
void CalculateNodePairs (const std::vector< Node< DIM > * > &rNodes, std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs)
 
bool IsOwned (Node< DIM > *pNode)
 
bool IsBoxOwned (unsigned globalIndex)
 

Private Member Functions

unsigned GetLinearIndex (c_vector< int, DIM > gridIndices)
 
c_vector< unsigned, DIM > GetGridIndices (unsigned linearIndex)
 
bool IsBoxInDomain (c_vector< unsigned, DIM > gridIndices)
 
c_vector< bool, DIM > IsIndexPenultimate (c_vector< unsigned, DIM > gridIndices)
 
void SetupLocalBoxes (const std::vector< c_vector< int, DIM > > &rNeighbours)
 

Private Attributes

std::vector< Box< DIM > > mBoxes
 
c_vector< double, 2 *DIM > mDomainSize
 
double mBoxWidth
 
c_vector< unsigned, DIM > mNumBoxesEachDirection
 
std::vector< std::set< unsigned > > mLocalBoxes
 
c_vector< bool, DIM > mIsDomainPeriodic
 

Static Private Attributes

static const double msFudge = 5e-14
 

Friends

class TestObsoleteBoxCollection
 

Detailed Description

template<unsigned DIM>
class ObsoleteBoxCollection< DIM >

A collection of 'boxes' partitioning the domain with information on which nodes are located in which box Not archived - in cell_based constructed in NodeBasedCellPopulation constructor.

This is to be merged with DistributedBoxCollection.

Definition at line 52 of file ObsoleteBoxCollection.hpp.

Constructor & Destructor Documentation

◆ ObsoleteBoxCollection()

template<unsigned DIM>
ObsoleteBoxCollection< DIM >::ObsoleteBoxCollection ( double  boxWidth,
c_vector< double, 2 *DIM >  domainSize,
bool  isPeriodicInX = false,
bool  isPeriodicInY = false,
bool  isPeriodicInZ = false 
)

Constructor.

Parameters
boxWidththe width of each box (cut-off length in NodeBasedCellPopulation simulations)
domainSizethe size of the domain, in the form (xmin, xmax, ymin, ymax) (etc)
isPeriodicInXwhether the domain is periodic in the x direction
isPeriodicInYwhether the domain is periodic in the y direction
isPeriodicInZwhether the domain is periodic in the z direction
Todo:
#2725 example: domain width of 1.0 and box width of 0.25, the following line will create 5 boxes not 4

Definition at line 48 of file ObsoleteBoxCollection.cpp.

References ObsoleteBoxCollection< DIM >::mIsDomainPeriodic, and NEVER_REACHED.

Member Function Documentation

◆ CalculateContainingBox() [1/2]

template<unsigned DIM>
unsigned ObsoleteBoxCollection< DIM >::CalculateContainingBox ( c_vector< double, DIM > &  rLocation)
Returns
the index of the box a point is contained in
Parameters
rLocationThe point

Definition at line 112 of file ObsoleteBoxCollection.cpp.

◆ CalculateContainingBox() [2/2]

template<unsigned DIM>
unsigned ObsoleteBoxCollection< DIM >::CalculateContainingBox ( Node< DIM > *  pNode)
Returns
the index of the box this node is contained in.
Parameters
pNodeaddress of the node

Definition at line 104 of file ObsoleteBoxCollection.cpp.

References Node< SPACE_DIM >::rGetLocation().

◆ CalculateNodePairs()

template<unsigned DIM>
void ObsoleteBoxCollection< DIM >::CalculateNodePairs ( const std::vector< Node< DIM > * > &  rNodes,
std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &  rNodePairs 
)

Compute all the pairs of (potentially) connected nodes for cell_based simulations, ie nodes which are in a local box to the box containing the first node. **Note: the user still has to check that the node pairs are less than the cut-off distance apart.** The pairs are checked so that index1 < index2, so each connected pair of nodes is only in the set once.

Parameters
rNodesall the nodes to be considered
rNodePairsthe return value, a set of pairs of nodes

Definition at line 624 of file ObsoleteBoxCollection.cpp.

References Node< SPACE_DIM >::AddNeighbour(), and Node< SPACE_DIM >::GetIndex().

◆ EmptyBoxes()

template<unsigned DIM>
void ObsoleteBoxCollection< DIM >::EmptyBoxes ( )

Remove the list of nodes stored in each box.

Definition at line 95 of file ObsoleteBoxCollection.cpp.

◆ GetGridIndices()

template<unsigned DIM>
c_vector< unsigned, DIM > ObsoleteBoxCollection< DIM >::GetGridIndices ( unsigned  linearIndex)
private
Parameters
linearIndexthe linear index in row-major form
Returns
the grid indices (i), (i,j), or (i,j,k) depending on DIM

Definition at line 211 of file ObsoleteBoxCollection.cpp.

◆ GetLinearIndex()

template<unsigned DIM>
unsigned ObsoleteBoxCollection< DIM >::GetLinearIndex ( c_vector< int, DIM >  gridIndices)
private
Parameters
gridIndicesthe grid indices (i), (i,j), or (i,j,k) depending on DIM
Returns
the linear index in row-major form

Definition at line 151 of file ObsoleteBoxCollection.cpp.

◆ GetNumBoxes()

template<unsigned DIM>
unsigned ObsoleteBoxCollection< DIM >::GetNumBoxes ( )
Returns
the total (global) number of boxes.

Definition at line 145 of file ObsoleteBoxCollection.cpp.

◆ IsBoxInDomain()

template<unsigned DIM>
bool ObsoleteBoxCollection< DIM >::IsBoxInDomain ( c_vector< unsigned, DIM >  gridIndices)
private
Parameters
gridIndicesthe coordinates (i), (i,j), or (i,j,k) depending on DIM
Returns
whether the box is in the domain

Definition at line 238 of file ObsoleteBoxCollection.cpp.

◆ IsBoxOwned()

template<unsigned DIM>
bool ObsoleteBoxCollection< DIM >::IsBoxOwned ( unsigned  globalIndex)
inline

Helper function for transition to distributed version of box collection.

This method allows us to insert of dummy test for whether a box/point/node/location is located on the local process.

Parameters
globalIndexthe global index of the box.
Returns
true (whether the point at pNode->rGetLocation() is owned on this process)

Definition at line 224 of file ObsoleteBoxCollection.hpp.

◆ IsIndexPenultimate()

template<unsigned DIM>
c_vector< bool, DIM > ObsoleteBoxCollection< DIM >::IsIndexPenultimate ( c_vector< unsigned, DIM >  gridIndices)
private

This method is used for periodicity. It is necessary to consider additional boxes as being local to a candidate box if and only if the candidate box is in the penultimate location of any dimension.

Parameters
gridIndicesthe coordinates (i), (i,j), or (i,j,k) depending on DIM
Returns
whether the box is in the penultimate location in each dimension

Definition at line 266 of file ObsoleteBoxCollection.cpp.

◆ IsOwned()

template<unsigned DIM>
bool ObsoleteBoxCollection< DIM >::IsOwned ( Node< DIM > *  pNode)
inline

Helper function for transition to distributed version of box collection.

This method allows us to insert of dummy test for whether a box/point/node/location is located on the local process.

Parameters
pNodethe node to test.
Returns
true (whether the point at pNode->rGetLocation() is owned on this process)

Definition at line 211 of file ObsoleteBoxCollection.hpp.

◆ rGetBox()

template<unsigned DIM>
Box< DIM > & ObsoleteBoxCollection< DIM >::rGetBox ( unsigned  boxIndex)
Parameters
boxIndexthe index of the box to return
Returns
a reference to the box with global index boxIndex.

Definition at line 138 of file ObsoleteBoxCollection.cpp.

◆ rGetDomainSize()

template<unsigned DIM>
const c_vector< double, 2 *DIM > & ObsoleteBoxCollection< DIM >::rGetDomainSize ( ) const

Return the size of the domain partitioned by this collection

Returns
the vector of the domain edges (xmin, xmax etc).

Definition at line 618 of file ObsoleteBoxCollection.cpp.

◆ rGetLocalBoxes()

template<unsigned DIM>
std::set< unsigned > & ObsoleteBoxCollection< DIM >::rGetLocalBoxes ( unsigned  boxIndex)

Get the set of all the local boxes, i.e. itself and its nearest-neighbours.

Parameters
boxIndexthe index of the box
Returns
the set containing the indices of boxes local to box boxIndex. i.e. the box boxIndex itself and its nearest-neighbours.

Definition at line 611 of file ObsoleteBoxCollection.cpp.

◆ SetupAllLocalBoxes()

template<unsigned DIM>
void ObsoleteBoxCollection< DIM >::SetupAllLocalBoxes ( )

Generates a list of vectors representing all the possible neighbour locations in DIM-dimensions, and calls SetupLocalBoxes().

Definition at line 374 of file ObsoleteBoxCollection.cpp.

References NEVER_REACHED.

◆ SetupLocalBoxes()

template<unsigned DIM>
void ObsoleteBoxCollection< DIM >::SetupLocalBoxes ( const std::vector< c_vector< int, DIM > > &  rNeighbours)
private

Helper function for SetupLocalBoxesHalfOnly() and SetupAllLocalBoxes().

Accepts a vector of neighbours that should be considered for each box and populates mLocalBoxes based on these neighbours. The set of neighbours is either half or all of the neighbours, depending on the function calling this method.

Parameters
rNeighboursa vector of neighbours

Definition at line 449 of file ObsoleteBoxCollection.cpp.

References NEVER_REACHED.

◆ SetupLocalBoxesHalfOnly()

template<unsigned DIM>
void ObsoleteBoxCollection< DIM >::SetupLocalBoxesHalfOnly ( )

Generates a list of vectors representing half the possible neighbour locations in DIM-dimensions ({0} and {1} in 1D, rather than {-1}, {0}, {1}), and similar in higher dimensions, and calls SetupLocalBoxes().

Definition at line 279 of file ObsoleteBoxCollection.cpp.

References NEVER_REACHED.

Friends And Related Symbol Documentation

◆ TestObsoleteBoxCollection

template<unsigned DIM>
friend class TestObsoleteBoxCollection
friend

Definition at line 55 of file ObsoleteBoxCollection.hpp.

Member Data Documentation

◆ mBoxes

template<unsigned DIM>
std::vector< Box<DIM> > ObsoleteBoxCollection< DIM >::mBoxes
private

A vector of boxes to store rough node/element positions.

Definition at line 58 of file ObsoleteBoxCollection.hpp.

◆ mBoxWidth

template<unsigned DIM>
double ObsoleteBoxCollection< DIM >::mBoxWidth
private

The width of each box.

Definition at line 64 of file ObsoleteBoxCollection.hpp.

◆ mDomainSize

template<unsigned DIM>
c_vector<double, 2*DIM> ObsoleteBoxCollection< DIM >::mDomainSize
private

The domain being partitioned.

Definition at line 61 of file ObsoleteBoxCollection.hpp.

◆ mIsDomainPeriodic

template<unsigned DIM>
c_vector<bool, DIM> ObsoleteBoxCollection< DIM >::mIsDomainPeriodic
private

Whether the domain is periodic

Definition at line 73 of file ObsoleteBoxCollection.hpp.

Referenced by ObsoleteBoxCollection< DIM >::ObsoleteBoxCollection().

◆ mLocalBoxes

template<unsigned DIM>
std::vector< std::set<unsigned> > ObsoleteBoxCollection< DIM >::mLocalBoxes
private

The boxes local (itself and nearest neighbour) to a given box.

Definition at line 70 of file ObsoleteBoxCollection.hpp.

◆ mNumBoxesEachDirection

template<unsigned DIM>
c_vector<unsigned, DIM> ObsoleteBoxCollection< DIM >::mNumBoxesEachDirection
private

Number of boxes in each direction.

Definition at line 67 of file ObsoleteBoxCollection.hpp.

Referenced by ObsoleteBoxCollection< SPACE_DIM >::GetLinearIndex().

◆ msFudge

template<unsigned DIM>
const double ObsoleteBoxCollection< DIM >::msFudge = 5e-14
staticprivate

A fudge (box swelling) factor to deal with 32-bit floating point issues.

Definition at line 76 of file ObsoleteBoxCollection.hpp.

Referenced by ObsoleteBoxCollection< SPACE_DIM >::GetLinearIndex().


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