CellBasedSimulationWithPdes< DIM > Class Template Reference

#include <CellBasedSimulationWithPdes.hpp>

Inheritance diagram for CellBasedSimulationWithPdes< DIM >:

Inheritance graph
[legend]
Collaboration diagram for CellBasedSimulationWithPdes< DIM >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CellBasedSimulationWithPdes (AbstractCellPopulation< DIM > &rCellPopulation, std::vector< PdeAndBoundaryConditions< DIM > * > pdeAndBcCollection=std::vector< PdeAndBoundaryConditions< DIM > * >(), bool deleteCellPopulationAndForceCollection=false, bool initialiseCells=true)
 ~CellBasedSimulationWithPdes ()
void SetPdeAndBcCollection (std::vector< PdeAndBoundaryConditions< DIM > * > pdeAndBcCollection)
Vec GetCurrentPdeSolution (unsigned pdeIndex)
void SetWriteAverageRadialPdeSolution (unsigned numRadialIntervals=10, bool writeDailyResults=false)
void UseCoarsePdeMesh (double coarseGrainScaleFactor=10.0)
void OutputSimulationParameters (out_stream &rParamsFile)
template<>
void CreateCoarsePdeMesh (double coarseGrainScaleFactor)

Private Member Functions

template<class Archive>
void serialize (Archive &archive, const unsigned int version)
void SetupSolve ()
void SetupWritePdeSolution ()
void WritePdeSolution (double time)
void WriteAverageRadialPdeSolution (double time, unsigned numIntervals)
void SolvePde ()
void SolvePdeUsingCoarseMesh ()
unsigned FindCoarseElementContainingCell (CellPtr pCell)
void PostSolve ()
void AfterSolve ()
void CreateCoarsePdeMesh (double coarseGrainScaleFactor)
void InitialiseCoarsePdeMesh ()
void WriteVisualizerSetupFile ()

Private Attributes

std::vector
< PdeAndBoundaryConditions
< DIM > * > 
mPdeAndBcCollection
out_stream mpVizPdeSolutionResultsFile
out_stream mpAverageRadialPdeSolutionResultsFile
bool mWriteAverageRadialPdeSolution
bool mWriteDailyAverageRadialPdeSolution
unsigned mNumRadialIntervals
TetrahedralMesh< DIM, DIM > * mpCoarsePdeMesh
std::map< CellPtr, unsigned > mCellPdeElementMap

Friends

class TestCellBasedSimulationWithPdes
class boost::serialization::access


Detailed Description

template<unsigned DIM>
class CellBasedSimulationWithPdes< DIM >

A cell-based simulation class that includes one or more elliptic PDEs, e.g. describing the transport of nutrients and/or signalling molecules.

Definition at line 48 of file CellBasedSimulationWithPdes.hpp.


Constructor & Destructor Documentation

template<unsigned DIM>
CellBasedSimulationWithPdes< DIM >::CellBasedSimulationWithPdes ( AbstractCellPopulation< DIM > &  rCellPopulation,
std::vector< PdeAndBoundaryConditions< DIM > * >  pdeAndBcCollection = std::vector<PdeAndBoundaryConditions<DIM>*>(),
bool  deleteCellPopulationAndForceCollection = false,
bool  initialiseCells = true 
) [inline]

Constructor.

