Chaste  Release::3.4
OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <OffLatticeSimulation.hpp>

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

Public Member Functions

 OffLatticeSimulation (AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation, bool deleteCellPopulationInDestructor=false, bool initialiseCells=true)
 
void AddForce (boost::shared_ptr< AbstractForce< ELEMENT_DIM, SPACE_DIM > > pForce)
 
void RemoveAllForces ()
 
void AddCellPopulationBoundaryCondition (boost::shared_ptr< AbstractCellPopulationBoundaryCondition< ELEMENT_DIM, SPACE_DIM > > pBoundaryCondition)
 
void RemoveAllCellPopulationBoundaryConditions ()
 
void OutputAdditionalSimulationSetup (out_stream &rParamsFile)
 
virtual void OutputSimulationParameters (out_stream &rParamsFile)
 
- Public Member Functions inherited from AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >
 AbstractCellBasedSimulation (AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation, bool deleteCellPopulationInDestructor=false, bool initialiseCells=true)
 
virtual ~AbstractCellBasedSimulation ()
 
void SetCellBasedPdeHandler (CellBasedPdeHandler< SPACE_DIM > *pCellBasedPdeHandler)
 
CellBasedPdeHandler< SPACE_DIM > * GetCellBasedPdeHandler ()
 
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 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 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)
 
- Public Member Functions inherited from Identifiable
virtual ~Identifiable ()
 
std::string GetIdentifier () const
 

Protected Member Functions

virtual void UpdateCellLocationsAndTopology ()
 
virtual void UpdateNodePositions ()
 
virtual void SetupSolve ()
 
virtual c_vector< double,
SPACE_DIM > 
CalculateCellDivisionVector (CellPtr pParentCell)
 
virtual void WriteVisualizerSetupFile ()
 
- Protected Member Functions inherited from AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >
virtual unsigned DoCellBirth ()
 
unsigned DoCellRemoval ()
 
virtual bool StoppingEventHasOccurred ()
 
virtual void UpdateCellPopulation ()
 
void OutputSimulationSetup ()
 

Protected Attributes

std::vector< boost::shared_ptr
< AbstractForce< ELEMENT_DIM,
SPACE_DIM > > > 
mForceCollection
 
std::vector< boost::shared_ptr
< AbstractCellPopulationBoundaryCondition
< ELEMENT_DIM, SPACE_DIM > > > 
mBoundaryConditions
 
- Protected Attributes inherited from AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >
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
 
unsigned mSamplingTimestepMultiple
 
CellBasedPdeHandler< SPACE_DIM > * mpCellBasedPdeHandler
 

Private Member Functions

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

Friends

class boost::serialization::access
 
class TestOffLatticeSimulationWithNodeBasedCellPopulation
 

Detailed Description

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

Run an off-lattice 2D or 3D cell-based simulation using a cell-centre- or vertex-based cell population.

In cell-centre-based cell populations, each cell is represented by a single node (corresponding to its centre), and connectivity is defined either by a Delaunay triangulation or a radius of influence. In vertex- based cell populations, each cell is represented by a polytope (corresponding to its membrane) with a variable number of vertices.

The OffLatticeSimulation 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 Force laws may be passed to the OffLatticeSimulation object, to define the mechanical properties of the CellPopulation. Similarly, one or more CellKillers may be passed to the OffLatticeSimulation object to specify conditions in which Cells may die, and one or more CellPopulationBoundaryConditions to specify regions in space beyond which Cells may not move.

Definition at line 69 of file OffLatticeSimulation.hpp.

Constructor & Destructor Documentation

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

Constructor.

Parameters
rCellPopulationReference to a 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 50 of file OffLatticeSimulation.cpp.

References AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::AddCellKiller(), EXCEPTION, MAKE_PTR_ARGS, AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::mDt, and NEVER_REACHED.

Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::AddCellPopulationBoundaryCondition ( boost::shared_ptr< AbstractCellPopulationBoundaryCondition< ELEMENT_DIM, SPACE_DIM > >  pBoundaryCondition)

Add a cell population boundary condition to be used in this simulation.

Parameters
pBoundaryConditionpointer to a boundary condition

Definition at line 97 of file OffLatticeSimulation.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::AddForce ( boost::shared_ptr< AbstractForce< ELEMENT_DIM, SPACE_DIM > >  pForce)

Add a force to be used in this simulation (use this to set the mechanics system).

Parameters
pForcepointer to a force law

