#include <MeshBasedCellPopulationWithGhostNodes.hpp>
Public Member Functions | |
MeshBasedCellPopulationWithGhostNodes (MutableMesh< DIM, DIM > &rMesh, std::vector< CellPtr > &rCells, const std::vector< unsigned > locationIndices=std::vector< unsigned >(), bool deleteMesh=false, double ghostSpringStiffness=15.0) | |
MeshBasedCellPopulationWithGhostNodes (MutableMesh< DIM, DIM > &rMesh, double ghostSpringStiffness=15.0) | |
void | UpdateNodeLocations (const std::vector< c_vector< double, DIM > > &rNodeForces, double dt) |
std::vector< bool > & | rGetGhostNodes () |
bool | IsGhostNode (unsigned index) |
std::set< unsigned > | GetGhostNodeIndices () |
void | UpdateGhostPositions (double dt) |
void | UpdateGhostNodesAfterReMesh (NodeMap &rMap) |
c_vector< double, DIM > | CalculateForceBetweenGhostNodes (const unsigned &rNodeAGlobalIndex, const unsigned &rNodeBGlobalIndex) |
CellPtr | AddCell (CellPtr pNewCell, const c_vector< double, DIM > &rCellDivisionVector, CellPtr pParentCell) |
void | WriteVtkResultsToFile () |
void | OutputCellPopulationParameters (out_stream &rParamsFile) |
Private Member Functions | |
template<class Archive> | |
void | serialize (Archive &archive, const unsigned int version) |
void | SetGhostNodes (const std::set< unsigned > &rGhostNodeIndices) |
void | Validate () |
Private Attributes | |
std::vector< bool > | mIsGhostNode |
double | mGhostSpringStiffness |
Friends | |
class | TestMeshBasedCellPopulationWithGhostNodes |
class | boost::serialization::access |
If simulating a crypt with a mesh-based cell population, the mesh should be surrounded by at least one layer of ghost nodes. These are nodes which do not correspond to a cell, but are necessary for remeshing (because the remesher tries to create a convex hull of the set of nodes) and visualization purposes. The MeshBasedCellPopulationWithGhostNodes class deals with these ghost nodes, hiding the 'ghost nodes' concept from the CellBasedSimulation class, so the latter only ever deals with real cells.
Definition at line 49 of file MeshBasedCellPopulationWithGhostNodes.hpp.
MeshBasedCellPopulationWithGhostNodes< DIM >::MeshBasedCellPopulationWithGhostNodes | ( | MutableMesh< DIM, DIM > & | rMesh, | |
std::vector< CellPtr > & | rCells, | |||
const std::vector< unsigned > | locationIndices = std::vector<unsigned>() , |
|||
bool | deleteMesh = false , |
|||
double | ghostSpringStiffness = 15.0 | |||
) | [inline] |
Create a new cell population from a mesh and collection of cells.
rMesh | a mutable tetrahedral mesh | |
rCells | cells corresponding to the nodes of the mesh | |
locationIndices | an optional vector of location indices that correspond to real cells | |
deleteMesh | set to true if you want the cell population to free the mesh memory on destruction | |
ghostSpringStiffness | spring stiffness used to move the ghost nodes defaults to 15.0. |
Definition at line 32 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References MeshBasedCellPopulation< DIM >::GetNode(), MeshBasedCellPopulation< DIM >::GetNumNodes(), MeshBasedCellPopulationWithGhostNodes< DIM >::mIsGhostNode, MeshBasedCellPopulationWithGhostNodes< DIM >::SetGhostNodes(), and MeshBasedCellPopulationWithGhostNodes< DIM >::Validate().
MeshBasedCellPopulationWithGhostNodes< DIM >::MeshBasedCellPopulationWithGhostNodes | ( | MutableMesh< DIM, DIM > & | rMesh, | |
double | ghostSpringStiffness = 15.0 | |||
) | [inline] |
Constructor for use by the de-serializer.
rMesh | a mutable tetrahedral mesh. | |
ghostSpringStiffness | spring stiffness used to move the ghost nodes defaults to 15.0. |
Definition at line 72 of file MeshBasedCellPopulationWithGhostNodes.cpp.
void MeshBasedCellPopulationWithGhostNodes< 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.
archive | the archive | |
version | the current version of this class |
Reimplemented from MeshBasedCellPopulation< DIM >.
Definition at line 78 of file MeshBasedCellPopulationWithGhostNodes.hpp.
void MeshBasedCellPopulationWithGhostNodes< DIM >::SetGhostNodes | ( | const std::set< unsigned > & | rGhostNodeIndices | ) | [inline, private] |
Set the ghost nodes by taking in a set of which nodes indices are ghost nodes.
rGhostNodeIndices | set of node indices corresponding to ghost nodes |
Definition at line 106 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References MutableMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), MeshBasedCellPopulationWithGhostNodes< DIM >::mIsGhostNode, MeshBasedCellPopulation< DIM >::mrMesh, and MeshBasedCellPopulationWithGhostNodes< DIM >::Validate().
Referenced by MeshBasedCellPopulationWithGhostNodes< DIM >::MeshBasedCellPopulationWithGhostNodes().
void MeshBasedCellPopulationWithGhostNodes< DIM >::Validate | ( | ) | [inline, private, virtual] |
This is called after a cell population has been constructed to check the user gave consistent instructions. Check consistency of our internal data structures: Each node must have a cell associated with it OR must be a ghost node.
It is called after cells are added or removed from MeshBasedCellPopulation as it is an overridden virtual method.
Reimplemented from MeshBasedCellPopulation< DIM >.
Definition at line 211 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References AbstractCellPopulation< DIM >::Begin(), AbstractCellPopulation< DIM >::End(), EXCEPTION, MeshBasedCellPopulation< DIM >::GetNumNodes(), AbstractCellPopulation< DIM >::mCellLocationMap, and MeshBasedCellPopulationWithGhostNodes< DIM >::mIsGhostNode.
Referenced by MeshBasedCellPopulationWithGhostNodes< DIM >::MeshBasedCellPopulationWithGhostNodes(), and MeshBasedCellPopulationWithGhostNodes< DIM >::SetGhostNodes().
void MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateNodeLocations | ( | const std::vector< c_vector< double, DIM > > & | rNodeForces, | |
double | dt | |||
) | [inline, virtual] |
Overridden UpdateNodeLocation() method.
Update the location of each node in the cell population given a vector of forces on nodes and a time step over which to integrate the equations of motion.
rNodeForces | forces on nodes | |
dt | time step |
Reimplemented from AbstractCentreBasedCellPopulation< DIM >.
Definition at line 265 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateGhostPositions(), and AbstractCentreBasedCellPopulation< DIM >::UpdateNodeLocations().
std::vector< bool > & MeshBasedCellPopulationWithGhostNodes< DIM >::rGetGhostNodes | ( | ) | [inline] |
Definition at line 80 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References MeshBasedCellPopulationWithGhostNodes< DIM >::mIsGhostNode.
bool MeshBasedCellPopulationWithGhostNodes< DIM >::IsGhostNode | ( | unsigned | index | ) | [inline, virtual] |
Overridden IsGhostNode() method.
Find if a given node is a ghost node. The abstract method always returns false but is overridden in subclasses.
index | the global index of a specified node |
Reimplemented from AbstractCentreBasedCellPopulation< DIM >.
Definition at line 86 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References MeshBasedCellPopulationWithGhostNodes< DIM >::mIsGhostNode.
Referenced by MeshBasedCellPopulationWithGhostNodes< DIM >::WriteVtkResultsToFile().
std::set< unsigned > MeshBasedCellPopulationWithGhostNodes< DIM >::GetGhostNodeIndices | ( | ) | [inline] |
Definition at line 92 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References MeshBasedCellPopulationWithGhostNodes< DIM >::mIsGhostNode.
void MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateGhostPositions | ( | double | dt | ) | [inline] |
Update the GhostNode positions using the spring force model with rest length=1. Forces are applied to ghost nodes from connected ghost and normal nodes.
dt |
Definition at line 121 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References MeshBasedCellPopulationWithGhostNodes< DIM >::CalculateForceBetweenGhostNodes(), TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::EdgesBegin(), TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::EdgesEnd(), AbstractCellPopulation< DIM >::GetDampingConstantNormal(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorBegin(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorEnd(), MeshBasedCellPopulation< DIM >::GetNumNodes(), MeshBasedCellPopulationWithGhostNodes< DIM >::mIsGhostNode, MeshBasedCellPopulation< DIM >::mrMesh, and MutableMesh< ELEMENT_DIM, SPACE_DIM >::SetNode().
Referenced by MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateNodeLocations().
void MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateGhostNodesAfterReMesh | ( | NodeMap & | rMap | ) | [inline, virtual] |
Update mIsGhostNode if required by a remesh.
rMap | A map between node indices before and after remesh |
Reimplemented from MeshBasedCellPopulation< DIM >.
Definition at line 244 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References NodeMap::GetNewIndex(), MeshBasedCellPopulation< DIM >::GetNumNodes(), NodeMap::IsDeleted(), MeshBasedCellPopulationWithGhostNodes< DIM >::mIsGhostNode, and NodeMap::Size().
c_vector< double, DIM > MeshBasedCellPopulationWithGhostNodes< DIM >::CalculateForceBetweenGhostNodes | ( | const unsigned & | rNodeAGlobalIndex, | |
const unsigned & | rNodeBGlobalIndex | |||
) | [inline] |
This method is used to calculate the force between GHOST nodes.
rNodeAGlobalIndex | ||
rNodeBGlobalIndex |
Definition at line 171 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References MeshBasedCellPopulation< DIM >::GetNode(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetVectorFromAtoB(), MeshBasedCellPopulationWithGhostNodes< DIM >::mGhostSpringStiffness, and MeshBasedCellPopulation< DIM >::mrMesh.
Referenced by MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateGhostPositions().
CellPtr MeshBasedCellPopulationWithGhostNodes< DIM >::AddCell | ( | CellPtr | pNewCell, | |
const c_vector< double, DIM > & | rCellDivisionVector, | |||
CellPtr | pParentCell | |||
) | [inline, virtual] |
Overridden AddCell() method.
Add a new cell to the cell population and update mIsGhostNode.
pNewCell | the cell to add | |
rCellDivisionVector | the position in space at which to put it | |
pParentCell | pointer to a parent cell - this is required for mesh-based cell populations |
Reimplemented from MeshBasedCellPopulation< DIM >.
Definition at line 191 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References MeshBasedCellPopulation< DIM >::AddCell(), MeshBasedCellPopulation< DIM >::GetNumNodes(), AbstractCellPopulation< DIM >::mCellLocationMap, and MeshBasedCellPopulationWithGhostNodes< DIM >::mIsGhostNode.
void MeshBasedCellPopulationWithGhostNodes< DIM >::WriteVtkResultsToFile | ( | ) | [inline, virtual] |
Overridden WriteVtkResultsToFile method.
Reimplemented from MeshBasedCellPopulation< DIM >.
Definition at line 275 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References VertexMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddCellData(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetDelaunayNodeIndexCorrespondingToVoronoiElementIndex(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorEnd(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), CellwiseData< DIM >::GetNumVariables(), SimulationTime::GetTimeStepsElapsed(), CellwiseData< DIM >::GetValue(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetVolumeOfElement(), CellwiseData< DIM >::Instance(), SimulationTime::Instance(), MeshBasedCellPopulationWithGhostNodes< DIM >::IsGhostNode(), AbstractCellPopulation< DIM >::mDirPath, AbstractCellPopulation< DIM >::mLocationCellMap, AbstractCellPopulation< DIM >::mOutputCellAges, AbstractCellPopulation< DIM >::mOutputCellAncestors, AbstractCellPopulation< DIM >::mOutputCellCyclePhases, AbstractCellPopulation< DIM >::mOutputCellMutationStates, AbstractCellPopulation< DIM >::mOutputCellProliferativeTypes, AbstractCellPopulation< DIM >::mOutputCellVolumes, MeshBasedCellPopulation< DIM >::mpVoronoiTessellation, AbstractCellPopulation< DIM >::mpVtkMetaFile, UNSIGNED_UNSET, and VertexMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteVtkUsingMesh().
void MeshBasedCellPopulationWithGhostNodes< 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 MeshBasedCellPopulation< DIM >.
Definition at line 438 of file MeshBasedCellPopulationWithGhostNodes.cpp.
References MeshBasedCellPopulationWithGhostNodes< DIM >::mGhostSpringStiffness, and MeshBasedCellPopulation< DIM >::OutputCellPopulationParameters().
friend class TestMeshBasedCellPopulationWithGhostNodes [friend] |
Just so that the test can test the private functions
Definition at line 54 of file MeshBasedCellPopulationWithGhostNodes.hpp.
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from MeshBasedCellPopulation< DIM >.
Definition at line 65 of file MeshBasedCellPopulationWithGhostNodes.hpp.
std::vector<bool> MeshBasedCellPopulationWithGhostNodes< DIM >::mIsGhostNode [private] |
Records whether a node is a ghost node or not
Definition at line 57 of file MeshBasedCellPopulationWithGhostNodes.hpp.
Referenced by MeshBasedCellPopulationWithGhostNodes< DIM >::AddCell(), MeshBasedCellPopulationWithGhostNodes< DIM >::GetGhostNodeIndices(), MeshBasedCellPopulationWithGhostNodes< DIM >::IsGhostNode(), MeshBasedCellPopulationWithGhostNodes< DIM >::MeshBasedCellPopulationWithGhostNodes(), MeshBasedCellPopulationWithGhostNodes< DIM >::rGetGhostNodes(), MeshBasedCellPopulationWithGhostNodes< 2 >::serialize(), MeshBasedCellPopulationWithGhostNodes< DIM >::SetGhostNodes(), MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateGhostNodesAfterReMesh(), MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateGhostPositions(), and MeshBasedCellPopulationWithGhostNodes< DIM >::Validate().
double MeshBasedCellPopulationWithGhostNodes< DIM >::mGhostSpringStiffness [private] |
Spring stiffness for springs between ghost nodes.
Definition at line 62 of file MeshBasedCellPopulationWithGhostNodes.hpp.
Referenced by MeshBasedCellPopulationWithGhostNodes< DIM >::CalculateForceBetweenGhostNodes(), MeshBasedCellPopulationWithGhostNodes< DIM >::OutputCellPopulationParameters(), and MeshBasedCellPopulationWithGhostNodes< 2 >::serialize().