Chaste  Release::2018.1
ObsoleteBoxCollection< DIM > Class Template Reference

#include <ObsoleteBoxCollection.hpp>

+ 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 (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

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 >::mBoxes, ObsoleteBoxCollection< DIM >::mIsDomainPeriodic, ObsoleteBoxCollection< DIM >::mNumBoxesEachDirection, ObsoleteBoxCollection< DIM >::msFudge, and NEVER_REACHED.

Member Function Documentation

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

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.

References EXCEPTION.

template<unsigned DIM>
void ObsoleteBoxCollection< DIM >::CalculateNodePairs ( 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 634 of file ObsoleteBoxCollection.cpp.

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

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

Remove the list of nodes stored in each box.

Definition at line 95 of file ObsoleteBoxCollection.cpp.

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.

References NEVER_REACHED.

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.

References NEVER_REACHED.

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

Definition at line 145 of file ObsoleteBoxCollection.cpp.

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 248 of file ObsoleteBoxCollection.cpp.

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.

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 276 of file ObsoleteBoxCollection.cpp.

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.

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.

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 628 of file ObsoleteBoxCollection.cpp.

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 621 of file ObsoleteBoxCollection.cpp.

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 384 of file ObsoleteBoxCollection.cpp.

References NEVER_REACHED.

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 459 of file ObsoleteBoxCollection.cpp.

References NEVER_REACHED.

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 289 of file ObsoleteBoxCollection.cpp.

References NEVER_REACHED.

Member Data Documentation

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.

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

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

The width of each box.

Definition at line 64 of file ObsoleteBoxCollection.hpp.

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

The domain being partitioned.

Definition at line 61 of file ObsoleteBoxCollection.hpp.

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

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.

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< DIM >::ObsoleteBoxCollection().

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< DIM >::ObsoleteBoxCollection().


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