PottsBasedCellPopulation< DIM > Class Template Reference

#include <PottsBasedCellPopulation.hpp>

Inherits AbstractOnLatticeCellPopulation< DIM >.

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

List of all members.

Public Member Functions

 PottsBasedCellPopulation (PottsMesh< DIM > &rMesh, std::vector< CellPtr > &rCells, bool deleteMesh=false, bool validate=true, const std::vector< unsigned > locationIndices=std::vector< unsigned >())
 PottsBasedCellPopulation (PottsMesh< DIM > &rMesh)
virtual ~PottsBasedCellPopulation ()
PottsMesh< DIM > & rGetMesh ()
const PottsMesh< DIM > & rGetMesh () const
PottsElement< DIM > * GetElement (unsigned elementIndex)
unsigned GetNumElements ()
Node< DIM > * GetNode (unsigned index)
unsigned GetNumNodes ()
std::set< unsignedGetNeighbouringLocationIndices (CellPtr pCell)
c_vector< double, DIM > GetLocationOfCellCentre (CellPtr pCell)
PottsElement< DIM > * GetElementCorrespondingToCell (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)
virtual void OpenWritersFiles (OutputFileHandler &rOutputFileHandler)
virtual void WriteResultsToFiles (const std::string &rDirectory)
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< AbstractPottsUpdateRule< DIM > > pUpdateRule)
void RemoveAllUpdateRules ()
const std::vector
< boost::shared_ptr
< AbstractPottsUpdateRule< DIM > > > & 
rGetUpdateRuleCollection () const
void OutputCellPopulationParameters (out_stream &rParamsFile)
void SetTemperature (double temperature)
double GetTemperature ()
void SetNumSweepsPerTimestep (unsigned numSweepsPerTimestep)
unsigned GetNumSweepsPerTimestep ()
void CreateElementTessellation ()
VertexMesh< DIM, DIM > * GetElementTessellation ()
void CreateMutableMesh ()
MutableMesh< DIM, DIM > * GetMutableMesh ()

Private Member Functions

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

Private Attributes

VertexMesh< DIM, DIM > * mpElementTessellation
PottsMesh< DIM > * mpPottsMesh
MutableMesh< DIM, DIM > * mpMutableMesh
std::vector< boost::shared_ptr
< AbstractPottsUpdateRule< DIM > > > 
mUpdateRuleCollection
double mTemperature
unsigned mNumSweepsPerTimestep

Friends

class TestPottsBasedCellPopulation
class boost::serialization::access

Detailed Description

template<unsigned DIM>
class PottsBasedCellPopulation< DIM >

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 63 of file PottsBasedCellPopulation.hpp.


Constructor & Destructor Documentation

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

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:
rMesh reference to a PottsMesh
rCells reference to a vector of CellPtrs
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 true)
locationIndices an optional vector of location indices that correspond to real cells

Definition at line 78 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mpPottsMesh, AbstractCellPopulation< DIM >::mrMesh, and PottsBasedCellPopulation< DIM >::Validate().

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

Constructor for use by the de-serializer.

Parameters:
rMesh a vertex mesh.

Definition at line 98 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mpPottsMesh, and AbstractCellPopulation< DIM >::mrMesh.

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

Member Function Documentation

template<unsigned DIM>
void PottsBasedCellPopulation< 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 374 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
void PottsBasedCellPopulation< 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 368 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
void PottsBasedCellPopulation< 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 362 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
CellPtr PottsBasedCellPopulation< 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 177 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::GetElementCorrespondingToCell(), AbstractCellPopulation< DIM >::mCells, PottsBasedCellPopulation< DIM >::mpPottsMesh, and AbstractCellPopulation< DIM >::SetCellUsingLocationIndex().

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

Add an update rule to be used in this simulation (use this to set up the Hamiltonian).

Parameters:
pUpdateRule pointer to an update rule

Definition at line 401 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mUpdateRuleCollection.

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::CreateElementTessellation (  )  [inline]

Create a Element tessellation of the mesh for use in visualising the mesh.

