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

#include <NodeBasedCellPopulation.hpp>

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

List of all members.

Public Member Functions

void SetNode (unsigned nodeIndex, ChastePoint< DIM > &rNewLocation)
 NodeBasedCellPopulation (NodesOnlyMesh< DIM > &rMesh, std::vector< CellPtr > &rCells, const std::vector< unsigned > locationIndices=std::vector< unsigned >(), bool deleteMesh=false, bool validate=true)
 NodeBasedCellPopulation (NodesOnlyMesh< DIM > &rMesh)
virtual ~NodeBasedCellPopulation ()
NodesOnlyMesh< DIM > & rGetMesh ()
const NodesOnlyMesh< DIM > & rGetMesh () const
unsigned GetNumNodes ()
Node< DIM > * GetNode (unsigned index)
unsigned RemoveDeadCells ()
void Clear ()
void Update (bool hasHadBirthsOrDeaths=true)
BoxCollection< DIM > * GetBoxCollection ()
std::set< std::pair< Node< DIM >
*, Node< DIM > * > > & 
rGetNodePairs ()
void OutputCellPopulationParameters (out_stream &rParamsFile)
double GetMechanicsCutOffLength ()
void SetMechanicsCutOffLength (double mechanicsCutOffLength)
bool GetUseVariableRadii ()
void SetUseVariableRadii (bool useVariableRadii=true)
double GetWidth (const unsigned &rDimension)
std::set< unsignedGetNeighbouringNodeIndices (unsigned index)
virtual CellPtr AddCell (CellPtr pNewCell, const c_vector< double, DIM > &rCellDivisionVector, CellPtr pParentCell)
double GetVolumeOfCell (CellPtr pCell)

Protected Member Functions

virtual void UpdateParticlesAfterReMesh (NodeMap &rMap)
virtual void Validate ()

Private Member Functions

template<class Archive >
void serialize (Archive &archive, const unsigned int version)
unsigned AddNode (Node< DIM > *pNewNode)
void SplitUpIntoBoxes (double cutOffLength, c_vector< double, 2 *DIM > domainSize)
void FindMaxAndMin ()
void WriteCellVolumeResultsToFile ()
void WriteVtkResultsToFile ()

Private Attributes

NodesOnlyMesh< DIM > * mpNodesOnlyMesh
c_vector< double, DIM > mMinSpatialPositions
c_vector< double, DIM > mMaxSpatialPositions
std::set< std::pair< Node< DIM >
*, Node< DIM > * > > 
mNodePairs
std::map< unsigned, std::set
< unsigned > > 
mNodeNeighbours
bool mDeleteMesh
double mMechanicsCutOffLength
bool mUseVariableRadii

Friends

class TestNodeBasedCellPopulation
class TestBoxCollection
class boost::serialization::access

Detailed Description

template<unsigned DIM>
class NodeBasedCellPopulation< DIM >

A NodeBasedCellPopulation is a CellPopulation consisting of only nodes in space with associated cells. There are no elements and no mesh.

Definition at line 51 of file NodeBasedCellPopulation.hpp.


Constructor & Destructor Documentation

template<unsigned DIM>
NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation ( NodesOnlyMesh< DIM > &  rMesh,
std::vector< CellPtr > &  rCells,
const std::vector< unsigned locationIndices = std::vector<unsigned>(),
bool  deleteMesh = false,
bool  validate = true 
)

Default constructor.

Note that the cell population will take responsibility for freeing the memory used by the nodes.

Parameters:
rMesha mutable nodes-only mesh
rCellsa vector of cells
locationIndicesan optional vector of location indices that correspond to real cells
deleteMeshwhether to delete nodes-only mesh in destructor
validatewhether to call Validate() in the constructor or not

Definition at line 40 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mpNodesOnlyMesh, AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::mrMesh, and NodeBasedCellPopulation< DIM >::Validate().

template<unsigned DIM>
NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation ( NodesOnlyMesh< DIM > &  rMesh)

Constructor for use by the de-serializer.

Parameters:
rMesha mutable nodes-only mesh

Definition at line 58 of file NodeBasedCellPopulation.cpp.

References NodeBasedCellPopulation< DIM >::mpNodesOnlyMesh, and AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::mrMesh.

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

Destructor.

Frees all our node memory.

Definition at line 69 of file NodeBasedCellPopulation.cpp.


Member Function Documentation

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

Overridden AddCell() method.

