VertexBasedCellPopulation< DIM > Class Template Reference

#include <VertexBasedCellPopulation.hpp>

Inheritance diagram for VertexBasedCellPopulation< DIM >:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

 VertexBasedCellPopulation (MutableVertexMesh< DIM, DIM > &rMesh, std::vector< CellPtr > &rCells, bool deleteMesh=false, bool validate=true, const std::vector< unsigned > locationIndices=std::vector< unsigned >())
 VertexBasedCellPopulation (MutableVertexMesh< DIM, DIM > &rMesh)
virtual ~VertexBasedCellPopulation ()
double GetDampingConstant (unsigned nodeIndex)
MutableVertexMesh< DIM, DIM > & rGetMesh ()
const MutableVertexMesh< DIM,
DIM > & 
rGetMesh () const
VertexElement< DIM, DIM > * GetElement (unsigned elementIndex)
unsigned GetNumElements ()
unsigned GetNumNodes ()
c_vector< double, DIM > GetLocationOfCellCentre (CellPtr pCell)
Node< DIM > * GetNode (unsigned index)
unsigned AddNode (Node< DIM > *pNewNode)
void UpdateNodeLocations (const std::vector< c_vector< double, DIM > > &rNodeForces, double dt)
void SetNode (unsigned index, ChastePoint< DIM > &rNewLocation)
VertexElement< DIM, DIM > * GetElementCorrespondingToCell (CellPtr pCell)
CellPtr AddCell (CellPtr pNewCell, const c_vector< double, DIM > &rCellDivisionVector, CellPtr pParentCell=CellPtr())
unsigned RemoveDeadCells ()
bool IsCellAssociatedWithADeletedLocation (CellPtr pCell)
void Update (bool hasHadBirthsOrDeaths=true)
void CreateOutputFiles (const std::string &rDirectory, bool cleanOutputDirectory)
void CloseOutputFiles ()
void WriteResultsToFiles ()
virtual void GenerateCellResultsAndWriteToFiles ()
void OutputCellPopulationParameters (out_stream &rParamsFile)
double GetWidth (const unsigned &rDimension)

Private Member Functions

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

Private Attributes

MutableVertexMesh< DIM, DIM > & mrMesh
std::string mDirPath
out_stream mpVtkMetaFile
bool mDeleteMesh
out_stream mpVizElementsFile
out_stream mpT1SwapLocationsFile
out_stream mpT3SwapLocationsFile

Friends

class boost::serialization::access


Detailed Description

template<unsigned DIM>
class VertexBasedCellPopulation< DIM >

A facade class encapsulating a vertex-based cell population.

Contains a group of cells and maintains the associations between CellPtrs and elements in the MutableVertexMesh.

Definition at line 52 of file VertexBasedCellPopulation.hpp.


Constructor & Destructor Documentation

template<unsigned DIM>
VertexBasedCellPopulation< DIM >::VertexBasedCellPopulation ( MutableVertexMesh< DIM, DIM > &  rMesh,
std::vector< CellPtr > &  rCells,
bool  deleteMesh = false,
bool  validate = true,
const std::vector< unsigned >  locationIndices = std::vector<unsigned>() 
) [inline]

Create a new cell population facade from a mesh and collection of cells.

There must be precisely one CellPtr for each VertexElement in the mesh.

Parameters:
rMesh reference to a
rCells reference to a vector of CellPtrs
deleteMesh set to true if you want the cell population to free the mesh memory on destruction
validate whether to validate the cell population when it is created (defaults to true)
locationIndices an optional vector of location indices that correspond to real cells