Todo:
implement this method (#1666)

Definition at line 419 of file PottsBasedCellPopulation.cpp.

Referenced by PottsBasedCellPopulation< DIM >::WriteResultsToFiles().

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::CreateMutableMesh (  )  [inline]
template<unsigned DIM>
PottsElement< DIM > * PottsBasedCellPopulation< DIM >::GetElement ( unsigned  elementIndex  )  [inline]

Get a particular PottsElement.

Parameters:
elementIndex the global index of the PottsElement
Returns:
a pointer to the PottsElement.

Definition at line 134 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mpPottsMesh.

Referenced by PottsBasedCellPopulation< DIM >::UpdateCellLocations(), and CellPopulationElementWriter< ELEMENT_DIM, SPACE_DIM >::Visit().

template<unsigned DIM>
PottsElement< DIM > * PottsBasedCellPopulation< DIM >::GetElementCorrespondingToCell ( CellPtr  pCell  )  [inline]

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

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

Definition at line 171 of file PottsBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), and PottsBasedCellPopulation< DIM >::mpPottsMesh.

Referenced by PottsBasedCellPopulation< DIM >::AddCell(), and PottsBasedCellPopulation< DIM >::IsCellAssociatedWithADeletedLocation().

template<unsigned DIM>
VertexMesh< DIM, DIM > * PottsBasedCellPopulation< DIM >::GetElementTessellation (  )  [inline]
Returns:
a reference to mpElementTessellation.

Definition at line 437 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mpElementTessellation.

template<unsigned DIM>
c_vector< double, DIM > PottsBasedCellPopulation< 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 centre of mass of the element corresponding to this cell.

Implements AbstractCellPopulation< DIM >.

Definition at line 165 of file PottsBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), and PottsBasedCellPopulation< DIM >::mpPottsMesh.

template<unsigned DIM>
MutableMesh< DIM, DIM > * PottsBasedCellPopulation< DIM >::GetMutableMesh (  )  [inline]
Returns:
the Mutable Mesh

Definition at line 460 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mpMutableMesh.

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

Overridden GetNeighbouringLocationIndices() method.

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

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

Implements AbstractCellPopulation< DIM >.

Definition at line 158 of file PottsBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), and PottsBasedCellPopulation< DIM >::mpPottsMesh.

template<unsigned DIM>
Node< DIM > * PottsBasedCellPopulation< DIM >::GetNode ( unsigned  index  )  [inline, virtual]
template<unsigned DIM>
unsigned PottsBasedCellPopulation< DIM >::GetNumElements (  )  [inline]
Returns:
the number of PottsElements in the cell population.

Definition at line 140 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mpPottsMesh.

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

template<unsigned DIM>
unsigned PottsBasedCellPopulation< 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 PottsBasedCellPopulation.cpp.

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

Referenced by PottsBasedCellPopulation< DIM >::WriteVtkResultsToFile().

template<unsigned DIM>
unsigned PottsBasedCellPopulation< DIM >::GetNumSweepsPerTimestep (  )  [inline]
Returns:
mNumSweepsPerTimestep

Definition at line 495 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mNumSweepsPerTimestep.

template<unsigned DIM>
double PottsBasedCellPopulation< DIM >::GetTemperature (  )  [inline]
Returns:
mTemperature

Definition at line 483 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mTemperature.

template<unsigned DIM>
double PottsBasedCellPopulation< 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 380 of file PottsBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), and PottsBasedCellPopulation< DIM >::mpPottsMesh.

template<unsigned DIM>
double PottsBasedCellPopulation< 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.

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

Implements AbstractCellPopulation< DIM >.

Definition at line 392 of file PottsBasedCellPopulation.cpp.

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

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

Overridden IsCellAssociatedWithADeletedLocation() method.

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

Implements AbstractCellPopulation< DIM >.

Definition at line 327 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::GetElementCorrespondingToCell().

template<unsigned DIM>
void PottsBasedCellPopulation< 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 338 of file PottsBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::mOutputResultsForChasteVisualizer.

template<unsigned DIM>
void PottsBasedCellPopulation< 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 467 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mNumSweepsPerTimestep, and PottsBasedCellPopulation< DIM >::mTemperature.

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

Method to remove all the update rules

Definition at line 407 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mUpdateRuleCollection.

template<unsigned DIM>
unsigned PottsBasedCellPopulation< 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 195 of file PottsBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), AbstractCellPopulation< DIM >::mCells, and PottsBasedCellPopulation< DIM >::mpPottsMesh.

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

Definition at line 128 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mpPottsMesh.

template<unsigned DIM>
PottsMesh< DIM > & PottsBasedCellPopulation< DIM >::rGetMesh (  )  [inline]
template<unsigned DIM>
const std::vector< boost::shared_ptr< AbstractPottsUpdateRule< DIM > > > & PottsBasedCellPopulation< DIM >::rGetUpdateRuleCollection (  )  const [inline]

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

Returns:
the update rule collection

