NodeBasedCellPopulation< DIM > Class Template Reference

#include <NodeBasedCellPopulation.hpp>

Inheritance diagram for NodeBasedCellPopulation< DIM >:

Inheritance graph
[legend]
Collaboration diagram for NodeBasedCellPopulation< DIM >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 NodeBasedCellPopulation (const std::vector< Node< DIM > * > nodes, std::vector< CellPtr > &rCells, const std::vector< unsigned > locationIndices=std::vector< unsigned >(), bool deleteNodes=true)
 NodeBasedCellPopulation (const std::vector< Node< DIM > * > nodes, double mechanicsCutOffLength, bool deleteNodes=true)
 NodeBasedCellPopulation (const AbstractMesh< DIM, DIM > &rMesh, std::vector< CellPtr > &rCells)
 ~NodeBasedCellPopulation ()
unsigned GetNumNodes ()
Node< DIM > * GetNode (unsigned index)
unsigned RemoveDeadCells ()
void Clear ()
void Update (bool hasHadBirthsOrDeaths=true)
std::vector< Node< DIM > * > & rGetNodes ()
const std::vector< Node< DIM > * > & rGetNodes () const
BoxCollection< DIM > * GetBoxCollection ()
std::set< std::pair< Node< DIM >
*, Node< DIM > * > > & 
rGetNodePairs ()
void OutputCellPopulationParameters (out_stream &rParamsFile)
double GetMechanicsCutOffLength ()
void SetMechanicsCutOffLength (double mechanicsCutOffLength)
double GetWidth (const unsigned &rDimension)

Protected Attributes

std::vector< Node< DIM > * > mNodes
std::vector< unsigned > mDeletedNodeIndices
bool mAddedNodes

Private Member Functions

template<class Archive>
void serialize (Archive &archive, const unsigned int version)
unsigned AddNode (Node< DIM > *pNewNode)
void SetNode (unsigned nodeIndex, ChastePoint< DIM > &rNewLocation)
void Validate ()
void SplitUpIntoBoxes (double cutOffLength, c_vector< double, 2 *DIM > domainSize)
void FindMaxAndMin ()

Private Attributes

BoxCollection< DIM > * mpBoxCollection
c_vector< double, DIM > mMinSpatialPositions
c_vector< double, DIM > mMaxSpatialPositions
std::set< std::pair< Node< DIM >
*, Node< DIM > * > > 
mNodePairs
bool mDeleteNodes
double mMechanicsCutOffLength

Friends

class TestNodeBasedCellPopulation
class TestBoxCollection
class boost::serialization::access


Detailed Description

template<unsigned DIM>
class NodeBasedCellPopulation< DIM >

A NodeBasedCellPopulation is a CellPopulation consisting of only nodes in space with associated cells. There are no elements and no mesh.

Definition at line 45 of file NodeBasedCellPopulation.hpp.


Constructor & Destructor Documentation

template<unsigned DIM>
NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation ( const std::vector< Node< DIM > * >  nodes,
std::vector< CellPtr > &  rCells,
const std::vector< unsigned >  locationIndices = std::vector<unsigned>(),
bool  deleteNodes = true 
) [inline]

Default constructor.

Note that the cell population will take responsibility for freeing the memory used by the nodes.

Parameters:
nodes a vector of Nodes
rCells a vector of cells
locationIndices an optional vector of location indices that correspond to real cells
deleteNodes whether to delete nodes in destructor

Definition at line 31 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::Validate().

template<unsigned DIM>
NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation ( const std::vector< Node< DIM > * >  nodes,
double  mechanicsCutOffLength,
bool  deleteNodes = true 
) [inline]

Constructor for use by the archiving - doesn't take in cells, since these are dealt with by the serialize method of our base class.

Note that the cell population will take responsibility for freeing the memory used by the nodes.

Parameters:
nodes a vector of Nodes
mechanicsCutOffLength the cut of length for mechanics uised to create the BoxedCollection to improve speed
deleteNodes whether to delete nodes in destructor

Definition at line 47 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation ( const AbstractMesh< DIM, DIM > &  rMesh,
std::vector< CellPtr > &  rCells 
) [inline]

Constructor which takes in a mesh and takes a copy of its nodes. The mesh is not changed and no references to any of its data are created.

This constructor is a helper constructor: it is generally easier for the user to create a mesh than a set of nodes.

Parameters:
rMesh any mesh.
rCells a vector of cells.

Definition at line 59 of file NodeBasedCellPopulation.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), NodeBasedCellPopulation< DIM >::mAddedNodes, NodeBasedCellPopulation< DIM >::mNodes, and NodeBasedCellPopulation< DIM >::Validate().

