Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM > Class Template Referenceabstract

#include <AbstractCellBasedSimulation.hpp>

+ Inheritance diagram for AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >:
+ Collaboration diagram for AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >:

Public Member Functions

 AbstractCellBasedSimulation (AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation, bool deleteCellPopulationInDestructor=false, bool initialiseCells=true)
 
virtual ~AbstractCellBasedSimulation ()
 
std::vector< doubleGetNodeLocation (const unsigned &rNodeIndex)
 
double GetDt ()
 
unsigned GetNumBirths ()
 
unsigned GetNumDeaths ()
 
std::string GetOutputDirectory ()
 
void SetDt (double dt)
 
void SetEndTime (double endTime)
 
void SetOutputDirectory (std::string outputDirectory)
 
void SetSamplingTimestepMultiple (unsigned samplingTimestepMultiple)
 
void SetUpdatingTimestepMultiple (unsigned updatingTimestepMultiple)
 
void SetNoBirth (bool noBirth)
 
void SetUpdateCellPopulationRule (bool updateCellPopulation)
 
bool GetUpdateCellPopulationRule ()
 
void AddCellKiller (boost::shared_ptr< AbstractCellKiller< SPACE_DIM > > pCellKiller)
 
void RemoveAllCellKillers ()
 
void AddSimulationModifier (boost::shared_ptr< AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM > > pSimulationModifier)
 
std::vector< boost::shared_ptr< AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM > > > * GetSimulationModifiers ()
 
void AddTopologyUpdateSimulationModifier (boost::shared_ptr< AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM > > pSimulationModifier)
 
std::vector< boost::shared_ptr< AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM > > > * GetTopologyUpdateSimulationModifiers ()
 
void Solve ()
 
AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > & rGetCellPopulation ()
 
const AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > & rGetCellPopulation () const
 
bool GetOutputDivisionLocations ()
 
void SetOutputDivisionLocations (bool outputDivisionLocations)
 
bool GetOutputCellVelocities ()
 
void SetOutputCellVelocities (bool outputCellVelocities)
 
virtual void OutputSimulationParameters (out_stream &rParamsFile)=0
 
- Public Member Functions inherited from Identifiable
virtual ~Identifiable ()
 
std::string GetIdentifier () const
 

Protected Member Functions

virtual void WriteVisualizerSetupFile ()
 
virtual unsigned DoCellBirth ()
 
unsigned DoCellRemoval ()
 
virtual void SetupSolve ()
 
virtual bool StoppingEventHasOccurred ()
 
virtual void UpdateCellPopulation ()
 
virtual void UpdateCellLocationsAndTopology ()=0
 
void OutputSimulationSetup ()
 
virtual void OutputAdditionalSimulationSetup (out_stream &rParamsFile)=0
 

Protected Attributes

double mDt
 
double mEndTime
 
AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > & mrCellPopulation
 
bool mDeleteCellPopulationInDestructor
 
bool mInitialiseCells
 
bool mNoBirth
 
bool mUpdateCellPopulation
 
std::string mOutputDirectory
 
std::string mSimulationOutputDirectory
 
out_stream mpVizSetupFile
 
unsigned mNumBirths
 
unsigned mNumDeaths
 
bool mOutputDivisionLocations
 
out_stream mpDivisionLocationFile
 
bool mOutputCellVelocities
 
out_stream mpCellVelocitiesFile
 
std::vector< boost::shared_ptr< AbstractCellKiller< SPACE_DIM > > > mCellKillers
 
std::vector< boost::shared_ptr< AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM > > > mSimulationModifiers
 
std::vector< boost::shared_ptr< AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM > > > mTopologyUpdateSimulationModifiers
 
unsigned mSamplingTimestepMultiple
 
unsigned mUpdatingTimestepMultiple
 

Private Member Functions

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

Friends

class TestCryptSimulation2d
 
class TestOffLatticeSimulation3d
 
class TestOffLatticeSimulation
 
class boost::serialization::access
 

Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
class AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >

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 68 of file AbstractCellBasedSimulation.hpp.

Constructor & Destructor Documentation

◆ AbstractCellBasedSimulation()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::AbstractCellBasedSimulation ( AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &  rCellPopulation,
bool  deleteCellPopulationInDestructor = false,
bool  initialiseCells = true 
)

Constructor.

Parameters
rCellPopulationA cell population object
deleteCellPopulationInDestructorWhether to delete the cell population on destruction to free up memory (defaults to false)
initialiseCellsWhether to initialise cells (defaults to true; set to false when loading from an archive)