Add a new cell to the cell population and update the vector of cell radii in the NodesOnlyMesh.

Parameters:
pNewCellthe cell to add
rCellDivisionVectorthe position in space at which to put it
pParentCellpointer to a parent cell - this is required for node-based cell populations
Returns:
address of cell as it appears in the cell list (internal of this method uses a copy constructor along the way)

Reimplemented in NodeBasedCellPopulationWithParticles< DIM >.

Definition at line 664 of file NodeBasedCellPopulation.cpp.

References AbstractCentreBasedCellPopulation< ELEMENT_DIM, SPACE_DIM >::AddCell().

template<unsigned DIM>
unsigned NodeBasedCellPopulation< DIM >::AddNode ( Node< DIM > *  pNewNode) [private]

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 285 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::Clear ( )

Reset the member variables mNodePairs and mpBoxCollection in the underlying mesh.

Definition at line 91 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::FindMaxAndMin ( ) [private]

Loops over nodes and sets mMinSpatialPositions and mMaxSpatialPositions

Definition at line 127 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
BoxCollection< DIM > * NodeBasedCellPopulation< DIM >::GetBoxCollection ( )
Returns:
pointer to a node box collection.

Definition at line 302 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
double NodeBasedCellPopulation< DIM >::GetMechanicsCutOffLength ( )
Returns:
mMechanicsCutOffLength

Definition at line 336 of file NodeBasedCellPopulation.cpp.

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

Overridden GetNeighbouringNodeIndices() method.

Only returns nodes that are strictly touching each other.

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

Implements AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >.

Definition at line 366 of file NodeBasedCellPopulation.cpp.

References EXCEPTION.

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

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

Overridden GetNode() method.

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

Implements AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >.

Definition at line 165 of file NodeBasedCellPopulation.cpp.

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

template<unsigned DIM>
unsigned NodeBasedCellPopulation< DIM >::GetNumNodes ( ) [virtual]
Returns:
the number of nodes in the cell population.

Implements AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >.

Definition at line 291 of file NodeBasedCellPopulation.cpp.

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

template<unsigned DIM>
bool NodeBasedCellPopulation< DIM >::GetUseVariableRadii ( )
Returns:
mUseVariableRadii

Definition at line 342 of file NodeBasedCellPopulation.cpp.

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

Overridden GetVolumeOfCell() method.

Parameters:
pCellboost shared pointer to a cell

Implements AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >.

Definition at line 430 of file NodeBasedCellPopulation.cpp.

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

Overridden GetWidth() method.

Calculate the 'width' of any dimension of the cell population by computing the maximum distance between any nodes in this dimension.

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

Implements AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >.

Definition at line 354 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
void NodeBasedCellPopulation< 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 AbstractCentreBasedCellPopulation< DIM >.

Reimplemented in NodeBasedCellPopulationWithBuskeUpdate< DIM >, and NodeBasedCellPopulationWithParticles< DIM >.

Definition at line 318 of file NodeBasedCellPopulation.cpp.

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

Referenced by NodeBasedCellPopulationWithParticles< DIM >::OutputCellPopulationParameters(), and NodeBasedCellPopulationWithBuskeUpdate< DIM >::OutputCellPopulationParameters().

template<unsigned DIM>
unsigned NodeBasedCellPopulation< 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, SPACE_DIM >.

Definition at line 258 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
NodesOnlyMesh< DIM > & NodeBasedCellPopulation< DIM >::rGetMesh ( )
Returns:
reference to mrMesh.

Reimplemented from AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >.

Definition at line 79 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
const NodesOnlyMesh< DIM > & NodeBasedCellPopulation< DIM >::rGetMesh ( ) const
Returns:
const reference to mrMesh (used in archiving).

Definition at line 85 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
std::set< std::pair< Node< DIM > *, Node< DIM > * > > & NodeBasedCellPopulation< DIM >::rGetNodePairs ( ) [virtual]

Overridden rGetNodePairs method

Returns:
Node pairs for force calculation.

Implements AbstractCentreBasedCellPopulation< DIM >.

Definition at line 308 of file NodeBasedCellPopulation.cpp.

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

Serialize the object and its member variables.

Note that serialization of the nodes is handled by load/save_construct_data, so we don't actually have to do anything here except delegate to the base class.

Parameters:
archivethe archive
versionthe current version of this class

Reimplemented from AbstractCentreBasedCellPopulation< DIM >.