Definition at line 413 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mUpdateRuleCollection.

template<unsigned DIM>
template<class Archive >
void PottsBasedCellPopulation< 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 113 of file PottsBasedCellPopulation.hpp.

References PottsBasedCellPopulation< DIM >::mNumSweepsPerTimestep, PottsBasedCellPopulation< DIM >::mpElementTessellation, PottsBasedCellPopulation< DIM >::mTemperature, and PottsBasedCellPopulation< DIM >::mUpdateRuleCollection.

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::SetNumSweepsPerTimestep ( unsigned  numSweepsPerTimestep  )  [inline]

Set mNumSweepsPerTimestep.

Parameters:
numSweepsPerTimestep the number of MonteCarlo sweeps of the mesh performed each timestep

Definition at line 489 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mNumSweepsPerTimestep.

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::SetTemperature ( double  temperature  )  [inline]

Set mTemperature.

Parameters:
temperature the temperature of the system

Definition at line 477 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mTemperature.

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

Remove the PottsElements which have been marked as deleted, and update the correspondence with CellPtrs.

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

Implements AbstractCellPopulation< DIM >.

Definition at line 333 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::UpdateCellLocations ( double  dt  )  [inline, virtual]
template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::Validate (  )  [inline, private, virtual]
template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::WriteResultsToFiles ( const std::string &  rDirectory  )  [inline, virtual]

Overridden WriteResultsToFiles() method.

Parameters:
rDirectory pathname of the output directory, relative to where Chaste output is stored

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 354 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::CreateElementTessellation().

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

Overridden WriteVtkResultsToFile() method.

As a CellIdWriter is added to the population in the overridden method OpenWritersFiles(), distinct cells can be visualized when viewing VTK output of Potts model simulations.

Parameters:
rDirectory pathname of the output directory, relative to where Chaste output is stored

Implements AbstractCellPopulation< DIM >.

Definition at line 501 of file PottsBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::Begin(), NodesOnlyMesh< SPACE_DIM >::ConstructNodesWithoutMesh(), AbstractCellPopulation< DIM >::GetCellUsingLocationIndex(), PottsBasedCellPopulation< DIM >::GetNumNodes(), SimulationTime::GetTimeStepsElapsed(), SimulationTime::Instance(), AbstractCellPopulation< DIM >::mCellWriters, PottsBasedCellPopulation< DIM >::mpPottsMesh, and AbstractCellPopulation< DIM >::mpVtkMetaFile.


Friends And Related Function Documentation

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

Needed for serialization.

Reimplemented from AbstractOnLatticeCellPopulation< DIM >.

Definition at line 100 of file PottsBasedCellPopulation.hpp.


Member Data Documentation

template<unsigned DIM>
unsigned PottsBasedCellPopulation< DIM >::mNumSweepsPerTimestep [private]
template<unsigned DIM>
VertexMesh<DIM,DIM>* PottsBasedCellPopulation< DIM >::mpElementTessellation [private]

Pointer to a VertexMesh object that stores the Element tessellation that is used to visualize mrMesh. The tessellation is created by calling CreateElementTessellation() and can be accessed by calling GetElementTessellation().

Definition at line 74 of file PottsBasedCellPopulation.hpp.

Referenced by PottsBasedCellPopulation< DIM >::GetElementTessellation(), PottsBasedCellPopulation< DIM >::serialize(), and PottsBasedCellPopulation< DIM >::~PottsBasedCellPopulation().

template<unsigned DIM>
MutableMesh<DIM,DIM>* PottsBasedCellPopulation< DIM >::mpMutableMesh [private]

Pointer to a MutableMesh that can be created from the nodes of the PottsMesh in order to solve PDEs on the population.

Definition at line 86 of file PottsBasedCellPopulation.hpp.

Referenced by PottsBasedCellPopulation< DIM >::CreateMutableMesh(), PottsBasedCellPopulation< DIM >::GetMutableMesh(), and PottsBasedCellPopulation< DIM >::~PottsBasedCellPopulation().

template<unsigned DIM>
PottsMesh<DIM>* PottsBasedCellPopulation< DIM >::mpPottsMesh [private]
template<unsigned DIM>
double PottsBasedCellPopulation< DIM >::mTemperature [private]
template<unsigned DIM>
std::vector<boost::shared_ptr<AbstractPottsUpdateRule<DIM> > > PottsBasedCellPopulation< DIM >::mUpdateRuleCollection [private]

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

Generated by  doxygen 1.6.2