Definition at line 49 of file AbstractCellBasedSimulation.cpp.

References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::GetDefaultTimeStep(), RandomNumberGenerator::Instance(), AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mDt, AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mInitialiseCells, and AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mrCellPopulation.

◆ ~AbstractCellBasedSimulation()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::~AbstractCellBasedSimulation ( )
virtual

Destructor.

This frees the cell population if it was created by de-serialization.

Definition at line 84 of file AbstractCellBasedSimulation.cpp.

Member Function Documentation

◆ AddCellKiller()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::AddCellKiller ( boost::shared_ptr< AbstractCellKiller< SPACE_DIM > >  pCellKiller)

Add a cell killer to be used in this simulation.

Parameters
pCellKillerpointer to a cell killer

Definition at line 266 of file AbstractCellBasedSimulation.cpp.

Referenced by VertexBasedCellPopulation< DIM >::SimulationSetupHook().

◆ AddSimulationModifier()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::AddSimulationModifier ( boost::shared_ptr< AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM > >  pSimulationModifier)

Add a SimulationModifier to be used in this simulation.

Parameters
pSimulationModifierpointer to a SimulationModifier

Definition at line 278 of file AbstractCellBasedSimulation.cpp.

◆ AddTopologyUpdateSimulationModifier()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::AddTopologyUpdateSimulationModifier ( boost::shared_ptr< AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM > >  pSimulationModifier)

Add a Topology SimulationModifier to be used in this simulation. This modifier updates cell population after topology has been changed (e.g. after T1 swap or cell division in case of vertex based models) and before cell locations updated. This can be useful when a topology update (e.g. cell division) influences movement of cells.

Parameters
pSimulationModifierpointer to a SimulationModifier

Definition at line 290 of file AbstractCellBasedSimulation.cpp.

◆ DoCellBirth()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::DoCellBirth ( )
protectedvirtual

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.

If mOutputDivisionLocations is set to true, then this method also writes the location of each cell division at the present time to mpDivisionLocationFile. This outputs a line of tab-separated values of the form: [time] [div 0 x-pos] [div 0 y-pos] [div 0 z-pos] [div 0 age] [div 1 x-pos] [div 1 y-pos] [div 1 z-pos] [div 1 age] ...

with [y-pos] and [z-pos] included for 2 and 3 dimensional simulations, respectively, and [...age] denoting the age of the dividing cell.

Returns
the number of births that occurred.

If required, output this location to file

Division Time, Location of Parent Cell (x,y,z), Age on Division, Parent Cell ID, New Cell ID.

Definition at line 93 of file AbstractCellBasedSimulation.cpp.

References SimulationTime::GetTime(), and SimulationTime::Instance().

◆ DoCellRemoval()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
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.

Returns
the number of deaths that occurred.

Definition at line 156 of file AbstractCellBasedSimulation.cpp.

◆ GetDt()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetDt ( )
Returns
the timestep of the simulation

Definition at line 184 of file AbstractCellBasedSimulation.cpp.

◆ GetNodeLocation()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< double > AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetNodeLocation ( const unsigned rNodeIndex)

Get a node's location (ONLY FOR TESTING).

Parameters
rNodeIndexthe node index
Returns
the co-ordinates of this node.

Definition at line 302 of file AbstractCellBasedSimulation.cpp.

◆ GetNumBirths()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetNumBirths ( )
Returns
the number of births that have occurred in the entire simulation (since t=0)

Definition at line 190 of file AbstractCellBasedSimulation.cpp.

◆ GetNumDeaths()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetNumDeaths ( )
Returns
the number of deaths that have occurred in the entire simulation (since t=0).

Definition at line 196 of file AbstractCellBasedSimulation.cpp.

◆ GetOutputCellVelocities()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetOutputCellVelocities ( )
Returns
mOutputCellVelocities

Definition at line 665 of file AbstractCellBasedSimulation.cpp.

◆ GetOutputDirectory()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::string AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetOutputDirectory ( )
Returns
the output directory of the simulation.

Definition at line 216 of file AbstractCellBasedSimulation.cpp.

◆ GetOutputDivisionLocations()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetOutputDivisionLocations ( )
Returns
mOutputDivisionLocations

Definition at line 653 of file AbstractCellBasedSimulation.cpp.

◆ GetSimulationModifiers()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< boost::shared_ptr< AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM > > > * AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetSimulationModifiers ( )
Returns
a pointer to the vector of SimulationModifiers used in this simulation.

Definition at line 284 of file AbstractCellBasedSimulation.cpp.

