Chaste Release::3.1
|
#include <MultipleCaBasedCellPopulation.hpp>
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< unsigned > | GetNeighbouringNodeIndices (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< unsigned > | mAvailableSpaces |
Friends | |
class | TestMultipleCaBasedCellPopulation |
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 69 of file MultipleCaBasedCellPopulation.hpp.
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.
rMesh | reference to a PottsMesh |
rCells | reference to a vector of CellPtrs |
locationIndices | an optional vector of location indices that correspond to real cells |
latticeCarryingCapacity | an optional parameter to allow more than one cell per site |
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 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.
MultipleCaBasedCellPopulation< DIM >::MultipleCaBasedCellPopulation | ( | PottsMesh< DIM > & | rMesh | ) |
Constructor for use by the de-serializer.
rMesh | a vertex mesh. |
Definition at line 89 of file MultipleCaBasedCellPopulation.cpp.
MultipleCaBasedCellPopulation< DIM >::~MultipleCaBasedCellPopulation | ( | ) | [virtual] |
Destructor, which frees any memory allocated by the constructor.
Definition at line 95 of file MultipleCaBasedCellPopulation.cpp.
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.
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 176 of file MultipleCaBasedCellPopulation.cpp.
References EXCEPTION, PottsMesh< DIM >::GetMooreNeighbouringNodeIndices(), RandomNumberGenerator::Instance(), RandomNumberGenerator::randMod(), and UNSIGNED_UNSET.
void MultipleCaBasedCellPopulation< DIM >::AddCellUsingLocationIndex | ( | unsigned | index, |
CellPtr | pCell | ||
) | [virtual] |
Overridden AddCellUsingLocationIndex method to add a cell to a given location index. Also updates mAvailableSpaces
index | the location index |
pCell | the cell. |
Reimplemented from AbstractCellPopulation< DIM >.
Definition at line 155 of file MultipleCaBasedCellPopulation.cpp.
References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::AddCellUsingLocationIndex(), and EXCEPTION.
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).
pUpdateRule | pointer to an update rule |
Definition at line 492 of file MultipleCaBasedCellPopulation.cpp.
Referenced by OnLatticeSimulation< DIM >::AddMultipleCaUpdateRule().
void MultipleCaBasedCellPopulation< DIM >::CloseOutputFiles | ( | ) | [virtual] |
Overridden CloseOutputFiles() method.
Reimplemented from AbstractCellPopulation< DIM >.
Definition at line 381 of file MultipleCaBasedCellPopulation.cpp.
References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::CloseOutputFiles().
void MultipleCaBasedCellPopulation< 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 372 of file MultipleCaBasedCellPopulation.cpp.
References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::CreateOutputFiles(), and OutputFileHandler::OpenOutputFile().
void MultipleCaBasedCellPopulation< DIM >::GenerateCellResultsAndWriteToFiles | ( | ) | [virtual] |
Overridden GenerateCellResultsAndWriteToFiles() method.
Implements AbstractCellPopulation< DIM >.
Definition at line 454 of file MultipleCaBasedCellPopulation.cpp.
c_vector< double, DIM > MultipleCaBasedCellPopulation< 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 143 of file MultipleCaBasedCellPopulation.cpp.
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.
index | the node index |
Implements AbstractCellPopulation< DIM >.
Definition at line 517 of file MultipleCaBasedCellPopulation.cpp.
References EXCEPTION.
Node< DIM > * MultipleCaBasedCellPopulation< DIM >::GetNode | ( | unsigned | index | ) | [virtual] |
Overridden GetNode() method.
index | global index of the specified node |
Implements AbstractCellPopulation< DIM >.
Definition at line 131 of file MultipleCaBasedCellPopulation.cpp.
Referenced by DiffusionMultipleCaUpdateRule< DIM >::EvaluateProbability().
Node< DIM > * MultipleCaBasedCellPopulation< DIM >::GetNodeCorrespondingToCell | ( | CellPtr | pCell | ) |
Get a pointer to the node corresponding to a given CellPtr.
pCell | the cell |
Definition at line 149 of file MultipleCaBasedCellPopulation.cpp.
unsigned MultipleCaBasedCellPopulation< DIM >::GetNumNodes | ( | ) | [virtual] |
Overridden GetNumNodes() method.
Implements AbstractCellPopulation< DIM >.
Definition at line 137 of file MultipleCaBasedCellPopulation.cpp.
Referenced by MultipleCaBasedCellPopulation< DIM >::MultipleCaBasedCellPopulation().
double MultipleCaBasedCellPopulation< DIM >::GetVolumeOfCell | ( | CellPtr | pCell | ) | [virtual] |
Overridden GetVolumeOfCell() method.
pCell | boost shared pointer to a cell |
Implements AbstractCellPopulation< DIM >.
Definition at line 446 of file MultipleCaBasedCellPopulation.cpp.
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.
rDimension | a dimension (0,1 or 2) |
Implements AbstractCellPopulation< DIM >.
Definition at line 483 of file MultipleCaBasedCellPopulation.cpp.
bool MultipleCaBasedCellPopulation< DIM >::IsCellAssociatedWithADeletedLocation | ( | CellPtr | pCell | ) | [virtual] |
Overridden IsCellAssociatedWithADeletedLocation() method.
pCell | the cell |
Implements AbstractCellPopulation< DIM >.
Definition at line 361 of file MultipleCaBasedCellPopulation.cpp.
bool MultipleCaBasedCellPopulation< DIM >::IsSiteAvailable | ( | unsigned | index | ) |
Find if a given node Has space available.
index | the global index of a specified node |
Definition at line 113 of file MultipleCaBasedCellPopulation.cpp.
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.
rParamsFile | the file stream to which the parameters are output |
Reimplemented from AbstractOnLatticeCellPopulation< DIM >.
Definition at line 510 of file MultipleCaBasedCellPopulation.cpp.
References AbstractOnLatticeCellPopulation< DIM >::OutputCellPopulationParameters().
void MultipleCaBasedCellPopulation< DIM >::RemoveAllUpdateRules | ( | ) |
Method to remove all the update rules
Definition at line 498 of file MultipleCaBasedCellPopulation.cpp.
Referenced by OnLatticeSimulation< DIM >::RemoveAllMultipleCaUpdateRules().
void MultipleCaBasedCellPopulation< DIM >::RemoveCellUsingLocationIndex | ( | unsigned | index, |
CellPtr | pCell | ||
) | [virtual] |
Overridden AddCellUsingLocationIndex method to remove a cell from a given location index. Also updates mAvailableSpaces
index | the location index |
pCell | the cell. |
Reimplemented from AbstractCellPopulation< DIM >.
Definition at line 166 of file MultipleCaBasedCellPopulation.cpp.
References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::RemoveCellUsingLocationIndex().
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.
Implements AbstractCellPopulation< DIM >.
Definition at line 240 of file MultipleCaBasedCellPopulation.cpp.
std::vector< unsigned > & MultipleCaBasedCellPopulation< DIM >::rGetAvailableSpaces | ( | ) |
Definition at line 107 of file MultipleCaBasedCellPopulation.cpp.
const PottsMesh< DIM > & MultipleCaBasedCellPopulation< DIM >::rGetMesh | ( | ) | const |
Definition at line 125 of file MultipleCaBasedCellPopulation.cpp.
PottsMesh< DIM > & MultipleCaBasedCellPopulation< DIM >::rGetMesh | ( | ) |
Reimplemented from AbstractCellPopulation< DIM >.
Definition at line 119 of file MultipleCaBasedCellPopulation.cpp.
Referenced by DiffusionMultipleCaUpdateRule< DIM >::EvaluateProbability().
const std::vector< boost::shared_ptr< AbstractMultipleCaUpdateRule< DIM > > > & MultipleCaBasedCellPopulation< DIM >::rGetUpdateRuleCollection | ( | ) | const |
Get the collection of update rules to be used in this simulation.
Definition at line 504 of file MultipleCaBasedCellPopulation.cpp.
Referenced by OnLatticeSimulation< DIM >::OutputAdditionalSimulationSetup().
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.
archive | the archive |
version | the 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.
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.
rEmptySiteIndices | set of node indices corresponding to empty sites |
void MultipleCaBasedCellPopulation< DIM >::Update | ( | bool | hasHadBirthsOrDeaths = true | ) | [virtual] |
Overridden Update() method.
Checks association of nodes with CellPtrs.
hasHadBirthsOrDeaths | - a bool saying whether cell population has had Births Or Deaths |
Implements AbstractCellPopulation< DIM >.
Definition at line 367 of file MultipleCaBasedCellPopulation.cpp.
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.
dt | time step |
Implements AbstractOnLatticeCellPopulation< DIM >.
Definition at line 265 of file MultipleCaBasedCellPopulation.cpp.
References EXCEPTION, PottsMesh< DIM >::GetMooreNeighbouringNodeIndices(), RandomNumberGenerator::Instance(), NEVER_REACHED, and RandomNumberGenerator::ranf().
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.
void MultipleCaBasedCellPopulation< DIM >::WriteCellVolumeResultsToFile | ( | ) | [virtual] |
Overridden WriteCellVolumeResultsToFile() method.
Implements AbstractCellPopulation< DIM >.
Definition at line 413 of file MultipleCaBasedCellPopulation.cpp.
References SimulationTime::GetTime(), and SimulationTime::Instance().
void MultipleCaBasedCellPopulation< DIM >::WriteResultsToFiles | ( | ) | [virtual] |
Overridden WriteResultsToFiles() method.
Reimplemented from AbstractCellPopulation< DIM >.
Definition at line 388 of file MultipleCaBasedCellPopulation.cpp.
References SimulationTime::GetTime(), SimulationTime::Instance(), and AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::WriteResultsToFiles().
void MultipleCaBasedCellPopulation< DIM >::WriteVtkResultsToFile | ( | ) | [private, virtual] |
Overridden WriteVtkResultsToFile() method.
Implements AbstractCellPopulation< DIM >.
Definition at line 525 of file MultipleCaBasedCellPopulation.cpp.
References NodesOnlyMesh< SPACE_DIM >::ConstructNodesWithoutMesh(), SimulationTime::GetTimeStepsElapsed(), RandomNumberGenerator::Instance(), SimulationTime::Instance(), RandomNumberGenerator::ranf(), and UNSIGNED_UNSET.
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from AbstractOnLatticeCellPopulation< DIM >.
Definition at line 95 of file MultipleCaBasedCellPopulation.hpp.
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().
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().
out_stream MultipleCaBasedCellPopulation< DIM >::mpVizLocationsFile [private] |
Results file for cell locations.
Definition at line 80 of file MultipleCaBasedCellPopulation.hpp.
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().