Chaste Release::3.1
|
#include <AbstractCellBasedSimulation.hpp>
An abstract cell-based simulation class. This class contains common functionality from off lattice and on lattice simulations.
The AbstractCellBasedSimulation is constructed with a CellPopulation, which updates the correspondence between each Cell and its spatial representation and handles cell division (governed by the CellCycleModel associated with each cell). Once constructed, one or more CellKillers may be passed to the AbstractCellBasedSimulation object to specify conditions in which Cells may die,
Subclasses use one or more Force laws or update rules (Which are passed to the child class object) to define the mechanical properties of the CellPopulation.
Definition at line 64 of file AbstractCellBasedSimulation.hpp.
AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::AbstractCellBasedSimulation | ( | AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > & | rCellPopulation, |
bool | deleteCellPopulationInDestructor = false , |
||
bool | initialiseCells = true |
||
) |
Constructor.
rCellPopulation | A cell population object |
deleteCellPopulationInDestructor | Whether to delete the cell population on destruction to free up memory (defaults to false) |
initialiseCells | Whether to initialise cells (defaults to true; set to false when loading from an archive) |
Definition at line 51 of file AbstractCellBasedSimulation.cpp.
References RandomNumberGenerator::Instance(), AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mInitialiseCells, and AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mrCellPopulation.
AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::~AbstractCellBasedSimulation | ( | ) | [virtual] |
Destructor.
This frees the cell population if it was created by de-serialization.
Definition at line 79 of file AbstractCellBasedSimulation.cpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::AddCellKiller | ( | boost::shared_ptr< AbstractCellKiller< SPACE_DIM > > | pCellKiller | ) |
Add a cell killer to be used in this simulation.
pCellKiller | pointer to a cell killer |
Definition at line 261 of file AbstractCellBasedSimulation.cpp.
virtual c_vector<double, SPACE_DIM> AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::CalculateCellDivisionVector | ( | CellPtr | pParentCell | ) | [protected, pure virtual] |
Method for determining how cell division occurs. This method returns a vector which is then passed into the CellPopulation method AddCell().
As this method is pure virtual, it must be overridden in subclasses.
pParentCell | the parent cell |
Implemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OnLatticeSimulation< DIM >, CryptSimulation1d, CryptSimulation2d, OffLatticeSimulation< DIM >, OffLatticeSimulation< 1 >, and OffLatticeSimulation< 2 >.
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::DoCellBirth | ( | ) | [protected, virtual] |
During a simulation time step, process any cell divisions that need to occur. If the simulation includes cell birth, causes (almost) all cells that are ready to divide to produce daughter cells.
Definition at line 101 of file AbstractCellBasedSimulation.cpp.
References Exception::GetShortMessage(), SimulationTime::GetTime(), SimulationTime::Instance(), and NEVER_REACHED.
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::DoCellRemoval | ( | ) | [protected] |
During a simulation time step, process any cell sloughing or death
This uses the cell killers to remove cells and associated nodes from the facade class.
Definition at line 164 of file AbstractCellBasedSimulation.cpp.
CellBasedPdeHandler< SPACE_DIM > * AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetCellBasedPdeHandler | ( | ) |
Definition at line 95 of file AbstractCellBasedSimulation.cpp.
double AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetDt | ( | ) |
Definition at line 192 of file AbstractCellBasedSimulation.cpp.
std::vector< double > AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetNodeLocation | ( | const unsigned & | rNodeIndex | ) |
Get a node's location (ONLY FOR TESTING).
rNodeIndex | the node index |
Definition at line 273 of file AbstractCellBasedSimulation.cpp.
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetNumBirths | ( | ) |
Definition at line 198 of file AbstractCellBasedSimulation.cpp.
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetNumDeaths | ( | ) |
Definition at line 204 of file AbstractCellBasedSimulation.cpp.
std::string AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetOutputDirectory | ( | ) |
Get the output directory of the simulation.
Definition at line 224 of file AbstractCellBasedSimulation.cpp.
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetOutputDivisionLocations | ( | ) |
Definition at line 504 of file AbstractCellBasedSimulation.cpp.
virtual void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::OutputAdditionalSimulationSetup | ( | out_stream & | rParamsFile | ) | [inline, protected, virtual] |
Helper method to output additional simulations parameters and information defined in subclasses to file.
rParamsFile | the file stream to which the parameters are output |
Reimplemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OnLatticeSimulation< DIM >, OffLatticeSimulation< DIM >, OffLatticeSimulation< 1 >, and OffLatticeSimulation< 2 >.
Definition at line 252 of file AbstractCellBasedSimulation.hpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::OutputSimulationParameters | ( | out_stream & | rParamsFile | ) | [pure virtual] |
Outputs simulation 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 |
Implemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OnLatticeSimulation< DIM >, CryptSimulation1d, CryptSimulation2d, OffLatticeSimulation< DIM >, OffLatticeSimulation< 1 >, and OffLatticeSimulation< 2 >.
Definition at line 562 of file AbstractCellBasedSimulation.cpp.
Referenced by OnLatticeSimulation< DIM >::OutputSimulationParameters(), and OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::OutputSimulationParameters().
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::OutputSimulationSetup | ( | ) | [protected] |
Helper method to output all the simulations parameters and information to file.
Definition at line 516 of file AbstractCellBasedSimulation.cpp.
References OutputFileHandler::OpenOutputFile(), ExecutableSupport::WriteLibraryInfo(), and ExecutableSupport::WriteMachineInfoFile().
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::RemoveAllCellKillers | ( | ) |
Method to remove all the cell killers
Definition at line 267 of file AbstractCellBasedSimulation.cpp.
const AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > & AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::rGetCellPopulation | ( | ) | const |
Definition at line 243 of file AbstractCellBasedSimulation.cpp.
AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > & AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::rGetCellPopulation | ( | ) |
Definition at line 237 of file AbstractCellBasedSimulation.cpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize | ( | Archive & | archive, |
const unsigned int | version | ||
) | [inline, private] |
Save or restore the simulation.
archive | the archive |
version | the current version of this class |
Reimplemented in DeltaNotchOffLatticeSimulation< DIM >, OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OnLatticeSimulation< DIM >, VolumeTrackedOffLatticeSimulation< DIM >, CryptSimulation1d, CryptSimulation2d, OffLatticeSimulation< DIM >, OffLatticeSimulation< 1 >, and OffLatticeSimulation< 2 >.
Definition at line 83 of file AbstractCellBasedSimulation.hpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetCellBasedPdeHandler | ( | CellBasedPdeHandler< SPACE_DIM > * | pCellBasedPdeHandler | ) |
Set mpCellBasedPdeHandler
pCellBasedPdeHandler | pointer to a CellBasedPdeHandler object |
Definition at line 89 of file AbstractCellBasedSimulation.cpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetDt | ( | double | dt | ) |
Set the timestep of the simulation.
dt | the timestep to use |
Definition at line 185 of file AbstractCellBasedSimulation.cpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetEndTime | ( | double | endTime | ) |
Set the end time and resets the timestep to be endtime/100.
endTime | the end time to use |
Definition at line 210 of file AbstractCellBasedSimulation.cpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetNoBirth | ( | bool | noBirth | ) |
Set the simulation to run with no birth.
noBirth | whether to run with no birth |
Definition at line 255 of file AbstractCellBasedSimulation.cpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetOutputDirectory | ( | std::string | outputDirectory | ) |
Set the output directory of the simulation.
outputDirectory | the output directory to use |
Definition at line 217 of file AbstractCellBasedSimulation.cpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetOutputDivisionLocations | ( | bool | outputDivisionLocations | ) |
Set mOutputDivisionLocations.
outputDivisionLocations | the new value of mOutputDivisionLocations |
Definition at line 510 of file AbstractCellBasedSimulation.cpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetSamplingTimestepMultiple | ( | unsigned | samplingTimestepMultiple | ) |
Set the ratio of the number of actual timesteps to the number of timesteps at which results are written to file. Default value is set to 1 by the constructor.
samplingTimestepMultiple | the ratio to use |
Definition at line 230 of file AbstractCellBasedSimulation.cpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetUpdateCellPopulationRule | ( | bool | updateCellPopulation | ) |
Set whether to update the topology of the cell population at each time step.
updateCellPopulation | whether to update the cell population each time step |
Definition at line 249 of file AbstractCellBasedSimulation.cpp.
virtual void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetupSolve | ( | ) | [inline, protected, virtual] |
A method for subclasses to do something at before the start of the time loop.
Reimplemented in DeltaNotchOffLatticeSimulation< DIM >, OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OnLatticeSimulation< DIM >, VolumeTrackedOffLatticeSimulation< DIM >, CryptSimulation2d, OffLatticeSimulation< DIM >, OffLatticeSimulation< 1 >, and OffLatticeSimulation< 2 >.
Definition at line 210 of file AbstractCellBasedSimulation.hpp.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::Solve | ( | ) |
Main solve method.
This method sets up the simulation time, creates output files, and initialises the cell population. It then iterates through a time loop. At each time step, first any cell death or birth is implemented, then the cell population topology is updated, then the forces are recalculated and the cell population evolved according to whatever force laws are present in the simulation, and finally the results for that time step are output to file. At the end of the time loop, the method closes any output files.
Definition at line 284 of file AbstractCellBasedSimulation.cpp.
References PetscTools::AmMaster(), GenericEventHandler< 11, CellBasedEventHandler >::BeginEvent(), DOUBLE_UNSET, GenericEventHandler< 11, CellBasedEventHandler >::EndEvent(), EXCEPTION, SimulationTime::GetTime(), SimulationTime::GetTimeStepsElapsed(), SimulationTime::IncrementTimeOneStep(), SimulationTime::Instance(), SimulationTime::IsEndTimeAndNumberOfTimeStepsSetUp(), SimulationTime::IsFinished(), OutputFileHandler::OpenOutputFile(), SimulationTime::ResetEndTimeAndNumberOfTimeSteps(), and SimulationTime::SetEndTimeAndNumberOfTimeSteps().
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::StoppingEventHasOccurred | ( | ) | [protected, virtual] |
A child class can overload this if they want the simulation to stop based on certain conditions before the specified end time (for example, run until a crypt becomes monoclonal).
Definition at line 463 of file AbstractCellBasedSimulation.cpp.
virtual void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::UpdateAtEndOfSolve | ( | ) | [inline, protected, virtual] |
This method may be overridden in subclasses to do something at the end of each time loop.
Reimplemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OnLatticeSimulation< DIM >, CryptSimulation2d, OffLatticeSimulation< DIM >, OffLatticeSimulation< 1 >, and OffLatticeSimulation< 2 >.
Definition at line 218 of file AbstractCellBasedSimulation.hpp.
virtual void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::UpdateAtEndOfTimeStep | ( | ) | [inline, protected, virtual] |
A method for subclasses to do something at the end of each timestep.
Reimplemented in DeltaNotchOffLatticeSimulation< DIM >, VolumeTrackedOffLatticeSimulation< DIM >, and CryptSimulation2d.
Definition at line 203 of file AbstractCellBasedSimulation.hpp.
Referenced by DeltaNotchOffLatticeSimulation< DIM >::UpdateAtEndOfTimeStep().
virtual void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::UpdateCellLocationsAndTopology | ( | ) | [protected, pure virtual] |
Updates the locations and topology of cells, must be defined in subclasses.
For example this calculates forces and updates node positions in off lattice simulations.
Implemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OnLatticeSimulation< DIM >, OffLatticeSimulation< DIM >, OffLatticeSimulation< 1 >, and OffLatticeSimulation< 2 >.
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::UpdateCellPopulation | ( | ) | [protected, virtual] |
Calls the deaths, births and (if mUpdateCellPopulation is true) CellPopulation::Update() methods.
Reimplemented in OnLatticeSimulation< DIM >.
Definition at line 469 of file AbstractCellBasedSimulation.cpp.
References GenericEventHandler< 11, CellBasedEventHandler >::BeginEvent(), GenericEventHandler< 11, CellBasedEventHandler >::EndEvent(), and EXCEPTION.
Referenced by OnLatticeSimulation< DIM >::UpdateCellPopulation().
virtual void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::WriteVisualizerSetupFile | ( | ) | [inline, protected, virtual] |
Writes out special information about the mesh to the visualizer.
Reimplemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OnLatticeSimulation< DIM >, OffLatticeSimulation< DIM >, OffLatticeSimulation< 1 >, and OffLatticeSimulation< 2 >.
Definition at line 164 of file AbstractCellBasedSimulation.hpp.
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented in DeltaNotchOffLatticeSimulation< DIM >, OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OnLatticeSimulation< DIM >, VolumeTrackedOffLatticeSimulation< DIM >, CryptSimulation1d, CryptSimulation2d, OffLatticeSimulation< DIM >, OffLatticeSimulation< 1 >, and OffLatticeSimulation< 2 >.
Definition at line 74 of file AbstractCellBasedSimulation.hpp.
std::vector<boost::shared_ptr<AbstractCellKiller<SPACE_DIM> > > AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mCellKillers [protected] |
List of cell killers.
Definition at line 148 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< DIM >::serialize().
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mDeleteCellPopulationInDestructor [protected] |
Whether to delete the cell population in the destructor.
Definition at line 115 of file AbstractCellBasedSimulation.hpp.
double AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mDt [protected] |
Time step.
Definition at line 106 of file AbstractCellBasedSimulation.hpp.
Referenced by OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::OffLatticeSimulation(), and AbstractCellBasedSimulation< DIM >::serialize().
double AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mEndTime [protected] |
Time to run the Solve() method up to.
Definition at line 109 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< DIM >::serialize().
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mInitialiseCells [protected] |
Whether to initialise the cells.
Definition at line 118 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::AbstractCellBasedSimulation().
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mNoBirth [protected] |
Whether to run the simulation with no birth (defaults to false).
Definition at line 121 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< DIM >::serialize().
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mNumBirths [protected] |
Counts the number of births during the simulation.
Definition at line 136 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< DIM >::serialize().
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mNumDeaths [protected] |
Counts the number of deaths during the simulation.
Definition at line 139 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< DIM >::serialize().
std::string AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mOutputDirectory [protected] |
Output directory (a subfolder of tmp/[USERNAME]/testoutput).
Definition at line 127 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< DIM >::serialize().
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mOutputDivisionLocations [protected] |
Whether to output the locations of division events (defaults to false).
Definition at line 142 of file AbstractCellBasedSimulation.hpp.
CellBasedPdeHandler<SPACE_DIM>* AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mpCellBasedPdeHandler [protected] |
Pointer to a CellBasedPdeHandler object.
Definition at line 159 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< DIM >::serialize().
out_stream AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mpDivisionLocationFile [protected] |
Output file for location of division events.
Definition at line 145 of file AbstractCellBasedSimulation.hpp.
out_stream AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mpVizSetupFile [protected] |
Visualizer setup file.
Definition at line 133 of file AbstractCellBasedSimulation.hpp.
AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>& AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mrCellPopulation [protected] |
Facade encapsulating cells in the cell population being simulated.
Definition at line 112 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::AbstractCellBasedSimulation().
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mSamplingTimestepMultiple [protected] |
The ratio of the number of actual timesteps to the number of timesteps at which results are written to file.
Definition at line 154 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< DIM >::serialize().
std::string AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mSimulationOutputDirectory [protected] |
Simulation Output directory either the same as mOutputDirectory or includes mOutputDirectory/results_from_time_[TIME].
Definition at line 130 of file AbstractCellBasedSimulation.hpp.
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mUpdateCellPopulation [protected] |
Whether to update the topology of the cell population at each time step (defaults to true).
Definition at line 124 of file AbstractCellBasedSimulation.hpp.
Referenced by AbstractCellBasedSimulation< DIM >::serialize().