CaBasedCellPopulation< DIM > Class Template Reference

#include <CaBasedCellPopulation.hpp>

Inherits AbstractOnLatticeCellPopulation< DIM >.

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

List of all members.

Public Member Functions

 CaBasedCellPopulation (PottsMesh< DIM > &rMesh, std::vector< CellPtr > &rCells, const std::vector< unsigned > locationIndices, unsigned latticeCarryingCapacity=1u, bool deleteMesh=false, bool validate=false)
 CaBasedCellPopulation (PottsMesh< DIM > &rMesh)
virtual ~CaBasedCellPopulation ()
std::vector< unsigned > & rGetAvailableSpaces ()
virtual bool IsSiteAvailable (unsigned index, CellPtr pCell)
PottsMesh< DIM > & rGetMesh ()
const PottsMesh< DIM > & rGetMesh () const
Node< DIM > * GetNode (unsigned index)
unsigned GetNumNodes ()
std::set< unsignedGetNeighbouringLocationIndices (CellPtr pCell)
c_vector< double, DIM > GetLocationOfCellCentre (CellPtr pCell)
void AddCellUsingLocationIndex (unsigned index, CellPtr pCell)
void RemoveCellUsingLocationIndex (unsigned index, CellPtr pCell)
Node< DIM > * GetNodeCorrespondingToCell (CellPtr pCell)
CellPtr AddCell (CellPtr pNewCell, const c_vector< double, DIM > &rCellDivisionVector, CellPtr pParentCell=CellPtr())
virtual double EvaluateDivisionPropensity (unsigned currentNodeIndex, unsigned targetNodeIndex, CellPtr pCell)
unsigned RemoveDeadCells ()
virtual void OpenWritersFiles (OutputFileHandler &rOutputFileHandler)
void UpdateCellLocations (double dt)
bool IsCellAssociatedWithADeletedLocation (CellPtr pCell)
void Update (bool hasHadBirthsOrDeaths=true)
virtual void AcceptPopulationWriter (boost::shared_ptr< AbstractCellPopulationWriter< DIM, DIM > > pPopulationWriter)
virtual void AcceptPopulationCountWriter (boost::shared_ptr< AbstractCellPopulationCountWriter< DIM, DIM > > pPopulationCountWriter)
virtual void AcceptCellWriter (boost::shared_ptr< AbstractCellWriter< DIM, DIM > > pCellWriter, CellPtr pCell)
double GetVolumeOfCell (CellPtr pCell)
double GetWidth (const unsigned &rDimension)
void AddUpdateRule (boost::shared_ptr< AbstractCaUpdateRule< DIM > > pUpdateRule)
void RemoveAllUpdateRules ()
const std::vector
< boost::shared_ptr
< AbstractCaUpdateRule< DIM > > > & 
rGetUpdateRuleCollection () const
void OutputCellPopulationParameters (out_stream &rParamsFile)
bool IsRoomToDivide (CellPtr pCell)

Private Member Functions

void SetEmptySites (const std::set< unsigned > &rEmptySiteIndices)
template<class Archive >
void serialize (Archive &archive, const unsigned int version)
void Validate ()
virtual void WriteVtkResultsToFile (const std::string &rDirectory)

Private Attributes

unsigned mLatticeCarryingCapacity
std::vector< boost::shared_ptr
< AbstractCaUpdateRule< DIM > > > 
mUpdateRuleCollection
std::vector< unsignedmAvailableSpaces

Friends

class TestCaBasedCellPopulation
class boost::serialization::access

Detailed Description

template<unsigned DIM>
class CaBasedCellPopulation< DIM >

A facade class encapsulating a cell population under the Cellular Automaton (CA) framework.

Contains a group of cells and maintains the associations between CellPtrs and nodes in a specialised PottsMesh class.

When used here the PottsMesh has no elements as Cells are associated with nodes. The PottsMesh is used to define node connectivity.

Multiple cells can be associated at a single node.

Definition at line 65 of file CaBasedCellPopulation.hpp.


Constructor & Destructor Documentation

