PottsMesh< DIM > Class Template Reference

#include <PottsMesh.hpp>

Inherits AbstractMesh< DIM, DIM >.

Collaboration diagram for PottsMesh< DIM >:
Collaboration graph
[legend]

List of all members.

Classes

class  PottsElementIterator

Public Member Functions

PottsElementIterator GetElementIteratorBegin (bool skipDeletedElements=true)
PottsElementIterator GetElementIteratorEnd ()
 PottsMesh (std::vector< Node< DIM > * > nodes, std::vector< PottsElement< DIM > * > pottsElements, std::vector< std::set< unsigned > > vonNeumannNeighbouringNodeIndices, std::vector< std::set< unsigned > > mooreNeighbouringNodeIndices)
 PottsMesh ()
virtual ~PottsMesh ()
virtual unsigned GetNumNodes () const
virtual unsigned GetNumElements () const
unsigned GetNumAllElements () const
PottsElement< DIM > * GetElement (unsigned index) const
virtual c_vector< double, DIM > GetCentroidOfElement (unsigned index)
void ConstructFromMeshReader (AbstractMeshReader< DIM, DIM > &rMeshReader)
virtual void Clear ()
virtual c_vector< double, DIM > GetVectorFromAtoB (const c_vector< double, DIM > &rLocationA, const c_vector< double, DIM > &rLocationB)
virtual double GetVolumeOfElement (unsigned index)
virtual double GetSurfaceAreaOfElement (unsigned index)
std::set< unsignedGetMooreNeighbouringNodeIndices (unsigned nodeIndex)
std::set< unsignedGetVonNeumannNeighbouringNodeIndices (unsigned nodeIndex)
void DeleteElement (unsigned index)
unsigned DivideElement (PottsElement< DIM > *pElement, bool placeOriginalElementBelow=false)
unsigned AddElement (PottsElement< DIM > *pNewElement)

Protected Member Functions

unsigned SolveNodeMapping (unsigned index) const
unsigned SolveElementMapping (unsigned index) const
unsigned SolveBoundaryElementMapping (unsigned index) const
template<class Archive >
void save (Archive &archive, const unsigned int version) const
template<class Archive >
void load (Archive &archive, const unsigned int version)

Protected Attributes

std::vector< PottsElement< DIM > * > mElements
std::vector< unsignedmDeletedElementIndices
std::vector< std::set< unsigned > > mVonNeumannNeighbouringNodeIndices
std::vector< std::set< unsigned > > mMooreNeighbouringNodeIndices

Friends

class TestPottsMesh
class boost::serialization::access

Detailed Description

template<unsigned DIM>
class PottsMesh< DIM >

A Potts-based mesh class, for use in Cellular Potts model simulations.

Definition at line 56 of file PottsMesh.hpp.


Constructor & Destructor Documentation

template<unsigned DIM>
PottsMesh< DIM >::PottsMesh ( std::vector< Node< DIM > * >  nodes,
std::vector< PottsElement< DIM > * >  pottsElements,
std::vector< std::set< unsigned > >  vonNeumannNeighbouringNodeIndices,
std::vector< std::set< unsigned > >  mooreNeighbouringNodeIndices 
) [inline]

Default constructor.

Parameters:
nodes vector of pointers to nodes
pottsElements vector of pointers to PottsElements
vonNeumannNeighbouringNodeIndices vector of set of Moore Neighbours for each node
mooreNeighbouringNodeIndices vector of set of VonNeuman Neighbours for each node

Definition at line 36 of file PottsMesh.cpp.

References PottsMesh< DIM >::Clear(), EXCEPTION, AbstractElement< DIM, DIM >::GetIndex(), AbstractElement< DIM, DIM >::GetNode(), AbstractElement< DIM, DIM >::GetNumNodes(), PottsMesh< DIM >::mElements, AbstractMesh< DIM, DIM >::mMeshChangesDuringSimulation, PottsMesh< DIM >::mMooreNeighbouringNodeIndices, AbstractMesh< DIM, DIM >::mNodes, and PottsMesh< DIM >::mVonNeumannNeighbouringNodeIndices.

