Chaste Release::3.1
|
#include <PottsBasedCellPopulation.hpp>
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< unsigned > | GetNeighbouringNodeIndices (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 |
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.
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.
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 74 of file PottsBasedCellPopulation.cpp.
References PottsBasedCellPopulation< DIM >::mpPottsMesh, AbstractCellPopulation< DIM >::mrMesh, and PottsBasedCellPopulation< DIM >::Validate().
PottsBasedCellPopulation< DIM >::PottsBasedCellPopulation | ( | PottsMesh< DIM > & | rMesh | ) |
Constructor for use by the de-serializer.
rMesh | a vertex mesh. |
Definition at line 94 of file PottsBasedCellPopulation.cpp.
References PottsBasedCellPopulation< DIM >::mpPottsMesh, and AbstractCellPopulation< DIM >::mrMesh.
PottsBasedCellPopulation< DIM >::~PottsBasedCellPopulation | ( | ) | [virtual] |
Destructor, which frees any memory allocated by the constructor.
Definition at line 105 of file PottsBasedCellPopulation.cpp.
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.
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) |
Definition at line 166 of file PottsBasedCellPopulation.cpp.
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).
pUpdateRule | pointer to an update rule |
Definition at line 486 of file PottsBasedCellPopulation.cpp.
Referenced by OnLatticeSimulation< DIM >::AddPottsUpdateRule().
void PottsBasedCellPopulation< DIM >::CloseOutputFiles | ( | ) | [virtual] |
Overridden CloseOutputFiles() method.
Reimplemented from AbstractCellPopulation< DIM >.
Definition at line 337 of file PottsBasedCellPopulation.cpp.
References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::CloseOutputFiles().
void PottsBasedCellPopulation< DIM >::CreateElementTessellation | ( | ) |
Create a Element tessellation of the mesh for use in visualising the mesh.
Definition at line 504 of file PottsBasedCellPopulation.cpp.
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.
void PottsBasedCellPopulation< DIM >::CreateOutputFiles | ( | const std::string & | rDirectory, |
bool | cleanOutputDirectory | ||
) | [virtual] |
Overridden CreateOutputFiles() method.
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 328 of file PottsBasedCellPopulation.cpp.
References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::CreateOutputFiles(), and OutputFileHandler::OpenOutputFile().
void PottsBasedCellPopulation< DIM >::GenerateCellResultsAndWriteToFiles | ( | ) | [virtual] |
Overridden GenerateCellResultsAndWriteToFiles() method.
Implements AbstractCellPopulation< DIM >.
Definition at line 448 of file PottsBasedCellPopulation.cpp.
PottsElement< DIM > * PottsBasedCellPopulation< DIM >::GetElement | ( | unsigned | elementIndex | ) |
Get a particular PottsElement.
elementIndex | the global index of the PottsElement |
Definition at line 130 of file PottsBasedCellPopulation.cpp.
PottsElement< DIM > * PottsBasedCellPopulation< DIM >::GetElementCorrespondingToCell | ( | CellPtr | pCell | ) |
Get a pointer to the element corresponding to a given CellPtr.
pCell | the cell |
Definition at line 160 of file PottsBasedCellPopulation.cpp.
VertexMesh< DIM, DIM > * PottsBasedCellPopulation< DIM >::GetElementTessellation | ( | ) |
Get a reference to mpElementTessellation.
Definition at line 522 of file PottsBasedCellPopulation.cpp.
c_vector< double, DIM > PottsBasedCellPopulation< DIM >::GetLocationOfCellCentre | ( | CellPtr | pCell | ) | [virtual] |
Overridden GetLocationOfCellCentre() method. Find where a given cell is in space.
pCell | the cell |
Implements AbstractCellPopulation< DIM >.
Definition at line 154 of file PottsBasedCellPopulation.cpp.
MutableMesh< DIM, DIM > * PottsBasedCellPopulation< DIM >::GetMutableMesh | ( | ) |
Definition at line 545 of file PottsBasedCellPopulation.cpp.
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.
index | the node index |
Implements AbstractCellPopulation< DIM >.
Definition at line 562 of file PottsBasedCellPopulation.cpp.
References EXCEPTION.
Node< DIM > * PottsBasedCellPopulation< DIM >::GetNode | ( | unsigned | index | ) | [virtual] |
Overridden GetNode() method.
index | global index of the specified node |
Implements AbstractCellPopulation< DIM >.
Definition at line 142 of file PottsBasedCellPopulation.cpp.
Referenced by VolumeConstraintPottsUpdateRule< DIM >::EvaluateHamiltonianContribution(), SurfaceAreaConstraintPottsUpdateRule< DIM >::EvaluateHamiltonianContribution(), ChemotaxisPottsUpdateRule< DIM >::EvaluateHamiltonianContribution(), and AdhesionPottsUpdateRule< DIM >::EvaluateHamiltonianContribution().
unsigned PottsBasedCellPopulation< DIM >::GetNumElements | ( | ) |
Definition at line 136 of file PottsBasedCellPopulation.cpp.
unsigned PottsBasedCellPopulation< DIM >::GetNumNodes | ( | ) | [virtual] |
Overridden GetNumNodes() method.
Implements AbstractCellPopulation< DIM >.
Definition at line 148 of file PottsBasedCellPopulation.cpp.
unsigned PottsBasedCellPopulation< DIM >::GetNumSweepsPerTimestep | ( | ) |
Definition at line 588 of file PottsBasedCellPopulation.cpp.
double PottsBasedCellPopulation< DIM >::GetTemperature | ( | ) |
Definition at line 576 of file PottsBasedCellPopulation.cpp.
double PottsBasedCellPopulation< DIM >::GetVolumeOfCell | ( | CellPtr | pCell | ) | [virtual] |
Overridden GetVolumeOfCell() method.
pCell | boost shared pointer to a cell |
Implements AbstractCellPopulation< DIM >.
Definition at line 391 of file PottsBasedCellPopulation.cpp.
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.
rDimension | a dimension (0,1 or 2) |
Implements AbstractCellPopulation< DIM >.
Definition at line 477 of file PottsBasedCellPopulation.cpp.
bool PottsBasedCellPopulation< DIM >::IsCellAssociatedWithADeletedLocation | ( | CellPtr | pCell | ) | [virtual] |
Overridden IsCellAssociatedWithADeletedLocation() method.
pCell | the cell |
Implements AbstractCellPopulation< DIM >.
Definition at line 317 of file PottsBasedCellPopulation.cpp.
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.
rParamsFile | the file stream to which the parameters are output |
Reimplemented from AbstractOnLatticeCellPopulation< DIM >.
Definition at line 552 of file PottsBasedCellPopulation.cpp.
References AbstractOnLatticeCellPopulation< DIM >::OutputCellPopulationParameters().
void PottsBasedCellPopulation< DIM >::RemoveAllUpdateRules | ( | ) |
Method to remove all the update rules
Definition at line 492 of file PottsBasedCellPopulation.cpp.
Referenced by OnLatticeSimulation< DIM >::RemoveAllPottsUpdateRules().
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.
Implements AbstractCellPopulation< DIM >.
Definition at line 184 of file PottsBasedCellPopulation.cpp.
const PottsMesh< DIM > & PottsBasedCellPopulation< DIM >::rGetMesh | ( | ) | const |
Definition at line 124 of file PottsBasedCellPopulation.cpp.
PottsMesh< DIM > & PottsBasedCellPopulation< DIM >::rGetMesh | ( | ) |
Reimplemented from AbstractCellPopulation< DIM >.
Definition at line 118 of file PottsBasedCellPopulation.cpp.
Referenced by VolumeConstraintPottsUpdateRule< DIM >::EvaluateHamiltonianContribution(), SurfaceAreaConstraintPottsUpdateRule< DIM >::EvaluateHamiltonianContribution(), and AdhesionPottsUpdateRule< DIM >::EvaluateHamiltonianContribution().
const std::vector< boost::shared_ptr< AbstractPottsUpdateRule< DIM > > > & PottsBasedCellPopulation< DIM >::rGetUpdateRuleCollection | ( | ) | const |
Get the collection of update rules to be used in this simulation.
Definition at line 498 of file PottsBasedCellPopulation.cpp.
Referenced by OnLatticeSimulation< DIM >::OutputAdditionalSimulationSetup().
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.
archive | the archive |
version | the 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.
void PottsBasedCellPopulation< DIM >::SetNumSweepsPerTimestep | ( | unsigned | numSweepsPerTimestep | ) |
Set mNumSweepsPerTimestep.
numSweepsPerTimestep | the number of MonteCarlo sweeps of the mesh performed each timestep |
Definition at line 582 of file PottsBasedCellPopulation.cpp.
void PottsBasedCellPopulation< DIM >::SetTemperature | ( | double | temperature | ) |
Set mTemperature.
temperature | the temperature of the system |
Definition at line 570 of file PottsBasedCellPopulation.cpp.
void PottsBasedCellPopulation< DIM >::Update | ( | bool | hasHadBirthsOrDeaths = true | ) | [virtual] |
Remove the PottsElements which have been marked as deleted, and update the correspondence with CellPtrs.
hasHadBirthsOrDeaths | - a bool saying whether cell population has had Births Or Deaths |
Implements AbstractCellPopulation< DIM >.
Definition at line 323 of file PottsBasedCellPopulation.cpp.
void PottsBasedCellPopulation< DIM >::UpdateCellLocations | ( | double | dt | ) | [virtual] |
Overridden UpdateCellLocations() method.
dt | time step |
Implements AbstractOnLatticeCellPopulation< DIM >.
Definition at line 204 of file PottsBasedCellPopulation.cpp.
References Node< SPACE_DIM >::GetIndex(), Node< SPACE_DIM >::GetNumContainingElements(), RandomNumberGenerator::Instance(), NEVER_REACHED, RandomNumberGenerator::randMod(), RandomNumberGenerator::ranf(), Node< SPACE_DIM >::rGetContainingElementIndices(), and RandomNumberGenerator::Shuffle().
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().
void PottsBasedCellPopulation< DIM >::WriteCellVolumeResultsToFile | ( | ) | [virtual] |
Overridden WriteCellVolumeResultsToFile() method.
Implements AbstractCellPopulation< DIM >.
Definition at line 403 of file PottsBasedCellPopulation.cpp.
References SimulationTime::GetTime(), and SimulationTime::Instance().
void PottsBasedCellPopulation< DIM >::WriteResultsToFiles | ( | ) | [virtual] |
Overridden WriteResultsToFiles() method.
Reimplemented from AbstractCellPopulation< DIM >.
Definition at line 344 of file PottsBasedCellPopulation.cpp.
References AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), SimulationTime::GetTime(), SimulationTime::Instance(), and AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::WriteResultsToFiles().
void PottsBasedCellPopulation< DIM >::WriteVtkResultsToFile | ( | ) | [private, virtual] |
Overridden WriteVtkResultsToFile() method.
Implements AbstractCellPopulation< DIM >.
Definition at line 594 of file PottsBasedCellPopulation.cpp.
References NodesOnlyMesh< SPACE_DIM >::ConstructNodesWithoutMesh(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorBegin(), CellPropertyCollection::GetProperties(), CellPropertyCollection::GetProperty(), SimulationTime::GetTimeStepsElapsed(), and SimulationTime::Instance().
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from AbstractOnLatticeCellPopulation< DIM >.
Definition at line 106 of file PottsBasedCellPopulation.hpp.
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().
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().
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.
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().
out_stream PottsBasedCellPopulation< DIM >::mpVizElementsFile [private] |
Results file for elements.
Definition at line 92 of file PottsBasedCellPopulation.hpp.
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().
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().