Chaste
Release::2017.1
|
#include <DistributedBoxCollection.hpp>
Public Member Functions | |
DistributedBoxCollection (double boxWidth, c_vector< double, 2 *DIM > domainSize, bool isPeriodicInX=false, int localRows=PETSC_DECIDE) | |
~DistributedBoxCollection () | |
void | EmptyBoxes () |
void | UpdateHaloBoxes () |
unsigned | GetNumLocalRows () const |
bool | IsBoxOwned (unsigned globalIndex) |
bool | IsInteriorBox (unsigned globalIndex) |
bool | IsHaloBox (unsigned globalIndex) |
unsigned | CalculateGlobalIndex (c_vector< unsigned, DIM > gridIndices) |
unsigned | CalculateContainingBox (Node< DIM > *pNode) |
unsigned | CalculateContainingBox (c_vector< double, DIM > &rLocation) |
c_vector< unsigned, DIM > | CalculateGridIndices (unsigned globalIndex) |
Box< DIM > & | rGetBox (unsigned boxIndex) |
Box< DIM > & | rGetHaloBox (unsigned boxIndex) |
unsigned | GetNumBoxes () |
unsigned | GetNumLocalBoxes () |
c_vector< double, 2 *DIM > | rGetDomainSize () const |
bool | GetAreLocalBoxesSet () const |
double | GetBoxWidth () const |
bool | GetIsPeriodicInX () const |
unsigned | GetNumRowsOfBoxes () const |
int | LoadBalance (std::vector< int > localDistribution) |
void | SetupLocalBoxesHalfOnly () |
void | SetupAllLocalBoxes () |
std::set< unsigned > & | rGetLocalBoxes (unsigned boxIndex) |
bool | IsOwned (Node< DIM > *pNode) |
bool | IsOwned (c_vector< double, DIM > &location) |
unsigned | GetProcessOwningNode (Node< DIM > *pNode) |
std::vector< unsigned > & | rGetHaloNodesRight () |
std::vector< unsigned > & | rGetHaloNodesLeft () |
void | SetCalculateNodeNeighbours (bool calculateNodeNeighbours) |
void | CalculateNodePairs (std::vector< Node< DIM > * > &rNodes, std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs) |
void | CalculateInteriorNodePairs (std::vector< Node< DIM > * > &rNodes, std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs) |
void | CalculateBoundaryNodePairs (std::vector< Node< DIM > * > &rNodes, std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs) |
void | AddPairsFromBox (unsigned boxIndex, std::vector< std::pair< Node< DIM > *, Node< DIM > * > > &rNodePairs) |
std::vector< int > | CalculateNumberOfNodesInEachStrip () |
Private Member Functions | |
void | SetupHaloBoxes () |
template<class Archive > | |
void | serialize (Archive &archive, const unsigned int version) |
Private Attributes | |
std::vector< Box< DIM > > | mBoxes |
std::vector< Box< DIM > > | mHaloBoxes |
std::vector< unsigned > | mHalosRight |
std::vector< unsigned > | mHalosLeft |
std::vector< unsigned > | mHaloNodesRight |
std::vector< unsigned > | mHaloNodesLeft |
std::map< unsigned, unsigned > | mHaloBoxesMapping |
c_vector< double, 2 *DIM > | mDomainSize |
double | mBoxWidth |
unsigned | mNumBoxes |
c_vector< unsigned, DIM > | mNumBoxesEachDirection |
unsigned | mNumBoxesInAFace |
std::vector< std::set< unsigned > > | mLocalBoxes |
unsigned | mMinBoxIndex |
unsigned | mMaxBoxIndex |
bool | mIsPeriodicInX |
bool | mAreLocalBoxesSet |
DistributedVectorFactory * | mpDistributedBoxStackFactory |
bool | mCalculateNodeNeighbours |
Static Private Attributes | |
static const double | msFudge = 5e-14 |
Friends | |
class | TestDistributedBoxCollection |
class | boost::serialization::access |
A collection of 'boxes' partitioning the domain with information on which nodes are located in which box.
Definition at line 54 of file DistributedBoxCollection.hpp.
DistributedBoxCollection< DIM >::DistributedBoxCollection | ( | double | boxWidth, |
c_vector< double, 2 *DIM > | domainSize, | ||
bool | isPeriodicInX = false , |
||
int | localRows = PETSC_DECIDE |
||
) |
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 |
localRows | the number of local rows in a parallel DistributedBoxCollection. |
Note that the domain size may be increased because each process should have at least one slice of boxes in the largest dimension. For example, if the box size is 1 and the domain is [(0,0,0), (3,3,3)] then, if there are more than 3 processes the domain will be swollen to [(0,0,0), (3,3,num_procs)]. The user is warned when this happens.
Definition at line 45 of file DistributedBoxCollection.cpp.
References DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLow(), DistributedBoxCollection< DIM >::GetNumLocalRows(), PetscTools::GetNumProcs(), DistributedBoxCollection< DIM >::mBoxes, DistributedBoxCollection< DIM >::mBoxWidth, DistributedBoxCollection< DIM >::mDomainSize, DistributedBoxCollection< DIM >::mMaxBoxIndex, DistributedBoxCollection< DIM >::mMinBoxIndex, DistributedBoxCollection< DIM >::mNumBoxes, DistributedBoxCollection< DIM >::mNumBoxesEachDirection, DistributedBoxCollection< DIM >::mNumBoxesInAFace, DistributedBoxCollection< DIM >::mpDistributedBoxStackFactory, DistributedBoxCollection< DIM >::msFudge, and DistributedBoxCollection< DIM >::SetupHaloBoxes().
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize().
DistributedBoxCollection< DIM >::~DistributedBoxCollection | ( | ) |
Destructor - frees memory allocated to distributed vector.
Definition at line 113 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mpDistributedBoxStackFactory.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize().
void DistributedBoxCollection< DIM >::AddPairsFromBox | ( | unsigned | boxIndex, |
std::vector< std::pair< Node< DIM > *, Node< DIM > * > > & | rNodePairs | ||
) |
A method pulled out of CalculateNodePairs methods that adds all pairs of nodes from neighbouring boxes of the box with index boxIndex.
boxIndex | the box to add neighbours to. |
rNodePairs | the return value, a set of pairs of nodes |
Definition at line 1251 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::IsBoxOwned(), DistributedBoxCollection< DIM >::mBoxes, DistributedBoxCollection< DIM >::mCalculateNodeNeighbours, DistributedBoxCollection< DIM >::mHaloBoxes, DistributedBoxCollection< DIM >::mHaloBoxesMapping, DistributedBoxCollection< DIM >::mMinBoxIndex, DistributedBoxCollection< DIM >::rGetBox(), DistributedBoxCollection< DIM >::rGetLocalBoxes(), and Box< DIM >::rGetNodesContained().
Referenced by DistributedBoxCollection< DIM >::CalculateBoundaryNodePairs(), DistributedBoxCollection< DIM >::CalculateInteriorNodePairs(), DistributedBoxCollection< DIM >::CalculateNodePairs(), and DistributedBoxCollection< SPACE_DIM >::serialize().
void DistributedBoxCollection< DIM >::CalculateBoundaryNodePairs | ( | std::vector< Node< DIM > * > & | rNodes, |
std::vector< std::pair< Node< DIM > *, Node< DIM > * > > & | rNodePairs | ||
) |
The same as CalculateNodePairs() only we only work on boxes that are ''not'' interior on this process. I.e. some of their local boxes are halo boxes.
rNodes | all the nodes to be consider |
rNodePairs | the return value, a set of pairs of nodes |
Definition at line 1223 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::AddPairsFromBox(), DistributedBoxCollection< DIM >::CalculateContainingBox(), DistributedBoxCollection< DIM >::IsBoxOwned(), DistributedBoxCollection< DIM >::IsInteriorBox(), DistributedBoxCollection< DIM >::mCalculateNodeNeighbours, DistributedBoxCollection< DIM >::mMaxBoxIndex, and DistributedBoxCollection< DIM >::mMinBoxIndex.
Referenced by NodesOnlyMesh< SPACE_DIM >::CalculateBoundaryNodePairs(), and DistributedBoxCollection< SPACE_DIM >::serialize().
unsigned DistributedBoxCollection< DIM >::CalculateContainingBox | ( | Node< DIM > * | pNode | ) |
pNode | address of the node |
Definition at line 259 of file DistributedBoxCollection.cpp.
References Node< SPACE_DIM >::rGetLocation().
Referenced by NodesOnlyMesh< SPACE_DIM >::AddHaloNodesToBoxes(), NodesOnlyMesh< SPACE_DIM >::AddNodesToBoxes(), DistributedBoxCollection< DIM >::CalculateBoundaryNodePairs(), DistributedBoxCollection< DIM >::CalculateInteriorNodePairs(), DistributedBoxCollection< DIM >::CalculateNodePairs(), DistributedBoxCollection< DIM >::GetProcessOwningNode(), DistributedBoxCollection< DIM >::IsOwned(), DistributedBoxCollection< SPACE_DIM >::serialize(), and FineCoarseMeshPair< DIM >::SetUpBoxes().
unsigned DistributedBoxCollection< DIM >::CalculateContainingBox | ( | c_vector< double, DIM > & | rLocation | ) |
rLocation | The point |
Definition at line 267 of file DistributedBoxCollection.cpp.
References EXCEPTION, DistributedBoxCollection< DIM >::mBoxWidth, DistributedBoxCollection< DIM >::mDomainSize, DistributedBoxCollection< DIM >::mNumBoxes, DistributedBoxCollection< DIM >::mNumBoxesEachDirection, and DistributedBoxCollection< DIM >::msFudge.
unsigned DistributedBoxCollection< DIM >::CalculateGlobalIndex | ( | c_vector< unsigned, DIM > | gridIndices | ) |
Given the (i,j,k) grid indices of a box in the collection, calculate its global index.
gridIndices | the (i,j,k) grid indices of the box |
Definition at line 225 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mNumBoxesEachDirection, and NEVER_REACHED.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize().
c_vector< unsigned, DIM > DistributedBoxCollection< DIM >::CalculateGridIndices | ( | unsigned | globalIndex | ) |
Calculate x,y,z indices of box given its 'global' index.
globalIndex | the global index of the box |
Definition at line 309 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mNumBoxesEachDirection, and NEVER_REACHED.
Referenced by DistributedBoxCollection< DIM >::CalculateNumberOfNodesInEachStrip(), DistributedBoxCollection< SPACE_DIM >::serialize(), and DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly().
void DistributedBoxCollection< DIM >::CalculateInteriorNodePairs | ( | std::vector< Node< DIM > * > & | rNodes, |
std::vector< std::pair< Node< DIM > *, Node< DIM > * > > & | rNodePairs | ||
) |
The same as CalculateNodePairs() only we only work on boxes that are interior on this process. I.e. none of their local boxes are halo boxes.
rNodes | all the nodes to be consider |
rNodePairs | the return value, a set of pairs of nodes |
Definition at line 1179 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::AddPairsFromBox(), DistributedBoxCollection< DIM >::CalculateContainingBox(), DistributedBoxCollection< DIM >::IsBoxOwned(), DistributedBoxCollection< DIM >::IsInteriorBox(), DistributedBoxCollection< DIM >::mCalculateNodeNeighbours, DistributedBoxCollection< DIM >::mMaxBoxIndex, and DistributedBoxCollection< DIM >::mMinBoxIndex.
Referenced by NodesOnlyMesh< SPACE_DIM >::CalculateInteriorNodePairs(), and DistributedBoxCollection< SPACE_DIM >::serialize().
void DistributedBoxCollection< 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 consider |
rNodePairs | the return value, a set of pairs of nodes |
Definition at line 1140 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::AddPairsFromBox(), DistributedBoxCollection< DIM >::CalculateContainingBox(), DistributedBoxCollection< DIM >::IsBoxOwned(), DistributedBoxCollection< DIM >::mCalculateNodeNeighbours, DistributedBoxCollection< DIM >::mMaxBoxIndex, and DistributedBoxCollection< DIM >::mMinBoxIndex.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize().
std::vector< int > DistributedBoxCollection< DIM >::CalculateNumberOfNodesInEachStrip | ( | ) |
Calculate how many cells lie in each strip / face of boxes, used in load balancing
Definition at line 1316 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::CalculateGridIndices(), DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLow(), DistributedBoxCollection< DIM >::mBoxes, DistributedBoxCollection< DIM >::mMaxBoxIndex, DistributedBoxCollection< DIM >::mMinBoxIndex, and DistributedBoxCollection< DIM >::mpDistributedBoxStackFactory.
Referenced by NodesOnlyMesh< SPACE_DIM >::LoadBalanceMesh(), and DistributedBoxCollection< SPACE_DIM >::serialize().
void DistributedBoxCollection< DIM >::EmptyBoxes | ( | ) |
Remove the list of nodes stored in each box.
Definition at line 119 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mBoxes, and DistributedBoxCollection< DIM >::mHaloBoxes.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize(), and NodesOnlyMesh< SPACE_DIM >::UpdateBoxCollection().
bool DistributedBoxCollection< DIM >::GetAreLocalBoxesSet | ( | ) | const |
Definition at line 387 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mAreLocalBoxesSet.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize().
double DistributedBoxCollection< DIM >::GetBoxWidth | ( | ) | const |
Definition at line 393 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mBoxWidth.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize().
bool DistributedBoxCollection< DIM >::GetIsPeriodicInX | ( | ) | const |
Definition at line 399 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mIsPeriodicInX.
Referenced by NodesOnlyMesh< SPACE_DIM >::EnlargeBoxCollection(), NodesOnlyMesh< SPACE_DIM >::IsANodeCloseToDomainBoundary(), and DistributedBoxCollection< SPACE_DIM >::serialize().
unsigned DistributedBoxCollection< DIM >::GetNumBoxes | ( | ) |
Definition at line 369 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mNumBoxes.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize().
unsigned DistributedBoxCollection< DIM >::GetNumLocalBoxes | ( | ) |
Definition at line 375 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mBoxes.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize().
unsigned DistributedBoxCollection< DIM >::GetNumLocalRows | ( | ) | const |
Definition at line 196 of file DistributedBoxCollection.cpp.
References DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLow(), and DistributedBoxCollection< DIM >::mpDistributedBoxStackFactory.
Referenced by DistributedBoxCollection< DIM >::DistributedBoxCollection(), NodesOnlyMesh< SPACE_DIM >::EnlargeBoxCollection(), and DistributedBoxCollection< SPACE_DIM >::serialize().
unsigned DistributedBoxCollection< DIM >::GetNumRowsOfBoxes | ( | ) | const |
Definition at line 405 of file DistributedBoxCollection.cpp.
References DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLow(), and DistributedBoxCollection< DIM >::mpDistributedBoxStackFactory.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize().
unsigned DistributedBoxCollection< DIM >::GetProcessOwningNode | ( | Node< DIM > * | pNode | ) |
Get the process that should own this node. Currently only returns +/-1 of this process so assumes nodes don't move too far. //\ todo this should be fixed.
pNode | the node to be tested |
Definition at line 1104 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::CalculateContainingBox(), PetscTools::GetMyRank(), DistributedBoxCollection< DIM >::mMaxBoxIndex, and DistributedBoxCollection< DIM >::mMinBoxIndex.
Referenced by NodesOnlyMesh< SPACE_DIM >::CalculateNodesOutsideLocalDomain(), and DistributedBoxCollection< SPACE_DIM >::serialize().
bool DistributedBoxCollection< DIM >::IsBoxOwned | ( | unsigned | globalIndex | ) |
globalIndex | the global index of the box. |
Definition at line 202 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mMaxBoxIndex, and DistributedBoxCollection< DIM >::mMinBoxIndex.
Referenced by DistributedBoxCollection< DIM >::AddPairsFromBox(), DistributedBoxCollection< DIM >::CalculateBoundaryNodePairs(), DistributedBoxCollection< DIM >::CalculateInteriorNodePairs(), DistributedBoxCollection< DIM >::CalculateNodePairs(), DistributedBoxCollection< DIM >::IsOwned(), DistributedBoxCollection< SPACE_DIM >::serialize(), and FineCoarseMeshPair< DIM >::SetUpBoxes().
bool DistributedBoxCollection< DIM >::IsHaloBox | ( | unsigned | globalIndex | ) |
globalIndex | the global index of the box. |
Definition at line 208 of file DistributedBoxCollection.cpp.
References PetscTools::IsParallel(), DistributedBoxCollection< DIM >::mMaxBoxIndex, DistributedBoxCollection< DIM >::mMinBoxIndex, and DistributedBoxCollection< DIM >::mNumBoxesInAFace.
Referenced by DistributedBoxCollection< DIM >::rGetHaloBox(), and DistributedBoxCollection< SPACE_DIM >::serialize().
bool DistributedBoxCollection< DIM >::IsInteriorBox | ( | unsigned | globalIndex | ) |
Get whether the box with global index globalIndex is interior on this process. A box is interior if it doesn't share any boundary (even of zero length) with a halo box.
globalIndex | the global index of the box to check. |
Definition at line 217 of file DistributedBoxCollection.cpp.
References PetscTools::IsSequential(), DistributedBoxCollection< DIM >::mMaxBoxIndex, DistributedBoxCollection< DIM >::mMinBoxIndex, and DistributedBoxCollection< DIM >::mNumBoxesInAFace.
Referenced by DistributedBoxCollection< DIM >::CalculateBoundaryNodePairs(), DistributedBoxCollection< DIM >::CalculateInteriorNodePairs(), and DistributedBoxCollection< SPACE_DIM >::serialize().
bool DistributedBoxCollection< DIM >::IsOwned | ( | Node< DIM > * | pNode | ) |
pNode | the node to test. |
Definition at line 1088 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::CalculateContainingBox(), and DistributedBoxCollection< DIM >::IsBoxOwned().
Referenced by NodesOnlyMesh< SPACE_DIM >::ConstructNodesWithoutMesh(), NodesOnlyMesh< SPACE_DIM >::IsOwned(), DistributedBoxCollection< SPACE_DIM >::serialize(), and FineCoarseMeshPair< DIM >::SetUpBoxes().
bool DistributedBoxCollection< DIM >::IsOwned | ( | c_vector< double, DIM > & | location | ) |
location | the location to test. |
Definition at line 1096 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::CalculateContainingBox(), and DistributedBoxCollection< DIM >::IsBoxOwned().
int DistributedBoxCollection< DIM >::LoadBalance | ( | std::vector< int > | localDistribution | ) |
A helper function to work out the optimal number of rows to be owned by this process, to balance the number of nodes.
localDistribution | a vector containing the number of nodes in each row/face of boxes in 2d/3d |
Shift information on distribution of nodes to the right, so processes can manage their left/bottom/back boundary (1d/2d/3d)
Calculate change in balance of loads by shifting the left/bottom boundary in either direction
Definition at line 411 of file DistributedBoxCollection.cpp.
References PetscTools::AmMaster(), PetscTools::AmTopMost(), and PetscTools::GetMyRank().
Referenced by NodesOnlyMesh< SPACE_DIM >::LoadBalanceMesh(), and DistributedBoxCollection< SPACE_DIM >::serialize().
Box< DIM > & DistributedBoxCollection< DIM >::rGetBox | ( | unsigned | boxIndex | ) |
If this box is out-of-bounds to the local process then it will attempt to return a halo box (and trip an assertion is the box is completely out of scope.
boxIndex | the index of the box to return |
Definition at line 346 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mBoxes, DistributedBoxCollection< DIM >::mMaxBoxIndex, DistributedBoxCollection< DIM >::mMinBoxIndex, and DistributedBoxCollection< DIM >::rGetHaloBox().
Referenced by NodesOnlyMesh< SPACE_DIM >::AddNodesToBoxes(), DistributedBoxCollection< DIM >::AddPairsFromBox(), FineCoarseMeshPair< DIM >::CollectElementsInContainingBox(), FineCoarseMeshPair< DIM >::CollectElementsInLocalBoxes(), DistributedBoxCollection< SPACE_DIM >::serialize(), FineCoarseMeshPair< DIM >::SetUpBoxes(), and DistributedBoxCollection< DIM >::UpdateHaloBoxes().
c_vector< double, 2 *DIM > DistributedBoxCollection< DIM >::rGetDomainSize | ( | ) | const |
Definition at line 381 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mDomainSize.
Referenced by NodesOnlyMesh< SPACE_DIM >::EnlargeBoxCollection(), NodesOnlyMesh< SPACE_DIM >::IsANodeCloseToDomainBoundary(), NodesOnlyMesh< SPACE_DIM >::LoadBalanceMesh(), and DistributedBoxCollection< SPACE_DIM >::serialize().
Box< DIM > & DistributedBoxCollection< DIM >::rGetHaloBox | ( | unsigned | boxIndex | ) |
Get a halo box.
boxIndex | the index of the box to return |
Definition at line 359 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::IsHaloBox(), DistributedBoxCollection< DIM >::mHaloBoxes, and DistributedBoxCollection< DIM >::mHaloBoxesMapping.
Referenced by NodesOnlyMesh< SPACE_DIM >::AddHaloNodesToBoxes(), DistributedBoxCollection< DIM >::rGetBox(), and DistributedBoxCollection< SPACE_DIM >::serialize().
std::vector< unsigned > & DistributedBoxCollection< DIM >::rGetHaloNodesLeft | ( | ) |
Definition at line 1128 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mHaloNodesLeft.
Referenced by NodesOnlyMesh< SPACE_DIM >::rGetHaloNodesToSendLeft(), and DistributedBoxCollection< SPACE_DIM >::serialize().
std::vector< unsigned > & DistributedBoxCollection< DIM >::rGetHaloNodesRight | ( | ) |
Definition at line 1122 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mHaloNodesRight.
Referenced by NodesOnlyMesh< SPACE_DIM >::rGetHaloNodesToSendRight(), and DistributedBoxCollection< SPACE_DIM >::serialize().
std::set< unsigned > & DistributedBoxCollection< 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 1080 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mLocalBoxes, DistributedBoxCollection< DIM >::mMaxBoxIndex, and DistributedBoxCollection< DIM >::mMinBoxIndex.
Referenced by DistributedBoxCollection< DIM >::AddPairsFromBox(), FineCoarseMeshPair< DIM >::CollectElementsInLocalBoxes(), and DistributedBoxCollection< SPACE_DIM >::serialize().
|
inlineprivate |
Serialize the box collection. It is possible to save and load on a different # of processes.
archive | the archive. |
version | the version number. |
Definition at line 137 of file DistributedBoxCollection.hpp.
void DistributedBoxCollection< DIM >::SetCalculateNodeNeighbours | ( | bool | calculateNodeNeighbours | ) |
Set whether to record node neighbour in the map rNodeNeighbours during CalculateNodePairs. Set to false for efficiency if not needed.
calculateNodeNeighbours | whether to store the neighbours. |
Definition at line 1134 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mCalculateNodeNeighbours.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize(), and NodesOnlyMesh< SPACE_DIM >::SetUpBoxCollection().
void DistributedBoxCollection< DIM >::SetupAllLocalBoxes | ( | ) |
Set up the local boxes (ie itself and its nearest-neighbours) for each of the boxes.
Definition at line 759 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mAreLocalBoxesSet, DistributedBoxCollection< DIM >::mIsPeriodicInX, DistributedBoxCollection< DIM >::mLocalBoxes, DistributedBoxCollection< DIM >::mMaxBoxIndex, DistributedBoxCollection< DIM >::mMinBoxIndex, DistributedBoxCollection< DIM >::mNumBoxesEachDirection, and NEVER_REACHED.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize(), and FineCoarseMeshPair< DIM >::SetUpBoxes().
|
private |
Setup the halo box structure on this process. (Private method since this is called as a helper method by the constructor.)
Sets up the containers mHaloBoxes, mHalosRight, mHalosLeft
Definition at line 132 of file DistributedBoxCollection.cpp.
References PetscTools::AmMaster(), PetscTools::AmTopMost(), DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLow(), DistributedBoxCollection< DIM >::mHaloBoxes, DistributedBoxCollection< DIM >::mHaloBoxesMapping, DistributedBoxCollection< DIM >::mHalosLeft, DistributedBoxCollection< DIM >::mHalosRight, DistributedBoxCollection< DIM >::mNumBoxesInAFace, and DistributedBoxCollection< DIM >::mpDistributedBoxStackFactory.
Referenced by DistributedBoxCollection< DIM >::DistributedBoxCollection().
void DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly | ( | ) |
Set up the local boxes (ie itself and its nearest-neighbours) for each of the boxes. This method just sets up half of the local boxes (for example, in 1D, local boxes for box0 = {1} local boxes for box1 = {2} not {0,2}, and so on. Similar to 2d, 3d.
Definition at line 499 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::CalculateGridIndices(), EXCEPTION, DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLow(), DistributedBoxCollection< DIM >::mAreLocalBoxesSet, DistributedBoxCollection< DIM >::mBoxes, DistributedBoxCollection< DIM >::mIsPeriodicInX, DistributedBoxCollection< DIM >::mLocalBoxes, DistributedBoxCollection< DIM >::mMaxBoxIndex, DistributedBoxCollection< DIM >::mMinBoxIndex, DistributedBoxCollection< DIM >::mNumBoxesEachDirection, DistributedBoxCollection< DIM >::mpDistributedBoxStackFactory, and NEVER_REACHED.
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize(), and NodesOnlyMesh< SPACE_DIM >::SetUpBoxCollection().
void DistributedBoxCollection< DIM >::UpdateHaloBoxes | ( | ) |
Update the halo boxes on this process, by transferring the nodes to be sent into the lists mHaloNodesRight / Left.
Definition at line 169 of file DistributedBoxCollection.cpp.
References DistributedBoxCollection< DIM >::mHaloNodesLeft, DistributedBoxCollection< DIM >::mHaloNodesRight, DistributedBoxCollection< DIM >::mHalosLeft, DistributedBoxCollection< DIM >::mHalosRight, and DistributedBoxCollection< DIM >::rGetBox().
Referenced by DistributedBoxCollection< SPACE_DIM >::serialize(), and NodesOnlyMesh< SPACE_DIM >::UpdateBoxCollection().
|
friend |
Needed for serialization
Definition at line 128 of file DistributedBoxCollection.hpp.
|
private |
Whether the local boxes have been setup or not.
Definition at line 108 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::GetAreLocalBoxesSet(), DistributedBoxCollection< DIM >::SetupAllLocalBoxes(), and DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly().
|
private |
A vector of boxes to store rough node/element positions.
Definition at line 60 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::AddPairsFromBox(), DistributedBoxCollection< DIM >::CalculateNumberOfNodesInEachStrip(), DistributedBoxCollection< DIM >::DistributedBoxCollection(), DistributedBoxCollection< DIM >::EmptyBoxes(), DistributedBoxCollection< DIM >::GetNumLocalBoxes(), DistributedBoxCollection< DIM >::rGetBox(), and DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly().
|
private |
The width of each box.
Definition at line 84 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::CalculateContainingBox(), DistributedBoxCollection< DIM >::DistributedBoxCollection(), and DistributedBoxCollection< DIM >::GetBoxWidth().
|
private |
A flag that can be set to not save rNodeNeighbours in CalculateNodePairs - for efficiency
Definition at line 117 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::AddPairsFromBox(), DistributedBoxCollection< DIM >::CalculateBoundaryNodePairs(), DistributedBoxCollection< DIM >::CalculateInteriorNodePairs(), DistributedBoxCollection< DIM >::CalculateNodePairs(), and DistributedBoxCollection< DIM >::SetCalculateNodeNeighbours().
|
private |
The domain being partitioned.
Definition at line 81 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::CalculateContainingBox(), DistributedBoxCollection< DIM >::DistributedBoxCollection(), and DistributedBoxCollection< DIM >::rGetDomainSize().
|
private |
A vector of boxes owned on other processes sharing a boundary with this process
Definition at line 63 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::AddPairsFromBox(), DistributedBoxCollection< DIM >::EmptyBoxes(), DistributedBoxCollection< DIM >::rGetHaloBox(), and DistributedBoxCollection< DIM >::SetupHaloBoxes().
|
private |
Map of global to local indices of halo boxes in mHaloBoxes.
Definition at line 78 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::AddPairsFromBox(), DistributedBoxCollection< DIM >::rGetHaloBox(), and DistributedBoxCollection< DIM >::SetupHaloBoxes().
|
private |
Set of Nodes that are halos of adjacent left process, but lie locally
Definition at line 75 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::rGetHaloNodesLeft(), and DistributedBoxCollection< DIM >::UpdateHaloBoxes().
|
private |
Set of Nodes that are halos of adjacent right process, but lie locally
Definition at line 72 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::rGetHaloNodesRight(), and DistributedBoxCollection< DIM >::UpdateHaloBoxes().
|
private |
A vector of the global indices of boxes, owned by this process, but on a boundary with left process.
Definition at line 69 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::SetupHaloBoxes(), and DistributedBoxCollection< DIM >::UpdateHaloBoxes().
|
private |
A vector of the global indices of boxes, owned by this process, but on a boundary with right process.
Definition at line 66 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::SetupHaloBoxes(), and DistributedBoxCollection< DIM >::UpdateHaloBoxes().
|
private |
Whether the domain is periodic in the X dimension Note this currently only works for DIM=2.
Definition at line 105 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::GetIsPeriodicInX(), DistributedBoxCollection< DIM >::SetupAllLocalBoxes(), and DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly().
|
private |
The boxes local (itself and nearest neighbour) to a given box.
Definition at line 96 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::rGetLocalBoxes(), DistributedBoxCollection< DIM >::SetupAllLocalBoxes(), and DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly().
|
private |
The largest index of the boxes owned by this process.
Definition at line 102 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::CalculateBoundaryNodePairs(), DistributedBoxCollection< DIM >::CalculateInteriorNodePairs(), DistributedBoxCollection< DIM >::CalculateNodePairs(), DistributedBoxCollection< DIM >::CalculateNumberOfNodesInEachStrip(), DistributedBoxCollection< DIM >::DistributedBoxCollection(), DistributedBoxCollection< DIM >::GetProcessOwningNode(), DistributedBoxCollection< DIM >::IsBoxOwned(), DistributedBoxCollection< DIM >::IsHaloBox(), DistributedBoxCollection< DIM >::IsInteriorBox(), DistributedBoxCollection< DIM >::rGetBox(), DistributedBoxCollection< DIM >::rGetLocalBoxes(), DistributedBoxCollection< DIM >::SetupAllLocalBoxes(), and DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly().
|
private |
The smallest index of the boxes owned by this process.
Definition at line 99 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::AddPairsFromBox(), DistributedBoxCollection< DIM >::CalculateBoundaryNodePairs(), DistributedBoxCollection< DIM >::CalculateInteriorNodePairs(), DistributedBoxCollection< DIM >::CalculateNodePairs(), DistributedBoxCollection< DIM >::CalculateNumberOfNodesInEachStrip(), DistributedBoxCollection< DIM >::DistributedBoxCollection(), DistributedBoxCollection< DIM >::GetProcessOwningNode(), DistributedBoxCollection< DIM >::IsBoxOwned(), DistributedBoxCollection< DIM >::IsHaloBox(), DistributedBoxCollection< DIM >::IsInteriorBox(), DistributedBoxCollection< DIM >::rGetBox(), DistributedBoxCollection< DIM >::rGetLocalBoxes(), DistributedBoxCollection< DIM >::SetupAllLocalBoxes(), and DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly().
|
private |
The total number of boxes across all processes
Definition at line 87 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::CalculateContainingBox(), DistributedBoxCollection< DIM >::DistributedBoxCollection(), and DistributedBoxCollection< DIM >::GetNumBoxes().
|
private |
Number of boxes in each direction.
Definition at line 90 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::CalculateContainingBox(), DistributedBoxCollection< DIM >::CalculateGlobalIndex(), DistributedBoxCollection< DIM >::CalculateGridIndices(), DistributedBoxCollection< DIM >::DistributedBoxCollection(), DistributedBoxCollection< DIM >::SetupAllLocalBoxes(), and DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly().
|
private |
Number of boxes in a face (1 in 1d, mNumBoxesEachDirection(0) in 2d, mNumBoxesEachDirection(0)*mNumBoxesEachDirection(1) in 3d
Definition at line 93 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::DistributedBoxCollection(), DistributedBoxCollection< DIM >::IsHaloBox(), DistributedBoxCollection< DIM >::IsInteriorBox(), and DistributedBoxCollection< DIM >::SetupHaloBoxes().
|
private |
A distributed vector factory that governs ownership of rows of boxes
Definition at line 114 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::CalculateNumberOfNodesInEachStrip(), DistributedBoxCollection< DIM >::DistributedBoxCollection(), DistributedBoxCollection< DIM >::GetNumLocalRows(), DistributedBoxCollection< DIM >::GetNumRowsOfBoxes(), DistributedBoxCollection< DIM >::SetupHaloBoxes(), DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly(), and DistributedBoxCollection< DIM >::~DistributedBoxCollection().
|
staticprivate |
A fudge (box swelling) factor to deal with 32-bit floating point issues.
Definition at line 111 of file DistributedBoxCollection.hpp.
Referenced by DistributedBoxCollection< DIM >::CalculateContainingBox(), and DistributedBoxCollection< DIM >::DistributedBoxCollection().