template<unsigned DIM>
NodeBasedCellPopulation< DIM >::~NodeBasedCellPopulation (  )  [inline]


Member Function Documentation

template<unsigned DIM>
template<class Archive>
void NodeBasedCellPopulation< DIM >::serialize ( Archive &  archive,
const unsigned int  version 
) [inline, private]

Serialize the object and its member variables.

Note that serialization of the nodes is handled by load/save_construct_data, so we don't actually have to do anything here except delegate to the base class.

Parameters:
archive the archive
version the current version of this class

Reimplemented from AbstractCentreBasedCellPopulation< DIM >.

Definition at line 98 of file NodeBasedCellPopulation.hpp.

References NodeBasedCellPopulation< DIM >::Validate().

template<unsigned DIM>
unsigned NodeBasedCellPopulation< DIM >::AddNode ( Node< DIM > *  pNewNode  )  [inline, private, virtual]

Overridden AddNode() method.

Add a new node to the cell population.

Parameters:
pNewNode pointer to the new node
Returns:
global index of new node in cell population

Implements AbstractCellPopulation< DIM >.

Definition at line 310 of file NodeBasedCellPopulation.cpp.

References Node< SPACE_DIM >::GetIndex(), NodeBasedCellPopulation< DIM >::mAddedNodes, NodeBasedCellPopulation< DIM >::mDeletedNodeIndices, NodeBasedCellPopulation< DIM >::mNodes, and Node< SPACE_DIM >::SetIndex().

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::SetNode ( unsigned  nodeIndex,
ChastePoint< DIM > &  rNewLocation 
) [inline, private, virtual]

Move the node with a given index to a new point in space.

Parameters:
nodeIndex the index of the node to be moved
rNewLocation the new target location of the node

Implements AbstractCellPopulation< DIM >.

Definition at line 201 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mNodes.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::Validate (  )  [inline, private, virtual]

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::SplitUpIntoBoxes ( double  cutOffLength,
c_vector< double, 2 *DIM >  domainSize 
) [inline, private]

Method for Initially Splitting up cell population into neighbouring boxes, to decrease runtime.

Parameters:
cutOffLength length of spring cut off between nodes
domainSize c_vector of size 2*dimension reads minX, maxX, minY, maxY, etc

Definition at line 144 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mNodes, and NodeBasedCellPopulation< DIM >::mpBoxCollection.

Referenced by NodeBasedCellPopulation< DIM >::Update().

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::FindMaxAndMin (  )  [inline, private]

template<unsigned DIM>
unsigned NodeBasedCellPopulation< DIM >::GetNumNodes (  )  [inline, virtual]

Returns:
the number of nodes in the cell population.

Implements AbstractCellPopulation< DIM >.

Definition at line 330 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mDeletedNodeIndices, and NodeBasedCellPopulation< DIM >::mNodes.

Referenced by NodeBasedCellPopulation< DIM >::Validate().

template<unsigned DIM>
Node< DIM > * NodeBasedCellPopulation< DIM >::GetNode ( unsigned  index  )  [inline, virtual]

Overridden GetNode() method.

Parameters:
index global index of the specified node
Returns:
a pointer to the node with a given index.

Implements AbstractCellPopulation< DIM >.

Definition at line 195 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mNodes.

Referenced by NodeBasedCellPopulation< DIM >::FindMaxAndMin().

template<unsigned DIM>
unsigned NodeBasedCellPopulation< DIM >::RemoveDeadCells (  )  [inline, virtual]

Remove all cells labelled as dead.

Note that after calling this method the cell population will be in an inconsistent state until the equivalent of a 'remesh' is performed! So don't try iterating over cells or anything like that.

Returns:
number of cells removed

Implements AbstractCellPopulation< DIM >.

Definition at line 288 of file NodeBasedCellPopulation.cpp.

References AbstractCentreBasedCellPopulation< DIM >::GetNodeCorrespondingToCell(), AbstractCellPopulation< DIM >::mCellLocationMap, AbstractCellPopulation< DIM >::mCells, and NodeBasedCellPopulation< DIM >::mDeletedNodeIndices.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::Clear (  )  [inline]

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::Update ( bool  hasHadBirthsOrDeaths = true  )  [inline, virtual]

template<unsigned DIM>
std::vector< Node< DIM > * > & NodeBasedCellPopulation< DIM >::rGetNodes (  )  [inline]

Method for getting all nodes in the cell population.

Returns:
vector of Nodes

Definition at line 132 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mNodes.

template<unsigned DIM>
const std::vector< Node< DIM > * > & NodeBasedCellPopulation< DIM >::rGetNodes (  )  const [inline]

Method for getting all nodes in the cell population (for archiving).