template<unsigned DIM>
CaBasedCellPopulation< DIM >::CaBasedCellPopulation ( PottsMesh< DIM > &  rMesh,
std::vector< CellPtr > &  rCells,
const std::vector< unsigned locationIndices,
unsigned  latticeCarryingCapacity = 1u,
bool  deleteMesh = false,
bool  validate = false 
) [inline]

Create a new cell population facade from a mesh, a vector of location indices and a collection of cells.

There must be precisely one CellPtr for each entry of the locationIndices vector.

Parameters:
rMesh reference to a PottsMesh
rCells reference to a vector of CellPtrs
locationIndices a vector of location indices that correspond to real cells
latticeCarryingCapacity an optional parameter to allow more than one cell per site
deleteMesh set to true if you want the cell population to free the mesh memory on destruction (defaults to false)
validate whether to validate the cell population when it is created (defaults to false as not used in CA simulations)

Definition at line 66 of file CaBasedCellPopulation.cpp.

References EXCEPTION, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), CaBasedCellPopulation< DIM >::GetNumNodes(), CaBasedCellPopulation< DIM >::IsSiteAvailable(), CaBasedCellPopulation< DIM >::mAvailableSpaces, AbstractCellPopulation< DIM >::mCells, and AbstractCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
CaBasedCellPopulation< DIM >::CaBasedCellPopulation ( PottsMesh< DIM > &  rMesh  )  [inline]

Constructor for use by the de-serializer.

Parameters:
rMesh a vertex mesh.

Definition at line 106 of file CaBasedCellPopulation.cpp.

template<unsigned DIM>
CaBasedCellPopulation< DIM >::~CaBasedCellPopulation (  )  [inline, virtual]

Destructor, which frees any memory allocated by the constructor.

Definition at line 112 of file CaBasedCellPopulation.cpp.

References AbstractOnLatticeCellPopulation< DIM >::mDeleteMesh, and AbstractCellPopulation< DIM >::mrMesh.


Member Function Documentation

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::AcceptCellWriter ( boost::shared_ptr< AbstractCellWriter< DIM, DIM > >  pCellWriter,
CellPtr  pCell 
) [inline, virtual]

A virtual method to accept a cell writer so it can write data from this object to file.

Parameters:
pCellWriter the population writer.
pCell the cell whose data is being written.

Definition at line 459 of file CaBasedCellPopulation.cpp.

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::AcceptPopulationCountWriter ( boost::shared_ptr< AbstractCellPopulationCountWriter< DIM, DIM > >  pPopulationCountWriter  )  [inline, virtual]

A virtual method to accept a cell population count writer so it can write data from this object to file.

Parameters:
pPopulationCountWriter the population count writer.

Definition at line 453 of file CaBasedCellPopulation.cpp.

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::AcceptPopulationWriter ( boost::shared_ptr< AbstractCellPopulationWriter< DIM, DIM > >  pPopulationWriter  )  [inline, virtual]

A virtual method to accept a cell population writer so it can write data from this object to file.

Parameters:
pPopulationWriter the population writer.

Definition at line 447 of file CaBasedCellPopulation.cpp.

template<unsigned DIM>
CellPtr CaBasedCellPopulation< DIM >::AddCell ( CellPtr  pNewCell,
const c_vector< double, DIM > &  rCellDivisionVector,
CellPtr  pParentCell = CellPtr() 
) [inline]

Overridden AddCell() method.

Add a new cell to the cell population.

Parameters:
pNewCell the cell to add
rCellDivisionVector this parameter is not yet used in this class (see #1737)
pParentCell pointer to a parent cell (if required)
Returns:
address of cell as it appears in the cell list (internal of this method uses a copy constructor along the way)

Definition at line 238 of file CaBasedCellPopulation.cpp.

References CaBasedCellPopulation< DIM >::AddCellUsingLocationIndex(), CaBasedCellPopulation< DIM >::EvaluateDivisionPropensity(), AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), RandomNumberGenerator::Instance(), CaBasedCellPopulation< DIM >::IsSiteAvailable(), AbstractCellPopulation< DIM >::mCells, AbstractCellPopulation< DIM >::mrMesh, RandomNumberGenerator::ranf(), and UNSIGNED_UNSET.

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::AddCellUsingLocationIndex ( unsigned  index,
CellPtr  pCell 
) [inline, virtual]

