VertexBasedCellPopulation< DIM > Class Template Reference

#include <VertexBasedCellPopulation.hpp>

Inherits AbstractOffLatticeCellPopulation< DIM >.

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 ()
void WriteCellVolumeResultsToFile ()
virtual void GenerateCellResultsAndWriteToFiles ()
void OutputCellPopulationParameters (out_stream &rParamsFile)
double GetWidth (const unsigned &rDimension)
std::set< unsignedGetNeighbouringNodeIndices (unsigned index)

Private Member Functions

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

Private Attributes

MutableVertexMesh< DIM, DIM > & mrMesh
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 51 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 70 of file VertexBasedCellPopulation.cpp.

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

Destructor, which frees any memory allocated by the constructor.

Definition at line 78 of file VertexBasedCellPopulation.cpp.

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


Member Function Documentation

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 177 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 >::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 AbstractOffLatticeCellPopulation< DIM >.

Definition at line 153 of file VertexBasedCellPopulation.cpp.

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

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::CloseOutputFiles (  )  [inline, virtual]
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 599 of file VertexBasedCellPopulation.cpp.

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

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::GenerateCellResultsAndWriteToFiles (  )  [inline, virtual]
template<unsigned DIM>
double VertexBasedCellPopulation< DIM >::GetDampingConstant ( unsigned  nodeIndex  )  [inline, virtual]
template<unsigned DIM>
VertexElement< DIM, DIM > * VertexBasedCellPopulation< DIM >::GetElement ( unsigned  elementIndex  )  [inline]
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 165 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>
c_vector< double, DIM > VertexBasedCellPopulation< DIM >::GetLocationOfCellCentre ( CellPtr  pCell  )  [inline, virtual]

Overridden GetLocationOfCellCentre() method.

Find the centre of mass of a given cell (assuming uniform density). Note that, as there is no guarantee of convexity, this may lie outside the VertexElement corresponding to the cell.

Parameters:
pCell a cell in the population
Returns:
the location of the centre of mass of the element corresponding to this cell.

Implements AbstractCellPopulation< DIM >.

Definition at line 141 of file VertexBasedCellPopulation.cpp.

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

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

template<unsigned DIM>
std::set< unsigned > VertexBasedCellPopulation< DIM >::GetNeighbouringNodeIndices ( unsigned  index  )  [inline, virtual]

Overridden GetNeighbouringNodeIndices() method.

Parameters:
index the node index
Returns:
the set of neighbouring node indices.

Implements AbstractCellPopulation< DIM >.

Definition at line 668 of file VertexBasedCellPopulation.cpp.

References VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNeighbouringNodeIndices(), and VertexBasedCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
Node< DIM > * VertexBasedCellPopulation< DIM >::GetNode ( unsigned  index  )  [inline, virtual]
template<unsigned DIM>
unsigned VertexBasedCellPopulation< DIM >::GetNumElements (  )  [inline]
Returns:
the number of VertexElements in the cell population.

Definition at line 171 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>
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 659 of file VertexBasedCellPopulation.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetWidth(), 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 268 of file VertexBasedCellPopulation.cpp.

References VertexBasedCellPopulation< DIM >::GetElementCorrespondingToCell().

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

Reimplemented from AbstractOffLatticeCellPopulation< DIM >.

Definition at line 648 of file VertexBasedCellPopulation.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCellRearrangementRatio(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCellRearrangementThreshold(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetT2Threshold(), 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 206 of file VertexBasedCellPopulation.cpp.

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

template<unsigned DIM>
const MutableVertexMesh< DIM, DIM > & VertexBasedCellPopulation< DIM >::rGetMesh (  )  const [inline]
Returns:
const reference to mrMesh (used in archiving).

Definition at line 123 of file VertexBasedCellPopulation.cpp.

References VertexBasedCellPopulation< DIM >::mrMesh.

template<unsigned DIM>
MutableVertexMesh< DIM, DIM > & VertexBasedCellPopulation< DIM >::rGetMesh (  )  [inline]
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 AbstractOffLatticeCellPopulation< DIM >.

Definition at line 91 of file VertexBasedCellPopulation.hpp.

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 AbstractOffLatticeCellPopulation< DIM >.

Definition at line 159 of file VertexBasedCellPopulation.cpp.

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

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

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

Todo:
this is a kludge to remove the cell once a T2Swap occurs this is not included in the dead cells counter. This should be included in the RemoveDeadCells method so the death is counted

Implements AbstractCellPopulation< DIM >.

Definition at line 274 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 >::UpdateNodeLocations ( const std::vector< c_vector< double, DIM > > &  rNodeForces,
double  dt 
) [inline, virtual]
template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::Validate (  )  [inline, private, virtual]
template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::WriteCellVolumeResultsToFile (  )  [inline, virtual]
template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::WriteResultsToFiles (  )  [inline, virtual]
template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::WriteVtkResultsToFile (  )  [inline, private, virtual]

Friends And Related Function Documentation

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

Needed for serialization.

Reimplemented from AbstractOffLatticeCellPopulation< DIM >.

Definition at line 78 of file VertexBasedCellPopulation.hpp.


Member Data Documentation

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 62 of file VertexBasedCellPopulation.hpp.

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

template<unsigned DIM>
out_stream VertexBasedCellPopulation< DIM >::mpT1SwapLocationsFile [private]
template<unsigned DIM>
out_stream VertexBasedCellPopulation< DIM >::mpT3SwapLocationsFile [private]
template<unsigned DIM>
out_stream VertexBasedCellPopulation< DIM >::mpVizElementsFile [private]
template<unsigned DIM>
MutableVertexMesh<DIM, DIM>& VertexBasedCellPopulation< DIM >::mrMesh [private]

The documentation for this class was generated from the following files:
Generated on Thu Dec 22 13:08:10 2011 for Chaste by  doxygen 1.6.3