Reimplemented in NodeBasedCellPopulationWithBuskeUpdate< DIM >, and NodeBasedCellPopulationWithParticles< DIM >.

Definition at line 99 of file NodeBasedCellPopulation.hpp.

References NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength, NodeBasedCellPopulation< DIM >::mUseVariableRadii, and NodeBasedCellPopulation< DIM >::Validate().

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::SetMechanicsCutOffLength ( double  mechanicsCutOffLength)

Set mMechanicsCutOffLength.

Parameters:
mechanicsCutOffLengththe new value of mMechanicsCutOffLength

Definition at line 329 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::SetNode ( unsigned  nodeIndex,
ChastePoint< DIM > &  rNewLocation 
)

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

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

Definition at line 171 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::SetUseVariableRadii ( bool  useVariableRadii = true)

Set mUseVariableRadii.

Parameters:
useVariableRadiithe new value of mUseVariableRadii

Definition at line 348 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::SplitUpIntoBoxes ( double  cutOffLength,
c_vector< double, 2 *DIM >  domainSize 
) [private]

Method for Initially Splitting up cell population into neighbouring boxes, to decrease runtime.

Parameters:
cutOffLengthlength of spring cut off between nodes
domainSizec_vector of size 2*dimension reads minX, maxX, minY, maxY, etc

Definition at line 121 of file NodeBasedCellPopulation.cpp.

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

Remove nodes that have been marked as deleted and update the node cell map.

Parameters:
hasHadBirthsOrDeathswhether cell population has had Births Or Deaths

Todo:
we want to make mCellLocationMap private - we need to find a better way of doing this

Implements AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >.

Definition at line 177 of file NodeBasedCellPopulation.cpp.

References EXCEPTION.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::UpdateParticlesAfterReMesh ( NodeMap rMap) [protected, virtual]

Update mIsParticle if required by a remesh.

Parameters:
rMapA map between node indices before and after remesh

Reimplemented in NodeBasedCellPopulationWithParticles< DIM >.

Definition at line 297 of file NodeBasedCellPopulation.cpp.

template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::Validate ( ) [protected, virtual]
template<unsigned DIM>
void NodeBasedCellPopulation< DIM >::WriteCellVolumeResultsToFile ( ) [private, virtual]

Friends And Related Function Documentation

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

Member Data Documentation

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

Whether to delete the nodes-only mesh (taken in one of the constructors, defaults to false).

Definition at line 74 of file NodeBasedCellPopulation.hpp.

template<unsigned DIM>
c_vector<double, DIM> NodeBasedCellPopulation< DIM >::mMaxSpatialPositions [private]

Vector of maximal spatial positions in each dimension.

Definition at line 65 of file NodeBasedCellPopulation.hpp.

template<unsigned DIM>
double NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength [private]

Mechanics cut off length. Used in order to calculate the BoxCollection.

Definition at line 80 of file NodeBasedCellPopulation.hpp.

Referenced by NodeBasedCellPopulation< DIM >::serialize().

template<unsigned DIM>
c_vector<double, DIM> NodeBasedCellPopulation< DIM >::mMinSpatialPositions [private]

Vector of minimal spatial positions in each dimension.

Definition at line 62 of file NodeBasedCellPopulation.hpp.

template<unsigned DIM>
std::map<unsigned, std::set<unsigned> > NodeBasedCellPopulation< DIM >::mNodeNeighbours [private]

Indices of neighbours of local nodes.

Definition at line 71 of file NodeBasedCellPopulation.hpp.

template<unsigned DIM>
std::set< std::pair<Node<DIM>*, Node<DIM>* > > NodeBasedCellPopulation< DIM >::mNodePairs [private]

Node pairs for force calculations.

Definition at line 68 of file NodeBasedCellPopulation.hpp.

template<unsigned DIM>
NodesOnlyMesh<DIM>* NodeBasedCellPopulation< DIM >::mpNodesOnlyMesh [private]

Static cast of the mesh from AbstractCellPopulation.

Definition at line 59 of file NodeBasedCellPopulation.hpp.

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

template<unsigned DIM>
bool NodeBasedCellPopulation< DIM >::mUseVariableRadii [private]

Whether or not to have cell radii updated from CellData defaults to false.

Definition at line 85 of file NodeBasedCellPopulation.hpp.

Referenced by NodeBasedCellPopulation< DIM >::serialize().


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