◆ GetTopologyUpdateSimulationModifiers()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< boost::shared_ptr< AbstractCellBasedSimulationModifier< ELEMENT_DIM, SPACE_DIM > > > * AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetTopologyUpdateSimulationModifiers ( )
Returns
a pointer to the vector of SimulationModifiers that influence topology update in this simulation.

Definition at line 296 of file AbstractCellBasedSimulation.cpp.

◆ GetUpdateCellPopulationRule()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::GetUpdateCellPopulationRule ( )

Return whether to update the topology of the cell population at each time step.

Returns
whether to update the cell population each time step

Definition at line 254 of file AbstractCellBasedSimulation.cpp.

◆ OutputAdditionalSimulationSetup()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
virtual void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::OutputAdditionalSimulationSetup ( out_stream &  rParamsFile)
protectedpure virtual

Helper method to output additional simulations parameters and information defined in subclasses to file.

As this method is pure virtual, it must be overridden in subclasses.

Parameters
rParamsFilethe file stream to which the parameters are output

Implemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OffLatticeSimulation< 1 >, OffLatticeSimulation< 2 >, and OnLatticeSimulation< DIM >.

◆ OutputSimulationParameters()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
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.

Parameters
rParamsFilethe file stream to which the parameters are output

Implemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OffLatticeSimulation< 1 >, OffLatticeSimulation< 2 >, OnLatticeSimulation< DIM >, CryptSimulation1d, and CryptSimulation2d.

Definition at line 740 of file AbstractCellBasedSimulation.cpp.

Referenced by OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::OutputSimulationParameters(), and OnLatticeSimulation< DIM >::OutputSimulationParameters().

◆ OutputSimulationSetup()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::OutputSimulationSetup ( )
protected

◆ RemoveAllCellKillers()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::RemoveAllCellKillers ( )

Method to remove all the cell killers.

Definition at line 272 of file AbstractCellBasedSimulation.cpp.