Parameters:
rCellPopulation A cell population object
pdeAndBcCollection A vector of pointers to PdeAndBoundaryConditions objects (defaults to an empty vector0
deleteCellPopulationAndForceCollection Whether to delete the cell population on destruction to free up memory
initialiseCells Whether to initialise cells (set to false when loading from an archive)

Definition at line 42 of file CellBasedSimulationWithPdes.cpp.

References CellBasedSimulation< DIM >::mrCellPopulation.

template<unsigned DIM>
CellBasedSimulationWithPdes< DIM >::~CellBasedSimulationWithPdes (  )  [inline]

Destructor.

Free any memory allocated by the constructor. This frees the current PDE solution, if it exists.

Definition at line 63 of file CellBasedSimulationWithPdes.cpp.

References CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh.


Member Function Documentation

template<unsigned DIM>
template<class Archive>
void CellBasedSimulationWithPdes< DIM >::serialize ( Archive &  archive,
const unsigned int  version 
) [inline, private]

Archive the member variables.

Serialization of singleton objects must be done with care. Before the object is serialized via a pointer, it *MUST* be serialized directly, or an assertion will trip when a second instance of the class is created on de-serialization.

Parameters:
archive the archive
version the current version of this class

Reimplemented from CellBasedSimulation< DIM >.

Definition at line 57 of file CellBasedSimulationWithPdes.hpp.

References CellBasedSimulationWithPdes< DIM >::mCellPdeElementMap, CellBasedSimulationWithPdes< DIM >::mNumRadialIntervals, CellBasedSimulationWithPdes< DIM >::mWriteAverageRadialPdeSolution, and CellBasedSimulationWithPdes< DIM >::mWriteDailyAverageRadialPdeSolution.

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::SetupSolve (  )  [inline, private, virtual]

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::SetupWritePdeSolution (  )  [inline, private]

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::WritePdeSolution ( double  time  )  [inline, private]

Write the PDE solution to file at a specified time.

Parameters:
time The time at which to record the PDE solution

Definition at line 588 of file CellBasedSimulationWithPdes.cpp.

References PetscTools::AmMaster(), CellwiseData< DIM >::GetValue(), CellwiseData< DIM >::Instance(), and CellBasedSimulation< DIM >::mrCellPopulation.

Referenced by CellBasedSimulationWithPdes< DIM >::PostSolve(), and CellBasedSimulationWithPdes< DIM >::SetupSolve().

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::WriteAverageRadialPdeSolution ( double  time,
unsigned  numIntervals 
) [inline, private]

Write the average radial PDE solution to file at a specified time.

Parameters:
time The time at which to record the average radial PDE solution
numIntervals The number of radial intervals in which the average PDE solution is calculated

Definition at line 626 of file CellBasedSimulationWithPdes.cpp.

References CellwiseData< DIM >::GetValue(), CellwiseData< DIM >::Instance(), and CellBasedSimulation< DIM >::mrCellPopulation.

Referenced by CellBasedSimulationWithPdes< DIM >::AfterSolve(), and CellBasedSimulationWithPdes< DIM >::PostSolve().

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::SolvePde (  )  [inline, private]

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::SolvePdeUsingCoarseMesh (  )  [inline, private]

template<unsigned DIM>
unsigned CellBasedSimulationWithPdes< DIM >::FindCoarseElementContainingCell ( CellPtr  pCell  )  [inline, private]

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::PostSolve (  )  [inline, private, virtual]

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::AfterSolve (  )  [inline, private, virtual]

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::CreateCoarsePdeMesh ( double  coarseGrainScaleFactor  )  [inline, private]

Create a coarse mesh on which to solve the PDE.

Todo:
currently only works in 2D (see #737)
Parameters:
coarseGrainScaleFactor the ratio of the width of the coarse PDE mesh to the initial width of the cell population

Definition at line 145 of file CellBasedSimulationWithPdes.cpp.

References EXCEPTION.

Referenced by CellBasedSimulationWithPdes< DIM >::UseCoarsePdeMesh().

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::InitialiseCoarsePdeMesh (  )  [inline, private]

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::WriteVisualizerSetupFile (  )  [inline, private, virtual]

Overridden WriteVisualizerSetupFile() method.

Writes out special information about the mesh to the visualizer.

Reimplemented from CellBasedSimulation< DIM >.

Definition at line 89 of file CellBasedSimulationWithPdes.cpp.

References CellBasedSimulation< DIM >::mForceCollection, and CellBasedSimulation< DIM >::mpVizSetupFile.

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::SetPdeAndBcCollection ( std::vector< PdeAndBoundaryConditions< DIM > * >  pdeAndBcCollection  )  [inline]

A small hack until we fully archive this class - needed to set the PDE after loading a simulation from an archive.

Todo:
Check if archiving has been implemented yet for PDE classes (#1460)
Parameters:
pdeAndBcCollection A vector of pointers to PdeAndBoundaryConditions objects

Definition at line 72 of file CellBasedSimulationWithPdes.cpp.

References CellBasedSimulationWithPdes< DIM >::mPdeAndBcCollection.

template<unsigned DIM>
Vec CellBasedSimulationWithPdes< DIM >::GetCurrentPdeSolution ( unsigned  pdeIndex  )  [inline]

Get the current solution to the PDE problem.

Parameters:
pdeIndex The index of the PDE in the vector mPdeAndBcCollection

Definition at line 78 of file CellBasedSimulationWithPdes.cpp.

References CellBasedSimulationWithPdes< DIM >::mPdeAndBcCollection.

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::SetWriteAverageRadialPdeSolution ( unsigned  numRadialIntervals = 10,
bool  writeDailyResults = false 
) [inline]

Write the final (and optionally also the daily) average radial PDE solution to file.

Parameters:
numRadialIntervals The number of radial intervals in which the average PDE solution is calculated (defaults to 10)
writeDailyResults Whether to record the average radial PDE solution at the end of each day of the simulation (defaults to false)

Definition at line 618 of file CellBasedSimulationWithPdes.cpp.

References CellBasedSimulationWithPdes< DIM >::mNumRadialIntervals, CellBasedSimulationWithPdes< DIM >::mWriteAverageRadialPdeSolution, and CellBasedSimulationWithPdes< DIM >::mWriteDailyAverageRadialPdeSolution.

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::UseCoarsePdeMesh ( double  coarseGrainScaleFactor = 10.0  )  [inline]

Solve the PDE problem on a coarse mesh.

Parameters:
coarseGrainScaleFactor the ratio of the width of the coarse PDE mesh to the initial width of the cell population (defaults to 10.0)

Definition at line 133 of file CellBasedSimulationWithPdes.cpp.

References CellBasedSimulationWithPdes< DIM >::CreateCoarsePdeMesh(), and CellBasedSimulationWithPdes< DIM >::mPdeAndBcCollection.

template<unsigned DIM>
void CellBasedSimulationWithPdes< DIM >::OutputSimulationParameters ( out_stream &  rParamsFile  )  [inline, virtual]

Outputs simulation parameters to file

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

Parameters:
rParamsFile the file stream to which the parameters are output

Reimplemented from CellBasedSimulation< DIM >.

Definition at line 694 of file CellBasedSimulationWithPdes.cpp.

References CellBasedSimulationWithPdes< DIM >::mWriteAverageRadialPdeSolution, CellBasedSimulationWithPdes< DIM >::mWriteDailyAverageRadialPdeSolution, and CellBasedSimulation< DIM >::OutputSimulationParameters().

template<>
void CellBasedSimulationWithPdes< 2 >::CreateCoarsePdeMesh ( double  coarseGrainScaleFactor  )  [inline]

The CreateCoarsePdeMesh method is currently only implemented in 2D, hence there are two definitions to this method (one templated and one not).

Parameters:
coarseGrainScaleFactor the ratio of the width of the coarse PDE mesh to the initial width of the cell population

Definition at line 157 of file CellBasedSimulationWithPdes.cpp.

References TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructFromMeshReader(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh, CellBasedSimulation< DIM >::mrCellPopulation, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::Scale(), and AbstractMesh< ELEMENT_DIM, SPACE_DIM >::Translate().


Friends And Related Function Documentation

template<unsigned DIM>
friend class boost::serialization::access [friend]

Needed for serialization.

Reimplemented from CellBasedSimulation< DIM >.

Definition at line 55 of file CellBasedSimulationWithPdes.hpp.


Member Data Documentation

template<unsigned DIM>
std::vector<PdeAndBoundaryConditions<DIM>*> CellBasedSimulationWithPdes< DIM >::mPdeAndBcCollection [private]

template<unsigned DIM>
out_stream CellBasedSimulationWithPdes< DIM >::mpVizPdeSolutionResultsFile [private]

File that the values of the PDE solution are written out to.

Definition at line 77 of file CellBasedSimulationWithPdes.hpp.

Referenced by CellBasedSimulationWithPdes< DIM >::AfterSolve(), and CellBasedSimulationWithPdes< DIM >::SetupWritePdeSolution().

template<unsigned DIM>
out_stream CellBasedSimulationWithPdes< DIM >::mpAverageRadialPdeSolutionResultsFile [private]

File that the average radial PDE solution is written out to.

Definition at line 82 of file CellBasedSimulationWithPdes.hpp.

Referenced by CellBasedSimulationWithPdes< DIM >::AfterSolve(), and CellBasedSimulationWithPdes< DIM >::SetupWritePdeSolution().

template<unsigned DIM>
bool CellBasedSimulationWithPdes< DIM >::mWriteAverageRadialPdeSolution [private]

template<unsigned DIM>
bool CellBasedSimulationWithPdes< DIM >::mWriteDailyAverageRadialPdeSolution [private]

template<unsigned DIM>
unsigned CellBasedSimulationWithPdes< DIM >::mNumRadialIntervals [private]

template<unsigned DIM>
TetrahedralMesh<DIM,DIM>* CellBasedSimulationWithPdes< DIM >::mpCoarsePdeMesh [private]

template<unsigned DIM>
std::map<CellPtr, unsigned> CellBasedSimulationWithPdes< DIM >::mCellPdeElementMap [private]


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

Generated on Mon Nov 1 12:36:19 2010 for Chaste by  doxygen 1.5.5