MeshBasedTissue< DIM > Class Template Reference

#include <MeshBasedTissue.hpp>

Inheritance diagram for MeshBasedTissue< DIM >:

Inheritance graph
[legend]
Collaboration diagram for MeshBasedTissue< DIM >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 MeshBasedTissue (MutableMesh< DIM, DIM > &rMesh, const std::vector< TissueCell > &rCells, const std::vector< unsigned > locationIndices=std::vector< unsigned >(), bool deleteMesh=false, bool validate=true)
 MeshBasedTissue (MutableMesh< DIM, DIM > &rMesh)
 ~MeshBasedTissue ()
MutableMesh< DIM, DIM > & rGetMesh ()
const MutableMesh< DIM, DIM > & rGetMesh () const
bool GetWriteVoronoiData ()
bool GetWriteTissueAreas ()
bool UseAreaBasedDampingConstant ()
void SetOutputVoronoiData (bool writeVoronoiData)
unsigned AddNode (Node< DIM > *pNewNode)
void SetNode (unsigned nodeIndex, ChastePoint< DIM > &rNewLocation)
virtual bool IsGhostNode (unsigned index)
double GetDampingConstant (unsigned nodeIndex)
void SetOutputTissueAreas (bool writeTissueAreas)
void SetAreaBasedDampingConstant (bool useAreaBasedDampingConstant)
virtual unsigned RemoveDeadCells ()
virtual TissueCellAddCell (TissueCell &rNewCell, c_vector< double, DIM > newLocation, TissueCell *pParentCell=NULL)
void CreateOutputFiles (const std::string &rDirectory, bool cleanOutputDirectory)
void CloseOutputFiles ()
void WriteResultsToFiles ()
virtual void Update (bool hasHadBirthsOrDeaths=true)
Node< DIM > * GetNode (unsigned index)
unsigned GetNumNodes ()
void SetBottomCellAncestors ()
void WriteVoronoiResultsToFile ()
void WriteTissueAreaResultsToFile ()
void WriteCellAreaResultsToFile ()
void CreateVoronoiTessellation ()
VoronoiTessellation< DIM > & rGetVoronoiTessellation ()
SpringIterator SpringsBegin ()
SpringIterator SpringsEnd ()
void CheckTissueCellPointers ()
bool IsMarkedSpring (TissueCell &, TissueCell &)
void MarkSpring (TissueCell &, TissueCell &)
void UnmarkSpring (TissueCell &, TissueCell &)
template<>
void CreateVoronoiTessellation ()

Protected Member Functions

std::set< TissueCell * > CreateCellPair (TissueCell &, TissueCell &)
virtual void UpdateGhostNodesAfterReMesh (NodeMap &rMap)
virtual void Validate ()

Protected Attributes

MutableMesh< DIM, DIM > & mrMesh
VoronoiTessellation< DIM > * mpVoronoiTessellation
bool mDeleteMesh
std::set< std::set< TissueCell * > > mMarkedSprings
out_stream mpElementFile
out_stream mpVoronoiFile
out_stream mpTissueAreasFile
out_stream mpCellAreasFile
bool mUseAreaBasedDampingConstant

Private Member Functions

template<class Archive>
void serialize (Archive &archive, const unsigned int version)

Friends

class TestMeshBasedTissue
class boost::serialization::access

Classes

class  SpringIterator


Detailed Description

template<unsigned DIM>
class MeshBasedTissue< DIM >

A facade class encapsulating a mesh-based 'tissue'

Contains a group of cells and maintains the associations between cells and nodes in the mesh.

Definition at line 52 of file MeshBasedTissue.hpp.


Constructor & Destructor Documentation

template<unsigned DIM>
MeshBasedTissue< DIM >::MeshBasedTissue ( MutableMesh< DIM, DIM > &  rMesh,
const std::vector< TissueCell > &  rCells,
const std::vector< unsigned >  locationIndices = std::vector<unsigned>(),
bool  deleteMesh = false,
bool  validate = true 
) [inline]

Create a new tissue facade from a mesh and collection of cells.

There must be precisely 1 cell for each node of the mesh.

Parameters:
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
validate whether to validate the tissue

Definition at line 33 of file MeshBasedTissue.cpp.

References MutableMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), AbstractTissue< DIM >::mCells, MeshBasedTissue< DIM >::mrMesh, AbstractTissue< DIM >::mTissueContainsMesh, and MeshBasedTissue< DIM >::Validate().

template<unsigned DIM>
MeshBasedTissue< DIM >::MeshBasedTissue ( MutableMesh< DIM, DIM > &  rMesh  )  [inline]

