BoxCollection< DIM > Class Template Reference

#include <BoxCollection.hpp>

Collaboration diagram for BoxCollection< DIM >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BoxCollection (double boxWidth, c_vector< double, 2 *DIM > domainSize, bool isPeriodicInX=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< unsignedGetLocalBoxes (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 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
bool mIsPeriodicInX

Static Private Attributes

static const double msFudge = 5e-14

Friends

class TestBoxCollection

Detailed Description

template<unsigned DIM>
class BoxCollection< 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.

Definition at line 49 of file BoxCollection.hpp.


Constructor & Destructor Documentation

template<unsigned DIM>
BoxCollection< DIM >::BoxCollection ( double  boxWidth,
c_vector< double, 2 *DIM >  domainSize,
bool  isPeriodicInX = false 
) [inline]

Constructor

Parameters:
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 peiodic in the x direction

Definition at line 47 of file BoxCollection.cpp.

References BoxCollection< DIM >::mBoxes, BoxCollection< DIM >::mNumBoxesEachDirection, and BoxCollection< DIM >::msFudge.


Member Function Documentation

template<unsigned DIM>
unsigned BoxCollection< DIM >::CalculateContainingBox ( c_vector< double, DIM > &  rLocation  )  [inline]
Returns:
the index of the box a point is contained in
Parameters:
rLocation The point

Definition at line 147 of file BoxCollection.cpp.

References EXCEPTION, BoxCollection< DIM >::mBoxes, BoxCollection< DIM >::mBoxWidth, BoxCollection< DIM >::mDomainSize, BoxCollection< DIM >::mNumBoxesEachDirection, and BoxCollection< DIM >::msFudge.

template<unsigned DIM>
unsigned BoxCollection< DIM >::CalculateContainingBox ( Node< DIM > *  pNode  )  [inline]
Returns:
the index of the box this node is contained in.
Parameters:
pNode address of the node

Definition at line 138 of file BoxCollection.cpp.

References Node< SPACE_DIM >::rGetLocation().

Referenced by BoxCollection< DIM >::CalculateNodePairs(), and FineCoarseMeshPair< DIM >::SetUpBoxes().

template<unsigned DIM>
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 
) [inline]

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:
rNodes all the nodes to be consider
rNodePairs the return value, a set of pairs of nodes
rNodeNeighbours the other return value, the neighbours of each node.

Definition at line 709 of file BoxCollection.cpp.

References BoxCollection< DIM >::CalculateContainingBox(), BoxCollection< DIM >::GetLocalBoxes(), and BoxCollection< DIM >::mBoxes.

template<unsigned DIM>
void BoxCollection< DIM >::EmptyBoxes (  )  [inline]

Remove the list of nodes stored in each box.

Definition at line 129 of file BoxCollection.cpp.

References BoxCollection< DIM >::mBoxes.

template<unsigned DIM>
std::set< unsigned > BoxCollection< DIM >::GetLocalBoxes ( unsigned  boxIndex  )  [inline]
Returns:
the set of all the local boxes, i.e. itself and its nearest-neighbours.
Parameters:
boxIndex the index of the box

Definition at line 696 of file BoxCollection.cpp.

References BoxCollection< DIM >::mLocalBoxes.

Referenced by BoxCollection< DIM >::CalculateNodePairs(), and FineCoarseMeshPair< DIM >::CollectElementsInLocalBoxes().

template<unsigned DIM>
unsigned BoxCollection< DIM >::GetNumBoxes (  )  [inline]
Returns:
the number of boxes.

Definition at line 191 of file BoxCollection.cpp.

References BoxCollection< DIM >::mBoxes.

template<unsigned DIM>
Box< DIM > & BoxCollection< DIM >::rGetBox ( unsigned  boxIndex  )  [inline]
Returns:
a box.
Parameters:
boxIndex the index of the box to return

Definition at line 184 of file BoxCollection.cpp.

References BoxCollection< DIM >::mBoxes.

Referenced by FineCoarseMeshPair< DIM >::CollectElementsInContainingBox(), FineCoarseMeshPair< DIM >::CollectElementsInLocalBoxes(), and FineCoarseMeshPair< DIM >::SetUpBoxes().

template<unsigned DIM>
const c_vector< double, 2 *DIM > & BoxCollection< DIM >::rGetDomainSize (  )  const [inline]

Return the size of the domain partitioned by this collection

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

Definition at line 703 of file BoxCollection.cpp.

References BoxCollection< DIM >::mDomainSize.

template<unsigned DIM>
void BoxCollection< DIM >::SetupAllLocalBoxes (  )  [inline]

Set up the local boxes (ie itself and its nearest-neighbours) for each of the boxes.

Definition at line 376 of file BoxCollection.cpp.

References BoxCollection< DIM >::mBoxes, BoxCollection< DIM >::mIsPeriodicInX, BoxCollection< DIM >::mLocalBoxes, BoxCollection< DIM >::mNumBoxesEachDirection, and NEVER_REACHED.

Referenced by FineCoarseMeshPair< DIM >::SetUpBoxes().

template<unsigned DIM>
void BoxCollection< DIM >::SetupLocalBoxesHalfOnly (  )  [inline]

Set up the local boxes (ie itself and its nearest-neighbours) for each of the boxes. Just set 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 197 of file BoxCollection.cpp.

References BoxCollection< DIM >::mBoxes, BoxCollection< DIM >::mIsPeriodicInX, BoxCollection< DIM >::mLocalBoxes, BoxCollection< DIM >::mNumBoxesEachDirection, and NEVER_REACHED.


Member Data Documentation

template<unsigned DIM>
std::vector< Box<DIM> > BoxCollection< DIM >::mBoxes [private]
template<unsigned DIM>
double BoxCollection< DIM >::mBoxWidth [private]

The width of each box.

Definition at line 61 of file BoxCollection.hpp.

Referenced by BoxCollection< DIM >::CalculateContainingBox().

template<unsigned DIM>
c_vector<double, 2*DIM> BoxCollection< DIM >::mDomainSize [private]

The domain being partitioned.

Definition at line 58 of file BoxCollection.hpp.

Referenced by BoxCollection< DIM >::CalculateContainingBox(), and BoxCollection< DIM >::rGetDomainSize().

template<unsigned DIM>
bool BoxCollection< DIM >::mIsPeriodicInX [private]

Whether the domain is periodic in the X dimension Note this currently only works for DIM=2.

Definition at line 70 of file BoxCollection.hpp.

Referenced by BoxCollection< DIM >::SetupAllLocalBoxes(), and BoxCollection< DIM >::SetupLocalBoxesHalfOnly().

template<unsigned DIM>
std::vector< std::set<unsigned> > BoxCollection< DIM >::mLocalBoxes [private]

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

Definition at line 67 of file BoxCollection.hpp.

Referenced by BoxCollection< DIM >::GetLocalBoxes(), BoxCollection< DIM >::SetupAllLocalBoxes(), and BoxCollection< DIM >::SetupLocalBoxesHalfOnly().

template<unsigned DIM>
c_vector<unsigned, DIM> BoxCollection< DIM >::mNumBoxesEachDirection [private]
template<unsigned DIM>
const double BoxCollection< DIM >::msFudge = 5e-14 [inline, static, private]

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

Definition at line 73 of file BoxCollection.hpp.

Referenced by BoxCollection< DIM >::BoxCollection(), and BoxCollection< DIM >::CalculateContainingBox().


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

Generated by  doxygen 1.6.2