template<unsigned DIM>
PottsMesh< DIM >::PottsMesh (  )  [inline]

Default constructor for use by serializer.

Definition at line 83 of file PottsMesh.cpp.

References PottsMesh< DIM >::Clear(), and AbstractMesh< DIM, DIM >::mMeshChangesDuringSimulation.

template<unsigned DIM>
PottsMesh< DIM >::~PottsMesh (  )  [inline, virtual]

Destructor.

Definition at line 90 of file PottsMesh.cpp.

References PottsMesh< DIM >::Clear().


Member Function Documentation

template<unsigned DIM>
unsigned PottsMesh< DIM >::AddElement ( PottsElement< DIM > *  pNewElement  )  [inline]

Add an element to the mesh.

Parameters:
pNewElement the new element
Returns:
the index of the new element in the mesh

Definition at line 383 of file PottsMesh.cpp.

References AbstractElement< DIM, DIM >::GetIndex(), PottsMesh< DIM >::mElements, and PottsElement< DIM >::RegisterWithNodes().

Referenced by PottsMesh< DIM >::DivideElement().

template<unsigned DIM>
void PottsMesh< DIM >::Clear (  )  [inline, virtual]
template<unsigned DIM>
void PottsMesh< DIM >::ConstructFromMeshReader ( AbstractMeshReader< DIM, DIM > &  rMeshReader  )  [inline]
template<unsigned DIM>
void PottsMesh< DIM >::DeleteElement ( unsigned  index  )  [inline]

Mark an element as deleted. Note that in a Potts mesh this does not delete the nodes so no remeshing is required.

Parameters:
index the global index of a specified Potts element

Definition at line 248 of file PottsMesh.cpp.

References PottsMesh< DIM >::mDeletedElementIndices, and PottsMesh< DIM >::mElements.

template<unsigned DIM>
unsigned PottsMesh< DIM >::DivideElement ( PottsElement< DIM > *  pElement,
bool  placeOriginalElementBelow = false 
) [inline]

Divide an element by assigning half the nodes to each new element in numerical order. If an odd number of nodes then the existing element has one more node than the new element.

Parameters:
pElement the element to divide
placeOriginalElementBelow whether to place the original element below (in the y direction) the new element (defaults to false)
Returns:
the index of the new element

Todo:
not implemented in 3d yet

Remove the correct nodes from each element. If placeOriginalElementBelow is true, place the original element below (in the y direction) the new element; otherwise, place it above.

Todo:
this could be more efficient

Definition at line 256 of file PottsMesh.cpp.

References PottsMesh< DIM >::AddElement(), PottsElement< DIM >::DeleteNode(), EXCEPTION, AbstractElement< DIM, DIM >::GetNode(), AbstractElement< DIM, DIM >::GetNumNodes(), PottsMesh< DIM >::mDeletedElementIndices, and PottsMesh< DIM >::mElements.

template<unsigned DIM>
c_vector< double, DIM > PottsMesh< DIM >::GetCentroidOfElement ( unsigned  index  )  [inline, virtual]

Compute the centroid of an element.

This needs to be overridden in daughter classes for non-Euclidean metrics.

Parameters:
index the global index of a specified vertex element
Returns:
(centroid_x,centroid_y).

Todo:
This should probably be returning the nearest node

Definition at line 165 of file PottsMesh.cpp.

References PottsMesh< DIM >::GetElement(), AbstractElement< DIM, DIM >::GetNodeLocation(), and AbstractElement< DIM, DIM >::GetNumNodes().

template<unsigned DIM>
PottsElement< DIM > * PottsMesh< DIM >::GetElement ( unsigned  index  )  const [inline]
Parameters:
index the global index of a specified PottsElement.
Returns:
a pointer to the PottsElement

Definition at line 158 of file PottsMesh.cpp.

References PottsMesh< DIM >::mElements.

Referenced by PottsMesh< DIM >::GetCentroidOfElement(), PottsMesh< DIM >::GetSurfaceAreaOfElement(), and PottsMesh< DIM >::GetVolumeOfElement().