Constructor for use by the de-serializer.

Parameters:
rMesh a mutable tetrahedral mesh.

Definition at line 56 of file MeshBasedTissue.cpp.

References MeshBasedTissue< DIM >::mDeleteMesh, MeshBasedTissue< DIM >::mpVoronoiTessellation, and AbstractTissue< DIM >::mTissueContainsMesh.

template<unsigned DIM>
MeshBasedTissue< DIM >::~MeshBasedTissue (  )  [inline]


Member Function Documentation

template<unsigned DIM>
template<class Archive>
void MeshBasedTissue< 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:
archive the archive
version the current version of this class

Reimplemented from AbstractCellCentreBasedTissue< DIM >.

Reimplemented in MeshBasedTissueWithGhostNodes< DIM >, and MeshBasedTissueWithGhostNodes< 2 >.

Definition at line 70 of file MeshBasedTissue.hpp.

template<unsigned DIM>
std::set< TissueCell * > MeshBasedTissue< DIM >::CreateCellPair ( TissueCell rCell1,
TissueCell rCell2 
) [inline, protected]

Helper method used by the spring marking routines

Definition at line 754 of file MeshBasedTissue.cpp.

Referenced by MeshBasedTissue< DIM >::IsMarkedSpring(), MeshBasedTissue< DIM >::MarkSpring(), and MeshBasedTissue< DIM >::UnmarkSpring().

template<unsigned DIM>
void MeshBasedTissue< DIM >::UpdateGhostNodesAfterReMesh ( NodeMap rMap  )  [inline, protected, virtual]

Update mIsGhostNode if required by a remesh.

Parameters:
rMap A map between node indices before and after remesh

Reimplemented in MeshBasedTissueWithGhostNodes< DIM >, and MeshBasedTissueWithGhostNodes< 2 >.

Definition at line 361 of file MeshBasedTissue.cpp.

Referenced by MeshBasedTissue< DIM >::Update().

template<unsigned DIM>
void MeshBasedTissue< DIM >::Validate (  )  [inline, protected, virtual]

template<unsigned DIM>
MutableMesh< DIM, DIM > & MeshBasedTissue< DIM >::rGetMesh (  )  [inline]

template<unsigned DIM>
const MutableMesh< DIM, DIM > & MeshBasedTissue< DIM >::rGetMesh (  )  const [inline]

Returns:
const reference to mrMesh (used in archiving).

Definition at line 181 of file MeshBasedTissue.cpp.

References MeshBasedTissue< DIM >::mrMesh.

template<unsigned DIM>
bool MeshBasedTissue< DIM >::GetWriteVoronoiData (  ) 

Returns:
mWriteVoronoiData.

template<unsigned DIM>
bool MeshBasedTissue< DIM >::GetWriteTissueAreas (  ) 

Returns:
mWriteTissueAreas.

template<unsigned DIM>
bool MeshBasedTissue< DIM >::UseAreaBasedDampingConstant (  )  [inline]

Returns:
mUseAreaBasedDampingConstant.

Definition at line 75 of file MeshBasedTissue.cpp.

References MeshBasedTissue< DIM >::mUseAreaBasedDampingConstant.

Referenced by MeshBasedTissue< DIM >::Update().

template<unsigned DIM>
void MeshBasedTissue< DIM >::SetOutputVoronoiData ( bool  writeVoronoiData  ) 

Set method for mWriteVoronoiData.

Parameters:
writeVoronoiData whether to output cell area and perimeter information

template<unsigned DIM>
unsigned MeshBasedTissue< DIM >::AddNode ( Node< DIM > *  pNewNode  )  [inline, virtual]

Overridden AddNode() method.

Add a new node to the tissue.

Parameters:
pNewNode pointer to the new node
Returns:
global index of new node in tissue

Implements AbstractTissue< DIM >.

Definition at line 88 of file MeshBasedTissue.cpp.

References MutableMesh< ELEMENT_DIM, SPACE_DIM >::AddNode(), and MeshBasedTissue< DIM >::mrMesh.

template<unsigned DIM>
void MeshBasedTissue< DIM >::SetNode ( unsigned  nodeIndex,
ChastePoint< DIM > &  rNewLocation 
) [inline, virtual]

Overridden SetNode() method.

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

Parameters:
nodeIndex the index of the node to be moved
rNewLocation the new target location of the node

Implements AbstractTissue< DIM >.

Definition at line 94 of file MeshBasedTissue.cpp.

References MeshBasedTissue< DIM >::mrMesh, and MutableMesh< ELEMENT_DIM, SPACE_DIM >::SetNode().