Todo:
we should be able to do this, but mBoundaryNodes is not used in vertex meshes (#1558)

Definition at line 35 of file VertexBasedCellPopulation.cpp.

References EXCEPTION, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorBegin(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorEnd(), VertexBasedCellPopulation< DIM >::mrMesh, and VertexBasedCellPopulation< DIM >::Validate().

template<unsigned DIM>
VertexBasedCellPopulation< DIM >::VertexBasedCellPopulation ( MutableVertexMesh< DIM, DIM > &  rMesh  )  [inline]

Constructor for use by the de-serializer.

Parameters:
rMesh a vertex mesh.

Definition at line 71 of file VertexBasedCellPopulation.cpp.

References VertexBasedCellPopulation< DIM >::mDeleteMesh.

template<unsigned DIM>
VertexBasedCellPopulation< DIM >::~VertexBasedCellPopulation (  )  [inline, virtual]

Destructor, which frees any memory allocated by the constructor.

Definition at line 79 of file VertexBasedCellPopulation.cpp.

References VertexBasedCellPopulation< DIM >::mDeleteMesh, and VertexBasedCellPopulation< DIM >::mrMesh.


Member Function Documentation

template<unsigned DIM>
template<class Archive>
void VertexBasedCellPopulation< 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.

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

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 93 of file VertexBasedCellPopulation.hpp.

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::Validate (  )  [inline, private, virtual]

template<unsigned DIM>
double VertexBasedCellPopulation< DIM >::GetDampingConstant ( unsigned  nodeIndex  )  [inline, virtual]

template<unsigned DIM>
MutableVertexMesh< DIM, DIM > & VertexBasedCellPopulation< DIM >::rGetMesh (  )  [inline]

template<unsigned DIM>
const MutableVertexMesh< DIM, DIM > & VertexBasedCellPopulation< DIM >::rGetMesh (  )  const [inline]

Returns:
const reference to mrMesh (used in archiving).

Definition at line 127 of file VertexBasedCellPopulation.cpp.

References VertexBasedCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
VertexElement< DIM, DIM > * VertexBasedCellPopulation< DIM >::GetElement ( unsigned  elementIndex  )  [inline]

template<unsigned DIM>
unsigned VertexBasedCellPopulation< DIM >::GetNumElements (  )  [inline]

Returns:
the number of VertexElements in the cell population.

Definition at line 183 of file VertexBasedCellPopulation.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), and VertexBasedCellPopulation< DIM >::mrMesh.

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

template<unsigned DIM>
unsigned VertexBasedCellPopulation< DIM >::GetNumNodes (  )  [inline, virtual]

template<unsigned DIM>
c_vector< double, DIM > VertexBasedCellPopulation< DIM >::GetLocationOfCellCentre ( CellPtr  pCell  )  [inline, virtual]

Overridden GetLocationOfCellCentre() method. Find where a given cell is in space.

Todo:
If required, we could come up with a more clever definition of cell location for a VertexCellPopulation (for example, there is no guarantee of convexity so the centre of mass may lie outside the element)
Parameters:
pCell the cell
Returns:
the location of the centre of mass of the element corresponding to this cell.

Implements AbstractCellPopulation< DIM >.

Definition at line 148 of file VertexBasedCellPopulation.cpp.

References VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCentroidOfElement(), AbstractCellPopulation< DIM >::mCellLocationMap, and VertexBasedCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
Node< DIM > * VertexBasedCellPopulation< DIM >::GetNode ( unsigned  index  )  [inline, virtual]

template<unsigned DIM>
unsigned VertexBasedCellPopulation< DIM >::AddNode ( Node< DIM > *  pNewNode  )  [inline, virtual]

Overridden AddNode() method.

Add a new node to the cell population.

Parameters:
pNewNode pointer to the new node
Returns:
global index of new node in cell population

Implements AbstractCellPopulation< DIM >.

Definition at line 162 of file VertexBasedCellPopulation.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::AddNode(), and VertexBasedCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::UpdateNodeLocations ( const std::vector< c_vector< double, DIM > > &  rNodeForces,
double  dt 
) [inline, virtual]

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::SetNode ( unsigned  index,
ChastePoint< DIM > &  rNewLocation 
) [inline, virtual]

Overridden SetNode() method.

Move the node with a given index to a new point in space.

Parameters:
index the index of the node to be moved
rNewLocation the new target location of the node

Implements AbstractCellPopulation< DIM >.

Definition at line 169 of file VertexBasedCellPopulation.cpp.

References VertexBasedCellPopulation< DIM >::mrMesh, and MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetNode().

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

template<unsigned DIM>
VertexElement< DIM, DIM > * VertexBasedCellPopulation< DIM >::GetElementCorrespondingToCell ( CellPtr  pCell  )  [inline]

Get a pointer to the element corresponding to a given CellPtr.

Parameters:
pCell the cell
Returns:
pointer to the element.

Definition at line 176 of file VertexBasedCellPopulation.cpp.

References VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), AbstractCellPopulation< DIM >::mCellLocationMap, and VertexBasedCellPopulation< DIM >::mrMesh.

