Chaste
Release::3.4
|
#include <BoxCollection.hpp>
Public Member Functions | |
BoxCollection (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 > | GetLocalBoxes (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, std::map< unsigned, std::set< unsigned > > &rNodeNeighbours) |
Private Member Functions | |
unsigned | GetLinearIndex (c_vector< int, DIM > gridIndices) |
c_vector< int, DIM > | GetGridIndices (unsigned linearIndex) |
bool | IsBoxInDomain (c_vector< int, DIM > gridIndices) |
c_vector< bool, DIM > | IsIndexPenultimate (c_vector< int, DIM > gridIndices) |
void | SetupLocalBoxes (std::vector< c_vector< int, DIM > > neighbours) |
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 | TestBoxCollection |
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.
Definition at line 48 of file BoxCollection.hpp.
BoxCollection< DIM >::BoxCollection | ( | 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 49 of file BoxCollection.cpp.
References BoxCollection< DIM >::mBoxes, BoxCollection< DIM >::mIsDomainPeriodic, BoxCollection< DIM >::mNumBoxesEachDirection, BoxCollection< DIM >::msFudge, and NEVER_REACHED.
unsigned BoxCollection< DIM >::CalculateContainingBox | ( | Node< DIM > * | pNode | ) |
pNode | address of the node |
Definition at line 162 of file BoxCollection.cpp.
References Node< SPACE_DIM >::rGetLocation().
Referenced by FineCoarseMeshPair< DIM >::SetUpBoxes().
unsigned BoxCollection< DIM >::CalculateContainingBox | ( | c_vector< double, DIM > & | rLocation | ) |
rLocation | The point |
Definition at line 170 of file BoxCollection.cpp.
References EXCEPTION.
void BoxCollection< DIM >::CalculateNodePairs | ( | std::vector< Node< DIM > * > & | rNodes, |
std::vector< std::pair< Node< DIM > *, Node< DIM > * > > & | rNodePairs, | ||
std::map< unsigned, std::set< unsigned > > & | rNodeNeighbours | ||
) |
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 |
rNodeNeighbours | the other return value, the neighbours of each node. |
Definition at line 681 of file BoxCollection.cpp.
References Node< SPACE_DIM >::GetIndex().
void BoxCollection< DIM >::EmptyBoxes | ( | ) |
Remove the list of nodes stored in each box.
Definition at line 153 of file BoxCollection.cpp.
|
private |
linearIndex | the linear index in row-major form |
Definition at line 261 of file BoxCollection.cpp.
References NEVER_REACHED.
|
private |
gridIndices | the grid indices (i), (i,j), or (i,j,k) depending on DIM |
Definition at line 201 of file BoxCollection.cpp.
References NEVER_REACHED.
std::set< unsigned > BoxCollection< DIM >::GetLocalBoxes | ( | unsigned | boxIndex | ) |
boxIndex | the index of the box |
Definition at line 668 of file BoxCollection.cpp.
Referenced by FineCoarseMeshPair< DIM >::CollectElementsInLocalBoxes().
unsigned BoxCollection< DIM >::GetNumBoxes | ( | ) |
Definition at line 195 of file BoxCollection.cpp.
|
private |
gridIndices | the coordinates (i), (i,j), or (i,j,k) depending on DIM |
Definition at line 298 of file BoxCollection.cpp.
|
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 326 of file BoxCollection.cpp.
Box< DIM > & BoxCollection< DIM >::rGetBox | ( | unsigned | boxIndex | ) |
boxIndex | the index of the box to return |
Definition at line 188 of file BoxCollection.cpp.
Referenced by FineCoarseMeshPair< DIM >::CollectElementsInContainingBox(), FineCoarseMeshPair< DIM >::CollectElementsInLocalBoxes(), and FineCoarseMeshPair< DIM >::SetUpBoxes().
const c_vector< double, 2 *DIM > & BoxCollection< DIM >::rGetDomainSize | ( | ) | const |
Return the size of the domain partitioned by this collection
Definition at line 675 of file BoxCollection.cpp.
void BoxCollection< DIM >::SetupAllLocalBoxes | ( | ) |
Generates a list of vectors representing all the possible neighbour locations in DIM-dimensions, and calls SetupLocalBoxes().
Definition at line 434 of file BoxCollection.cpp.
References NEVER_REACHED.
Referenced by FineCoarseMeshPair< DIM >::SetUpBoxes().
|
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.
neighbours | a vector of neighbours |
Definition at line 509 of file BoxCollection.cpp.
References NEVER_REACHED.
void BoxCollection< 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 339 of file BoxCollection.cpp.
References NEVER_REACHED.
|
private |
A vector of boxes to store rough node/element positions.
Definition at line 54 of file BoxCollection.hpp.
Referenced by BoxCollection< DIM >::BoxCollection().
|
private |
The width of each box.
Definition at line 60 of file BoxCollection.hpp.
|
private |
The domain being partitioned.
Definition at line 57 of file BoxCollection.hpp.
|
private |
Whether the domain is periodic
Definition at line 69 of file BoxCollection.hpp.
Referenced by BoxCollection< DIM >::BoxCollection().
|
private |
The boxes local (itself and nearest neighbour) to a given box.
Definition at line 66 of file BoxCollection.hpp.
|
private |
Number of boxes in each direction.
Definition at line 63 of file BoxCollection.hpp.
Referenced by BoxCollection< DIM >::BoxCollection().
|
staticprivate |
A fudge (box swelling) factor to deal with 32-bit floating point issues.
Definition at line 72 of file BoxCollection.hpp.
Referenced by BoxCollection< DIM >::BoxCollection().