Overridden AddCellUsingLocationIndex method to add a cell to a given location index. Also updates mAvailableSpaces

Parameters:
index the location index
pCell the cell.

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 190 of file CaBasedCellPopulation.cpp.

References EXCEPTION, CaBasedCellPopulation< DIM >::IsSiteAvailable(), and CaBasedCellPopulation< DIM >::mAvailableSpaces.

Referenced by CaBasedCellPopulation< DIM >::AddCell().

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::AddUpdateRule ( boost::shared_ptr< AbstractCaUpdateRule< DIM > >  pUpdateRule  )  [inline]

Add an update rule to be used in this simulation (use this to set up how cells move).

Parameters:
pUpdateRule pointer to an update rule

Definition at line 493 of file CaBasedCellPopulation.cpp.

References CaBasedCellPopulation< DIM >::mUpdateRuleCollection.

template<unsigned DIM>
double CaBasedCellPopulation< DIM >::EvaluateDivisionPropensity ( unsigned  currentNodeIndex,
unsigned  targetNodeIndex,
CellPtr  pCell 
) [inline, virtual]

Calculate the propensity of a dividing into a given site. Overridden in child classes to define other division methods. eg directed division.

Parameters:
currentNodeIndex The index of the current node/lattice site
targetNodeIndex The index of the target node/lattice site
pCell a pointer to the cell (needed if more than one cell per lattice site
Returns:
The probability of the cell dividing from the current node to the target node

Definition at line 312 of file CaBasedCellPopulation.cpp.

Referenced by CaBasedCellPopulation< DIM >::AddCell().

template<unsigned DIM>
c_vector< double, DIM > CaBasedCellPopulation< DIM >::GetLocationOfCellCentre ( CellPtr  pCell  )  [inline, virtual]

Overridden GetLocationOfCellCentre() method. Find where a given cell is in space.

Parameters:
pCell the cell
Returns:
the location of the node corresponding to this cell.

Implements AbstractCellPopulation< DIM >.

Definition at line 178 of file CaBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), and AbstractCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
std::set< unsigned > CaBasedCellPopulation< DIM >::GetNeighbouringLocationIndices ( CellPtr  pCell  )  [inline, virtual]

Overridden GetNeighbouringLocationIndices() method.

Given a cell, returns the set of location indices corresponding to neighbouring cells.

Note: In keeping with other parts of the code in this class, we assume a Moore neighbourhood. Also, at present this method assumes a unit carrying capacity at each lattice site.

Parameters:
pCell a cell
Returns:
the set of neighbouring location indices.

Implements AbstractCellPopulation< DIM >.

Definition at line 158 of file CaBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), CaBasedCellPopulation< DIM >::IsSiteAvailable(), and AbstractCellPopulation< DIM >::mrMesh.

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

Overridden GetNode() method.

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

Implements AbstractCellPopulation< DIM >.

Definition at line 146 of file CaBasedCellPopulation.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), and AbstractCellPopulation< DIM >::mrMesh.

Referenced by DiffusionCaUpdateRule< DIM >::EvaluateProbability().

template<unsigned DIM>
Node< DIM > * CaBasedCellPopulation< DIM >::GetNodeCorrespondingToCell ( CellPtr  pCell  )  [inline]

Get a pointer to the node corresponding to a given CellPtr.

Parameters:
pCell the cell
Returns:
pointer to the node.

Definition at line 184 of file CaBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), and AbstractCellPopulation< DIM >::mrMesh.

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

Overridden GetNumNodes() method.

Returns:
the number of nodes in the cell population.

Implements AbstractCellPopulation< DIM >.

Definition at line 152 of file CaBasedCellPopulation.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), and AbstractCellPopulation< DIM >::mrMesh.

Referenced by CaBasedCellPopulation< DIM >::CaBasedCellPopulation().