template<unsigned DIM>
bool MeshBasedTissue< DIM >::IsGhostNode ( unsigned  index  )  [inline, virtual]

Find if a given node is a ghost node. The method always returns false but is overridden in MeshBasedTissueWithGhostNodes.

Parameters:
index the global index of a specified node
Returns:
whether the node is a ghost node

Reimplemented from AbstractTissue< DIM >.

Reimplemented in MeshBasedTissueWithGhostNodes< DIM >, and MeshBasedTissueWithGhostNodes< 2 >.

Definition at line 100 of file MeshBasedTissue.cpp.

template<unsigned DIM>
double MeshBasedTissue< DIM >::GetDampingConstant ( unsigned  nodeIndex  )  [inline, virtual]

Overridden GetDampingConstant() method that includes the case of a cell-area-based damping constant.

Parameters:
nodeIndex the global index of this node
Returns:
the damping constant for the given TissueCell.

We use a linear dependence of the form

new_damping_const = old_damping_const * (d0+d1*A)

where d0, d1 are parameters, A is the cell's area, and old_damping_const is the damping constant if not using mUseAreaBasedDampingConstant

Compute the parameter d1 such that d0+A*d1=1, where A is the equilibrium area of a cell (this is equal to sqrt(3)/4, which is a third of the area of a regular hexagon of edge length 1)

The cell area should not be too large - the next assertion is to avoid getting an infinite cell area, which may occur if area-based viscosity is chosen in the absence of ghost nodes.

Reimplemented from AbstractCellCentreBasedTissue< DIM >.

Definition at line 106 of file MeshBasedTissue.cpp.

References TissueConfig::GetAreaBasedDampingConstantParameter(), AbstractCellCentreBasedTissue< DIM >::GetDampingConstant(), VoronoiTessellation< DIM >::GetFaceArea(), TissueConfig::Instance(), MeshBasedTissue< DIM >::mUseAreaBasedDampingConstant, and MeshBasedTissue< DIM >::rGetVoronoiTessellation().

template<unsigned DIM>
void MeshBasedTissue< DIM >::SetOutputTissueAreas ( bool  writeTissueAreas  ) 

Set method for mWriteTissueAreas.

Todo:
Extend this to 3D (possibly rename to SetOutputTissueVolumes?) - see also #738
Parameters:
writeTissueAreas whether to output tissue area data

template<unsigned DIM>
void MeshBasedTissue< DIM >::SetAreaBasedDampingConstant ( bool  useAreaBasedDampingConstant  )  [inline]

Set method for mUseAreaBasedDampingConstant.

Parameters:
useAreaBasedDampingConstant whether to use a viscosity that is linear in the cell area, rather than constant

Definition at line 81 of file MeshBasedTissue.cpp.

References MeshBasedTissue< DIM >::mUseAreaBasedDampingConstant.

template<unsigned DIM>
unsigned MeshBasedTissue< DIM >::RemoveDeadCells (  )  [inline, virtual]

Remove all cells that are labelled as dead.

Note that this now calls MutableMesh::DeleteNodePriorToReMesh() and therefore a ReMesh(map) must be called before any element information is used.

Note also that after calling this method the tissue will be in an inconsistent state until Update() is called! So don't try iterating over cells or anything like that.

Returns:
number of cells removed.

Implements AbstractTissue< DIM >.

Definition at line 187 of file MeshBasedTissue.cpp.

References MutableMesh< ELEMENT_DIM, SPACE_DIM >::DeleteNodePriorToReMesh(), AbstractTissue< DIM >::mCellLocationMap, AbstractTissue< DIM >::mCells, AbstractTissue< DIM >::mLocationCellMap, MeshBasedTissue< DIM >::mMarkedSprings, and MeshBasedTissue< DIM >::mrMesh.

template<unsigned DIM>
TissueCell * MeshBasedTissue< 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.

Parameters:
rNewCell the cell to add
newLocation the position in space at which to put it
pParentCell pointer 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)

Reimplemented from AbstractCellCentreBasedTissue< DIM >.

Reimplemented in MeshBasedTissueWithGhostNodes< DIM >, and MeshBasedTissueWithGhostNodes< 2 >.

Definition at line 366 of file MeshBasedTissue.cpp.

References AbstractCellCentreBasedTissue< DIM >::AddCell(), and MeshBasedTissue< DIM >::MarkSpring().

Referenced by MeshBasedTissueWithGhostNodes< DIM >::AddCell().

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

Overridden CreateOutputFiles() method.