Referenced by VertexBasedCellPopulation< DIM >::AddCell(), and VertexBasedCellPopulation< DIM >::IsCellAssociatedWithADeletedLocation().

template<unsigned DIM>
CellPtr VertexBasedCellPopulation< DIM >::AddCell ( CellPtr  pNewCell,
const c_vector< double, DIM > &  rCellDivisionVector,
CellPtr  pParentCell = CellPtr() 
) [inline, virtual]

Overridden AddCell() method.

Add a new cell to the cell population.

Parameters:
pNewCell the cell to add
rCellDivisionVector if this vector has any non-zero component, then it is used as the axis along which the parent cell divides
pParentCell pointer to a parent cell (if required)
Returns:
address of cell as it appears in the cell list (internal of this method uses a copy constructor along the way)

Implements AbstractCellPopulation< DIM >.

Definition at line 190 of file VertexBasedCellPopulation.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideElementAlongGivenAxis(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideElementAlongShortAxis(), VertexBasedCellPopulation< DIM >::GetElementCorrespondingToCell(), AbstractCellPopulation< DIM >::mCellLocationMap, AbstractCellPopulation< DIM >::mCells, AbstractCellPopulation< DIM >::mLocationCellMap, and VertexBasedCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
unsigned VertexBasedCellPopulation< DIM >::RemoveDeadCells (  )  [inline, 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.

Returns:
number of cells removed

Implements AbstractCellPopulation< DIM >.

Definition at line 220 of file VertexBasedCellPopulation.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DeleteElementPriorToReMesh(), AbstractCellPopulation< DIM >::mCellLocationMap, AbstractCellPopulation< DIM >::mCells, and VertexBasedCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
bool VertexBasedCellPopulation< DIM >::IsCellAssociatedWithADeletedLocation ( CellPtr  pCell  )  [inline, virtual]

Overridden IsCellAssociatedWithADeletedLocation() method.

Parameters:
pCell the cell
Returns:
whether a given cell is associated with a deleted element.

Implements AbstractCellPopulation< DIM >.

Definition at line 279 of file VertexBasedCellPopulation.cpp.

References VertexBasedCellPopulation< DIM >::GetElementCorrespondingToCell().

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::Update ( bool  hasHadBirthsOrDeaths = true  )  [inline, virtual]

Remove the VertexElements which have been marked as deleted, perform any cell rearrangements if required, and update the correspondence with CellPtrs.

Parameters:
hasHadBirthsOrDeaths - a bool saying whether cell population has had Births Or Deaths not needed in this cell population class

Implements AbstractCellPopulation< DIM >.

Definition at line 286 of file VertexBasedCellPopulation.cpp.

References VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumAllElements(), AbstractCellPopulation< DIM >::mCellLocationMap, AbstractCellPopulation< DIM >::mCells, AbstractCellPopulation< DIM >::mLocationCellMap, VertexBasedCellPopulation< DIM >::mrMesh, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh(), and VertexBasedCellPopulation< DIM >::Validate().

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::CreateOutputFiles ( const std::string &  rDirectory,
bool  cleanOutputDirectory 
) [inline, virtual]

Overridden CreateOutputFiles() method.

Parameters:
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 566 of file VertexBasedCellPopulation.cpp.

References AbstractCellPopulation< DIM >::CreateOutputFiles(), VertexBasedCellPopulation< DIM >::mDirPath, VertexBasedCellPopulation< DIM >::mpT1SwapLocationsFile, VertexBasedCellPopulation< DIM >::mpT3SwapLocationsFile, VertexBasedCellPopulation< DIM >::mpVizElementsFile, VertexBasedCellPopulation< DIM >::mpVtkMetaFile, and OutputFileHandler::OpenOutputFile().

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::CloseOutputFiles (  )  [inline, virtual]

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::WriteResultsToFiles (  )  [inline, virtual]

Overridden WriteResultsToFiles() method.

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 367 of file VertexBasedCellPopulation.cpp.

References VertexMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddCellData(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ClearLocationsOfT1Swaps(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ClearLocationsOfT3Swaps(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), VertexBasedCellPopulation< DIM >::GetElement(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorEnd(), AbstractCellPopulation< DIM >::GetLocationIndexUsingCell(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLocationsOfT1Swaps(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLocationsOfT3Swaps(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), CellwiseData< DIM >::GetNumVariables(), SimulationTime::GetTime(), SimulationTime::GetTimeStepsElapsed(), CellwiseData< DIM >::GetValue(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetVolumeOfElement(), CellwiseData< DIM >::Instance(), SimulationTime::Instance(), AbstractCellPopulation< DIM >::mCells, VertexBasedCellPopulation< DIM >::mDirPath, AbstractCellPopulation< DIM >::mLocationCellMap, AbstractCellPopulation< DIM >::mOutputCellAges, AbstractCellPopulation< DIM >::mOutputCellAncestors, AbstractCellPopulation< DIM >::mOutputCellCyclePhases, AbstractCellPopulation< DIM >::mOutputCellMutationStates, AbstractCellPopulation< DIM >::mOutputCellProliferativeTypes, AbstractCellPopulation< DIM >::mOutputCellVolumes, VertexBasedCellPopulation< DIM >::mpT1SwapLocationsFile, VertexBasedCellPopulation< DIM >::mpT3SwapLocationsFile, VertexBasedCellPopulation< DIM >::mpVizElementsFile, VertexBasedCellPopulation< DIM >::mpVtkMetaFile, VertexBasedCellPopulation< DIM >::mrMesh, UNSIGNED_UNSET, AbstractCellPopulation< DIM >::WriteResultsToFiles(), and VertexMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteVtkUsingMesh().

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::GenerateCellResultsAndWriteToFiles (  )  [inline, virtual]

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

Outputs CellPopulation 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

Implements AbstractCellPopulation< DIM >.

Definition at line 629 of file VertexBasedCellPopulation.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCellRearrangementRatio(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCellRearrangementThreshold(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetT2Threshold(), VertexBasedCellPopulation< DIM >::mrMesh, and AbstractCellPopulation< DIM >::OutputCellPopulationParameters().

template<unsigned DIM>
double VertexBasedCellPopulation< DIM >::GetWidth ( const unsigned &  rDimension  )  [inline, virtual]

Overridden GetWidth() method.

Calculate the 'width' of any dimension of the cell population by calling GetWidth() on the mesh.

Parameters:
rDimension a dimension (0,1 or 2)
Returns:
The maximum distance between any nodes in this dimension.

Implements AbstractCellPopulation< DIM >.

Definition at line 641 of file VertexBasedCellPopulation.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetWidth(), and VertexBasedCellPopulation< DIM >::mrMesh.


Friends And Related Function Documentation

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

Needed for serialization.

Reimplemented from AbstractCellPopulation< DIM >.

Definition at line 80 of file VertexBasedCellPopulation.hpp.


Member Data Documentation

template<unsigned DIM>
MutableVertexMesh<DIM, DIM>& VertexBasedCellPopulation< DIM >::mrMesh [private]

template<unsigned DIM>
std::string VertexBasedCellPopulation< DIM >::mDirPath [private]

A cache of where the results are going (used for VTK writer).

Definition at line 60 of file VertexBasedCellPopulation.hpp.

Referenced by VertexBasedCellPopulation< DIM >::CreateOutputFiles(), and VertexBasedCellPopulation< DIM >::WriteResultsToFiles().

template<unsigned DIM>
out_stream VertexBasedCellPopulation< DIM >::mpVtkMetaFile [private]

template<unsigned DIM>
bool VertexBasedCellPopulation< DIM >::mDeleteMesh [private]

Whether to delete the mesh when we are destroyed. Needed if this cell population has been de-serialized.

Definition at line 69 of file VertexBasedCellPopulation.hpp.

Referenced by VertexBasedCellPopulation< DIM >::VertexBasedCellPopulation(), and VertexBasedCellPopulation< DIM >::~VertexBasedCellPopulation().

template<unsigned DIM>
out_stream VertexBasedCellPopulation< DIM >::mpVizElementsFile [private]

template<unsigned DIM>
out_stream VertexBasedCellPopulation< DIM >::mpT1SwapLocationsFile [private]

template<unsigned DIM>
out_stream VertexBasedCellPopulation< DIM >::mpT3SwapLocationsFile [private]


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

Generated on Mon Nov 1 12:37:32 2010 for Chaste by  doxygen 1.5.5