template<unsigned DIM>
double CaBasedCellPopulation< DIM >::GetVolumeOfCell ( CellPtr  pCell  )  [inline, virtual]

Overridden GetVolumeOfCell() method.

Parameters:
pCell boost shared pointer to a cell
Returns:
volume via associated mesh element

Implements AbstractCellPopulation< DIM >.

Definition at line 479 of file CaBasedCellPopulation.cpp.

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

Overridden GetWidth() method.

Calculate the 'width' of any dimension of the cell population by calling GetWidth() on the mesh.

Note this returns the size of the underlying mesh not the population of cells so here it will be the same for all time.

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

Implements AbstractCellPopulation< DIM >.

Definition at line 486 of file CaBasedCellPopulation.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetWidth(), and AbstractCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
bool CaBasedCellPopulation< DIM >::IsCellAssociatedWithADeletedLocation ( CellPtr  pCell  )  [inline, virtual]

Overridden IsCellAssociatedWithADeletedLocation() method.

Parameters:
pCell the cell
Returns:
whether a given cell is associated with a deleted node.

Implements AbstractCellPopulation< DIM >.

Definition at line 436 of file CaBasedCellPopulation.cpp.

template<unsigned DIM>
bool CaBasedCellPopulation< DIM >::IsRoomToDivide ( CellPtr  pCell  )  [inline, virtual]

Overridden IsRoomToDivide() method. Returns whether there are any available neighbouring sites to the one occupied by a given cell.

Parameters:
pCell pointer to a cell
Returns:
whether the cell has any free neighbouring sites

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 212 of file CaBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), CaBasedCellPopulation< DIM >::IsSiteAvailable(), and AbstractCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
bool CaBasedCellPopulation< DIM >::IsSiteAvailable ( unsigned  index,
CellPtr  pCell 
) [inline, virtual]

Find if a given node has space available. Overridden in subclasses to implement different division regimes.

Todo:
Which subclasses? Why is the second input argument needed?
Parameters:
index The global index of a specified node.
pCell The cell wanting to divide into the lattice site (defaults to NULL).
Returns:
whether the node is an empty site

Todo:
this is where to deal with carrying capacity

Definition at line 127 of file CaBasedCellPopulation.cpp.

References CaBasedCellPopulation< DIM >::mAvailableSpaces.

Referenced by CaBasedCellPopulation< DIM >::AddCell(), CaBasedCellPopulation< DIM >::AddCellUsingLocationIndex(), CaBasedCellPopulation< DIM >::CaBasedCellPopulation(), CaBasedCellPopulation< DIM >::GetNeighbouringLocationIndices(), CaBasedCellPopulation< DIM >::IsRoomToDivide(), and CaBasedCellPopulation< DIM >::UpdateCellLocations().

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::OpenWritersFiles ( OutputFileHandler rOutputFileHandler  )  [inline, virtual]

Overridden OpenWritersFiles() method.

Open all files in mCellPopulationWriters and mCellWriters for writing (not appending).

Parameters:
rOutputFileHandler handler for the directory in which to open this file.

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 465 of file CaBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::mOutputResultsForChasteVisualizer.

template<unsigned DIM>
void CaBasedCellPopulation< 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 AbstractOnLatticeCellPopulation< DIM >.

Definition at line 511 of file CaBasedCellPopulation.cpp.

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::RemoveAllUpdateRules (  )  [inline]

Method to remove all the update rules

Definition at line 499 of file CaBasedCellPopulation.cpp.

References CaBasedCellPopulation< DIM >::mUpdateRuleCollection.

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::RemoveCellUsingLocationIndex ( unsigned  index,
CellPtr  pCell 
) [inline, virtual]

Overridden AddCellUsingLocationIndex method to remove a cell from a given location index. Also updates mAvailableSpaces

Parameters:
index the location index
pCell the cell.

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 202 of file CaBasedCellPopulation.cpp.

References CaBasedCellPopulation< DIM >::mAvailableSpaces, and CaBasedCellPopulation< DIM >::mLatticeCarryingCapacity.

Referenced by CaBasedCellPopulation< DIM >::RemoveDeadCells().

