Chaste Release::3.1
VertexBasedCellPopulation< DIM > Class Template Reference

#include <VertexBasedCellPopulation.hpp>

Inheritance diagram for VertexBasedCellPopulation< DIM >:
Collaboration diagram for VertexBasedCellPopulation< DIM >:

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 ()
double GetVolumeOfCell (CellPtr pCell)
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

bool mDeleteMesh
MutableVertexMesh< DIM, DIM > * mpMutableVertexMesh
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 58 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>() 
)

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:
rMeshreference to a
rCellsreference to a vector of CellPtrs
deleteMeshset to true if you want the cell population to free the mesh memory on destruction
validatewhether to validate the cell population when it is created (defaults to true)
locationIndicesan 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 41 of file VertexBasedCellPopulation.cpp.

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

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

Constructor for use by the de-serializer.

Parameters:
rMesha vertex mesh.

Definition at line 77 of file VertexBasedCellPopulation.cpp.

References VertexBasedCellPopulation< DIM >::mpMutableVertexMesh, and AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >::mrMesh.

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

Destructor, which frees any memory allocated by the constructor.

Definition at line 85 of file VertexBasedCellPopulation.cpp.


Member Function Documentation

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

Overridden AddCell() method.

Add a new cell to the cell population.

Parameters:
pNewCellthe cell to add
rCellDivisionVectorif this vector has any non-zero component, then it is used as the axis along which the parent cell divides
pParentCellpointer 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)

Definition at line 184 of file VertexBasedCellPopulation.cpp.

template<unsigned DIM>
unsigned VertexBasedCellPopulation< DIM >::AddNode ( Node< DIM > *  pNewNode)

Overridden AddNode() method.

Add a new node to the cell population.

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

Definition at line 160 of file VertexBasedCellPopulation.cpp.

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

Overridden CreateOutputFiles() method.

Parameters:
rDirectorypathname of the output directory, relative to where Chaste output is stored
cleanOutputDirectorywhether to delete the contents of the output directory prior to output file creation

Reimplemented from AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 611 of file VertexBasedCellPopulation.cpp.

References AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::CreateOutputFiles(), and OutputFileHandler::OpenOutputFile().

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::GenerateCellResultsAndWriteToFiles ( ) [virtual]
template<unsigned DIM>
double VertexBasedCellPopulation< DIM >::GetDampingConstant ( unsigned  nodeIndex) [virtual]

Overridden GetDampingConstant() method.

Parameters:
nodeIndexthe global index of this node
Returns:
the average damping constant of the cells surrounding the node.

Implements AbstractOffLatticeCellPopulation< DIM >.

Definition at line 94 of file VertexBasedCellPopulation.cpp.

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

Get a particular VertexElement.

Parameters:
elementIndexthe global index of the VertexElement
Returns:
a pointer to the VertexElement.

Definition at line 136 of file VertexBasedCellPopulation.cpp.

Referenced by NagaiHondaForce< DIM >::AddForceContribution().

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

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

Parameters:
pCellthe cell
Returns:
pointer to the element.

Definition at line 172 of file VertexBasedCellPopulation.cpp.

