Chaste  Release::3.4
PottsMesh< DIM > Class Template Reference

#include <PottsMesh.hpp>

+ Inheritance diagram for PottsMesh< DIM >:
+ Collaboration diagram for PottsMesh< DIM >:

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 double GetVolumeOfElement (unsigned index)
 
virtual double GetSurfaceAreaOfElement (unsigned index)
 
std::set< unsignedGetMooreNeighbouringNodeIndices (unsigned nodeIndex)
 
std::set< unsignedGetVonNeumannNeighbouringNodeIndices (unsigned nodeIndex)
 
void DeleteNode (unsigned index)
 
void DeleteElement (unsigned index)
 
void RemoveDeletedElements ()
 
unsigned DivideElement (PottsElement< DIM > *pElement, bool placeOriginalElementBelow=false)
 
unsigned AddElement (PottsElement< DIM > *pNewElement)
 
std::set< unsignedGetNeighbouringElementIndices (unsigned elementIndex)
 
- Public Member Functions inherited from AbstractMesh< DIM, DIM >
virtual ChasteCuboid< SPACE_DIM > CalculateBoundingBox () const
 
NodeIterator GetNodeIteratorBegin (bool skipDeletedNodes=true)
 
NodeIterator GetNodeIteratorEnd ()
 
 AbstractMesh ()
 
virtual ~AbstractMesh ()
 
unsigned GetNumBoundaryNodes () const
 
virtual unsigned GetNumAllNodes () const
 
unsigned GetNumNodeAttributes () const
 
Node< SPACE_DIM > * GetNode (unsigned index) const
 
virtual Node< SPACE_DIM > * GetNodeOrHaloNode (unsigned index) const
 
Node< SPACE_DIM > * GetNodeFromPrePermutationIndex (unsigned index) const
 
virtual void ReadNodesPerProcessorFile (const std::string &rNodesPerProcessorFile)
 
virtual DistributedVectorFactoryGetDistributedVectorFactory ()
 
virtual void SetDistributedVectorFactory (DistributedVectorFactory *pFactory)
 
virtual void PermuteNodes ()
 
BoundaryNodeIterator GetBoundaryNodeIteratorBegin () const
 
BoundaryNodeIterator GetBoundaryNodeIteratorEnd () const
 
std::string GetMeshFileBaseName () const
 
bool IsMeshOnDisk () const
 
const std::vector< unsigned > & rGetNodePermutation () const
 
virtual c_vector< double,
SPACE_DIM > 
GetVectorFromAtoB (const c_vector< double, SPACE_DIM > &rLocationA, const c_vector< double, SPACE_DIM > &rLocationB)
 
double GetDistanceBetweenNodes (unsigned indexA, unsigned indexB)
 
virtual double GetWidth (const unsigned &rDimension) const
 
virtual unsigned GetNearestNodeIndex (const ChastePoint< SPACE_DIM > &rTestPoint)
 
virtual void Scale (const double xFactor=1.0, const double yFactor=1.0, const double zFactor=1.0)
 
virtual void Translate (const c_vector< double, SPACE_DIM > &rDisplacement)
 
void Translate (const double xMovement=0.0, const double yMovement=0.0, const double zMovement=0.0)
 
virtual void Rotate (c_matrix< double, SPACE_DIM, SPACE_DIM > rotationMatrix)
 
void Rotate (c_vector< double, 3 > axis, double angle)
 
void Rotate (double theta)
 
void RotateX (const double theta)
 
void RotateY (const double theta)
 
void RotateZ (const double theta)
 
virtual void RefreshMesh ()
 
bool IsMeshChanging () const
 
unsigned CalculateMaximumContainingElementsPerProcess () const
 
void SetMeshHasChangedSinceLoading ()
 

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 Member Functions inherited from AbstractMesh< DIM, DIM >
virtual void SetElementOwnerships ()
 
ChasteCuboid< SPACE_DIM > CalculateBoundingBox (const std::vector< Node< SPACE_DIM > * > &rNodes) const
 

Protected Attributes

std::vector< PottsElement< DIM > * > mElements
 
std::vector< unsignedmDeletedElementIndices
 
std::vector< std::set< unsigned > > mVonNeumannNeighbouringNodeIndices
 
