Chaste
Release::2017.1
|
#include <ObsoleteBoxCollection.hpp>
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 |
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.
ObsoleteBoxCollection< DIM >::ObsoleteBoxCollection | ( | double | boxWidth, |
c_vector< double, 2 *DIM > | domainSize, | ||
bool | isPeriodicInX = false , |
||
bool | isPeriodicInY = false , |
||
bool | isPeriodicInZ = false |
||
) |
Constructor.
boxWidth | the width of each box (cut-off length in NodeBasedCellPopulation simulations) |
domainSize | the size of the domain, in the form (xmin, xmax, ymin, ymax) (etc) |
isPeriodicInX | whether the domain is periodic in the x direction |
isPeriodicInY | whether the domain is periodic in the y direction |
isPeriodicInZ | whether the domain is periodic in the z direction |
Definition at line 48 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::mBoxes, ObsoleteBoxCollection< DIM >::mIsDomainPeriodic, ObsoleteBoxCollection< DIM >::mNumBoxesEachDirection, ObsoleteBoxCollection< DIM >::msFudge, and NEVER_REACHED.
unsigned ObsoleteBoxCollection< DIM >::CalculateContainingBox | ( | Node< DIM > * | pNode | ) |
pNode | address of the node |
Definition at line 104 of file ObsoleteBoxCollection.cpp.
References Node< SPACE_DIM >::rGetLocation().
Referenced by ObsoleteBoxCollection< DIM >::CalculateNodePairs().
unsigned ObsoleteBoxCollection< DIM >::CalculateContainingBox | ( | c_vector< double, DIM > & | rLocation | ) |
rLocation | The point |
Definition at line 112 of file ObsoleteBoxCollection.cpp.
References EXCEPTION, ObsoleteBoxCollection< DIM >::GetLinearIndex(), ObsoleteBoxCollection< DIM >::mBoxWidth, ObsoleteBoxCollection< DIM >::mDomainSize, and ObsoleteBoxCollection< DIM >::msFudge.
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.
rNodes | all the nodes to be considered |
rNodePairs | the return value, a set of pairs of nodes |
Definition at line 634 of file ObsoleteBoxCollection.cpp.
References Node< SPACE_DIM >::AddNeighbour(), ObsoleteBoxCollection< DIM >::CalculateContainingBox(), ObsoleteBoxCollection< DIM >::EmptyBoxes(), Node< SPACE_DIM >::GetIndex(), ObsoleteBoxCollection< DIM >::mBoxes, and ObsoleteBoxCollection< DIM >::rGetLocalBoxes().
void ObsoleteBoxCollection< DIM >::EmptyBoxes | ( | ) |
Remove the list of nodes stored in each box.
Definition at line 95 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::mBoxes.
Referenced by ObsoleteBoxCollection< DIM >::CalculateNodePairs().
|
private |
linearIndex | the linear index in row-major form |
Definition at line 211 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::mNumBoxesEachDirection, and NEVER_REACHED.
Referenced by ObsoleteBoxCollection< DIM >::SetupLocalBoxes().
|
private |
gridIndices | the grid indices (i), (i,j), or (i,j,k) depending on DIM |
Definition at line 151 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::mIsDomainPeriodic, ObsoleteBoxCollection< DIM >::mNumBoxesEachDirection, and NEVER_REACHED.
Referenced by ObsoleteBoxCollection< DIM >::CalculateContainingBox(), and ObsoleteBoxCollection< DIM >::SetupLocalBoxes().
unsigned ObsoleteBoxCollection< DIM >::GetNumBoxes | ( | ) |
Definition at line 145 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::mBoxes.
|
private |
gridIndices | the coordinates (i), (i,j), or (i,j,k) depending on DIM |
Definition at line 248 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::mIsDomainPeriodic, and ObsoleteBoxCollection< DIM >::mNumBoxesEachDirection.
Referenced by ObsoleteBoxCollection< DIM >::SetupLocalBoxes().
|
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.
globalIndex | the global index of the box. |
Definition at line 224 of file ObsoleteBoxCollection.hpp.
|
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.
gridIndices | the coordinates (i), (i,j), or (i,j,k) depending on DIM |
Definition at line 276 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::mNumBoxesEachDirection.
Referenced by ObsoleteBoxCollection< DIM >::SetupLocalBoxes().
|
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.
pNode | the node to test. |
Definition at line 211 of file ObsoleteBoxCollection.hpp.
Box< DIM > & ObsoleteBoxCollection< DIM >::rGetBox | ( | unsigned | boxIndex | ) |
boxIndex | the index of the box to return |
Definition at line 138 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::mBoxes.
const c_vector< double, 2 *DIM > & ObsoleteBoxCollection< DIM >::rGetDomainSize | ( | ) | const |
Return the size of the domain partitioned by this collection
Definition at line 628 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::mDomainSize.
std::set< unsigned > & ObsoleteBoxCollection< DIM >::rGetLocalBoxes | ( | unsigned | boxIndex | ) |
Get the set of all the local boxes, i.e. itself and its nearest-neighbours.
boxIndex | the index of the box |
Definition at line 621 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::mLocalBoxes.
Referenced by ObsoleteBoxCollection< DIM >::CalculateNodePairs().
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, and ObsoleteBoxCollection< DIM >::SetupLocalBoxes().
|
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.
rNeighbours | a vector of neighbours |
Definition at line 459 of file ObsoleteBoxCollection.cpp.
References ObsoleteBoxCollection< DIM >::GetGridIndices(), ObsoleteBoxCollection< DIM >::GetLinearIndex(), ObsoleteBoxCollection< DIM >::IsBoxInDomain(), ObsoleteBoxCollection< DIM >::IsIndexPenultimate(), ObsoleteBoxCollection< DIM >::mBoxes, ObsoleteBoxCollection< DIM >::mIsDomainPeriodic, ObsoleteBoxCollection< DIM >::mLocalBoxes, and NEVER_REACHED.
Referenced by ObsoleteBoxCollection< DIM >::SetupAllLocalBoxes(), and ObsoleteBoxCollection< DIM >::SetupLocalBoxesHalfOnly().
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, and ObsoleteBoxCollection< DIM >::SetupLocalBoxes().
|
private |
A vector of boxes to store rough node/element positions.
Definition at line 58 of file ObsoleteBoxCollection.hpp.
Referenced by ObsoleteBoxCollection< DIM >::CalculateNodePairs(), ObsoleteBoxCollection< DIM >::EmptyBoxes(), ObsoleteBoxCollection< DIM >::GetNumBoxes(), ObsoleteBoxCollection< DIM >::ObsoleteBoxCollection(), ObsoleteBoxCollection< DIM >::rGetBox(), and ObsoleteBoxCollection< DIM >::SetupLocalBoxes().
|
private |
The width of each box.
Definition at line 64 of file ObsoleteBoxCollection.hpp.
Referenced by ObsoleteBoxCollection< DIM >::CalculateContainingBox().
|
private |
The domain being partitioned.
Definition at line 61 of file ObsoleteBoxCollection.hpp.
Referenced by ObsoleteBoxCollection< DIM >::CalculateContainingBox(), and ObsoleteBoxCollection< DIM >::rGetDomainSize().
|
private |
Whether the domain is periodic
Definition at line 73 of file ObsoleteBoxCollection.hpp.
Referenced by ObsoleteBoxCollection< DIM >::GetLinearIndex(), ObsoleteBoxCollection< DIM >::IsBoxInDomain(), ObsoleteBoxCollection< DIM >::ObsoleteBoxCollection(), and ObsoleteBoxCollection< DIM >::SetupLocalBoxes().
|
private |
The boxes local (itself and nearest neighbour) to a given box.
Definition at line 70 of file ObsoleteBoxCollection.hpp.
Referenced by ObsoleteBoxCollection< DIM >::rGetLocalBoxes(), and ObsoleteBoxCollection< DIM >::SetupLocalBoxes().
|
private |
Number of boxes in each direction.
Definition at line 67 of file ObsoleteBoxCollection.hpp.
Referenced by ObsoleteBoxCollection< DIM >::GetGridIndices(), ObsoleteBoxCollection< DIM >::GetLinearIndex(), ObsoleteBoxCollection< DIM >::IsBoxInDomain(), ObsoleteBoxCollection< DIM >::IsIndexPenultimate(), and ObsoleteBoxCollection< DIM >::ObsoleteBoxCollection().
|
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 >::CalculateContainingBox(), and ObsoleteBoxCollection< DIM >::ObsoleteBoxCollection().