template<unsigned DIM>
c_vector< double, DIM > VertexBasedCellPopulation< DIM >::GetLocationOfCellCentre ( CellPtr  pCell) [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:
pCella cell in the population
Returns:
the location of the centre of mass of the element corresponding to this cell.

Implements AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 148 of file VertexBasedCellPopulation.cpp.

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

Overridden GetNeighbouringNodeIndices() method.

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

Implements AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 680 of file VertexBasedCellPopulation.cpp.

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

Overridden GetNode() method.

Parameters:
indexglobal index of the specified node
Returns:
a pointer to the node.

Implements AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 154 of file VertexBasedCellPopulation.cpp.

Referenced by NagaiHondaForce< DIM >::AddForceContribution(), and PlaneBoundaryCondition< DIM >::ImposeBoundaryCondition().

template<unsigned DIM>
unsigned VertexBasedCellPopulation< DIM >::GetNumElements ( )
Returns:
the number of VertexElements in the cell population.

Definition at line 178 of file VertexBasedCellPopulation.cpp.

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

Overridden GetNumNodes() method.

Returns:
the number of nodes in the cell population.

Implements AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 142 of file VertexBasedCellPopulation.cpp.

Referenced by NagaiHondaForce< DIM >::AddForceContribution(), and PlaneBoundaryCondition< DIM >::ImposeBoundaryCondition().

template<unsigned DIM>
double VertexBasedCellPopulation< DIM >::GetVolumeOfCell ( CellPtr  pCell) [virtual]

Overridden GetVolumeOfCell() method.

Parameters:
pCellboost shared pointer to a cell

Implements AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 431 of file VertexBasedCellPopulation.cpp.

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

Overridden GetWidth() method.

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

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

Implements AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 671 of file VertexBasedCellPopulation.cpp.

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

Overridden IsCellAssociatedWithADeletedLocation() method.

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

Implements AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 275 of file VertexBasedCellPopulation.cpp.

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

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

Reimplemented from AbstractOffLatticeCellPopulation< DIM >.

Definition at line 660 of file VertexBasedCellPopulation.cpp.

References AbstractOffLatticeCellPopulation< ELEMENT_DIM, SPACE_DIM >::OutputCellPopulationParameters().

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

Definition at line 213 of file VertexBasedCellPopulation.cpp.

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

Definition at line 130 of file VertexBasedCellPopulation.cpp.

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:
archivethe archive
versionthe current version of this class

Reimplemented from AbstractOffLatticeCellPopulation< DIM >.

Definition at line 101 of file VertexBasedCellPopulation.hpp.

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

Overridden SetNode() method.

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

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

Definition at line 166 of file VertexBasedCellPopulation.cpp.

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::Update ( bool  hasHadBirthsOrDeaths = true) [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:
We want to make these maps private, so we need a better way of doing the code below.
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< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 281 of file VertexBasedCellPopulation.cpp.

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

Overridden UpdateNodeLocations() method.

Parameters:
rNodeForcesa vector containing the force on each node in the cell population
dtthe time step

Definition at line 234 of file VertexBasedCellPopulation.cpp.

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

Check the consistency of internal data structures. Each VertexElement must have a CellPtr associated with it.

Implements AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 329 of file VertexBasedCellPopulation.cpp.

References EXCEPTION.

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

template<unsigned DIM>
void VertexBasedCellPopulation< DIM >::WriteCellVolumeResultsToFile ( ) [virtual]

Write the current index and location (of the centre) of each element in mrMesh, as well as the ID and the area (in 2D) or volume (in 3D) of its corresponding cell, to mpCellVolumesFile.

Implements AbstractCellPopulation< ELEMENT_DIM, ELEMENT_DIM >.

Definition at line 443 of file VertexBasedCellPopulation.cpp.

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


Friends And Related Function Documentation

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

Needed for serialization.

Reimplemented from AbstractOffLatticeCellPopulation< DIM >.

Definition at line 88 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 66 of file VertexBasedCellPopulation.hpp.

template<unsigned DIM>
MutableVertexMesh<DIM, DIM>* VertexBasedCellPopulation< DIM >::mpMutableVertexMesh [private]

A static cast of the Abstract mesh from `AbstractCellPopulation` for use in this class

Definition at line 72 of file VertexBasedCellPopulation.hpp.

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

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

Results file for locations of T1Swaps.

Definition at line 78 of file VertexBasedCellPopulation.hpp.

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

Results file for locations of T3Swaps.

Definition at line 81 of file VertexBasedCellPopulation.hpp.

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

Results file for elements.

Definition at line 75 of file VertexBasedCellPopulation.hpp.


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