template<unsigned DIM>
PottsMesh< DIM >::PottsElementIterator PottsMesh< DIM >::GetElementIteratorBegin ( bool  skipDeletedElements = true  )  [inline]

Get an iterator to the first element in the mesh.

Parameters:
skipDeletedElements whether to include deleted element

Definition at line 402 of file PottsMesh.hpp.

Referenced by PottsMeshWriter< SPACE_DIM >::WriteFilesUsingMesh().

template<unsigned DIM>
PottsMesh< DIM >::PottsElementIterator PottsMesh< DIM >::GetElementIteratorEnd (  )  [inline]

Get an iterator to one past the last element in the mesh.

Definition at line 409 of file PottsMesh.hpp.

References PottsMesh< DIM >::mElements.

template<unsigned DIM>
std::set< unsigned > PottsMesh< DIM >::GetMooreNeighbouringNodeIndices ( unsigned  nodeIndex  )  [inline]

Given a node, return a set containing the indices of its Moore neighbouring nodes.

Parameters:
nodeIndex global index of the node
Returns:
neighbouring node indices in Moore neighbourhood

Definition at line 236 of file PottsMesh.cpp.

References PottsMesh< DIM >::mMooreNeighbouringNodeIndices.

template<unsigned DIM>
unsigned PottsMesh< DIM >::GetNumAllElements (  )  const [inline]
Returns:
the number of PottsElements in the mesh, including those marked as deleted.

Definition at line 152 of file PottsMesh.cpp.

References PottsMesh< DIM >::mElements.

template<unsigned DIM>
unsigned PottsMesh< DIM >::GetNumElements (  )  const [inline, virtual]
Returns:
the number of PottsElements in the mesh.

Definition at line 146 of file PottsMesh.cpp.

References PottsMesh< DIM >::mDeletedElementIndices, and PottsMesh< DIM >::mElements.

Referenced by PottsMeshWriter< SPACE_DIM >::GetNextElement(), and PottsMeshWriter< SPACE_DIM >::WriteFilesUsingMesh().

template<unsigned DIM>
unsigned PottsMesh< DIM >::GetNumNodes (  )  const [inline, virtual]
Returns:
the number of Nodes in the mesh.

Reimplemented from AbstractMesh< DIM, DIM >.

Definition at line 140 of file PottsMesh.cpp.

References AbstractMesh< DIM, DIM >::mNodes.

Referenced by PottsMeshWriter< SPACE_DIM >::GetNextNode(), and PottsMeshWriter< SPACE_DIM >::WriteFilesUsingMesh().

template<unsigned DIM>
double PottsMesh< DIM >::GetSurfaceAreaOfElement ( unsigned  index  )  [inline, virtual]

Compute the surface area (or perimeter in 2D) of a PottsElement.

This needs to be overridden in daughter classes for non-Euclidean metrics.

Parameters:
index the global index of a specified PottsElement
Returns:
the surfacearea of the element

Todo:
not implemented in 3d yet

Definition at line 202 of file PottsMesh.cpp.

References PottsMesh< DIM >::GetElement(), AbstractElement< DIM, DIM >::GetNode(), AbstractElement< DIM, DIM >::GetNumNodes(), PottsMesh< DIM >::GetVonNeumannNeighbouringNodeIndices(), and AbstractMesh< DIM, DIM >::mNodes.

template<unsigned DIM>
c_vector< double, DIM > PottsMesh< DIM >::GetVectorFromAtoB ( const c_vector< double, DIM > &  rLocationA,
const c_vector< double, DIM > &  rLocationB 
) [inline, virtual]

Overridden GetVectorFromAtoB() method. Returns a vector between two points in space.

If the mesh is being used to represent a Voronoi tessellation, and mpDelaunayMesh is not NULL, then use that to compute GetVectorFromAtoB.

Parameters:
rLocationA a c_vector of coordinates
rLocationB a c_vector of coordinates
Returns:
c_vector from location A to location B.

Definition at line 185 of file PottsMesh.cpp.

template<unsigned DIM>
double PottsMesh< DIM >::GetVolumeOfElement ( unsigned  index  )  [inline, virtual]

Get the volume (or area in 2D, or length in 1D) of a PottsElement.

