#include <NodeBasedCellPopulation.hpp>
Public Member Functions | |
NodeBasedCellPopulation (const std::vector< Node< DIM > * > nodes, std::vector< CellPtr > &rCells, const std::vector< unsigned > locationIndices=std::vector< unsigned >(), bool deleteNodes=true) | |
NodeBasedCellPopulation (const std::vector< Node< DIM > * > nodes, double mechanicsCutOffLength, bool deleteNodes=true) | |
NodeBasedCellPopulation (const AbstractMesh< DIM, DIM > &rMesh, std::vector< CellPtr > &rCells) | |
~NodeBasedCellPopulation () | |
unsigned | GetNumNodes () |
Node< DIM > * | GetNode (unsigned index) |
unsigned | RemoveDeadCells () |
void | Clear () |
void | Update (bool hasHadBirthsOrDeaths=true) |
std::vector< Node< DIM > * > & | rGetNodes () |
const std::vector< Node< DIM > * > & | rGetNodes () const |
BoxCollection< DIM > * | GetBoxCollection () |
std::set< std::pair< Node< DIM > *, Node< DIM > * > > & | rGetNodePairs () |
void | OutputCellPopulationParameters (out_stream &rParamsFile) |
double | GetMechanicsCutOffLength () |
void | SetMechanicsCutOffLength (double mechanicsCutOffLength) |
double | GetWidth (const unsigned &rDimension) |
Protected Attributes | |
std::vector< Node< DIM > * > | mNodes |
std::vector< unsigned > | mDeletedNodeIndices |
bool | mAddedNodes |
Private Member Functions | |
template<class Archive> | |
void | serialize (Archive &archive, const unsigned int version) |
unsigned | AddNode (Node< DIM > *pNewNode) |
void | SetNode (unsigned nodeIndex, ChastePoint< DIM > &rNewLocation) |
void | Validate () |
void | SplitUpIntoBoxes (double cutOffLength, c_vector< double, 2 *DIM > domainSize) |
void | FindMaxAndMin () |
Private Attributes | |
BoxCollection< DIM > * | mpBoxCollection |
c_vector< double, DIM > | mMinSpatialPositions |
c_vector< double, DIM > | mMaxSpatialPositions |
std::set< std::pair< Node< DIM > *, Node< DIM > * > > | mNodePairs |
bool | mDeleteNodes |
double | mMechanicsCutOffLength |
Friends | |
class | TestNodeBasedCellPopulation |
class | TestBoxCollection |
class | boost::serialization::access |
Definition at line 45 of file NodeBasedCellPopulation.hpp.
NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation | ( | const std::vector< Node< DIM > * > | nodes, | |
std::vector< CellPtr > & | rCells, | |||
const std::vector< unsigned > | locationIndices = std::vector<unsigned>() , |
|||
bool | deleteNodes = true | |||
) | [inline] |
Default constructor.
Note that the cell population will take responsibility for freeing the memory used by the nodes.
nodes | a vector of Nodes | |
rCells | a vector of cells | |
locationIndices | an optional vector of location indices that correspond to real cells | |
deleteNodes | whether to delete nodes in destructor |
Definition at line 31 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::Validate().
NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation | ( | const std::vector< Node< DIM > * > | nodes, | |
double | mechanicsCutOffLength, | |||
bool | deleteNodes = true | |||
) | [inline] |
Constructor for use by the archiving - doesn't take in cells, since these are dealt with by the serialize method of our base class.
Note that the cell population will take responsibility for freeing the memory used by the nodes.
nodes | a vector of Nodes | |
mechanicsCutOffLength | the cut of length for mechanics uised to create the BoxedCollection to improve speed | |
deleteNodes | whether to delete nodes in destructor |
Definition at line 47 of file NodeBasedCellPopulation.cpp.
NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation | ( | const AbstractMesh< DIM, DIM > & | rMesh, | |
std::vector< CellPtr > & | rCells | |||
) | [inline] |
Constructor which takes in a mesh and takes a copy of its nodes. The mesh is not changed and no references to any of its data are created.
This constructor is a helper constructor: it is generally easier for the user to create a mesh than a set of nodes.
rMesh | any mesh. | |
rCells | a vector of cells. |
Definition at line 59 of file NodeBasedCellPopulation.cpp.
References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), NodeBasedCellPopulation< DIM >::mAddedNodes, NodeBasedCellPopulation< DIM >::mNodes, and NodeBasedCellPopulation< DIM >::Validate().
NodeBasedCellPopulation< DIM >::~NodeBasedCellPopulation | ( | ) | [inline] |
Destructor.
Frees all our node memory.
Definition at line 81 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::Clear(), NodeBasedCellPopulation< DIM >::mDeleteNodes, and NodeBasedCellPopulation< DIM >::mNodes.
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.
archive | the archive | |
version | the current version of this class |
Reimplemented from AbstractCentreBasedCellPopulation< DIM >.
Definition at line 98 of file NodeBasedCellPopulation.hpp.
References NodeBasedCellPopulation< DIM >::Validate().
unsigned NodeBasedCellPopulation< DIM >::AddNode | ( | Node< DIM > * | pNewNode | ) | [inline, private, virtual] |
Overridden AddNode() method.
Add a new node to the cell population.
pNewNode | pointer to the new node |
Implements AbstractCellPopulation< DIM >.
Definition at line 310 of file NodeBasedCellPopulation.cpp.
References Node< SPACE_DIM >::GetIndex(), NodeBasedCellPopulation< DIM >::mAddedNodes, NodeBasedCellPopulation< DIM >::mDeletedNodeIndices, NodeBasedCellPopulation< DIM >::mNodes, and Node< SPACE_DIM >::SetIndex().
void NodeBasedCellPopulation< DIM >::SetNode | ( | unsigned | nodeIndex, | |
ChastePoint< DIM > & | rNewLocation | |||
) | [inline, private, virtual] |
Move the node with a given index to a new point in space.
nodeIndex | the index of the node to be moved | |
rNewLocation | the new target location of the node |
Implements AbstractCellPopulation< DIM >.
Definition at line 201 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mNodes.
void NodeBasedCellPopulation< DIM >::Validate | ( | ) | [inline, private, virtual] |
Check consistency of our internal data structures.
Implements AbstractCellPopulation< DIM >.
Definition at line 106 of file NodeBasedCellPopulation.cpp.
References AbstractCellPopulation< DIM >::Begin(), AbstractCellPopulation< DIM >::End(), EXCEPTION, NodeBasedCellPopulation< DIM >::GetNumNodes(), and AbstractCellPopulation< DIM >::mCellLocationMap.
Referenced by NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation(), NodeBasedCellPopulation< DIM >::serialize(), and NodeBasedCellPopulation< DIM >::Update().
void NodeBasedCellPopulation< DIM >::SplitUpIntoBoxes | ( | double | cutOffLength, | |
c_vector< double, 2 *DIM > | domainSize | |||
) | [inline, private] |
Method for Initially Splitting up cell population into neighbouring boxes, to decrease runtime.
cutOffLength | length of spring cut off between nodes | |
domainSize | c_vector of size 2*dimension reads minX, maxX, minY, maxY, etc |
Definition at line 144 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mNodes, and NodeBasedCellPopulation< DIM >::mpBoxCollection.
Referenced by NodeBasedCellPopulation< DIM >::Update().
void NodeBasedCellPopulation< DIM >::FindMaxAndMin | ( | ) | [inline, private] |
Loops over nodes and sets mMinSpatialPositions and mMaxSpatialPositions
Definition at line 157 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::GetNode(), NodeBasedCellPopulation< DIM >::mMaxSpatialPositions, NodeBasedCellPopulation< DIM >::mMinSpatialPositions, and NodeBasedCellPopulation< DIM >::mNodes.
Referenced by NodeBasedCellPopulation< DIM >::GetWidth(), and NodeBasedCellPopulation< DIM >::Update().
unsigned NodeBasedCellPopulation< DIM >::GetNumNodes | ( | ) | [inline, virtual] |
Implements AbstractCellPopulation< DIM >.
Definition at line 330 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mDeletedNodeIndices, and NodeBasedCellPopulation< DIM >::mNodes.
Referenced by NodeBasedCellPopulation< DIM >::Validate().
Node< DIM > * NodeBasedCellPopulation< DIM >::GetNode | ( | unsigned | index | ) | [inline, virtual] |
Overridden GetNode() method.
index | global index of the specified node |
Implements AbstractCellPopulation< DIM >.
Definition at line 195 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mNodes.
Referenced by NodeBasedCellPopulation< DIM >::FindMaxAndMin().
unsigned NodeBasedCellPopulation< 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.
Implements AbstractCellPopulation< DIM >.
Definition at line 288 of file NodeBasedCellPopulation.cpp.
References AbstractCentreBasedCellPopulation< DIM >::GetNodeCorrespondingToCell(), AbstractCellPopulation< DIM >::mCellLocationMap, AbstractCellPopulation< DIM >::mCells, and NodeBasedCellPopulation< DIM >::mDeletedNodeIndices.
void NodeBasedCellPopulation< DIM >::Clear | ( | ) | [inline] |
Reset the member variables mDeletedNodeIndices, mAddedNodes, mNodePairs, and mpBoxCollection.
Definition at line 96 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mAddedNodes, NodeBasedCellPopulation< DIM >::mDeletedNodeIndices, NodeBasedCellPopulation< DIM >::mNodePairs, and NodeBasedCellPopulation< DIM >::mpBoxCollection.
Referenced by NodeBasedCellPopulation< DIM >::Update(), and NodeBasedCellPopulation< DIM >::~NodeBasedCellPopulation().
void NodeBasedCellPopulation< DIM >::Update | ( | bool | hasHadBirthsOrDeaths = true |
) | [inline, virtual] |
Remove nodes that have been marked as deleted and update the node cell map.
hasHadBirthsOrDeaths | whether cell population has had Births Or Deaths |
Implements AbstractCellPopulation< DIM >.
Definition at line 207 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::Clear(), EXCEPTION, NodeBasedCellPopulation< DIM >::FindMaxAndMin(), AbstractCellPopulation< DIM >::mCellLocationMap, AbstractCellPopulation< DIM >::mLocationCellMap, NodeBasedCellPopulation< DIM >::mMaxSpatialPositions, NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength, NodeBasedCellPopulation< DIM >::mMinSpatialPositions, NodeBasedCellPopulation< DIM >::mNodePairs, NodeBasedCellPopulation< DIM >::mNodes, NodeBasedCellPopulation< DIM >::mpBoxCollection, NodeBasedCellPopulation< DIM >::SplitUpIntoBoxes(), and NodeBasedCellPopulation< DIM >::Validate().
std::vector< Node< DIM > * > & NodeBasedCellPopulation< DIM >::rGetNodes | ( | ) | [inline] |
Method for getting all nodes in the cell population.
Definition at line 132 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mNodes.
const std::vector< Node< DIM > * > & NodeBasedCellPopulation< DIM >::rGetNodes | ( | ) | const [inline] |
Method for getting all nodes in the cell population (for archiving).
Definition at line 138 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mNodes.
BoxCollection< DIM > * NodeBasedCellPopulation< DIM >::GetBoxCollection | ( | ) | [inline] |
Definition at line 336 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mpBoxCollection.
std::set< std::pair< Node< DIM > *, Node< DIM > * > > & NodeBasedCellPopulation< DIM >::rGetNodePairs | ( | ) | [inline] |
Definition at line 342 of file NodeBasedCellPopulation.cpp.
References EXCEPTION, and NodeBasedCellPopulation< DIM >::mNodePairs.
void NodeBasedCellPopulation< DIM >::OutputCellPopulationParameters | ( | out_stream & | rParamsFile | ) | [inline, virtual] |
Outputs CellPopulation parameters to file
As this method is pure virtual, it must be overridden in subclasses.
rParamsFile | the file stream to which the parameters are output |
Reimplemented from AbstractCentreBasedCellPopulation< DIM >.
Definition at line 352 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength, and AbstractCentreBasedCellPopulation< DIM >::OutputCellPopulationParameters().
double NodeBasedCellPopulation< DIM >::GetMechanicsCutOffLength | ( | ) | [inline] |
Definition at line 371 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength.
void NodeBasedCellPopulation< DIM >::SetMechanicsCutOffLength | ( | double | mechanicsCutOffLength | ) | [inline] |
Set mMechanicsCutOffLength.
mechanicsCutOffLength | the new value of mMechanicsCutOffLength |
Definition at line 364 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength.
double NodeBasedCellPopulation< DIM >::GetWidth | ( | const unsigned & | rDimension | ) | [inline, 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.
rDimension | a dimension (0,1 or 2) |
Implements AbstractCellPopulation< DIM >.
Definition at line 377 of file NodeBasedCellPopulation.cpp.
References NodeBasedCellPopulation< DIM >::FindMaxAndMin(), NodeBasedCellPopulation< DIM >::mMaxSpatialPositions, and NodeBasedCellPopulation< DIM >::mMinSpatialPositions.
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from AbstractCentreBasedCellPopulation< DIM >.
Definition at line 87 of file NodeBasedCellPopulation.hpp.
std::vector<Node<DIM>* > NodeBasedCellPopulation< DIM >::mNodes [protected] |
List of nodes.
Definition at line 53 of file NodeBasedCellPopulation.hpp.
Referenced by NodeBasedCellPopulation< DIM >::AddNode(), NodeBasedCellPopulation< DIM >::FindMaxAndMin(), NodeBasedCellPopulation< DIM >::GetNode(), NodeBasedCellPopulation< DIM >::GetNumNodes(), NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation(), NodeBasedCellPopulation< DIM >::rGetNodes(), NodeBasedCellPopulation< DIM >::SetNode(), NodeBasedCellPopulation< DIM >::SplitUpIntoBoxes(), NodeBasedCellPopulation< DIM >::Update(), and NodeBasedCellPopulation< DIM >::~NodeBasedCellPopulation().
std::vector<unsigned> NodeBasedCellPopulation< DIM >::mDeletedNodeIndices [protected] |
Indices of nodes that have been deleted, to be reused when adding new nodes.
Definition at line 56 of file NodeBasedCellPopulation.hpp.
Referenced by NodeBasedCellPopulation< DIM >::AddNode(), NodeBasedCellPopulation< DIM >::Clear(), NodeBasedCellPopulation< DIM >::GetNumNodes(), and NodeBasedCellPopulation< DIM >::RemoveDeadCells().
bool NodeBasedCellPopulation< DIM >::mAddedNodes [protected] |
Whether nodes have been added to the cell population.
Definition at line 59 of file NodeBasedCellPopulation.hpp.
Referenced by NodeBasedCellPopulation< DIM >::AddNode(), NodeBasedCellPopulation< DIM >::Clear(), and NodeBasedCellPopulation< DIM >::NodeBasedCellPopulation().
BoxCollection<DIM>* NodeBasedCellPopulation< DIM >::mpBoxCollection [private] |
Pointer to a Node box collection
Definition at line 64 of file NodeBasedCellPopulation.hpp.
Referenced by NodeBasedCellPopulation< DIM >::Clear(), NodeBasedCellPopulation< DIM >::GetBoxCollection(), NodeBasedCellPopulation< DIM >::SplitUpIntoBoxes(), and NodeBasedCellPopulation< DIM >::Update().
c_vector<double, DIM> NodeBasedCellPopulation< DIM >::mMinSpatialPositions [private] |
Vector of minimal spatial positions in each dimension
Definition at line 67 of file NodeBasedCellPopulation.hpp.
Referenced by NodeBasedCellPopulation< DIM >::FindMaxAndMin(), NodeBasedCellPopulation< DIM >::GetWidth(), and NodeBasedCellPopulation< DIM >::Update().
c_vector<double, DIM> NodeBasedCellPopulation< DIM >::mMaxSpatialPositions [private] |
Vector of maximal spatial positions in each dimension
Definition at line 70 of file NodeBasedCellPopulation.hpp.
Referenced by NodeBasedCellPopulation< DIM >::FindMaxAndMin(), NodeBasedCellPopulation< DIM >::GetWidth(), and NodeBasedCellPopulation< DIM >::Update().
std::set< std::pair<Node<DIM>*, Node<DIM>* > > NodeBasedCellPopulation< DIM >::mNodePairs [private] |
Node pairs for force calculations
Definition at line 73 of file NodeBasedCellPopulation.hpp.
Referenced by NodeBasedCellPopulation< DIM >::Clear(), NodeBasedCellPopulation< DIM >::rGetNodePairs(), and NodeBasedCellPopulation< DIM >::Update().
bool NodeBasedCellPopulation< DIM >::mDeleteNodes [private] |
Whether to delete the nodes (taken in one of the constructors, defaults to true)
Definition at line 78 of file NodeBasedCellPopulation.hpp.
Referenced by NodeBasedCellPopulation< DIM >::~NodeBasedCellPopulation().
double NodeBasedCellPopulation< DIM >::mMechanicsCutOffLength [private] |
Mechanics cut off length. Used in order to calculate the BoxCollection.
Definition at line 84 of file NodeBasedCellPopulation.hpp.
Referenced by NodeBasedCellPopulation< DIM >::GetMechanicsCutOffLength(), NodeBasedCellPopulation< DIM >::OutputCellPopulationParameters(), NodeBasedCellPopulation< DIM >::SetMechanicsCutOffLength(), and NodeBasedCellPopulation< DIM >::Update().