◆ rGetCellPopulation() [1/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > & AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::rGetCellPopulation ( )
Returns
reference to the cell population.

Definition at line 236 of file AbstractCellBasedSimulation.cpp.

◆ rGetCellPopulation() [2/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
const AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > & AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::rGetCellPopulation ( ) const
Returns
const reference to the cell population (used in archiving).

Definition at line 242 of file AbstractCellBasedSimulation.cpp.

◆ serialize()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
template<class Archive >
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize ( Archive &  archive,
const unsigned int  version 
)
inlineprivate

◆ SetDt()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetDt ( double  dt)

Set the timestep of the simulation.

Parameters
dtthe timestep to use

Definition at line 177 of file AbstractCellBasedSimulation.cpp.

◆ SetEndTime()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetEndTime ( double  endTime)

Set the end time and resets the timestep to be endtime/100.

Parameters
endTimethe end time to use

Definition at line 202 of file AbstractCellBasedSimulation.cpp.

◆ SetNoBirth()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetNoBirth ( bool  noBirth)

Set the simulation to run with no birth.

Parameters
noBirthwhether to run with no birth

Definition at line 260 of file AbstractCellBasedSimulation.cpp.

◆ SetOutputCellVelocities()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetOutputCellVelocities ( bool  outputCellVelocities)

Set mOutputCellVelocities.

Parameters
outputCellVelocitiesthe new value of mOutputCellVelocities

Definition at line 671 of file AbstractCellBasedSimulation.cpp.

◆ SetOutputDirectory()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetOutputDirectory ( std::string  outputDirectory)

Set the output directory of the simulation.

Parameters
outputDirectorythe output directory to use

Definition at line 209 of file AbstractCellBasedSimulation.cpp.

◆ SetOutputDivisionLocations()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetOutputDivisionLocations ( bool  outputDivisionLocations)

Set mOutputDivisionLocations.

Parameters
outputDivisionLocationsthe new value of mOutputDivisionLocations

Definition at line 659 of file AbstractCellBasedSimulation.cpp.

◆ SetSamplingTimestepMultiple()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
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.

Parameters
samplingTimestepMultiplethe ratio to use

Definition at line 222 of file AbstractCellBasedSimulation.cpp.

◆ SetUpdateCellPopulationRule()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetUpdateCellPopulationRule ( bool  updateCellPopulation)

Set whether to update the topology of the cell population at each time step.

Parameters
updateCellPopulationwhether to update the cell population each time step

Definition at line 248 of file AbstractCellBasedSimulation.cpp.

◆ SetUpdatingTimestepMultiple()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetUpdatingTimestepMultiple ( unsigned  updatingTimestepMultiple)

Set the ratio of the number of actual timesteps to the number of timesteps at which the cells are updated. Default value is set to 1 by the constructor.

Parameters
updatingTimestepMultiplethe ratio to use

Definition at line 229 of file AbstractCellBasedSimulation.cpp.

◆ SetupSolve()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
virtual void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::SetupSolve ( )
inlineprotectedvirtual

A method for subclasses to do something at before the start of the time loop.

Reimplemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OffLatticeSimulation< 1 >, OffLatticeSimulation< 2 >, and CryptSimulation2d.

Definition at line 224 of file AbstractCellBasedSimulation.hpp.

◆ Solve()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::Solve ( )

Main Solve() method, used to evolve the cell population. Note that prior to calling Solve() we must have called SetEndTime(). We may also have optionally called SetDt(); if not, then a default time step is used.

The Solve() method proceeds as follows.

Setting up:

First, we set up SimulationTime, which (i) provides a globally consistent time, accessible to all other classes in the cell_based code and (ii) handles any rounding issues when the time step does not exactly divide the end time.

Next, we create output files. We then call SetupSolve(), which is empty in the parent class but may be overridden, e.g. to open additional output files. We then call SetupSolve() on any member objects inheriting from AbstractCellBasedSimulationModifier. This class hierarchy allows the user to introduce new ways of updating the cell population within the simulation.

Next, we set up each cell by calling ReadyToDivide() on it, which updates the cell's age and cell cycle model. Finally, we call WriteVisualizerSetupFile() and OutputSimulationSetup(), as well as WriteResultsToFiles() on the cell population, to record the initial configuration. This completes the set up process.

The main time loop:

At each time step, we begin by calling UpdateCellPopulation(), which implements any cell deaths and cell divisions through DoCellRemoval() and DoCellBirth() respectively. We then update the correspondence between cells and the mesh by calling Update() on the cell population.

If mOutputCellVelocities is set to true and we are at a printing time, then we als write the velocity of each cell at the present time to mpCellVelocitiesFile. This outputs a line of tab-separated values of the form: [time] [cell 0 x-pos] [cell 0 y-pos] [cell 0 z-pos] [cell 0 x-vel] [cell 0 y-vel] [cell 0 z-vel] ...

with [y-pos] and [z-pos] included for 2 and 3 dimensional simulations, respectively, and data for cells being ordered as given by the cell population Iterator.

Next, we call UpdateCellLocationsAndTopology(), which is pure virtual in the parent class so must be overridden. As the cell population has been updated, we then increment SimulationTime by one time step. We then call UpdateAtEndOfTimeStep() on any AbstractCellBasedSimulationModifiers present, e.g. to write additional output. In an analogous manner to the calls to SetupSolve() prior to entering the main time loop.

The last step within the main time loop is to output the present results to file.

Finishing up:

After exiting the main time loop, we call UpdateCellPopulation() in order to carry out a final update of the cell population. We also call UpdateAtEndOfSolve()} on any member objects inheriting from AbstractCellBasedSimulationModifier in an analogous manner to the aforementioned calls to SetupSolve() UpdateAtEndOfTimeStep(). Finally, we close output files. This completes the Solve() method.

Definition at line 313 of file AbstractCellBasedSimulation.cpp.

◆ StoppingEventHasOccurred()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::StoppingEventHasOccurred ( )
protectedvirtual

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).

Returns
true if stopping event has occurred

Definition at line 600 of file AbstractCellBasedSimulation.cpp.

◆ UpdateCellLocationsAndTopology()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
virtual void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::UpdateCellLocationsAndTopology ( )
protectedpure virtual

Update the cell locations and topology (connectivity) of the cell population. This method is called within the main time loop of Solve() .

As this method is pure virtual, it must be overridden in subclasses.

In the case of an OffLatticeSimulation, the method computes the force acting on each node (corresponding to a cell in centre-based models and to a vertex in vertex-based models) and integrates equations of motion to find the new position of each node.

In the case of an OnLatticeSimulation, the method performs Monte Carlo updating of the cell population, through a call to UpdateCellLocations() on the cell population object.

Implemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OffLatticeSimulation< 1 >, OffLatticeSimulation< 2 >, and OnLatticeSimulation< DIM >.

◆ UpdateCellPopulation()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::UpdateCellPopulation ( )
protectedvirtual

◆ WriteVisualizerSetupFile()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
virtual void AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::WriteVisualizerSetupFile ( )
inlineprotectedvirtual

