Chaste Release::3.1
MultipleCaBasedCellPopulation< DIM > Class Template Reference

#include <MultipleCaBasedCellPopulation.hpp>

Inheritance diagram for MultipleCaBasedCellPopulation< DIM >:
Collaboration diagram for MultipleCaBasedCellPopulation< DIM >:

List of all members.

Public Member Functions

 MultipleCaBasedCellPopulation (PottsMesh< DIM > &rMesh, std::vector< CellPtr > &rCells, const std::vector< unsigned > locationIndices=std::vector< unsigned >(), unsigned latticeCarryingCapacity=1u, bool deleteMesh=false, bool validate=false)
 MultipleCaBasedCellPopulation (PottsMesh< DIM > &rMesh)
virtual ~MultipleCaBasedCellPopulation ()
std::vector< unsigned > & rGetAvailableSpaces ()
bool IsSiteAvailable (unsigned index)
PottsMesh< DIM > & rGetMesh ()
const PottsMesh< DIM > & rGetMesh () const
Node< DIM > * GetNode (unsigned index)
unsigned GetNumNodes ()
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())
unsigned RemoveDeadCells ()
void UpdateCellLocations (double dt)
bool IsCellAssociatedWithADeletedLocation (CellPtr pCell)
void Update (bool hasHadBirthsOrDeaths=true)
void CreateOutputFiles (const std::string &rDirectory, bool cleanOutputDirectory)
void CloseOutputFiles ()
void WriteResultsToFiles ()
void WriteCellVolumeResultsToFile ()
double GetVolumeOfCell (CellPtr pCell)
virtual void GenerateCellResultsAndWriteToFiles ()
double GetWidth (const unsigned &rDimension)
void AddUpdateRule (boost::shared_ptr< AbstractMultipleCaUpdateRule< DIM > > pUpdateRule)
void RemoveAllUpdateRules ()
const std::vector
< boost::shared_ptr
< AbstractMultipleCaUpdateRule
< DIM > > > & 
rGetUpdateRuleCollection () const
void OutputCellPopulationParameters (out_stream &rParamsFile)
std::set< unsignedGetNeighbouringNodeIndices (unsigned index)

Private Member Functions

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

Private Attributes

unsigned mLatticeCarryingCapacity
out_stream mpVizLocationsFile
std::vector< boost::shared_ptr
< AbstractMultipleCaUpdateRule
< DIM > > > 
mUpdateRuleCollection
std::vector< unsignedmAvailableSpaces

Friends

class TestMultipleCaBasedCellPopulation
class boost::serialization::access

Detailed Description

template<unsigned DIM>
class MultipleCaBasedCellPopulation< DIM >

Todo:
This description is pasted from Potts. Please change it.

A facade class encapsulating a cell population under the Cellular Potts Model framework.

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

The code currently requires the PottsMesh object to be fixed, in the sense that no new nodes or elements can be added.

Definition at line 69 of file MultipleCaBasedCellPopulation.hpp.


Constructor & Destructor Documentation

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

Create a new cell population facade from a mesh and collection of cells.

There must be precisely one CellPtr for each PottsElement in the mesh.

Parameters:
rMeshreference to a PottsMesh
rCellsreference to a vector of CellPtrs
locationIndicesan optional vector of location indices that correspond to real cells
latticeCarryingCapacityan optional parameter to allow more than one cell per site
deleteMeshset to true if you want the cell population to free the mesh memory on destruction (defaults to false)
validatewhether to validate the cell population when it is created (defaults to false as not used in CA simulations)

Definition at line 52 of file MultipleCaBasedCellPopulation.cpp.

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

template<unsigned DIM>
MultipleCaBasedCellPopulation< DIM >::MultipleCaBasedCellPopulation ( PottsMesh< DIM > &  rMesh)

Constructor for use by the de-serializer.

Parameters:
rMesha vertex mesh.

Definition at line 89 of file MultipleCaBasedCellPopulation.cpp.

template<unsigned DIM>
MultipleCaBasedCellPopulation< DIM >::~MultipleCaBasedCellPopulation ( ) [virtual]

Destructor, which frees any memory allocated by the constructor.

Definition at line 95 of file MultipleCaBasedCellPopulation.cpp.


Member Function Documentation

template<unsigned DIM>
CellPtr MultipleCaBasedCellPopulation< DIM >::AddCell ( CellPtr  pNewCell,
const c_vector< double, DIM > &  rCellDivisionVector,
CellPtr  pParentCell = CellPtr() 
)

Overridden AddCell() method.

Add a new cell to the cell population.