Returns:
vector of Nodes

Definition at line 138 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mNodes.

template<unsigned DIM>
BoxCollection< DIM > * NodeBasedCellPopulation< DIM >::GetBoxCollection (  )  [inline]

Returns:
pointer to a node box collection.

Definition at line 336 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mpBoxCollection.

template<unsigned DIM>
std::set< std::pair< Node< DIM > *, Node< DIM > * > > & NodeBasedCellPopulation< DIM >::rGetNodePairs (  )  [inline]

Returns:
Node pairs for force calculation.

Definition at line 342 of file NodeBasedCellPopulation.cpp.

References EXCEPTION, and NodeBasedCellPopulation< DIM >::mNodePairs.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::OutputCellPopulationParameters ( out_stream &  rParamsFile  )  [inline, virtual]

Outputs CellPopulation parameters to file

As this method is pure virtual, it must be overridden in subclasses.

Parameters:
rParamsFile the file stream to which the parameters are output

Reimplemented from AbstractCentreBasedCellPopulation< DIM >.

Definition at line 352 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength, and AbstractCentreBasedCellPopulation< DIM >::OutputCellPopulationParameters().

template<unsigned DIM>
double NodeBasedCellPopulation< DIM >::GetMechanicsCutOffLength (  )  [inline]

Returns:
mMechanicsCutOffLength

Definition at line 371 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::SetMechanicsCutOffLength ( double  mechanicsCutOffLength  )  [inline]

Set mMechanicsCutOffLength.

Parameters:
mechanicsCutOffLength the new value of mMechanicsCutOffLength

Definition at line 364 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength.

template<unsigned DIM>
double NodeBasedCellPopulation< DIM >::GetWidth ( const unsigned &  rDimension  )  [inline, virtual]

Overridden GetWidth() method.

Calculate the 'width' of any dimension of the cell population by computing the maximum distance between any nodes in this dimension.

Parameters:
rDimension a dimension (0,1 or 2)
Returns:
The maximum distance between any nodes in this dimension.

Implements AbstractCellPopulation< DIM >.

Definition at line 377 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::FindMaxAndMin(), NodeBasedCellPopulation< DIM >::mMaxSpatialPositions, and NodeBasedCellPopulation< DIM >::mMinSpatialPositions.


Friends And Related Function Documentation

template<unsigned DIM>
friend class boost::serialization::access [friend]

Needed for serialization.

Reimplemented from AbstractCentreBasedCellPopulation< DIM >.

Definition at line 87 of file NodeBasedCellPopulation.hpp.


Member Data Documentation

template<unsigned DIM>
std::vector<Node<DIM>* > NodeBasedCellPopulation< DIM >::mNodes [protected]

template<unsigned DIM>
std::vector<unsigned> NodeBasedCellPopulation< DIM >::mDeletedNodeIndices [protected]

template<unsigned DIM>
bool NodeBasedCellPopulation< DIM >::mAddedNodes [protected]

template<unsigned DIM>
BoxCollection<DIM>* NodeBasedCellPopulation< DIM >::mpBoxCollection [private]

template<unsigned DIM>
c_vector<double, DIM> NodeBasedCellPopulation< DIM >::mMinSpatialPositions [private]

Vector of minimal spatial positions in each dimension

Definition at line 67 of file NodeBasedCellPopulation.hpp.

Referenced by NodeBasedCellPopulation< DIM >::FindMaxAndMin(), NodeBasedCellPopulation< DIM >::GetWidth(), and NodeBasedCellPopulation< DIM >::Update().

template<unsigned DIM>
c_vector<double, DIM> NodeBasedCellPopulation< DIM >::mMaxSpatialPositions [private]

Vector of maximal spatial positions in each dimension

Definition at line 70 of file NodeBasedCellPopulation.hpp.

Referenced by NodeBasedCellPopulation< DIM >::FindMaxAndMin(), NodeBasedCellPopulation< DIM >::GetWidth(), and NodeBasedCellPopulation< DIM >::Update().

template<unsigned DIM>
std::set< std::pair<Node<DIM>*, Node<DIM>* > > NodeBasedCellPopulation< DIM >::mNodePairs [private]

template<unsigned DIM>
bool NodeBasedCellPopulation< DIM >::mDeleteNodes [private]

Whether to delete the nodes (taken in one of the constructors, defaults to true)

Definition at line 78 of file NodeBasedCellPopulation.hpp.

Referenced by NodeBasedCellPopulation< DIM >::~NodeBasedCellPopulation().

template<unsigned DIM>
double NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength [private]


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

Generated on Mon Nov 1 12:37:08 2010 for Chaste by  doxygen 1.5.5