Definition at line 85 of file OffLatticeSimulation.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
c_vector< double, SPACE_DIM > OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::CalculateCellDivisionVector ( CellPtr  pParentCell)
protectedvirtual

Overridden CalculateCellDivisionVector() method for determining how cell division occurs. This method returns a vector which is then passed into the CellPopulation method AddCell(). This method may be overridden by subclasses.

For a centre-based cell population, this method calculates the new locations of the cell centres of a dividing cell, moves the parent cell and returns the location of the daughter cell. The new locations are found by picking a random direction and placing the parent and daughter in opposing directions along this axis.

For a vertex-based cell population, the method calls the AbstractVertexBasedDivisionRule which is a member of the cell population.

Parameters
pParentCellthe parent cell
Returns
a vector containing information on cell division.
Todo:
#2400 Could remove this dynamic_cast by moving the code block below into AbstractCentreBasedCellPopulation::AddCell(), allowing it to be overruled by this method when overridden in subclasses. See also comment on #1093.

Implements AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >.

Reimplemented in CryptSimulation2d, and CryptSimulation1d.

Definition at line 138 of file OffLatticeSimulation.cpp.

References AbstractCentreBasedCellPopulation< ELEMENT_DIM, SPACE_DIM >::GetMeinekeDivisionSeparation(), VertexBasedCellPopulation< SPACE_DIM >::GetVertexBasedDivisionRule(), RandomNumberGenerator::Instance(), NEVER_REACHED, and RandomNumberGenerator::ranf().

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

Overridden OutputAdditionalSimulationSetup method to output the force and cell population boundary condition information.

Parameters
rParamsFilethe file stream to which the parameters are output

Reimplemented from AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >.

Definition at line 318 of file OffLatticeSimulation.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::OutputSimulationParameters ( out_stream &  rParamsFile)
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

Implements AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >.

Reimplemented in CryptSimulation2d, and CryptSimulation1d.

Definition at line 344 of file OffLatticeSimulation.cpp.

References AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::OutputSimulationParameters().

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::RemoveAllCellPopulationBoundaryConditions ( )

Method to remove all the cell population boundary conditions

Definition at line 103 of file OffLatticeSimulation.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::RemoveAllForces ( )

Method to remove all the Forces

Definition at line 91 of file OffLatticeSimulation.cpp.

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

Save or restore the simulation.

Parameters
archivethe archive
versionthe current version of this class

Definition at line 84 of file OffLatticeSimulation.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::SetupSolve ( )
protectedvirtual

Overridden SetupSolve() method to clear the forces applied to the nodes.

Reimplemented from AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >.

Reimplemented in CryptSimulation2d.

Definition at line 305 of file OffLatticeSimulation.cpp.

Referenced by CryptSimulation2d::SetupSolve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::UpdateCellLocationsAndTopology ( )
protectedvirtual
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::UpdateNodePositions ( )
protectedvirtual

Moves each node to a new position for this timestep by calling the CellPopulation::UpdateNodeLocations() method then applying any boundary conditions.

Definition at line 267 of file OffLatticeSimulation.cpp.

References EXCEPTION, and AbstractOffLatticeCellPopulation< ELEMENT_DIM, SPACE_DIM >::UpdateNodeLocations().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::WriteVisualizerSetupFile ( )
protectedvirtual

Overridden WriteVisualizerSetupFile() method.

Todo:
Check whether this comment is still valid

Reimplemented from AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >.

Definition at line 231 of file OffLatticeSimulation.cpp.

References PetscTools::AmMaster().

Friends And Related Function Documentation

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

Needed for serialization.

Definition at line 74 of file OffLatticeSimulation.hpp.

Member Data Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
std::vector<boost::shared_ptr<AbstractCellPopulationBoundaryCondition<ELEMENT_DIM,SPACE_DIM> > > OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::mBoundaryConditions
protected

List of boundary conditions.

Definition at line 97 of file OffLatticeSimulation.hpp.

Referenced by OffLatticeSimulation< 2 >::serialize().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
std::vector<boost::shared_ptr<AbstractForce<ELEMENT_DIM, SPACE_DIM> > > OffLatticeSimulation< ELEMENT_DIM, SPACE_DIM >::mForceCollection
protected

The mechanics used to determine the new location of the cells, a list of the forces.

Definition at line 94 of file OffLatticeSimulation.hpp.

Referenced by OffLatticeSimulation< 2 >::serialize().


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