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

#include <PottsBasedCellPopulation.hpp>

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

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 ()
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)
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< AbstractPottsUpdateRule< DIM > > pUpdateRule)
void RemoveAllUpdateRules ()
const std::vector
< boost::shared_ptr
< AbstractPottsUpdateRule< DIM > > > & 
rGetUpdateRuleCollection () const
void OutputCellPopulationParameters (out_stream &rParamsFile)
std::set< unsignedGetNeighbouringNodeIndices (unsigned index)
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 ()
void WriteVtkResultsToFile ()

Private Attributes

VertexMesh< DIM, DIM > * mpElementTessellation
PottsMesh< DIM > * mpPottsMesh
MutableMesh< DIM, DIM > * mpMutableMesh
out_stream mpVizElementsFile
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 66 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>() 
)

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
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 true)
locationIndicesan optional vector of location indices that correspond to real cells

Definition at line 74 of file PottsBasedCellPopulation.cpp.

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

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

Constructor for use by the de-serializer.

Parameters:
rMesha vertex mesh.

Definition at line 94 of file PottsBasedCellPopulation.cpp.

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

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

Destructor, which frees any memory allocated by the constructor.

Definition at line 105 of file PottsBasedCellPopulation.cpp.


Member Function Documentation

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

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

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

Parameters:
pUpdateRulepointer to an update rule

Definition at line 486 of file PottsBasedCellPopulation.cpp.

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

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

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

Todo:
implement this method (#1666)

Definition at line 504 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::CreateMutableMesh ( )

Create a mutable mesh from the nodes of the Potts mesh. Used for solving PDEs

Definition at line 529 of file PottsBasedCellPopulation.cpp.

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

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

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::GenerateCellResultsAndWriteToFiles ( ) [virtual]

Overridden GenerateCellResultsAndWriteToFiles() method.

Implements AbstractCellPopulation< DIM >.

Definition at line 448 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
PottsElement< DIM > * PottsBasedCellPopulation< DIM >::GetElement ( unsigned  elementIndex)

Get a particular PottsElement.

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

Definition at line 130 of file PottsBasedCellPopulation.cpp.

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

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

Parameters:
pCellthe cell
Returns:
pointer to the element.

Definition at line 160 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
VertexMesh< DIM, DIM > * PottsBasedCellPopulation< DIM >::GetElementTessellation ( )

Get a reference to mpElementTessellation.

Definition at line 522 of file PottsBasedCellPopulation.cpp.

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

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

Definition at line 545 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
std::set< unsigned > PottsBasedCellPopulation< 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 562 of file PottsBasedCellPopulation.cpp.

References EXCEPTION.

template<unsigned DIM>
unsigned PottsBasedCellPopulation< DIM >::GetNumElements ( )
Returns:
the number of PottsElements in the cell population.

Definition at line 136 of file PottsBasedCellPopulation.cpp.

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

Overridden GetNumNodes() method.

Returns:
the number of nodes in the cell population.

Implements AbstractCellPopulation< DIM >.

Definition at line 148 of file PottsBasedCellPopulation.cpp.

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

Definition at line 588 of file PottsBasedCellPopulation.cpp.

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

Definition at line 576 of file PottsBasedCellPopulation.cpp.

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

Overridden GetVolumeOfCell() method.

Parameters:
pCellboost shared pointer to a cell

Implements AbstractCellPopulation< DIM >.

Definition at line 391 of file PottsBasedCellPopulation.cpp.

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

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

Implements AbstractCellPopulation< DIM >.

Definition at line 477 of file PottsBasedCellPopulation.cpp.

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

Overridden IsCellAssociatedWithADeletedLocation() method.

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

Implements AbstractCellPopulation< DIM >.

Definition at line 317 of file PottsBasedCellPopulation.cpp.

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

References AbstractOnLatticeCellPopulation< DIM >::OutputCellPopulationParameters().

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

Method to remove all the update rules

Definition at line 492 of file PottsBasedCellPopulation.cpp.

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

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

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

Definition at line 124 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
const std::vector< boost::shared_ptr< AbstractPottsUpdateRule< DIM > > > & PottsBasedCellPopulation< DIM >::rGetUpdateRuleCollection ( ) const

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

Returns:
the update rule collection

Definition at line 498 of file PottsBasedCellPopulation.cpp.

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

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:
archivethe archive
versionthe current version of this class

Reimplemented from AbstractOnLatticeCellPopulation< DIM >.

Definition at line 119 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)

Set mNumSweepsPerTimestep.

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

Definition at line 582 of file PottsBasedCellPopulation.cpp.

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

Set mTemperature.

Parameters:
temperaturethe temperature of the system

Definition at line 570 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::Update ( bool  hasHadBirthsOrDeaths = true) [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 323 of file PottsBasedCellPopulation.cpp.

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::UpdateCellLocations ( double  dt) [virtual]
template<unsigned DIM>
void PottsBasedCellPopulation< 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 PottsBasedCellPopulation.cpp.

References EXCEPTION.

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

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::WriteCellVolumeResultsToFile ( ) [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 106 of file PottsBasedCellPopulation.hpp.


Member Data Documentation

template<unsigned DIM>
unsigned PottsBasedCellPopulation< DIM >::mNumSweepsPerTimestep [private]

The number of MonteCarlo sweeps of the mesh performed each timestep. Initialised to 1 in the constructor.

Definition at line 104 of file PottsBasedCellPopulation.hpp.

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

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

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

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

template<unsigned DIM>
PottsMesh<DIM>* PottsBasedCellPopulation< DIM >::mpPottsMesh [private]

A static cast of the Abstract mesh from `AbstractCellPopulation` for use in this class

Definition at line 83 of file PottsBasedCellPopulation.hpp.

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

template<unsigned DIM>
out_stream PottsBasedCellPopulation< DIM >::mpVizElementsFile [private]

Results file for elements.

Definition at line 92 of file PottsBasedCellPopulation.hpp.

template<unsigned DIM>
double PottsBasedCellPopulation< DIM >::mTemperature [private]

The temperature of the system. Initialized to 0.1 in the constructor.

Definition at line 98 of file PottsBasedCellPopulation.hpp.

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

template<unsigned DIM>
std::vector<boost::shared_ptr<AbstractPottsUpdateRule<DIM> > > PottsBasedCellPopulation< DIM >::mUpdateRuleCollection [private]

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

Definition at line 95 of file PottsBasedCellPopulation.hpp.

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


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