Parameters:
rDirectory pathname of the output directory, relative to where Chaste output is stored
cleanOutputDirectory whether to delete the contents of the output directory prior to output file creation

Reimplemented from AbstractTissue< DIM >.

Definition at line 384 of file MeshBasedTissue.cpp.

References AbstractTissue< DIM >::CreateOutputFiles(), TissueConfig::Instance(), MeshBasedTissue< DIM >::mpCellAreasFile, MeshBasedTissue< DIM >::mpElementFile, MeshBasedTissue< DIM >::mpTissueAreasFile, MeshBasedTissue< DIM >::mpVoronoiFile, and OutputFileHandler::OpenOutputFile().

template<unsigned DIM>
void MeshBasedTissue< DIM >::CloseOutputFiles (  )  [inline, virtual]

template<unsigned DIM>
void MeshBasedTissue< DIM >::WriteResultsToFiles (  )  [inline, virtual]

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

template<unsigned DIM>
Node< DIM > * MeshBasedTissue< DIM >::GetNode ( unsigned  index  )  [inline, virtual]

Overridden GetNode() method.

Parameters:
index global index of the specified Node
Returns:
pointer to the Node with given index.

Implements AbstractTissue< DIM >.

Definition at line 336 of file MeshBasedTissue.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), and MeshBasedTissue< DIM >::mrMesh.

Referenced by MeshBasedTissueWithGhostNodes< DIM >::CalculateForceBetweenNodes(), and MeshBasedTissueWithGhostNodes< DIM >::MeshBasedTissueWithGhostNodes().

template<unsigned DIM>
unsigned MeshBasedTissue< DIM >::GetNumNodes (  )  [inline, virtual]

template<unsigned DIM>
void MeshBasedTissue< DIM >::SetBottomCellAncestors (  )  [inline]

Sets the Ancestor index of all the cells at the bottom in order, can be used to trace clonal populations.

Definition at line 348 of file MeshBasedTissue.cpp.

References AbstractTissue< DIM >::Begin(), AbstractTissue< DIM >::End(), and AbstractCellCentreBasedTissue< DIM >::GetNodeCorrespondingToCell().

template<unsigned DIM>
void MeshBasedTissue< DIM >::WriteVoronoiResultsToFile (  )  [inline]

template<unsigned DIM>
void MeshBasedTissue< DIM >::WriteTissueAreaResultsToFile (  )  [inline]

template<unsigned DIM>
void MeshBasedTissue< DIM >::WriteCellAreaResultsToFile (  )  [inline]

Write current results to mpCellAreasFile.

In 2D, the data is written in the form:

time cell0_id cell0_x cell0_y cell0_area cell1_id cell1_x cell1_y cell1_area ...

and similarly in 3D.

Definition at line 528 of file MeshBasedTissue.cpp.

References AbstractTissue< DIM >::Begin(), AbstractTissue< DIM >::End(), AbstractCellCentreBasedTissue< DIM >::GetLocationOfCellCentre(), SimulationTime::GetTime(), SimulationTime::Instance(), AbstractTissue< DIM >::mCellLocationMap, MeshBasedTissue< DIM >::mpCellAreasFile, and MeshBasedTissue< DIM >::rGetVoronoiTessellation().

Referenced by MeshBasedTissue< DIM >::WriteResultsToFiles().

template<unsigned DIM>
void MeshBasedTissue< DIM >::CreateVoronoiTessellation (  )  [inline]

Get a reference to a Voronoi tessellation of the mesh.

Definition at line 649 of file MeshBasedTissue.cpp.

References MeshBasedTissue< DIM >::mpVoronoiTessellation, and MeshBasedTissue< DIM >::mrMesh.

Referenced by MeshBasedTissue< DIM >::Update().

template<unsigned DIM>
VoronoiTessellation< DIM > & MeshBasedTissue< DIM >::rGetVoronoiTessellation (  )  [inline]

template<unsigned DIM>
MeshBasedTissue< DIM >::SpringIterator MeshBasedTissue< DIM >::SpringsBegin (  )  [inline]

Returns:
iterator pointing to the first spring in the tissue

Definition at line 637 of file MeshBasedTissue.cpp.

References TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::EdgesBegin(), and MeshBasedTissue< DIM >::mrMesh.

template<unsigned DIM>
MeshBasedTissue< DIM >::SpringIterator MeshBasedTissue< DIM >::SpringsEnd (  )  [inline]

Returns:
iterator pointing to one past the last spring in the tissue

Definition at line 643 of file MeshBasedTissue.cpp.

References TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::EdgesEnd(), and MeshBasedTissue< DIM >::mrMesh.

