Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
MutableVertexMesh< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <MutableVertexMesh.hpp>

+ Inheritance diagram for MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >:
+ Collaboration diagram for MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >:

Public Member Functions

void PerformNodeMerge (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
 
 MutableVertexMesh (std::vector< Node< SPACE_DIM > * > nodes, std::vector< VertexElement< ELEMENT_DIM, SPACE_DIM > * > vertexElements, double cellRearrangementThreshold=0.01, double t2Threshold=0.001, double cellRearrangementRatio=1.5, double protorosetteFormationProbability=0.0, double protorosetteResolutionProbabilityPerTimestep=0.0, double rosetteResolutionProbabilityPerTimestep=0.0)
 
 MutableVertexMesh ()
 
virtual ~MutableVertexMesh ()
 
void SetCellRearrangementThreshold (double cellRearrangementThreshold)
 
void SetT2Threshold (double t2Threshold)
 
void SetCellRearrangementRatio (double cellRearrangementRatio)
 
void SetProtorosetteFormationProbability (double protorosetteFormationProbability)
 
void SetProtorosetteResolutionProbabilityPerTimestep (double protorosetteResolutionProbabilityPerTimestep)
 
void SetRosetteResolutionProbabilityPerTimestep (double rosetteResolutionProbabilityPerTimestep)
 
virtual void SetNode (unsigned nodeIndex, ChastePoint< SPACE_DIM > point)
 
void SetCheckForInternalIntersections (bool checkForInternalIntersections)
 
void SetCheckForT3Swaps (bool checkForT3Swaps)
 
double GetCellRearrangementThreshold () const
 
double GetT2Threshold () const
 
double GetCellRearrangementRatio () const
 
double GetProtorosetteFormationProbability () const
 
double GetProtorosetteResolutionProbabilityPerTimestep () const
 
double GetRosetteResolutionProbabilityPerTimestep () const
 
void SetDistanceForT3SwapChecking (double distanceForT3SwapChecking)
 
double GetDistanceForT3SwapChecking () const
 
unsigned GetNumNodes () const
 
unsigned GetNumElements () const
 
bool GetCheckForInternalIntersections () const
 
bool GetCheckForT3Swaps () const
 
std::vector< c_vector< double, SPACE_DIM > > GetLocationsOfT1Swaps ()
 
c_vector< double, SPACE_DIM > GetLastT2SwapLocation ()
 
std::vector< c_vector< double, SPACE_DIM > > GetLocationsOfT3Swaps ()
 
std::vector< c_vector< double, SPACE_DIM > > GetLocationsOfIntersectionSwaps ()
 
void ClearLocationsOfT1Swaps ()
 
void ClearLocationsOfT3Swaps ()
 
void ClearLocationsOfIntersectionSwaps ()
 
unsigned AddNode (Node< SPACE_DIM > *pNewNode)
 
void DeleteElementPriorToReMesh (unsigned index)
 
void DeleteNodePriorToReMesh (unsigned index)
 
unsigned DivideElementAlongShortAxis (VertexElement< ELEMENT_DIM, SPACE_DIM > *pElement, bool placeOriginalElementBelow=false)
 
unsigned DivideElementAlongGivenAxis (VertexElement< ELEMENT_DIM, SPACE_DIM > *pElement, c_vector< double, SPACE_DIM > axisOfDivision, bool placeOriginalElementBelow=false)
 
unsigned AddElement (VertexElement< ELEMENT_DIM, SPACE_DIM > *pNewElement)
 
bool CheckForT2Swaps (VertexElementMap &rElementMap)
 
void Clear ()
 
void DivideEdge (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
 
void RemoveDeletedNodesAndElements (VertexElementMap &rElementMap)
 
void RemoveDeletedNodes ()
 
virtual void ReMesh (VertexElementMap &rElementMap)
 
void ReMesh ()
 
void SetMeshOperationTracking (const bool track)
 
VertexMeshOperationRecorder< ELEMENT_DIM, SPACE_DIM > * GetOperationRecorder ()
 
- Public Member Functions inherited from VertexMesh< ELEMENT_DIM, SPACE_DIM >
VertexElementIterator GetElementIteratorBegin (bool skipDeletedElements=true)
 
VertexElementIterator GetElementIteratorEnd ()
 
 VertexMesh (std::vector< Node< SPACE_DIM > * > nodes, std::vector< VertexElement< ELEMENT_DIM, SPACE_DIM > * > vertexElements)
 
 VertexMesh (std::vector< Node< SPACE_DIM > * > nodes, std::vector< VertexElement< ELEMENT_DIM - 1, SPACE_DIM > * > faces, std::vector< VertexElement< ELEMENT_DIM, SPACE_DIM > * > vertexElements)
 
 VertexMesh (TetrahedralMesh< 2, 2 > &rMesh, bool isPeriodic=false, bool isBounded=false, bool scaleBoundByEdgeLength=true, double maxDelaunayEdgeLength=DBL_MAX, bool offsetNewBoundaryNodes=false)
 Alternative 2D 'Voronoi' constructor.
 
 VertexMesh (TetrahedralMesh< 3, 3 > &rMesh)
 
 VertexMesh ()
 
virtual ~VertexMesh ()
 
unsigned GetNumEdges () const
 
Edge< SPACE_DIM > * GetEdge (unsigned index) const
 
const EdgeHelper< SPACE_DIM > & rGetEdgeHelper () const
 
unsigned GetNumAllElements () const
 
virtual unsigned GetNumFaces () const
 
VertexElement< ELEMENT_DIM, SPACE_DIM > * GetElement (unsigned index) const
 
VertexElement< ELEMENT_DIM - 1, SPACE_DIM > * GetFace (unsigned index) const
 
virtual c_vector< double, SPACE_DIM > GetCentroidOfElement (unsigned index)
 
void ConstructFromMeshReader (AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader)
 
unsigned GetDelaunayNodeIndexCorrespondingToVoronoiElementIndex (unsigned elementIndex)
 
unsigned GetVoronoiElementIndexCorrespondingToDelaunayNodeIndex (unsigned nodeIndex)
 
unsigned GetRosetteRankOfElement (unsigned index)
 
virtual c_vector< double, SPACE_DIM > GetVectorFromAtoB (const c_vector< double, SPACE_DIM > &rLocationA, const c_vector< double, SPACE_DIM > &rLocationB)
 
virtual double GetVolumeOfElement (unsigned index)
 
virtual double GetSurfaceAreaOfElement (unsigned index)
 
c_vector< double, SPACE_DIM > GetAreaGradientOfElementAtNode (VertexElement< ELEMENT_DIM, SPACE_DIM > *pElement, unsigned localIndex)
 
c_vector< double, SPACE_DIM > GetPreviousEdgeGradientOfElementAtNode (VertexElement< ELEMENT_DIM, SPACE_DIM > *pElement, unsigned localIndex)
 
c_vector< double, SPACE_DIM > GetNextEdgeGradientOfElementAtNode (VertexElement< ELEMENT_DIM, SPACE_DIM > *pElement, unsigned localIndex)
 
c_vector< double, SPACE_DIM > GetPerimeterGradientOfElementAtNode (VertexElement< ELEMENT_DIM, SPACE_DIM > *pElement, unsigned localIndex)
 
virtual c_vector< double, 3 > CalculateMomentsOfElement (unsigned index)
 
double GetEdgeLength (unsigned elementIndex1, unsigned elementIndex2)
 
double GetElongationShapeFactorOfElement (unsigned elementIndex)
 
double CalculateUnitNormalToFaceWithArea (VertexElement< ELEMENT_DIM - 1, SPACE_DIM > *pFace, c_vector< double, SPACE_DIM > &rNormal)
 
virtual double CalculateAreaOfFace (VertexElement< ELEMENT_DIM - 1, SPACE_DIM > *pFace)
 
c_vector< double, SPACE_DIM > GetShortAxisOfElement (unsigned index)
 
std::set< unsignedGetNeighbouringNodeIndices (unsigned nodeIndex)
 
std::set< unsignedGetNeighbouringNodeNotAlsoInElement (unsigned nodeIndex, unsigned elemIndex)
 
std::set< unsignedGetNeighbouringElementIndices (unsigned elementIndex)
 
virtual VertexMesh< ELEMENT_DIM, SPACE_DIM > * GetMeshForVtk ()
 
bool IsNearExistingNodes (c_vector< double, SPACE_DIM > newNodeLocation, std::vector< Node< SPACE_DIM > * > nodesToCheck, double minClearance)
 
- Public Member Functions inherited from AbstractMesh< ELEMENT_DIM, SPACE_DIM >
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
 
double GetDistanceBetweenNodes (unsigned indexA, unsigned indexB)
 
virtual double GetWidth (const unsigned &rDimension) const
 
virtual ChasteCuboid< SPACE_DIM > CalculateBoundingBox () 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 RotateX (const double theta)
 
void RotateY (const double theta)
 
void RotateZ (const double theta)
 
void Rotate (double theta)
 
virtual void RefreshMesh ()
 
bool IsMeshChanging () const
 
unsigned CalculateMaximumContainingElementsPerProcess () const
 
void SetMeshHasChangedSinceLoading ()
 

Protected Member Functions

unsigned DivideElement (VertexElement< ELEMENT_DIM, SPACE_DIM > *pElement, unsigned nodeAIndex, unsigned nodeBIndex, bool placeOriginalElementBelow=false)
 
virtual bool CheckForSwapsFromShortEdges ()
 
bool CheckForIntersections ()
 
virtual void IdentifySwapType (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
 
- Protected Member Functions inherited from VertexMesh< ELEMENT_DIM, SPACE_DIM >
unsigned SolveNodeMapping (unsigned index) const
 
unsigned SolveElementMapping (unsigned index) const
 
unsigned SolveBoundaryElementMapping (unsigned index) const
 
void GenerateEdgesFromElements (std::vector< VertexElement< ELEMENT_DIM, SPACE_DIM > * > &rElements)
 
void GenerateVerticesFromElementCircumcentres (TetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh)
 
bool ElementIncludesPoint (const c_vector< double, SPACE_DIM > &rTestPoint, unsigned elementIndex)
 
unsigned GetLocalIndexForElementEdgeClosestToPoint (const c_vector< double, SPACE_DIM > &rTestPoint, unsigned elementIndex)
 
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< ELEMENT_DIM, SPACE_DIM >
virtual void SetElementOwnerships ()
 
ChasteCuboid< SPACE_DIM > CalculateBoundingBox (const std::vector< Node< SPACE_DIM > * > &rNodes) const
 

Protected Attributes

bool mTrackMeshOperations = false
 
VertexMeshOperationRecorder< ELEMENT_DIM, SPACE_DIM > mOperationRecorder = (VertexMeshOperationRecorder<ELEMENT_DIM, SPACE_DIM>())
 
double mCellRearrangementThreshold
 
double mCellRearrangementRatio
 
double mT2Threshold
 
double mProtorosetteFormationProbability
 
double mProtorosetteResolutionProbabilityPerTimestep
 
double mRosetteResolutionProbabilityPerTimestep
 
bool mCheckForInternalIntersections
 
bool mCheckForT3Swaps
 
std::vector< unsignedmDeletedNodeIndices
 
std::vector< unsignedmDeletedElementIndices
 
double mDistanceForT3SwapChecking
 
c_vector< double, SPACE_DIM > mLastT2SwapLocation
 
std::vector< c_vector< double, SPACE_DIM > > mLocationsOfIntersectionSwaps
 
- Protected Attributes inherited from VertexMesh< ELEMENT_DIM, SPACE_DIM >
std::vector< VertexElement< ELEMENT_DIM, SPACE_DIM > * > mElements
 
std::vector< VertexElement< ELEMENT_DIM - 1, SPACE_DIM > * > mFaces
 
EdgeHelper< SPACE_DIM > mEdgeHelper
 
std::map< unsigned, unsignedmVoronoiElementIndexMap
 
TetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * mpDelaunayMesh
 
- Protected Attributes inherited from AbstractMesh< ELEMENT_DIM, SPACE_DIM >
std::vector< Node< SPACE_DIM > * > mNodes
 
std::vector< Node< SPACE_DIM > * > mBoundaryNodes
 
DistributedVectorFactorympDistributedVectorFactory
 
std::vector< unsignedmNodePermutation
 
std::string mMeshFileBaseName
 
bool mMeshChangesDuringSimulation
 

Private Member Functions

void PerformT1Swap (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB, std::set< unsigned > &rElementsContainingNodes)
 
void PerformIntersectionSwap (Node< SPACE_DIM > *pNode, unsigned elementIndex)
 
void PerformT2Swap (VertexElement< ELEMENT_DIM, SPACE_DIM > &rElement)
 
void PerformT3Swap (Node< SPACE_DIM > *pNode, unsigned elementIndex)
 
void PerformVoidRemoval (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB, Node< SPACE_DIM > *pNodeC)
 
virtual void HandleHighOrderJunctions (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
 
void PerformRosetteRankIncrease (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
 
void PerformProtorosetteResolution (Node< SPACE_DIM > *pProtorosetteNode)
 
void PerformRosetteRankDecrease (Node< SPACE_DIM > *pRosetteNode)
 
void CheckForRosettes ()
 
c_vector< double, 2 > WidenEdgeOrCorrectIntersectionLocationIfNecessary (unsigned indexA, unsigned indexB, c_vector< double, 2 > intersection)
 
template<class Archive >
void serialize (Archive &archive, const unsigned int version)
 

Friends

class TestMutableVertexMesh
 
class TestMutableVertexMeshReMesh
 
class TestMutableVertexMeshRosetteMethods
 
class TestMutableVertexEdges
 
class TestCellEdgeInteriorSrn
 
class TestMutableVertexMeshOperationsWithPopulationSrn
 
class boost::serialization::access
 

Additional Inherited Members

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

Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
class MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >

A mutable vertex-based mesh class, which inherits from VertexMesh and allows for local remeshing. This is implemented through simple operations including node merging, neighbour exchange ("T1 swap"), node/edge merging in the case of intersections ("T3 swap") and removal of small triangular elements ("T2 swap").

MutableVertexMesh is used as a member of the VertexBasedCellPopulation class to represent the junctional network of cells that forms the basis of simulations of off-lattice vertex-based models.

Definition at line 67 of file MutableVertexMesh.hpp.

Constructor & Destructor Documentation

◆ MutableVertexMesh() [1/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::MutableVertexMesh ( std::vector< Node< SPACE_DIM > * >  nodes,
std::vector< VertexElement< ELEMENT_DIM, SPACE_DIM > * >  vertexElements,
double  cellRearrangementThreshold = 0.01,
double  t2Threshold = 0.001,
double  cellRearrangementRatio = 1.5,
double  protorosetteFormationProbability = 0.0,
double  protorosetteResolutionProbabilityPerTimestep = 0.0,
double  rosetteResolutionProbabilityPerTimestep = 0.0 
)

Default constructor.

Parameters
nodesvector of pointers to nodes
vertexElementsvector of pointers to VertexElements
cellRearrangementThresholdthe minimum threshold distance for element rearrangement (defaults to 0.01)
t2Thresholdthe maximum threshold distance for Type 2 swaps (defaults to 0.001)
cellRearrangementRatioratio between the minimum threshold distance for element rearrangement node separation after remeshing (defaults to 1.5)
protorosetteFormationProbabilitythe probability of a protorosette formation event happening instead of a T1 swap
protorosetteResolutionProbabilityPerTimestepthe probability that, in a given timestep, a protorosette will resolve (similar to the completion of a T1 swap)
rosetteResolutionProbabilityPerTimestepthe probability that, in a given timestep, a rosette will resolve (reduce the number of cells sharing a common vertex by 1)

Definition at line 42 of file MutableVertexMesh.cpp.

References Node< SPACE_DIM >::AddElement(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::Clear(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GenerateEdgesFromElements(), VertexElement< ELEMENT_DIM, SPACE_DIM >::GetFace(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::mElements, VertexMesh< ELEMENT_DIM, SPACE_DIM >::mFaces, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mMeshChangesDuringSimulation, and AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes.

◆ MutableVertexMesh() [2/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::MutableVertexMesh ( )

◆ ~MutableVertexMesh()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::~MutableVertexMesh ( )
virtual

Destructor.

Definition at line 143 of file MutableVertexMesh.cpp.

Member Function Documentation

◆ AddElement()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::AddElement ( VertexElement< ELEMENT_DIM, SPACE_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 384 of file MutableVertexMesh.cpp.

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

◆ AddNode()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::AddNode ( Node< SPACE_DIM > *  pNewNode)

Add a node to the mesh.

Note: After calling this one or more times, you must then call ReMesh.

Parameters
pNewNodepointer to the new node
Returns
the global index of the new node in the mesh.

Definition at line 365 of file MutableVertexMesh.cpp.

References Node< SPACE_DIM >::SetIndex().

Referenced by Cylindrical2dVertexMesh::AddNode(), and Toroidal2dVertexMesh::AddNode().

◆ CheckForIntersections()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::CheckForIntersections ( )
protected

Helper method for ReMesh().

Check if any elements have become intersected and correct this by implementing the appropriate local remeshing operation (a T3 swap or node merge).

Returns
whether to recheck the mesh again

Definition at line 1151 of file MutableVertexMesh.cpp.

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

◆ CheckForRosettes()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::CheckForRosettes ( )
private

Helper method for ReMesh().

Check whether the mesh contains rosettes or protorosettes, and implement resolution events if necessary.

First, we loop over each node and populate vectors of protorosette and rosette nodes which need to undergo resolution.

We do not perform the resolution events in this initial loop because the resolution events involve changing nodes in the mesh.

Finally, we loop over the contents of each node vector and perform the necessary resolution events.

Because each resolution event changes nodes, we include several assertions to catch possible unconsidered behaviour.

Definition at line 4033 of file MutableVertexMesh.cpp.

References RandomNumberGenerator::Instance(), Node< SPACE_DIM >::IsDeleted(), NEVER_REACHED, and Node< SPACE_DIM >::rGetContainingElementIndices().

◆ CheckForSwapsFromShortEdges()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::CheckForSwapsFromShortEdges ( )
protectedvirtual

Helper method for ReMesh().

Check if any neighbouring nodes in an element are closer than the mCellRearrangementThreshold and are not contained in any triangular elements. If any such pair of nodes are found, then call IdentifySwapType(), which in turn implements the appropriate local remeshing operation (a T1 swap, void removal, or node merge).

Returns
whether we need to check for, and implement, any further local remeshing operations (true if any swaps are performed).
Todo:
Could we search more efficiently by just iterating over edges? (see #2401)
Todo:
Use iterators to tidy this up (see #2401)

Definition at line 1058 of file MutableVertexMesh.cpp.

References Node< SPACE_DIM >::GetIndex(), NEVER_REACHED, and Node< SPACE_DIM >::rGetContainingElementIndices().

◆ CheckForT2Swaps()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::CheckForT2Swaps ( VertexElementMap rElementMap)

Helper method for ReMesh().

Check for any triangular element whose area is smaller than mT2Threshold and call PerformT2Swap() on any such element.

Parameters
rElementMapa VertexElementMap which associates the indices of VertexElements in the old mesh with indices of VertexElements in the new mesh. This should be created with the correct size, GetNumElements()
Returns
whether we need to check for, and implement, any further local remeshing operations
Todo:
: cover this line in a test

Definition at line 1126 of file MutableVertexMesh.cpp.

References VertexElementMap::SetDeleted().

◆ Clear()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::Clear ( )
virtual

◆ ClearLocationsOfIntersectionSwaps()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ClearLocationsOfIntersectionSwaps ( )

Helper method to clear the stored intersection swaps

Definition at line 359 of file MutableVertexMesh.cpp.

Referenced by VertexIntersectionSwapLocationsWriter< ELEMENT_DIM, SPACE_DIM >::Visit().

◆ ClearLocationsOfT1Swaps()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ClearLocationsOfT1Swaps ( )

Helper method to clear the stored T1 swaps

Definition at line 347 of file MutableVertexMesh.cpp.

◆ ClearLocationsOfT3Swaps()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ClearLocationsOfT3Swaps ( )

Helper method to clear the stored T3 swaps

Definition at line 353 of file MutableVertexMesh.cpp.

◆ DeleteElementPriorToReMesh()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DeleteElementPriorToReMesh ( unsigned  index)

Mark an element as deleted. Note that it DOES NOT deal with the associated nodes and therefore should only be called immediately prior to a ReMesh() being called.

Parameters
indexthe global index of a specified vertex element

Definition at line 819 of file MutableVertexMesh.cpp.

References Node< SPACE_DIM >::GetIndex(), NEVER_REACHED, Node< SPACE_DIM >::rGetContainingElementIndices(), and Node< SPACE_DIM >::SetAsBoundaryNode().

◆ DeleteNodePriorToReMesh()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DeleteNodePriorToReMesh ( unsigned  index)

Mark a given node as deleted. Note that this method DOES NOT deal with the associated elements and therefore should only be called immediately prior to a ReMesh() being called.

Parameters
indexThe index of the node to delete

Definition at line 848 of file MutableVertexMesh.cpp.

◆ DivideEdge()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideEdge ( Node< SPACE_DIM > *  pNodeA,
Node< SPACE_DIM > *  pNodeB 
)

◆ DivideElement()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideElement ( VertexElement< ELEMENT_DIM, SPACE_DIM > *  pElement,
unsigned  nodeAIndex,
unsigned  nodeBIndex,
bool  placeOriginalElementBelow = false 
)
protected

Divide an element along the axis passing through two of its nodes.

Todo:
This method currently assumes SPACE_DIM = 2 (see #866)
Parameters
pElementthe element to divide
nodeAIndexthe local index of one node within this element
nodeBIndexthe local index of another node within this element
placeOriginalElementBelowwhether to place the original element below (in the y direction) the new element (defaults to false)
Returns
the index of the new element

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 (see #2401)

Definition at line 686 of file MutableVertexMesh.cpp.

◆ DivideElementAlongGivenAxis()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideElementAlongGivenAxis ( VertexElement< ELEMENT_DIM, SPACE_DIM > *  pElement,
c_vector< double, SPACE_DIM >  axisOfDivision,
bool  placeOriginalElementBelow = false 
)

Divide an element along a specified axis.

If the new nodes (intersections of axis with element) are within mCellRearrangementThreshold of existing nodes then they are moved 2*mCellRearrangementThreshold away.

Parameters
pElementthe element to divide
axisOfDivisionaxis to divide the element by
placeOriginalElementBelowwhether to place the original element below (in the y direction) the new element (defaults to false)
Returns
the index of the new element
Todo:
or should we move a and b apart, it may interfere with neighbouring edges? (see #1399 and #2401)

Definition at line 410 of file MutableVertexMesh.cpp.

◆ DivideElementAlongShortAxis()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideElementAlongShortAxis ( VertexElement< ELEMENT_DIM, SPACE_DIM > *  pElement,
bool  placeOriginalElementBelow = false 
)

Divide an element along its short axis.

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

Definition at line 668 of file MutableVertexMesh.cpp.

◆ GetCellRearrangementRatio()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCellRearrangementRatio ( ) const
Returns
mCellRearrangementRatio

Definition at line 161 of file MutableVertexMesh.cpp.

◆ GetCellRearrangementThreshold()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCellRearrangementThreshold ( ) const
Returns
mCellRearrangementThreshold

Definition at line 149 of file MutableVertexMesh.cpp.

◆ GetCheckForInternalIntersections()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCheckForInternalIntersections ( ) const
Returns
mCheckForInternalIntersections, either to check for edges intersections or not.

Definition at line 197 of file MutableVertexMesh.cpp.

◆ GetCheckForT3Swaps()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCheckForT3Swaps ( ) const

This is a shortcut to get locations from mOperationRecorder

Returns
the locations of the T3 swaps
mCheckForT3Swaps, either to check for T3 swaps or not.

Definition at line 203 of file MutableVertexMesh.cpp.

◆ GetDistanceForT3SwapChecking()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetDistanceForT3SwapChecking ( ) const

Get Distance for T3 swap checking.

Returns
mDistanceForT3SwapChecking

Definition at line 191 of file MutableVertexMesh.cpp.

◆ GetLastT2SwapLocation()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
c_vector< double, SPACE_DIM > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLastT2SwapLocation ( )
Returns
the location of the last T2 swap

Definition at line 323 of file MutableVertexMesh.cpp.

◆ GetLocationsOfIntersectionSwaps()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< c_vector< double, SPACE_DIM > > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLocationsOfIntersectionSwaps ( )
Returns
the locations of the intersection swaps

Definition at line 341 of file MutableVertexMesh.cpp.

Referenced by VertexIntersectionSwapLocationsWriter< ELEMENT_DIM, SPACE_DIM >::Visit().

◆ GetLocationsOfT1Swaps()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< c_vector< double, SPACE_DIM > > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLocationsOfT1Swaps ( )
Returns
the locations of the T1 swaps

Definition at line 311 of file MutableVertexMesh.cpp.

◆ GetLocationsOfT3Swaps()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< c_vector< double, SPACE_DIM > > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLocationsOfT3Swaps ( )

This is a shortcut to get locations from mOperationRecorder

Returns
the locations of the T3 swaps

Definition at line 329 of file MutableVertexMesh.cpp.

◆ GetNumElements()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements ( ) const
virtual
Returns
the number of VertexElements in the mesh.

Reimplemented from VertexMesh< ELEMENT_DIM, SPACE_DIM >.

Definition at line 305 of file MutableVertexMesh.cpp.

◆ GetNumNodes()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes ( ) const
virtual
Returns
the number of Nodes in the mesh.

Reimplemented from VertexMesh< ELEMENT_DIM, SPACE_DIM >.

Definition at line 299 of file MutableVertexMesh.cpp.

◆ GetOperationRecorder()

◆ GetProtorosetteFormationProbability()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetProtorosetteFormationProbability ( ) const

Get method for mProtoRosetteFormationProbability.

Returns
mProtoRosetteFormationProbability

Definition at line 167 of file MutableVertexMesh.cpp.

◆ GetProtorosetteResolutionProbabilityPerTimestep()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetProtorosetteResolutionProbabilityPerTimestep ( ) const

Get method for mProtoRosetteResolutionProbabilityPerTimestep.

Returns
mProtoRosetteResolutionProbabilityPerTimestep

Definition at line 173 of file MutableVertexMesh.cpp.

◆ GetRosetteResolutionProbabilityPerTimestep()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetRosetteResolutionProbabilityPerTimestep ( ) const

Get method for mRosetteResolutionProbabilityPerTimestep.

Returns
mRosetteResolutionProbabilityPerTimestep

Definition at line 179 of file MutableVertexMesh.cpp.

◆ GetT2Threshold()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetT2Threshold ( ) const
Returns
mT2Threshold

Definition at line 155 of file MutableVertexMesh.cpp.

◆ HandleHighOrderJunctions()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::HandleHighOrderJunctions ( Node< SPACE_DIM > *  pNodeA,
Node< SPACE_DIM > *  pNodeB 
)
privatevirtual

Helper method for ReMesh(), called by IdentifySwapType().

Handles the case where a swap involves a junction with more than three adjacent elements. This is implemented in a separate method to allow child classes to override this behaviour and implement junction remodelling with high-order nodes (see #2664).

Parameters
pNodeAone of the nodes to perform the swap with
pNodeBthe other node to perform the swap

Definition at line 3509 of file MutableVertexMesh.cpp.

References EXCEPTION, and Node< SPACE_DIM >::rGetContainingElementIndices().

◆ IdentifySwapType()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::IdentifySwapType ( Node< SPACE_DIM > *  pNodeA,
Node< SPACE_DIM > *  pNodeB 
)
protectedvirtual

Helper method for ReMesh(), called by CheckForSwapsFromShortEdges() when neighbouring nodes in an element have been found to be closer than the mCellRearrangementThreshold and do not share any triangular elements.

Identify the type of local remeshing operation required (T1 swap, void removal, or node merge).

Parameters
pNodeAone of the nodes to perform the swap with
pNodeBthe other node to perform the swap

Here, the triangular element would be along the short edge. Since we are already checking in CheckForSwapsFromShortEdges() whether the element is triangular, this exception is redundant for simulations. We leave it in for clarity. ///

Todo:
: consider removing the checking for this exception (see #2401)

If this is true then one of the elements adjacent to the triangular void is triangular. This element will then not share the short edge that is considered for a swap. Nevertheless, it would loose an edge during the swap. We are currently not able to deal with this situation. Related to #2533 and #2401.

Definition at line 1292 of file MutableVertexMesh.cpp.

References EXCEPTION, Node< SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), MutableElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), RandomNumberGenerator::Instance(), Node< SPACE_DIM >::IsDeleted(), NEVER_REACHED, Node< SPACE_DIM >::rGetContainingElementIndices(), Node< SPACE_DIM >::rGetLocation(), Node< SPACE_DIM >::rGetModifiableLocation(), and Node< SPACE_DIM >::SetAsBoundaryNode().

◆ PerformIntersectionSwap()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformIntersectionSwap ( Node< SPACE_DIM > *  pNode,
unsigned  elementIndex 
)
private

Helper method for ReMesh(), called by CheckForIntersections().

Perform an element swap to resolve the situation where a given node has been found to overlap a given element not containing it.

Parameters
pNodepointer to the node
elementIndexglobal index of the element in the mesh

Definition at line 2025 of file MutableVertexMesh.cpp.

References EXCEPTION, AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), MutableElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), and NEVER_REACHED.

◆ PerformNodeMerge()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformNodeMerge ( Node< SPACE_DIM > *  pNodeA,
Node< SPACE_DIM > *  pNodeB 
)

Helper method for ReMesh(), called by IdentifySwapType().

Merge two given nodes in the mesh and update node/element ownership, by replacing the node contained in the least number of elements with the other node. The merged node is moved to the centre between the two old node positions.

Parameters
pNodeAone of the nodes to perform the merge with
pNodeBthe other node to perform the merge with

Definition at line 1769 of file MutableVertexMesh.cpp.

References Node< SPACE_DIM >::GetIndex(), Node< SPACE_DIM >::rGetContainingElementIndices(), Node< SPACE_DIM >::rGetLocation(), and Node< SPACE_DIM >::rGetModifiableLocation().

◆ PerformProtorosetteResolution()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformProtorosetteResolution ( Node< SPACE_DIM > *  pProtorosetteNode)
private

Helper method for ReMesh(), called by CheckForRosettes().

Split protorosette in random direction. Create new node and redistribute nodes along line joining centres of randomly selected cell and cell opposite it.

Parameters
pProtorosetteNodenode at centre of protorosette

Ordering elements as follows:

\ A / \ / \ / B X D / \ / \ / C \

Element A is the randomly chosen element. Element C, which is directly opposite A, will end up separated from A, while the two elements B and D which start adjacent to A will end up sharing a common edge:

\ A / \ / \ / | B | D | / \ / \ / C \

Next, we compute where to place the two nodes which will replace the single protorosette node.

We place each node along the line joining the protorosette node to the centroid of element which will contain it, and the distance along this line is half of the swap distance.

To do this, we will move the existing protorosette node in to element A, and create a new node in element C. We then need to tidy up the nodes by adding the new node to elements B, C and D, and removing the protorosette node from element C.

NOTE: as the protorosette node was not necessarily on the line joining the centroids of elements A and C, unlike in a T1 swap, the new node locations will not necessarily be the full swap distance apart.

Here, we add the new node to elements B, C and D.

The method AddNode() takes the local index of a node i, where the new node is to be inserted between nodes i and i+1, so we need to find the local idx of the node directly before (clockwise from) where we wish to insert it.

For elements C and D, we just need the local index of the protorosette node, but for element B we need the one before, modulo number of elements.

Definition at line 3649 of file MutableVertexMesh.cpp.

References MutableElement< ELEMENT_DIM, SPACE_DIM >::AddNode(), MutableElement< ELEMENT_DIM, SPACE_DIM >::DeleteNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), MutableElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), RandomNumberGenerator::Instance(), NEVER_REACHED, RandomNumberGenerator::randMod(), and Node< SPACE_DIM >::rGetContainingElementIndices().

◆ PerformRosetteRankDecrease()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformRosetteRankDecrease ( Node< SPACE_DIM > *  pRosetteNode)
private

Helper method for ReMesh(), called by CheckForRosettes().

Split rosette by removing one cell at random. Create new node positioned along line joining rosette node and centre of randomly selected cell. Rosette node will remain unmoved.

Parameters
pRosetteNodenode at centre of rosette

We have now picked a vertex element at random from the rosette. This element will now be disconnected from the rosette in a manner analogous to performing a T1 swap.

The node at the centre of the rosette will not move, and a new node will be created a suitable distance away, along a line joining the rosette node and the centroid of the element we have randomly selected to move.

Ordering of elements is as follows:

\ S / \ / N \ / P —–X—– / \ / \ / \

where element S is the selected element, N is the next (counterclockwise) element from S, and P is the previous (clockwise) element from S.

Elements N and P will end up sharing an edge:

\ S / \ / \ / N | P | —–*—– / \ / \ / \

Next, we compute where to place the new node which will separate the rosette node from element S.

We place this node along the line joining the rosette node to the centroid of element S, at a distance of the swap distance ( (rearrangement ratio) x (rearrangement threshold) )

To do this, we create a new node in element S. We then need to tidy up the nodes by adding the new node to elements S, N and P, and by removing the rosette node from element S.

Here, we add the new node to elements S, N and P, and remove the rosette node from element S.

The method AddNode() takes the local index of a node i, where the new node is to be inserted between nodes i and i+1, so we need to find the local idx of the node directly before (clockwise from) where we wish to insert it.

For elements S and P, we just need the local index of the rosette node, but for element N we need the one before, modulo number of elements.

Definition at line 3847 of file MutableVertexMesh.cpp.

References MutableElement< ELEMENT_DIM, SPACE_DIM >::AddNode(), MutableElement< ELEMENT_DIM, SPACE_DIM >::DeleteNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), MutableElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), RandomNumberGenerator::Instance(), RandomNumberGenerator::randMod(), and Node< SPACE_DIM >::rGetContainingElementIndices().

◆ PerformRosetteRankIncrease()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformRosetteRankIncrease ( Node< SPACE_DIM > *  pNodeA,
Node< SPACE_DIM > *  pNodeB 
)
private

Helper method for ReMesh(), called by HandleHighOrderJunctions().

Merge a node of a non-rosette cell with the central node of a rosette, by replacing the node in the non-rosette cell with that of the rosette centre, keeping the rosette centre in the same position.

Parameters
pNodeAone of the nodes to perform the merge with
pNodeBthe other node to perform the merge with

The picture below shows the situation we are in. The central node (marked with an 'X') is contained in (at least) four elements already (A, B, C and D), and this is the rosette node which we have designated as hi_rank_node.

The node shared by elements C, D and E has come within the cell rearrangement threshold of the rosette node in order for this method to have been called. We have designated this node lo_rank_node.

We now 'merge' hi_rank_node and lo_rank_node, but keep hi_rank_node where it is (which is why we don't call PerformNodeMerge(), as that would move both nodes to their average location).

To accomplish this merge, we need do nothing to elements A and B. We remove lo_rank_node from elements C and D, and we replace lo_rank_node by hi_rank_node in element E.

\ A / \ / \ / B X C / \ ______ / \ / D \ E

Definition at line 3528 of file MutableVertexMesh.cpp.

References NEVER_REACHED, and Node< SPACE_DIM >::rGetContainingElementIndices().

◆ PerformT1Swap()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT1Swap ( Node< SPACE_DIM > *  pNodeA,
Node< SPACE_DIM > *  pNodeB,
std::set< unsigned > &  rElementsContainingNodes 
)
private

Helper method for ReMesh(), called by IdentifySwapType().

Perform a T1 swap on two given nodes contained in a given set of elements. This involves replacing the two nodes with two new nodes placed on either side of the previous shared edge, such that the edge formed by the two new nodes is the perpendicular bisector of the previous shared edge, and 'just larger' (by a factor mCellRearrangementRatio) than mThresholdDistance.

Parameters
pNodeAone of the nodes to perform the swap with
pNodeBthe other node to perform the swap
rElementsContainingNodesset of common elements
Todo:
remove magic number? (see #1884 and #2401)

Definition at line 1825 of file MutableVertexMesh.cpp.

References EXCEPTION, T1SwapInfo< SPACE_DIM >::mLocation, T1SwapInfo< SPACE_DIM >::mPostSwapEdge, T1SwapInfo< SPACE_DIM >::mPreSwapEdge, and NEVER_REACHED.

◆ PerformT2Swap()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT2Swap ( VertexElement< ELEMENT_DIM, SPACE_DIM > &  rElement)
private

◆ PerformT3Swap()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT3Swap ( Node< SPACE_DIM > *  pNode,
unsigned  elementIndex 
)
private

Helper method for ReMesh(), called by CheckForIntersections().

Perform a T3 swap on a given node that has been found to overlap a given element by moving the node back onto the edge of that element, associating it with the element and adding new nodes to maintain three elements per node.

Parameters
pNodepointer to the node
elementIndexglobal index of the element in the mesh
Todo:
the intersection location is sometimes overwritten when WidenEdgeOrCorrectIntersectionLocationIfNecessary

Definition at line 2514 of file MutableVertexMesh.cpp.

References MutableElement< ELEMENT_DIM, SPACE_DIM >::AddNode(), MutableElement< ELEMENT_DIM, SPACE_DIM >::DeleteNode(), EXCEPTION, MutableElement< ELEMENT_DIM, SPACE_DIM >::GetEdge(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), MutableElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocation(), MutableElement< ELEMENT_DIM, SPACE_DIM >::GetNumEdges(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), T3SwapInfo< SPACE_DIM >::mLocation, and NEVER_REACHED.

◆ PerformVoidRemoval()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformVoidRemoval ( Node< SPACE_DIM > *  pNodeA,
Node< SPACE_DIM > *  pNodeB,
Node< SPACE_DIM > *  pNodeC 
)
private

Helper method for ReMesh(), called by IdentifySwapType().

Remove a triangular void bounded by three given nodes, in which one of the edges is less than mCellRearrangementThreshold, through calls to PerformNodeMerge().

Parameters
pNodeAone of the nodes on the short edge
pNodeBthe other node on the short edge
pNodeCthe other node in the triangular void

Definition at line 3465 of file MutableVertexMesh.cpp.

References Node< SPACE_DIM >::IsDeleted(), NEVER_REACHED, Node< SPACE_DIM >::rGetModifiableLocation(), and Node< SPACE_DIM >::SetAsBoundaryNode().

◆ ReMesh() [1/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh ( )

Alternative version of ReMesh which takes no parameters and does not require a VertexElementMap. Note: inherited classes should overload ReMesh(VertexElementMap&).

Todo:
This method seems to be redundant; remove it? (#2401)

Definition at line 1051 of file MutableVertexMesh.cpp.

◆ ReMesh() [2/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh ( VertexElementMap rElementMap)
virtual

Update the state of the mesh by implementing any local remeshing operations (node merging, or T1, T2 or T3 swaps) that are required, and store any changes in element indices using the given VertexElementMap.

This method calls several other methods, in particular CheckForT2Swaps(), CheckForSwapsFromShortEdges() and CheckForIntersections().

Parameters
rElementMapa VertexElementMap which associates the indices of VertexElements in the old mesh with indices of VertexElements in the new mesh. This should be created with the correct size, GetNumElements()
Todo:
Implement ReMesh() in 3D (see #1422)

Definition at line 1003 of file MutableVertexMesh.cpp.

References EXCEPTION, and NEVER_REACHED.

◆ RemoveDeletedNodes()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::RemoveDeletedNodes ( )

Helper method for ReMesh(). Removes the deleted nodes from the mesh and relabels the node indices.

Definition at line 969 of file MutableVertexMesh.cpp.

◆ RemoveDeletedNodesAndElements()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::RemoveDeletedNodesAndElements ( VertexElementMap rElementMap)

Helper method for ReMesh(). Removes the deleted nodes and elements from the mesh and updates the rElementMap accordingly.

Parameters
rElementMapa VertexElementMap which associates the indices of VertexElements in the old mesh with indices of VertexElements in the new mesh. This should be created with the correct size, GetNumElements()

Definition at line 931 of file MutableVertexMesh.cpp.

References VertexElementMap::Resize(), VertexElementMap::SetDeleted(), and VertexElementMap::SetNewIndex().

◆ serialize()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
template<class Archive >
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize ( Archive &  archive,
const unsigned int  version 
)
inlineprivate

◆ SetCellRearrangementRatio()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetCellRearrangementRatio ( double  cellRearrangementRatio)

Set method for mCellRearrangementRatio.

Parameters
cellRearrangementRatio

Definition at line 221 of file MutableVertexMesh.cpp.

◆ SetCellRearrangementThreshold()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetCellRearrangementThreshold ( double  cellRearrangementThreshold)

Set method for mCellRearrangementThreshold.

Parameters
cellRearrangementThreshold

Definition at line 209 of file MutableVertexMesh.cpp.

◆ SetCheckForInternalIntersections()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetCheckForInternalIntersections ( bool  checkForInternalIntersections)

Set method for mCheckForInternalIntersections.

Parameters
checkForInternalIntersections

Definition at line 278 of file MutableVertexMesh.cpp.

◆ SetCheckForT3Swaps()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetCheckForT3Swaps ( bool  checkForT3Swaps)

Set method for mCheckForT3Swaps.

Parameters
checkForT3Swaps

Definition at line 284 of file MutableVertexMesh.cpp.

◆ SetDistanceForT3SwapChecking()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetDistanceForT3SwapChecking ( double  distanceForT3SwapChecking)

Set distance for T3 swap checking. At each time step we check for each boundary node whether it intersects with any boundary elements (cells) whose centroids lie within this distance to the node. Note that T3 swaps may not be resolved correctly if this distance is chosen too small, while large values for mDistanceForT3SwapChecking may slow down the simulation.

Parameters
distanceForT3SwapChecking

Definition at line 185 of file MutableVertexMesh.cpp.

◆ SetMeshOperationTracking()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetMeshOperationTracking ( const bool  track)
Parameters
trackwhether we need to track mesh operations during ReMesh

Definition at line 4183 of file MutableVertexMesh.cpp.

Referenced by VertexBasedCellPopulation< DIM >::VertexBasedCellPopulation().

◆ SetNode()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetNode ( unsigned  nodeIndex,
ChastePoint< SPACE_DIM >  point 
)
virtual

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

Parameters
nodeIndexthe index of the node to be moved
pointthe new target location of the node

Definition at line 404 of file MutableVertexMesh.cpp.

Referenced by Cylindrical2dVertexMesh::SetNode(), and Toroidal2dVertexMesh::SetNode().

◆ SetProtorosetteFormationProbability()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetProtorosetteFormationProbability ( double  protorosetteFormationProbability)

Set method for mProtoRosetteFormationProbability.

Parameters
protorosetteFormationProbabilitythe new value of mProtoRosetteFormationProbability

Definition at line 227 of file MutableVertexMesh.cpp.

References EXCEPTION.

◆ SetProtorosetteResolutionProbabilityPerTimestep()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetProtorosetteResolutionProbabilityPerTimestep ( double  protorosetteResolutionProbabilityPerTimestep)

Set method for mProtoRosetteResolutionProbabilityPerTimestep.

Parameters
protorosetteResolutionProbabilityPerTimestepthe new value of mProtoRosetteResolutionProbabilityPerTimestep

Definition at line 244 of file MutableVertexMesh.cpp.

◆ SetRosetteResolutionProbabilityPerTimestep()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetRosetteResolutionProbabilityPerTimestep ( double  rosetteResolutionProbabilityPerTimestep)

Set method for mRosetteResolutionProbabilityPerTimestep.

Parameters
rosetteResolutionProbabilityPerTimestepthe new value of mRosetteResolutionProbabilityPerTimestep

Definition at line 261 of file MutableVertexMesh.cpp.

References EXCEPTION.

◆ SetT2Threshold()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetT2Threshold ( double  t2Threshold)

Set method for mT2Threshold.

Parameters
t2Threshold

Definition at line 215 of file MutableVertexMesh.cpp.

◆ WidenEdgeOrCorrectIntersectionLocationIfNecessary()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
c_vector< double, 2 > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::WidenEdgeOrCorrectIntersectionLocationIfNecessary ( unsigned  indexA,
unsigned  indexB,
c_vector< double, 2 >  intersection 
)
private

Helper method for ReMesh(), called by PerformT3Swap(). During T3 swaps nodes are merged onto edges. This method checks if the edge is too short and moves its vertices apart if necessary in order to prevent T1 swaps from happening right away. The method also checks that the location where the merged node is going to end up at is not too close to one of the neighbouring vertices and moves it if necessary to prevent T1 swaps.

Parameters
indexAindex of one of the nodes on the short edge
indexBindex of the other node on the short edge
intersectionthe intersection location, i.e. the location where we are planning to put the merged node
Returns
intersection, the corrected location of where we are planning to put the merged node

If the edge is shorter than 4.0*mCellRearrangementRatio*mCellRearrangementThreshold move vertexA and vertexB 4.0*mCellRearrangementRatio*mCellRearrangementThreshold apart.

Todo:
investigate if moving A and B causes other issues with nearby nodes (see #2401)

Note: this distance is so that there is always enough room for new nodes (if necessary)

Todo:
currently this assumes a worst case scenario of 3 nodes between A and B could be less movement for other cases (see #1399 and #2401)

Reset the intersection away from vertices A and B to allow enough room for new nodes.

If the intersection is within mCellRearrangementRatio^2*mCellRearrangementThreshold of vertexA or vertexB move it mCellRearrangementRatio^2*mCellRearrangementThreshold away.

Note: this distance so that there is always enough room for new nodes (if necessary).

Todo:
currently this assumes a worst case scenario of 3 nodes between A and B; could be less movement for other cases (see #2401)

Definition at line 4119 of file MutableVertexMesh.cpp.

Friends And Related Symbol Documentation

◆ boost::serialization::access

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
friend class boost::serialization::access
friend

Needed for serialization.

Definition at line 330 of file MutableVertexMesh.hpp.

◆ TestCellEdgeInteriorSrn

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
friend class TestCellEdgeInteriorSrn
friend

Definition at line 73 of file MutableVertexMesh.hpp.

◆ TestMutableVertexEdges

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
friend class TestMutableVertexEdges
friend

Definition at line 72 of file MutableVertexMesh.hpp.

◆ TestMutableVertexMesh

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
friend class TestMutableVertexMesh
friend

Definition at line 69 of file MutableVertexMesh.hpp.

◆ TestMutableVertexMeshOperationsWithPopulationSrn

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
friend class TestMutableVertexMeshOperationsWithPopulationSrn
friend

Definition at line 74 of file MutableVertexMesh.hpp.

◆ TestMutableVertexMeshReMesh

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
friend class TestMutableVertexMeshReMesh
friend

Definition at line 70 of file MutableVertexMesh.hpp.

◆ TestMutableVertexMeshRosetteMethods

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
friend class TestMutableVertexMeshRosetteMethods
friend

Definition at line 71 of file MutableVertexMesh.hpp.

Member Data Documentation

◆ mCellRearrangementRatio

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementRatio
protected

The ratio between the minimum distance apart that two nodes in the mesh can be without causing element rearrangement and their separation after remeshing.

Definition at line 89 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mCellRearrangementThreshold

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementThreshold
protected

The minimum distance apart that two nodes in the mesh can be without causing element rearrangement.

Definition at line 83 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mCheckForInternalIntersections

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCheckForInternalIntersections
protected

Whether to check for edges intersections (true) or not (false).

Definition at line 104 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mCheckForT3Swaps

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCheckForT3Swaps
protected

Whether to check for T3 swaps (true) or not (false).

Definition at line 107 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mDeletedElementIndices

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedElementIndices
protected

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

Definition at line 113 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mDeletedNodeIndices

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedNodeIndices
protected

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

Definition at line 110 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mDistanceForT3SwapChecking

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDistanceForT3SwapChecking
protected

Distance for T3 swap checking. At each time step we check for each boundary node whether it intersects with any boundary elements (cells) whose centroids lie within this distance to the node. Note that T3 swaps may not be resolved correctly if this distance is chosen too small, while large values for mDistanceForT3SwapChecking may slow down the simulation.

Definition at line 121 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mLastT2SwapLocation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
c_vector<double, SPACE_DIM> MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mLastT2SwapLocation
protected

The location of the last T2 swap (the centre of the removed triangle), stored so it can be accessed by the T2SwapCellKiller.

Definition at line 126 of file MutableVertexMesh.hpp.

◆ mLocationsOfIntersectionSwaps

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< c_vector<double, SPACE_DIM> > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mLocationsOfIntersectionSwaps
protected

Locations of intersection swaps (the mid point of the switching nodes), stored so they can be accessed and output by the cell population. The locations are stored until they are cleared by ClearLocationsOfIntersectionSwaps().

Definition at line 132 of file MutableVertexMesh.hpp.

◆ mOperationRecorder

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
VertexMeshOperationRecorder<ELEMENT_DIM, SPACE_DIM> MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mOperationRecorder = (VertexMeshOperationRecorder<ELEMENT_DIM, SPACE_DIM>())
protected

Helper class to record rearrangements and mesh operations

Definition at line 80 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mProtorosetteFormationProbability

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mProtorosetteFormationProbability
protected

The probability that, instead of a T1 swap, the relevant nodes merge to form a protorosette

Definition at line 95 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mProtorosetteResolutionProbabilityPerTimestep

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mProtorosetteResolutionProbabilityPerTimestep
protected

The probability that, in a given timestep, a protorosette node resolves into two rank-3 nodes

Definition at line 98 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mRosetteResolutionProbabilityPerTimestep

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mRosetteResolutionProbabilityPerTimestep
protected

The probability that, in a given timestep, a rosette node resolves into two lower-rank nodes

Definition at line 101 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mT2Threshold

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mT2Threshold
protected

The area threshold at which T2 swaps occur in an apoptotic, triangular cell/element.

Definition at line 92 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::serialize().

◆ mTrackMeshOperations

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mTrackMeshOperations = false
protected

Whether we need to record mesh operations, e.g. when SRN models are used

Definition at line 77 of file MutableVertexMesh.hpp.


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