std::vector< std::set< unsigned > > mMooreNeighbouringNodeIndices
 
- Protected Attributes inherited from AbstractMesh< DIM, DIM >
std::vector< Node< SPACE_DIM > * > mNodes
 
std::vector< Node< SPACE_DIM > * > mBoundaryNodes
 
DistributedVectorFactorympDistributedVectorFactory
 
std::vector< unsignedmNodePermutation
 
std::string mMeshFileBaseName
 
bool mMeshChangesDuringSimulation
 

Friends

class TestPottsMesh
 
class boost::serialization::access
 

Additional Inherited Members

- Public Types inherited from AbstractMesh< DIM, DIM >
typedef std::vector< Node
< SPACE_DIM >
* >::const_iterator 
BoundaryNodeIterator
 

Detailed Description

template<unsigned DIM>
class PottsMesh< DIM >

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

Definition at line 63 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 
)

Default constructor.

Parameters
nodesvector of pointers to nodes
pottsElementsvector of pointers to PottsElements
vonNeumannNeighbouringNodeIndicesvector of set of Moore neighbours for each node
mooreNeighbouringNodeIndicesvector of set of Von Neumann neighbours for each node

Definition at line 43 of file PottsMesh.cpp.

References EXCEPTION, AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), and AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes().

template<unsigned DIM>
PottsMesh< DIM >::PottsMesh ( )

Default constructor for use by serializer.

Definition at line 89 of file PottsMesh.cpp.

template<unsigned DIM>
PottsMesh< DIM >::~PottsMesh ( )
virtual

Destructor.

Definition at line 96 of file PottsMesh.cpp.

Member Function Documentation

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

Add an element to the mesh.

Parameters
pNewElementthe new element
Returns
the index of the new element in the mesh

Definition at line 515 of file PottsMesh.cpp.

References AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), and MutableElement< DIM, DIM >::RegisterWithNodes().

template<unsigned DIM>
void PottsMesh< DIM >::Clear ( )
virtual

Delete mNodes and mElements.

Definition at line 122 of file PottsMesh.cpp.

template<unsigned DIM>
void PottsMesh< DIM >::DeleteElement ( unsigned  index)

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

Parameters
indexthe global index of a specified Potts element

Definition at line 246 of file PottsMesh.cpp.

template<unsigned DIM>
void PottsMesh< DIM >::DeleteNode ( unsigned  index)

Mark a node as deleted. Note that in a Potts mesh this requires the elements and connectivity to be updated accordingley.

Parameters
indexthe global index of a specified node

Definition at line 274 of file PottsMesh.cpp.

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

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
pElementthe element to divide
placeOriginalElementBelowwhether to place the original element below (in the y direction) the new element (defaults to false)
Returns
the index of the new element

Not implemented in 1d

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

Todo:
this could be more efficient

Definition at line 388 of file PottsMesh.cpp.

References MutableElement< DIM, DIM >::DeleteNode(), EXCEPTION, AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), and AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes().

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

Compute the centroid of an element.

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

Parameters
indexthe global index of a specified vertex element
Returns
(centroid_x,centroid_y).
Todo:
This should probably be returning the nearest node

Definition at line 171 of file PottsMesh.cpp.

References AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocation(), and AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes().

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

Definition at line 164 of file PottsMesh.cpp.

template<unsigned DIM>
PottsMesh< DIM >::PottsElementIterator PottsMesh< DIM >::GetElementIteratorBegin ( bool  skipDeletedElements = true)
inline
Returns
an iterator to the first element in the mesh.
Parameters
skipDeletedElementswhether to include deleted element

Definition at line 425 of file PottsMesh.hpp.

template<unsigned DIM>
PottsMesh< DIM >::PottsElementIterator PottsMesh< DIM >::GetElementIteratorEnd ( )
inline
Returns
an iterator to one past the last element in the mesh.

Definition at line 432 of file PottsMesh.hpp.

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

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

Parameters
nodeIndexglobal index of the node
Returns
neighbouring node indices in Moore neighbourhood

Definition at line 234 of file PottsMesh.cpp.

Referenced by ExclusionCaBasedDivisionRule< SPACE_DIM >::CalculateDaughterNodeIndex(), CaBasedCellPopulation< DIM >::GetNeighbouringLocationIndices(), ExclusionCaBasedDivisionRule< SPACE_DIM >::IsRoomToDivide(), and CaBasedCellPopulation< DIM >::UpdateCellLocations().

