#include <PottsMesh.hpp>
Inherits AbstractMesh< DIM, 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< unsigned > | GetMooreNeighbouringNodeIndices (unsigned nodeIndex) |
std::set< unsigned > | GetVonNeumannNeighbouringNodeIndices (unsigned nodeIndex) |
void | DeleteNode (unsigned index) |
void | DeleteElement (unsigned index) |
unsigned | DivideElement (PottsElement< DIM > *pElement, bool placeOriginalElementBelow=false) |
unsigned | AddElement (PottsElement< DIM > *pNewElement) |
std::set< unsigned > | GetNeighbouringElementIndices (unsigned elementIndex) |
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< unsigned > | mDeletedElementIndices |
std::vector< std::set< unsigned > > | mVonNeumannNeighbouringNodeIndices |
std::vector< std::set< unsigned > > | mMooreNeighbouringNodeIndices |
Friends | |
class | TestPottsMesh |
class | boost::serialization::access |
A Potts-based mesh class, for use in Cellular Potts model simulations.
Definition at line 63 of file PottsMesh.hpp.
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.
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 Von Neumann neighbours for each node |
Definition at line 43 of file PottsMesh.cpp.
References PottsMesh< DIM >::Clear(), EXCEPTION, AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), PottsMesh< DIM >::mElements, AbstractMesh< DIM, DIM >::mMeshChangesDuringSimulation, PottsMesh< DIM >::mMooreNeighbouringNodeIndices, AbstractMesh< DIM, DIM >::mNodes, and PottsMesh< DIM >::mVonNeumannNeighbouringNodeIndices.
Default constructor for use by serializer.
Definition at line 89 of file PottsMesh.cpp.
References PottsMesh< DIM >::Clear(), and AbstractMesh< DIM, DIM >::mMeshChangesDuringSimulation.
unsigned PottsMesh< DIM >::AddElement | ( | PottsElement< DIM > * | pNewElement | ) | [inline] |
Add an element to the mesh.
pNewElement | the new element |
Definition at line 496 of file PottsMesh.cpp.
References AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), PottsMesh< DIM >::mElements, and MutableElement< DIM, DIM >::RegisterWithNodes().
Referenced by PottsMesh< DIM >::DivideElement().
void PottsMesh< DIM >::Clear | ( | ) | [inline, virtual] |
Delete mNodes and mElements.
Definition at line 122 of file PottsMesh.cpp.
References PottsMesh< DIM >::mDeletedElementIndices, PottsMesh< DIM >::mElements, and AbstractMesh< DIM, DIM >::mNodes.
Referenced by PottsMesh< DIM >::PottsMesh(), and PottsMesh< DIM >::~PottsMesh().
void PottsMesh< DIM >::ConstructFromMeshReader | ( | AbstractMeshReader< DIM, DIM > & | rMeshReader | ) | [inline] |
Construct the mesh using a MeshReader.
rMeshReader | the mesh reader |
Definition at line 556 of file PottsMesh.cpp.
References ElementData::AttributeValue, AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextElementData(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextNode(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumElementAttributes(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::HasNodePermutation(), PottsMesh< DIM >::mElements, PottsMesh< DIM >::mMooreNeighbouringNodeIndices, AbstractMesh< DIM, DIM >::mNodes, PottsMesh< DIM >::mVonNeumannNeighbouringNodeIndices, ElementData::NodeIndices, AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::Reset(), and AbstractElement< ELEMENT_DIM, SPACE_DIM >::SetAttribute().
Referenced by PottsMesh< SPACE_DIM >::load().
Mark an element as deleted. Note that in a Potts mesh this does not delete the nodes so no remeshing is required.
index | the global index of a specified Potts element |
Definition at line 246 of file PottsMesh.cpp.
References PottsMesh< DIM >::mDeletedElementIndices, and PottsMesh< DIM >::mElements.
Referenced by PottsMesh< DIM >::DeleteNode().
Mark a node as deleted. Note that in a Potts mesh this requires the elements and connectivity to be updated accordingley.
index | the global index of a specified node |
Definition at line 254 of file PottsMesh.cpp.
References PottsMesh< DIM >::DeleteElement(), PottsMesh< DIM >::GetNumElements(), PottsMesh< DIM >::GetNumNodes(), PottsMesh< DIM >::mDeletedElementIndices, PottsMesh< DIM >::mElements, PottsMesh< DIM >::mMooreNeighbouringNodeIndices, AbstractMesh< DIM, DIM >::mNodes, and PottsMesh< DIM >::mVonNeumannNeighbouringNodeIndices.
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.
pElement | the element to divide | |
placeOriginalElementBelow | whether to place the original element below (in the y direction) the new element (defaults to false) |
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.
Definition at line 369 of file PottsMesh.cpp.
References PottsMesh< DIM >::AddElement(), MutableElement< DIM, DIM >::DeleteNode(), EXCEPTION, AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), PottsMesh< DIM >::mDeletedElementIndices, and PottsMesh< DIM >::mElements.
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.
index | the global index of a specified vertex element |
Definition at line 171 of file PottsMesh.cpp.
References PottsMesh< DIM >::GetElement(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocation(), and AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes().
PottsElement< DIM > * PottsMesh< DIM >::GetElement | ( | unsigned | index | ) | const [inline] |
index | the global index of a specified PottsElement. |
Definition at line 164 of file PottsMesh.cpp.
References PottsMesh< DIM >::mElements.
Referenced by PottsMesh< DIM >::GetCentroidOfElement(), PottsMesh< DIM >::GetNeighbouringElementIndices(), PottsMesh< DIM >::GetSurfaceAreaOfElement(), and PottsMesh< DIM >::GetVolumeOfElement().
PottsMesh< DIM >::PottsElementIterator PottsMesh< DIM >::GetElementIteratorBegin | ( | bool | skipDeletedElements = true |
) | [inline] |
skipDeletedElements | whether to include deleted element |
Definition at line 418 of file PottsMesh.hpp.
Referenced by PottsMeshWriter< SPACE_DIM >::WriteFilesUsingMesh().
PottsMesh< DIM >::PottsElementIterator PottsMesh< DIM >::GetElementIteratorEnd | ( | ) | [inline] |
Definition at line 425 of file PottsMesh.hpp.
References PottsMesh< DIM >::mElements.
std::set< unsigned > PottsMesh< DIM >::GetMooreNeighbouringNodeIndices | ( | unsigned | nodeIndex | ) | [inline] |
Given a node, return a set containing the indices of its Moore neighbouring nodes.
nodeIndex | global index of the node |
Definition at line 234 of file PottsMesh.cpp.
References PottsMesh< DIM >::mMooreNeighbouringNodeIndices.
std::set< unsigned > PottsMesh< DIM >::GetNeighbouringElementIndices | ( | unsigned | elementIndex | ) | [inline] |
Given an element, find a set containing the indices of its neighbouring elements.
elementIndex | global index of the element |
Definition at line 513 of file PottsMesh.cpp.
References PottsMesh< DIM >::GetElement(), Node< SPACE_DIM >::GetIndex(), AbstractMesh< DIM, DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), and PottsMesh< DIM >::GetVonNeumannNeighbouringNodeIndices().
Definition at line 158 of file PottsMesh.cpp.
References PottsMesh< DIM >::mElements.
Definition at line 152 of file PottsMesh.cpp.
References PottsMesh< DIM >::mDeletedElementIndices, and PottsMesh< DIM >::mElements.
Referenced by PottsMesh< DIM >::DeleteNode(), PottsMeshWriter< SPACE_DIM >::GetNextElement(), and PottsMeshWriter< SPACE_DIM >::WriteFilesUsingMesh().
Reimplemented from AbstractMesh< DIM, DIM >.
Definition at line 146 of file PottsMesh.cpp.
References AbstractMesh< DIM, DIM >::mNodes.
Referenced by PottsMesh< DIM >::DeleteNode(), PottsMeshWriter< SPACE_DIM >::GetNextNode(), and PottsMeshWriter< SPACE_DIM >::WriteFilesUsingMesh().
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.
index | the global index of a specified PottsElement |
Definition at line 200 of file PottsMesh.cpp.
References PottsMesh< DIM >::GetElement(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), PottsMesh< DIM >::GetVonNeumannNeighbouringNodeIndices(), and AbstractMesh< DIM, DIM >::mNodes.
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.
index | the global index of a specified PottsElement element |
Definition at line 191 of file PottsMesh.cpp.
References PottsMesh< DIM >::GetElement(), and AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes().
std::set< unsigned > PottsMesh< DIM >::GetVonNeumannNeighbouringNodeIndices | ( | unsigned | nodeIndex | ) | [inline] |
Given a node, return a set containing the indices of its Von Neumann neighbouring nodes.
nodeIndex | global index of the node |
Definition at line 240 of file PottsMesh.cpp.
References PottsMesh< DIM >::mVonNeumannNeighbouringNodeIndices.
Referenced by PottsMesh< DIM >::GetNeighbouringElementIndices(), and PottsMesh< DIM >::GetSurfaceAreaOfElement().
void PottsMesh< DIM >::load | ( | Archive & | archive, | |
const unsigned int | version | |||
) | [inline, protected] |
Loads a mesh by using PottsMeshReader and the location in ArchiveLocationInfo.
archive | the archive | |
version | the current version of this class |
Definition at line 143 of file PottsMesh.hpp.
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.
archive | the archive | |
version | the current version of this class |
Definition at line 121 of file PottsMesh.hpp.
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.
index | the global index of the boundary element |
Definition at line 116 of file PottsMesh.cpp.
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.
index | the global index of the element |
Definition at line 109 of file PottsMesh.cpp.
References PottsMesh< DIM >::mElements.
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.
index | the global index of the node |
Implements AbstractMesh< DIM, DIM >.
Definition at line 102 of file PottsMesh.cpp.
References AbstractMesh< DIM, DIM >::mNodes.
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from AbstractMesh< DIM, DIM >.
Definition at line 111 of file PottsMesh.hpp.
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< DIM >::Clear(), PottsMesh< DIM >::DeleteElement(), PottsMesh< DIM >::DeleteNode(), PottsMesh< DIM >::DivideElement(), PottsMesh< DIM >::GetNumElements(), PottsMesh< SPACE_DIM >::load(), and PottsMesh< SPACE_DIM >::save().
std::vector<PottsElement<DIM>*> PottsMesh< DIM >::mElements [protected] |
Vector of pointers to PottsElements.
Definition at line 69 of file PottsMesh.hpp.
Referenced by PottsMesh< DIM >::AddElement(), PottsMesh< DIM >::Clear(), PottsMesh< DIM >::ConstructFromMeshReader(), PottsMesh< DIM >::DeleteElement(), PottsMesh< DIM >::DeleteNode(), PottsMesh< DIM >::DivideElement(), PottsMesh< DIM >::GetElement(), PottsMesh< DIM >::GetElementIteratorEnd(), PottsMesh< DIM >::GetNumAllElements(), PottsMesh< DIM >::GetNumElements(), PottsMesh< DIM >::PottsMesh(), and PottsMesh< DIM >::SolveElementMapping().
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< DIM >::ConstructFromMeshReader(), PottsMesh< DIM >::DeleteNode(), PottsMesh< DIM >::GetMooreNeighbouringNodeIndices(), PottsMesh< SPACE_DIM >::load(), PottsMesh< DIM >::PottsMesh(), and PottsMesh< SPACE_DIM >::save().
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< DIM >::ConstructFromMeshReader(), PottsMesh< DIM >::DeleteNode(), PottsMesh< DIM >::GetVonNeumannNeighbouringNodeIndices(), PottsMesh< SPACE_DIM >::load(), PottsMesh< DIM >::PottsMesh(), and PottsMesh< SPACE_DIM >::save().