Parameters:
pNewCellthe cell to add
rCellDivisionVectorthis parameter is not yet used in this class (see #1737)
pParentCellpointer 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 176 of file MultipleCaBasedCellPopulation.cpp.

References EXCEPTION, PottsMesh< DIM >::GetMooreNeighbouringNodeIndices(), RandomNumberGenerator::Instance(), RandomNumberGenerator::randMod(), and UNSIGNED_UNSET.

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

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

Parameters:
indexthe location index
pCellthe cell.

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 155 of file MultipleCaBasedCellPopulation.cpp.

References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::AddCellUsingLocationIndex(), and EXCEPTION.

template<unsigned DIM>
void MultipleCaBasedCellPopulation< DIM >::AddUpdateRule ( boost::shared_ptr< AbstractMultipleCaUpdateRule< DIM > >  pUpdateRule)

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

Parameters:
pUpdateRulepointer to an update rule

Definition at line 492 of file MultipleCaBasedCellPopulation.cpp.

Referenced by OnLatticeSimulation< DIM >::AddMultipleCaUpdateRule().

template<unsigned DIM>
void MultipleCaBasedCellPopulation< DIM >::CloseOutputFiles ( ) [virtual]
template<unsigned DIM>
void MultipleCaBasedCellPopulation< DIM >::CreateOutputFiles ( const std::string &  rDirectory,
bool  cleanOutputDirectory 
) [virtual]

Overridden CreateOutputFiles() method.

Parameters:
rDirectorypathname of the output directory, relative to where Chaste output is stored
cleanOutputDirectorywhether to delete the contents of the output directory prior to output file creation

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 372 of file MultipleCaBasedCellPopulation.cpp.

References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::CreateOutputFiles(), and OutputFileHandler::OpenOutputFile().

template<unsigned DIM>
void MultipleCaBasedCellPopulation< DIM >::GenerateCellResultsAndWriteToFiles ( ) [virtual]
template<unsigned DIM>
c_vector< double, DIM > MultipleCaBasedCellPopulation< DIM >::GetLocationOfCellCentre ( CellPtr  pCell) [virtual]

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

Parameters:
pCellthe cell
Returns:
the location of the centre of mass of the element corresponding to this cell.

Implements AbstractCellPopulation< DIM >.

Definition at line 143 of file MultipleCaBasedCellPopulation.cpp.

template<unsigned DIM>
std::set< unsigned > MultipleCaBasedCellPopulation< DIM >::GetNeighbouringNodeIndices ( unsigned  index) [virtual]

Overridden GetNeighbouringNodeIndices() method.

This method currently returns an exception as the two types of neighbourhood (Moore and Von Neumann) are defined in the PottsMesh.

Parameters:
indexthe node index
Returns:
the set of neighbouring node indices.

Implements AbstractCellPopulation< DIM >.

Definition at line 517 of file MultipleCaBasedCellPopulation.cpp.

References EXCEPTION.

template<unsigned DIM>
Node< DIM > * MultipleCaBasedCellPopulation< DIM >::GetNode ( unsigned  index) [virtual]

Overridden GetNode() method.

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

Implements AbstractCellPopulation< DIM >.

Definition at line 131 of file MultipleCaBasedCellPopulation.cpp.

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

template<unsigned DIM>
Node< DIM > * MultipleCaBasedCellPopulation< DIM >::GetNodeCorrespondingToCell ( CellPtr  pCell)

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

Parameters:
pCellthe cell
Returns:
pointer to the node.

Definition at line 149 of file MultipleCaBasedCellPopulation.cpp.

template<unsigned DIM>
unsigned MultipleCaBasedCellPopulation< DIM >::GetNumNodes ( ) [virtual]

Overridden GetNumNodes() method.

Returns:
the number of nodes in the cell population.

Implements AbstractCellPopulation< DIM >.

Definition at line 137 of file MultipleCaBasedCellPopulation.cpp.

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

template<unsigned DIM>
double MultipleCaBasedCellPopulation< DIM >::GetVolumeOfCell ( CellPtr  pCell) [virtual]

Overridden GetVolumeOfCell() method.

Parameters:
pCellboost shared pointer to a cell

Implements AbstractCellPopulation< DIM >.

Definition at line 446 of file MultipleCaBasedCellPopulation.cpp.

template<unsigned DIM>
double MultipleCaBasedCellPopulation< DIM >::GetWidth ( const unsigned rDimension) [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:
rDimensiona dimension (0,1 or 2)
Returns:
The maximum distance between any nodes in this dimension.

Implements AbstractCellPopulation< DIM >.

Definition at line 483 of file MultipleCaBasedCellPopulation.cpp.

template<unsigned DIM>
bool MultipleCaBasedCellPopulation< DIM >::IsCellAssociatedWithADeletedLocation ( CellPtr  pCell) [virtual]

Overridden IsCellAssociatedWithADeletedLocation() method.

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

Implements AbstractCellPopulation< DIM >.

Definition at line 361 of file MultipleCaBasedCellPopulation.cpp.

template<unsigned DIM>
bool MultipleCaBasedCellPopulation< DIM >::IsSiteAvailable ( unsigned  index)

Find if a given node Has space available.

Parameters:
indexthe global index of a specified node
Returns:
whether the node is an empty site

Definition at line 113 of file MultipleCaBasedCellPopulation.cpp.

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

Outputs CellPopulation parameters to file

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

Parameters:
rParamsFilethe file stream to which the parameters are output

Reimplemented from AbstractOnLatticeCellPopulation< DIM >.

Definition at line 510 of file MultipleCaBasedCellPopulation.cpp.

References AbstractOnLatticeCellPopulation< DIM >::OutputCellPopulationParameters().

template<unsigned DIM>
void MultipleCaBasedCellPopulation< DIM >::RemoveAllUpdateRules ( )

Method to remove all the update rules

Definition at line 498 of file MultipleCaBasedCellPopulation.cpp.

Referenced by OnLatticeSimulation< DIM >::RemoveAllMultipleCaUpdateRules().

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

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

Parameters:
indexthe location index
pCellthe cell.

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 166 of file MultipleCaBasedCellPopulation.cpp.

References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::RemoveCellUsingLocationIndex().

template<unsigned DIM>
unsigned MultipleCaBasedCellPopulation< DIM >::RemoveDeadCells ( ) [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 240 of file MultipleCaBasedCellPopulation.cpp.

template<unsigned DIM>
std::vector< unsigned > & MultipleCaBasedCellPopulation< DIM >::rGetAvailableSpaces ( )
Returns:
mAvailableSpaces.

Definition at line 107 of file MultipleCaBasedCellPopulation.cpp.

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

Definition at line 125 of file MultipleCaBasedCellPopulation.cpp.

template<unsigned DIM>
PottsMesh< DIM > & MultipleCaBasedCellPopulation< DIM >::rGetMesh ( )
Returns:
reference to mrMesh.

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 119 of file MultipleCaBasedCellPopulation.cpp.

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

template<unsigned DIM>
const std::vector< boost::shared_ptr< AbstractMultipleCaUpdateRule< DIM > > > & MultipleCaBasedCellPopulation< DIM >::rGetUpdateRuleCollection ( ) const

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

Returns:
the update rule collection

Definition at line 504 of file MultipleCaBasedCellPopulation.cpp.

Referenced by OnLatticeSimulation< DIM >::OutputAdditionalSimulationSetup().

template<unsigned DIM>
template<class Archive >
void MultipleCaBasedCellPopulation< 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:
archivethe archive
versionthe current version of this class

Reimplemented from AbstractOnLatticeCellPopulation< DIM >.

Definition at line 108 of file MultipleCaBasedCellPopulation.hpp.

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

template<unsigned DIM>
void MultipleCaBasedCellPopulation< 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:
rEmptySiteIndicesset of node indices corresponding to empty sites
template<unsigned DIM>
void MultipleCaBasedCellPopulation< DIM >::Update ( bool  hasHadBirthsOrDeaths = true) [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 367 of file MultipleCaBasedCellPopulation.cpp.

template<unsigned DIM>
void MultipleCaBasedCellPopulation< DIM >::UpdateCellLocations ( double  dt) [virtual]

Calculated the probability of a cell moving based on the calculations provided by Owen et. al 2011 Overridden UpdateCellLocations() method.

Parameters:
dttime step

Implements AbstractOnLatticeCellPopulation< DIM >.

Definition at line 265 of file MultipleCaBasedCellPopulation.cpp.

References EXCEPTION, PottsMesh< DIM >::GetMooreNeighbouringNodeIndices(), RandomNumberGenerator::Instance(), NEVER_REACHED, and RandomNumberGenerator::ranf().

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

Check the consistency of internal data structures. Each PottsElement must have a CellPtr associated with it.

Implements AbstractCellPopulation< DIM >.

Definition at line 46 of file MultipleCaBasedCellPopulation.cpp.

References NEVER_REACHED.

template<unsigned DIM>
void MultipleCaBasedCellPopulation< DIM >::WriteCellVolumeResultsToFile ( ) [virtual]
template<unsigned DIM>
void MultipleCaBasedCellPopulation< DIM >::WriteResultsToFiles ( ) [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 95 of file MultipleCaBasedCellPopulation.hpp.


Member Data Documentation

template<unsigned DIM>
std::vector<unsigned> MultipleCaBasedCellPopulation< DIM >::mAvailableSpaces [private]

Records for each node the node the number of spaces available.

Definition at line 86 of file MultipleCaBasedCellPopulation.hpp.

Referenced by MultipleCaBasedCellPopulation< DIM >::MultipleCaBasedCellPopulation(), and MultipleCaBasedCellPopulation< DIM >::serialize().

template<unsigned DIM>
unsigned MultipleCaBasedCellPopulation< DIM >::mLatticeCarryingCapacity [private]

The carying capacity (number of cells allowed per site)

Definition at line 77 of file MultipleCaBasedCellPopulation.hpp.

Referenced by MultipleCaBasedCellPopulation< DIM >::serialize().

template<unsigned DIM>
out_stream MultipleCaBasedCellPopulation< DIM >::mpVizLocationsFile [private]

Results file for cell locations.

Definition at line 80 of file MultipleCaBasedCellPopulation.hpp.

template<unsigned DIM>
std::vector<boost::shared_ptr<AbstractMultipleCaUpdateRule<DIM> > > MultipleCaBasedCellPopulation< DIM >::mUpdateRuleCollection [private]

The update rules used to determine the new location of the cells.

Definition at line 83 of file MultipleCaBasedCellPopulation.hpp.

Referenced by MultipleCaBasedCellPopulation< DIM >::serialize().


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