Writes out special information about the mesh to the visualizer.

Reimplemented in OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >, OffLatticeSimulation< 1 >, and OffLatticeSimulation< 2 >.

Definition at line 190 of file AbstractCellBasedSimulation.hpp.

Friends And Related Symbol Documentation

◆ boost::serialization::access

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
friend class boost::serialization::access
friend

Needed for serialization.

Definition at line 78 of file AbstractCellBasedSimulation.hpp.

◆ TestCryptSimulation2d

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
friend class TestCryptSimulation2d
friend

Definition at line 71 of file AbstractCellBasedSimulation.hpp.

◆ TestOffLatticeSimulation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
friend class TestOffLatticeSimulation
friend

Definition at line 73 of file AbstractCellBasedSimulation.hpp.

◆ TestOffLatticeSimulation3d

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
friend class TestOffLatticeSimulation3d
friend

Definition at line 72 of file AbstractCellBasedSimulation.hpp.

Member Data Documentation

◆ mCellKillers

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
std::vector<boost::shared_ptr<AbstractCellKiller<SPACE_DIM> > > AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mCellKillers
protected

List of cell killers.

Definition at line 165 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mDeleteCellPopulationInDestructor

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mDeleteCellPopulationInDestructor
protected

Whether to delete the cell population in the destructor.

Definition at line 123 of file AbstractCellBasedSimulation.hpp.

Referenced by CryptSimulation1d::CryptSimulation1d(), and CryptSimulation2d::CryptSimulation2d().

◆ mDt

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
double AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mDt
protected

◆ mEndTime

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
double AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mEndTime
protected

Time to run the Solve() method up to.

Definition at line 117 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mInitialiseCells

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mInitialiseCells
protected

Whether to initialise the cells.

Definition at line 126 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::AbstractCellBasedSimulation().

◆ mNoBirth

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mNoBirth
protected

Whether to run the simulation with no birth (defaults to false).

Definition at line 129 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mNumBirths

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mNumBirths
protected

Counts the number of births during the simulation.

Definition at line 144 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mNumDeaths

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mNumDeaths
protected

Counts the number of deaths during the simulation.

Definition at line 147 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mOutputCellVelocities

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mOutputCellVelocities
protected

Whether to write the cell velocities to a file. Initialised to false in constructor.

Definition at line 159 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mOutputDirectory

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
std::string AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mOutputDirectory
protected

Output directory (a subfolder of tmp/[USERNAME]/testoutput).

Definition at line 135 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mOutputDivisionLocations

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
bool AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mOutputDivisionLocations
protected

Whether to output the locations of division events (defaults to false).

Definition at line 150 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mpCellVelocitiesFile

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
out_stream AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mpCellVelocitiesFile
protected

Results file for cell velocities.

Definition at line 162 of file AbstractCellBasedSimulation.hpp.

◆ mpDivisionLocationFile

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
out_stream AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mpDivisionLocationFile
protected

Output file for location of division events.

Definition at line 153 of file AbstractCellBasedSimulation.hpp.

◆ mpVizSetupFile

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
out_stream AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mpVizSetupFile
protected

Visualizer setup file.

Definition at line 141 of file AbstractCellBasedSimulation.hpp.

Referenced by CryptSimulation2d::SetupSolve().

◆ mrCellPopulation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>& AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mrCellPopulation
protected

◆ mSamplingTimestepMultiple

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
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 179 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mSimulationModifiers

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
std::vector<boost::shared_ptr<AbstractCellBasedSimulationModifier<ELEMENT_DIM, SPACE_DIM> > > AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mSimulationModifiers
protected

List of SimulationModifier rules.

Definition at line 168 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mSimulationOutputDirectory

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
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 138 of file AbstractCellBasedSimulation.hpp.

◆ mTopologyUpdateSimulationModifiers

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
std::vector<boost::shared_ptr<AbstractCellBasedSimulationModifier<ELEMENT_DIM, SPACE_DIM> > > AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mTopologyUpdateSimulationModifiers
protected

List of SimulationModifier rules that need to be applied before locations or topology are updated. For example, junctional tension may change after Remeshing in Vertex Based Models.

Definition at line 173 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mUpdateCellPopulation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
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 132 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mUpdatingTimestepMultiple

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
unsigned AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mUpdatingTimestepMultiple
protected

The ratio of the number of actual timesteps to the number of timesteps at which cells and topology are updated.

Definition at line 185 of file AbstractCellBasedSimulation.hpp.

Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::serialize().


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