template<unsigned DIM>
std::set< unsigned > PottsMesh< DIM >::GetNeighbouringElementIndices ( unsigned  elementIndex)

Given an element, find a set containing the indices of its neighbouring elements.

Parameters
elementIndexglobal index of the element
Returns
its neighbouring element indices

Definition at line 532 of file PottsMesh.cpp.

References Node< SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), and AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes().

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

Definition at line 158 of file PottsMesh.cpp.

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

Definition at line 152 of file PottsMesh.cpp.

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

Reimplemented from AbstractMesh< DIM, DIM >.

Definition at line 146 of file PottsMesh.cpp.

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

template<unsigned DIM>
double PottsMesh< DIM >::GetSurfaceAreaOfElement ( unsigned  index)
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
indexthe global index of a specified PottsElement
Returns
the surface area of the element
Todo:
not implemented in 3d yet

Definition at line 200 of file PottsMesh.cpp.

References AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), and AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes().

template<unsigned DIM>
double PottsMesh< DIM >::GetVolumeOfElement ( unsigned  index)
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
indexthe global index of a specified PottsElement element
Returns
the volume of the element

Definition at line 191 of file PottsMesh.cpp.

References AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes().

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

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

Parameters
nodeIndexglobal index of the node
Returns
neighbouring node indices in Von Neumann neighbourhood

Definition at line 240 of file PottsMesh.cpp.

template<unsigned DIM>
template<class Archive >
void PottsMesh< DIM >::load ( Archive &  archive,
const unsigned int  version 
)
inlineprotected

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

Parameters
archivethe archive
versionthe current version of this class

Definition at line 143 of file PottsMesh.hpp.

template<unsigned DIM>
void PottsMesh< DIM >::RemoveDeletedElements ( )

Remove deleted elements and reorder them appropriately

Definition at line 254 of file PottsMesh.cpp.

template<unsigned DIM>
template<class Archive >
void PottsMesh< DIM >::save ( Archive &  archive,
const unsigned int  version 
) const
inlineprotected

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

Parameters
archivethe archive
versionthe current version of this class

Definition at line 121 of file PottsMesh.hpp.

template<unsigned DIM>
unsigned PottsMesh< DIM >::SolveBoundaryElementMapping ( unsigned  index) const
protected

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

Parameters
indexthe global index of the boundary element
Returns
local index

Definition at line 116 of file PottsMesh.cpp.

template<unsigned DIM>
unsigned PottsMesh< DIM >::SolveElementMapping ( unsigned  index) const
protected

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

Parameters
indexthe global index of the element
Returns
local index

Definition at line 109 of file PottsMesh.cpp.

template<unsigned DIM>
unsigned PottsMesh< DIM >::SolveNodeMapping ( unsigned  index) const
protectedvirtual

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

Parameters
indexthe global index of the node
Returns
local index

Implements AbstractMesh< DIM, DIM >.

Definition at line 102 of file PottsMesh.cpp.

Friends And Related Function Documentation

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

Needed for serialization.

Definition at line 111 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 75 of file PottsMesh.hpp.

Referenced by PottsMesh< SPACE_DIM >::load(), and PottsMesh< SPACE_DIM >::save().

template<unsigned DIM>
std::vector<PottsElement<DIM>*> PottsMesh< DIM >::mElements
protected

Vector of pointers to PottsElements.

Definition at line 69 of file PottsMesh.hpp.

template<unsigned DIM>
std::vector< std::set<unsigned> > PottsMesh< DIM >::mMooreNeighbouringNodeIndices
protected

Vector of set of Moore neighbours for each node.

Definition at line 81 of file PottsMesh.hpp.

Referenced by PottsMesh< SPACE_DIM >::load(), and PottsMesh< SPACE_DIM >::save().

template<unsigned DIM>
std::vector< std::set<unsigned> > PottsMesh< DIM >::mVonNeumannNeighbouringNodeIndices
protected

Vector of set of Von Neumann neighbours for each node.

Definition at line 78 of file PottsMesh.hpp.

Referenced by PottsMesh< SPACE_DIM >::load(), and PottsMesh< SPACE_DIM >::save().


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