This needs to be overridden in daughter classes for non-Euclidean metrics.

Parameters:
index the global index of a specified PottsElement element
Returns:
the volume of the element

Definition at line 193 of file PottsMesh.cpp.

References PottsMesh< DIM >::GetElement(), and AbstractElement< DIM, DIM >::GetNumNodes().

template<unsigned DIM>
std::set< unsigned > PottsMesh< DIM >::GetVonNeumannNeighbouringNodeIndices ( unsigned  nodeIndex  )  [inline]

Given a node, return a set containing the indices of its Von Neumann neighbouring nodes.

Parameters:
nodeIndex global index of the node
Returns:
neighbouring node indices in Von Neumann neighbourhood

Definition at line 242 of file PottsMesh.cpp.

References PottsMesh< DIM >::mVonNeumannNeighbouringNodeIndices.

Referenced by PottsMesh< DIM >::GetSurfaceAreaOfElement().

template<unsigned DIM>
template<class Archive >
void PottsMesh< DIM >::load ( Archive &  archive,
const unsigned int  version 
) [inline, protected]

Loads a mesh by using PottsMeshReader and the location in ArchiveLocationInfo.

Parameters:
archive the archive
version the current version of this class

Definition at line 133 of file PottsMesh.hpp.

template<unsigned DIM>
template<class Archive >
void PottsMesh< DIM >::save ( Archive &  archive,
const unsigned int  version 
) const [inline, protected]

Archive the PottsMesh and its member variables. Note that this will write out a PottsMeshWriter file to wherever ArchiveLocationInfo has specified.

Parameters:
archive the archive
version the current version of this class

Definition at line 111 of file PottsMesh.hpp.

template<unsigned DIM>
unsigned PottsMesh< DIM >::SolveBoundaryElementMapping ( unsigned  index  )  const [inline, protected]

Solve boundary element mapping method. This overridden method is required as it is pure virtual in the base class.

Parameters:
index the global index of the boundary element

Definition at line 110 of file PottsMesh.cpp.

template<unsigned DIM>
unsigned PottsMesh< DIM >::SolveElementMapping ( unsigned  index  )  const [inline, protected]

Solve element mapping method. This overridden method is required as it is pure virtual in the base class.

Parameters:
index the global index of the element

Definition at line 103 of file PottsMesh.cpp.

References PottsMesh< DIM >::mElements.

template<unsigned DIM>
unsigned PottsMesh< DIM >::SolveNodeMapping ( unsigned  index  )  const [inline, protected, virtual]

Solve node mapping method. This overridden method is required as it is pure virtual in the base class.

Parameters:
index the global index of the node

Implements AbstractMesh< DIM, DIM >.

Definition at line 96 of file PottsMesh.cpp.

References AbstractMesh< DIM, DIM >::mNodes.


Friends And Related Function Documentation

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

Needed for serialization.

Reimplemented from AbstractMesh< DIM, DIM >.

Definition at line 101 of file PottsMesh.hpp.


Member Data Documentation

template<unsigned DIM>
std::vector<unsigned> PottsMesh< DIM >::mDeletedElementIndices [protected]

Indices of elements that have been marked as deleted. These indices can be reused when adding new elements.

Definition at line 68 of file PottsMesh.hpp.

Referenced by PottsMesh< DIM >::Clear(), PottsMesh< DIM >::DeleteElement(), PottsMesh< DIM >::DivideElement(), PottsMesh< DIM >::GetNumElements(), PottsMesh< SPACE_DIM >::load(), and PottsMesh< SPACE_DIM >::save().

template<unsigned DIM>
std::vector<PottsElement<DIM>*> PottsMesh< DIM >::mElements [protected]
template<unsigned DIM>
std::vector< std::set<unsigned> > PottsMesh< DIM >::mMooreNeighbouringNodeIndices [protected]
template<unsigned DIM>
std::vector< std::set<unsigned> > PottsMesh< DIM >::mVonNeumannNeighbouringNodeIndices [protected]

The documentation for this class was generated from the following files:
Generated on Thu Dec 22 13:07:20 2011 for Chaste by  doxygen 1.6.3