template<unsigned DIM>
void MeshBasedTissue< DIM >::CheckTissueCellPointers (  )  [inline]

template<unsigned DIM>
bool MeshBasedTissue< DIM >::IsMarkedSpring ( TissueCell rCell1,
TissueCell rCell2 
) [inline]

Returns:
whether the spring between two given cells is marked.

Definition at line 763 of file MeshBasedTissue.cpp.

References MeshBasedTissue< DIM >::CreateCellPair(), and MeshBasedTissue< DIM >::mMarkedSprings.

template<unsigned DIM>
void MeshBasedTissue< DIM >::MarkSpring ( TissueCell rCell1,
TissueCell rCell2 
) [inline]

Mark the spring between the given cells.

Definition at line 770 of file MeshBasedTissue.cpp.

References MeshBasedTissue< DIM >::CreateCellPair(), and MeshBasedTissue< DIM >::mMarkedSprings.

Referenced by MeshBasedTissue< DIM >::AddCell().

template<unsigned DIM>
void MeshBasedTissue< DIM >::UnmarkSpring ( TissueCell rCell1,
TissueCell rCell2 
) [inline]

Stop marking the spring between the given cells.

Definition at line 777 of file MeshBasedTissue.cpp.

References MeshBasedTissue< DIM >::CreateCellPair(), and MeshBasedTissue< DIM >::mMarkedSprings.

template<>
void MeshBasedTissue< 1 >::CreateVoronoiTessellation (  )  [inline]

The VoronoiTessellation class is only defined in 2D or 3D, hence there are two definitions to this method (one templated and one not).

Definition at line 660 of file MeshBasedTissue.cpp.


Friends And Related Function Documentation

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

Needed for serialization.

Reimplemented from AbstractCellCentreBasedTissue< DIM >.

Reimplemented in MeshBasedTissueWithGhostNodes< DIM >, and MeshBasedTissueWithGhostNodes< 2 >.

Definition at line 57 of file MeshBasedTissue.hpp.


Member Data Documentation

template<unsigned DIM>
MutableMesh<DIM, DIM>& MeshBasedTissue< DIM >::mrMesh [protected]

template<unsigned DIM>
VoronoiTessellation<DIM>* MeshBasedTissue< DIM >::mpVoronoiTessellation [protected]

template<unsigned DIM>
bool MeshBasedTissue< DIM >::mDeleteMesh [protected]

Whether to delete the mesh when we are destroyed. Needed if this tissue has been de-serialized.

Definition at line 105 of file MeshBasedTissue.hpp.

Referenced by MeshBasedTissue< DIM >::MeshBasedTissue(), and MeshBasedTissue< DIM >::~MeshBasedTissue().

template<unsigned DIM>
std::set<std::set<TissueCell*> > MeshBasedTissue< DIM >::mMarkedSprings [protected]

Special springs that we want to keep track of for some reason. Currently used to track cells in the process of dividing (which are represented as two cells joined by a shorter spring).

Definition at line 112 of file MeshBasedTissue.hpp.

Referenced by MeshBasedTissue< DIM >::CheckTissueCellPointers(), MeshBasedTissue< DIM >::IsMarkedSpring(), MeshBasedTissue< DIM >::MarkSpring(), MeshBasedTissue< DIM >::RemoveDeadCells(), MeshBasedTissue< 2 >::serialize(), MeshBasedTissue< DIM >::UnmarkSpring(), and MeshBasedTissue< DIM >::Update().

template<unsigned DIM>
out_stream MeshBasedTissue< DIM >::mpElementFile [protected]

template<unsigned DIM>
out_stream MeshBasedTissue< DIM >::mpVoronoiFile [protected]

template<unsigned DIM>
out_stream MeshBasedTissue< DIM >::mpTissueAreasFile [protected]

template<unsigned DIM>
out_stream MeshBasedTissue< DIM >::mpCellAreasFile [protected]

template<unsigned DIM>
bool MeshBasedTissue< DIM >::mUseAreaBasedDampingConstant [protected]

Whether to use a viscosity that is linear in the cell area, rather than constant.

Definition at line 130 of file MeshBasedTissue.hpp.

Referenced by MeshBasedTissue< DIM >::GetDampingConstant(), MeshBasedTissue< 2 >::serialize(), MeshBasedTissue< DIM >::SetAreaBasedDampingConstant(), and MeshBasedTissue< DIM >::UseAreaBasedDampingConstant().


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

Generated on Tue Aug 4 16:11:23 2009 for Chaste by  doxygen 1.5.5