template<unsigned DIM>
unsigned CaBasedCellPopulation< 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 320 of file CaBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), AbstractCellPopulation< DIM >::mCells, and CaBasedCellPopulation< DIM >::RemoveCellUsingLocationIndex().

template<unsigned DIM>
std::vector< unsigned > & CaBasedCellPopulation< DIM >::rGetAvailableSpaces (  )  [inline]
Returns:
mAvailableSpaces.

Definition at line 121 of file CaBasedCellPopulation.cpp.

References CaBasedCellPopulation< DIM >::mAvailableSpaces.

template<unsigned DIM>
const PottsMesh< DIM > & CaBasedCellPopulation< DIM >::rGetMesh (  )  const [inline]
Returns:
const reference to mrMesh (used in archiving).

Definition at line 140 of file CaBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
PottsMesh< DIM > & CaBasedCellPopulation< DIM >::rGetMesh (  )  [inline]
Returns:
reference to mrMesh.

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 134 of file CaBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::mrMesh.

Referenced by DiffusionCaUpdateRule< DIM >::EvaluateProbability().

template<unsigned DIM>
const std::vector< boost::shared_ptr< AbstractCaUpdateRule< DIM > > > & CaBasedCellPopulation< DIM >::rGetUpdateRuleCollection (  )  const [inline]

Get the collection of update rules to be used in this simulation.

Returns:
the update rule collection

Definition at line 505 of file CaBasedCellPopulation.cpp.

References CaBasedCellPopulation< DIM >::mUpdateRuleCollection.

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

Serialize the object and its member variables.

Note that serialization of the mesh and cells is handled by load/save_construct_data.

Note also that member data related to writers is not saved - output must be set up again by the caller after a restart.

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

Reimplemented from AbstractOnLatticeCellPopulation< DIM >.

Definition at line 100 of file CaBasedCellPopulation.hpp.

References CaBasedCellPopulation< DIM >::mAvailableSpaces, CaBasedCellPopulation< DIM >::mLatticeCarryingCapacity, and CaBasedCellPopulation< DIM >::mUpdateRuleCollection.

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::SetEmptySites ( const std::set< unsigned > &  rEmptySiteIndices  )  [private]

Set the empty sites by taking in a set of which nodes indices are empty sites.

Parameters:
rEmptySiteIndices set of node indices corresponding to empty sites
template<unsigned DIM>
void CaBasedCellPopulation< DIM >::Update ( bool  hasHadBirthsOrDeaths = true  )  [inline, virtual]

Overridden Update() method.

Checks association of nodes with CellPtrs.

Parameters:
hasHadBirthsOrDeaths - a bool saying whether cell population has had Births Or Deaths

Implements AbstractCellPopulation< DIM >.

Definition at line 442 of file CaBasedCellPopulation.cpp.

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::UpdateCellLocations ( double  dt  )  [inline, virtual]
template<unsigned DIM>
void CaBasedCellPopulation< DIM >::Validate (  )  [inline, private, virtual]

Overriden Validate Method.

Not used in CA simulations so just contains NEVER_REACHED

Implements AbstractCellPopulation< DIM >.

Definition at line 60 of file CaBasedCellPopulation.cpp.

References NEVER_REACHED.

template<unsigned DIM>
void CaBasedCellPopulation< DIM >::WriteVtkResultsToFile ( const std::string &  rDirectory  )  [inline, private, virtual]

Friends And Related Function Documentation

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

Needed for serialization.

Reimplemented from AbstractOnLatticeCellPopulation< DIM >.

Definition at line 87 of file CaBasedCellPopulation.hpp.


Member Data Documentation

template<unsigned DIM>
std::vector<unsigned> CaBasedCellPopulation< DIM >::mAvailableSpaces [private]
template<unsigned DIM>
unsigned CaBasedCellPopulation< DIM >::mLatticeCarryingCapacity [private]
template<unsigned DIM>
std::vector<boost::shared_ptr<AbstractCaUpdateRule<DIM> > > CaBasedCellPopulation< DIM >::mUpdateRuleCollection [private]

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

Generated by  doxygen 1.6.2