#include <MeshBasedTissueWithGhostNodes.hpp>
Public Member Functions | |
MeshBasedTissueWithGhostNodes (MutableMesh< DIM, DIM > &rMesh, const std::vector< TissueCell > &rCells, const std::vector< unsigned > locationIndices=std::vector< unsigned >(), bool deleteMesh=false) | |
MeshBasedTissueWithGhostNodes (MutableMesh< DIM, DIM > &rMesh) | |
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 > | CalculateForceBetweenNodes (const unsigned &rNodeAGlobalIndex, const unsigned &rNodeBGlobalIndex) |
TissueCell * | AddCell (TissueCell &rNewCell, c_vector< double, DIM > newLocation, TissueCell *pParentCell=NULL) |
virtual void | GenerateCellResultsAndWriteToFiles (std::vector< unsigned > &rCellTypeCounter, std::vector< unsigned > &rCellMutationStateCounter, std::vector< unsigned > &rCellCyclePhaseCounter) |
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 |
Friends | |
class | TestMeshBasedTissueWithGhostNodes |
class | boost::serialization::access |
If simulating a crypt with a mesh-based tissue, 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 MeshBasedTissueWithGhostNodes class deals with these ghost nodes, hiding the 'ghost nodes' concept from the TissueSimulation class, so the latter only ever deals with real cells.
Definition at line 49 of file MeshBasedTissueWithGhostNodes.hpp.
MeshBasedTissueWithGhostNodes< DIM >::MeshBasedTissueWithGhostNodes | ( | MutableMesh< DIM, DIM > & | rMesh, | |
const std::vector< TissueCell > & | rCells, | |||
const std::vector< unsigned > | locationIndices = std::vector<unsigned>() , |
|||
bool | deleteMesh = false | |||
) | [inline] |
Create a new tissue facade from a mesh and collection of cells.
rMesh | a mutable tetrahedral mesh | |
rCells | TissueCells 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 tissue to free the mesh memory on destruction |
Definition at line 32 of file MeshBasedTissueWithGhostNodes.cpp.
References MeshBasedTissue< DIM >::GetNode(), MeshBasedTissue< DIM >::GetNumNodes(), MeshBasedTissueWithGhostNodes< DIM >::mIsGhostNode, MeshBasedTissueWithGhostNodes< DIM >::SetGhostNodes(), and MeshBasedTissueWithGhostNodes< DIM >::Validate().
MeshBasedTissueWithGhostNodes< DIM >::MeshBasedTissueWithGhostNodes | ( | MutableMesh< DIM, DIM > & | rMesh | ) | [inline] |
Constructor for use by the de-serializer.
rMesh | a mutable tetrahedral mesh. |
Definition at line 70 of file MeshBasedTissueWithGhostNodes.cpp.
void MeshBasedTissueWithGhostNodes< 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 MeshBasedTissue< DIM >.
Definition at line 72 of file MeshBasedTissueWithGhostNodes.hpp.
void MeshBasedTissueWithGhostNodes< 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 102 of file MeshBasedTissueWithGhostNodes.cpp.
References MutableMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), MeshBasedTissueWithGhostNodes< DIM >::mIsGhostNode, MeshBasedTissue< DIM >::mrMesh, and MeshBasedTissueWithGhostNodes< DIM >::Validate().
Referenced by MeshBasedTissueWithGhostNodes< DIM >::MeshBasedTissueWithGhostNodes().
void MeshBasedTissueWithGhostNodes< DIM >::Validate | ( | ) | [inline, private, virtual] |
This is called after a tissue 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 MeshBasedTissue as it is an overridden virtual method.
Reimplemented from MeshBasedTissue< DIM >.
Definition at line 208 of file MeshBasedTissueWithGhostNodes.cpp.
References AbstractTissue< DIM >::Begin(), AbstractTissue< DIM >::End(), MeshBasedTissue< DIM >::GetNumNodes(), AbstractTissue< DIM >::mCellLocationMap, and MeshBasedTissueWithGhostNodes< DIM >::mIsGhostNode.
Referenced by MeshBasedTissueWithGhostNodes< DIM >::MeshBasedTissueWithGhostNodes(), and MeshBasedTissueWithGhostNodes< DIM >::SetGhostNodes().
void MeshBasedTissueWithGhostNodes< 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 tissue 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 AbstractCellCentreBasedTissue< DIM >.
Definition at line 262 of file MeshBasedTissueWithGhostNodes.cpp.
References MeshBasedTissueWithGhostNodes< DIM >::UpdateGhostPositions(), and AbstractCellCentreBasedTissue< DIM >::UpdateNodeLocations().
std::vector< bool > & MeshBasedTissueWithGhostNodes< DIM >::rGetGhostNodes | ( | ) | [inline] |
Definition at line 76 of file MeshBasedTissueWithGhostNodes.cpp.
References MeshBasedTissueWithGhostNodes< DIM >::mIsGhostNode.
bool MeshBasedTissueWithGhostNodes< 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 MeshBasedTissue< DIM >.
Definition at line 82 of file MeshBasedTissueWithGhostNodes.cpp.
References MeshBasedTissueWithGhostNodes< DIM >::mIsGhostNode.
std::set< unsigned > MeshBasedTissueWithGhostNodes< DIM >::GetGhostNodeIndices | ( | ) | [inline] |
Definition at line 88 of file MeshBasedTissueWithGhostNodes.cpp.
References MeshBasedTissueWithGhostNodes< DIM >::mIsGhostNode.
void MeshBasedTissueWithGhostNodes< 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 119 of file MeshBasedTissueWithGhostNodes.cpp.
References MeshBasedTissueWithGhostNodes< DIM >::CalculateForceBetweenNodes(), TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::EdgesBegin(), TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::EdgesEnd(), TissueConfig::GetDampingConstantNormal(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorBegin(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorEnd(), MeshBasedTissue< DIM >::GetNumNodes(), TissueConfig::Instance(), MeshBasedTissueWithGhostNodes< DIM >::mIsGhostNode, MeshBasedTissue< DIM >::mrMesh, and MutableMesh< ELEMENT_DIM, SPACE_DIM >::SetNode().
Referenced by MeshBasedTissueWithGhostNodes< DIM >::UpdateNodeLocations().
void MeshBasedTissueWithGhostNodes< 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 MeshBasedTissue< DIM >.
Definition at line 241 of file MeshBasedTissueWithGhostNodes.cpp.
References NodeMap::GetNewIndex(), MeshBasedTissue< DIM >::GetNumNodes(), NodeMap::IsDeleted(), MeshBasedTissueWithGhostNodes< DIM >::mIsGhostNode, and NodeMap::Size().
c_vector< double, DIM > MeshBasedTissueWithGhostNodes< DIM >::CalculateForceBetweenNodes | ( | const unsigned & | rNodeAGlobalIndex, | |
const unsigned & | rNodeBGlobalIndex | |||
) | [inline] |
This method is used to calculate the force between GHOST nodes.
rNodeAGlobalIndex | ||
rNodeBGlobalIndex |
Definition at line 169 of file MeshBasedTissueWithGhostNodes.cpp.
References MeshBasedTissue< DIM >::GetNode(), TissueConfig::GetSpringStiffness(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetVectorFromAtoB(), TissueConfig::Instance(), and MeshBasedTissue< DIM >::mrMesh.
Referenced by MeshBasedTissueWithGhostNodes< DIM >::UpdateGhostPositions().
TissueCell * MeshBasedTissueWithGhostNodes< DIM >::AddCell | ( | TissueCell & | rNewCell, | |
c_vector< double, DIM > | newLocation, | |||
TissueCell * | pParentCell = NULL | |||
) | [inline, virtual] |
Overridden AddCell() method.
Add a new cell to the tissue and update mIsGhostNode.
rNewCell | the cell to add | |
newLocation | the position in space at which to put it | |
pParentCell | pointer to a parent cell (if required) |
Reimplemented from MeshBasedTissue< DIM >.
Definition at line 189 of file MeshBasedTissueWithGhostNodes.cpp.
References MeshBasedTissue< DIM >::AddCell(), MeshBasedTissue< DIM >::GetNumNodes(), AbstractTissue< DIM >::mCellLocationMap, and MeshBasedTissueWithGhostNodes< DIM >::mIsGhostNode.
void MeshBasedTissueWithGhostNodes< DIM >::GenerateCellResultsAndWriteToFiles | ( | std::vector< unsigned > & | rCellTypeCounter, | |
std::vector< unsigned > & | rCellMutationStateCounter, | |||
std::vector< unsigned > & | rCellCyclePhaseCounter | |||
) | [inline, virtual] |
Overridden GenerateCellResultsAndWriteToFiles() method.
Call GenerateCellResults() on each cell then call WriteCellResultsToFiles(). Also accounts for ghost nodes.
rCellTypeCounter | cell type counter | |
rCellMutationStateCounter | cell mutation state counter | |
rCellCyclePhaseCounter | cell cycle phase counter |
Reimplemented from AbstractTissue< DIM >.
Definition at line 272 of file MeshBasedTissueWithGhostNodes.cpp.
References AbstractTissue< DIM >::GenerateCellResults(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorBegin(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorEnd(), MeshBasedTissue< DIM >::mrMesh, and AbstractTissue< DIM >::WriteCellResultsToFiles().
friend class TestMeshBasedTissueWithGhostNodes [friend] |
Just so that the test can test the private functions
Definition at line 53 of file MeshBasedTissueWithGhostNodes.hpp.
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from MeshBasedTissue< DIM >.
Definition at line 59 of file MeshBasedTissueWithGhostNodes.hpp.
std::vector<bool> MeshBasedTissueWithGhostNodes< DIM >::mIsGhostNode [private] |
Records whether a node is a ghost node or not
Definition at line 56 of file MeshBasedTissueWithGhostNodes.hpp.
Referenced by MeshBasedTissueWithGhostNodes< DIM >::AddCell(), MeshBasedTissueWithGhostNodes< DIM >::GetGhostNodeIndices(), MeshBasedTissueWithGhostNodes< DIM >::IsGhostNode(), MeshBasedTissueWithGhostNodes< DIM >::MeshBasedTissueWithGhostNodes(), MeshBasedTissueWithGhostNodes< DIM >::rGetGhostNodes(), MeshBasedTissueWithGhostNodes< 2 >::serialize(), MeshBasedTissueWithGhostNodes< DIM >::SetGhostNodes(), MeshBasedTissueWithGhostNodes< DIM >::UpdateGhostNodesAfterReMesh(), MeshBasedTissueWithGhostNodes< DIM >::UpdateGhostPositions(), and MeshBasedTissueWithGhostNodes< DIM >::Validate().