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 ()
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 ()
virtual void GenerateCellResultsAndWriteToFiles ()
double GetWidth (const unsigned &rDimension)
void AddUpdateRule (boost::shared_ptr< AbstractPottsUpdateRule< DIM > > pUpdateRule)
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 ()

Private Member Functions

template<class Archive >
void serialize (Archive &archive, const unsigned int version)
void Validate ()
void WriteVtkResultsToFile ()

Private Attributes

PottsMesh< DIM > & mrMesh
VertexMesh< DIM, DIM > * mpElementTessellation
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 58 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 67 of file PottsBasedCellPopulation.cpp.

References 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 86 of file PottsBasedCellPopulation.cpp.

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

Destructor, which frees any memory allocated by the constructor.

Definition at line 96 of file PottsBasedCellPopulation.cpp.

References AbstractOnLatticeCellPopulation< DIM >::mDeleteMesh, PottsBasedCellPopulation< DIM >::mpElementTessellation, and PottsBasedCellPopulation< DIM >::mrMesh.


Member Function Documentation

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

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)

Implements AbstractCellPopulation< DIM >.

Definition at line 155 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::GetElementCorrespondingToCell(), AbstractCellPopulation< DIM >::mCellLocationMap, AbstractCellPopulation< DIM >::mCells, AbstractCellPopulation< DIM >::mLocationCellMap, and PottsBasedCellPopulation< DIM >::mrMesh.

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 464 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mUpdateRuleCollection.

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::CloseOutputFiles (  )  [inline, virtual]
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 476 of file PottsBasedCellPopulation.cpp.

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

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

Overridden CreateOutputFiles() method.

Parameters:
rDirectory pathname of the output directory, relative to where Chaste output is stored
cleanOutputDirectory whether to delete the contents of the output directory prior to output file creation

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 318 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mpVizElementsFile, and OutputFileHandler::OpenOutputFile().

template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::GenerateCellResultsAndWriteToFiles (  )  [inline, virtual]
template<unsigned DIM>
PottsElement< DIM > * PottsBasedCellPopulation< DIM >::GetElement ( unsigned  elementIndex  )  [inline]
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 149 of file PottsBasedCellPopulation.cpp.

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

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

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

Get a reference to mpElementTessellation.

Definition at line 494 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 143 of file PottsBasedCellPopulation.cpp.

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

template<unsigned DIM>
std::set< unsigned > PottsBasedCellPopulation< DIM >::GetNeighbouringNodeIndices ( unsigned  index  )  [inline, 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:
index the node index
Returns:
the set of neighbouring node indices.

Implements AbstractCellPopulation< DIM >.

Definition at line 511 of file PottsBasedCellPopulation.cpp.

References EXCEPTION.

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 125 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mrMesh.

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 137 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mrMesh.

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

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

Definition at line 537 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mNumSweepsPerTimestep.

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

Definition at line 525 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mTemperature.

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 455 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< 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 307 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::GetElementCorrespondingToCell().

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 501 of file PottsBasedCellPopulation.cpp.

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

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 174 of file PottsBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::mCellLocationMap, AbstractCellPopulation< DIM >::mCells, and PottsBasedCellPopulation< DIM >::mrMesh.

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

Definition at line 113 of file PottsBasedCellPopulation.cpp.

References PottsBasedCellPopulation< DIM >::mrMesh.

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 470 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 102 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 531 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 519 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 313 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 >::WriteCellVolumeResultsToFile (  )  [inline, virtual]
template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::WriteResultsToFiles (  )  [inline, virtual]
template<unsigned DIM>
void PottsBasedCellPopulation< DIM >::WriteVtkResultsToFile (  )  [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 89 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 visualise mrMesh. The tessellation is created by calling CreateElementTessellation() and can be accessed by calling GetElementTessellation().

Definition at line 72 of file PottsBasedCellPopulation.hpp.

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

template<unsigned DIM>
out_stream PottsBasedCellPopulation< DIM >::mpVizElementsFile [private]
template<unsigned DIM>
PottsMesh<DIM>& PottsBasedCellPopulation< DIM >::mrMesh [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 on Thu Dec 22 13:07:18 2011 for Chaste by  doxygen 1.6.3