MutableVertexMesh< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <MutableVertexMesh.hpp>

Inherits VertexMesh< ELEMENT_DIM, SPACE_DIM >.

Collaboration diagram for MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 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)
 MutableVertexMesh ()
virtual ~MutableVertexMesh ()
void SetCellRearrangementThreshold (double cellRearrangementThreshold)
void SetT2Threshold (double t2Threshold)
void SetCellRearrangementRatio (double cellRearrangementRatio)
virtual void SetNode (unsigned nodeIndex, ChastePoint< SPACE_DIM > point)
void SetCheckForInternalIntersections (bool checkForInternalIntersections)
double GetCellRearrangementThreshold () const
double GetT2Threshold () const
double GetCellRearrangementRatio () const
unsigned GetNumNodes () const
unsigned GetNumElements () const
bool GetCheckForInternalIntersections () const
std::vector< c_vector< double,
SPACE_DIM > > 
GetLocationsOfT1Swaps ()
c_vector< double, SPACE_DIM > GetLastT2SwapLocation ()
std::vector< c_vector< double,
SPACE_DIM > > 
GetLocationsOfT3Swaps ()
void ClearLocationsOfT1Swaps ()
void ClearLocationsOfT3Swaps ()
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 ()

Protected Member Functions

unsigned DivideElement (VertexElement< ELEMENT_DIM, SPACE_DIM > *pElement, unsigned nodeAIndex, unsigned nodeBIndex, bool placeOriginalElementBelow=false)
bool CheckForSwapsFromShortEdges ()
bool CheckForIntersections ()
virtual void IdentifySwapType (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
void PerformNodeMerge (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
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)
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)

Protected Attributes

double mCellRearrangementThreshold
double mCellRearrangementRatio
double mT2Threshold
bool mCheckForInternalIntersections
std::vector< unsignedmDeletedNodeIndices
std::vector< unsignedmDeletedElementIndices
std::vector< c_vector< double,
SPACE_DIM > > 
mLocationsOfT1Swaps
c_vector< double, SPACE_DIM > mLastT2SwapLocation
std::vector< c_vector< double,
SPACE_DIM > > 
mLocationsOfT3Swaps

Friends

class TestMutableVertexMesh
class TestMutableVertexMeshReMesh
class boost::serialization::access

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 64 of file MutableVertexMesh.hpp.


Constructor & Destructor Documentation

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 
) [inline]

Default constructor.

Parameters:
nodes vector of pointers to nodes
vertexElements vector of pointers to VertexElements
cellRearrangementThreshold the minimum threshold distance for element rearrangement (defaults to 0.01)
t2Threshold the maximum threshold distance for Type 2 swaps (defaults to 0.001)
cellRearrangementRatio ratio between the minimum threshold distance for element rearrangement node separation after remeshing (defaults to 1.5)

Definition at line 42 of file MutableVertexMesh.cpp.

References Node< SPACE_DIM >::AddElement(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::Clear(), 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.

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

Destructor.

Definition at line 122 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::Clear().


Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::AddElement ( VertexElement< ELEMENT_DIM, SPACE_DIM > *  pNewElement  )  [inline]

Add an element to the mesh.

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

Definition at line 246 of file MutableVertexMesh.cpp.

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

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::AddNode ( Node< SPACE_DIM > *  pNewNode  )  [inline]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::CheckForIntersections (  )  [inline, protected]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::CheckForSwapsFromShortEdges (  )  [inline, protected]

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 822 of file MutableVertexMesh.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetDistanceBetweenNodes(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorEnd(), Node< SPACE_DIM >::GetIndex(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::IdentifySwapType(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementThreshold, and Node< SPACE_DIM >::rGetContainingElementIndices().

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

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

Helper method for ReMesh().

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

Parameters:
rElementMap a 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 883 of file MutableVertexMesh.cpp.

References VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorEnd(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetT2Threshold(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetVolumeOfElement(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT2Swap(), and VertexElementMap::SetDeleted().

Referenced by T2SwapCellKiller< DIM >::CheckAndLabelCellsForApoptosisOrDeath().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::Clear (  )  [inline, virtual]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ClearLocationsOfT1Swaps (  )  [inline]

Helper method to clear the stored T1 swaps

Definition at line 215 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mLocationsOfT1Swaps.

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

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

Helper method to clear the stored T3 swaps

Definition at line 221 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mLocationsOfT3Swaps.

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

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

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:
index the global index of a specified vertex element

Definition at line 594 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DeleteNodePriorToReMesh(), Node< SPACE_DIM >::GetIndex(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedElementIndices, VertexMesh< ELEMENT_DIM, SPACE_DIM >::mElements, Node< SPACE_DIM >::rGetContainingElementIndices(), and Node< SPACE_DIM >::SetAsBoundaryNode().

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

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

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:
index The index of the node to delete

Definition at line 618 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedNodeIndices, and AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes.

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideEdge ( Node< SPACE_DIM > *  pNodeA,
Node< SPACE_DIM > *  pNodeB 
) [inline]
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 
) [inline, protected]

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

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

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 468 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::AddElement(), MutableElement< ELEMENT_DIM, SPACE_DIM >::DeleteNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedElementIndices, and VertexMesh< ELEMENT_DIM, SPACE_DIM >::mElements.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::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 
) [inline]

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:
pElement the element to divide
axisOfDivision axis to divide the element by
placeOriginalElementBelow whether to place the original element below (in the y direction) the new element (defaults to false)
Returns:
the index of the new element

Todo:
or should we move a and b apart, it may interfere with neighbouring edges? (see #1399 and #2401)

Definition at line 269 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::AddNode(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideElement(), EXCEPTION, VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCentroidOfElement(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), Node< SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), MutableElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocation(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetVectorFromAtoB(), Node< SPACE_DIM >::IsBoundaryNode(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementRatio, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementThreshold, Node< SPACE_DIM >::rGetContainingElementIndices(), and Node< SPACE_DIM >::rGetLocation().

Referenced by VertexBasedCellPopulation< DIM >::AddCell(), and MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideElementAlongShortAxis().

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

Divide an element along its short axis.

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

Definition at line 455 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::DivideElementAlongGivenAxis(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), and VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetShortAxisOfElement().

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

Definition at line 146 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCheckForInternalIntersections.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
c_vector< double, SPACE_DIM > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLastT2SwapLocation (  )  [inline]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< c_vector< double, SPACE_DIM > > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLocationsOfT1Swaps (  )  [inline]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< c_vector< double, SPACE_DIM > > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLocationsOfT3Swaps (  )  [inline]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements (  )  const [inline, virtual]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes (  )  const [inline, virtual]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetT2Threshold (  )  const [inline]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::IdentifySwapType ( Node< SPACE_DIM > *  pNodeA,
Node< SPACE_DIM > *  pNodeB 
) [inline, protected, virtual]

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:
pNodeA one of the nodes to perform the swap with
pNodeB the 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 982 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(), Node< SPACE_DIM >::IsBoundaryNode(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::mElements, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes, NEVER_REACHED, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformNodeMerge(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT1Swap(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformVoidRemoval(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::RemoveDeletedNodes(), and Node< SPACE_DIM >::rGetContainingElementIndices().

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformIntersectionSwap ( Node< SPACE_DIM > *  pNode,
unsigned  elementIndex 
) [inline, protected]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformNodeMerge ( Node< SPACE_DIM > *  pNodeA,
Node< SPACE_DIM > *  pNodeB 
) [inline, protected]

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:
pNodeA one of the nodes to perform the merge with
pNodeB the other node to perform the merge with

Definition at line 1294 of file MutableVertexMesh.cpp.

References Node< SPACE_DIM >::GetIndex(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetVectorFromAtoB(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedNodeIndices, VertexMesh< ELEMENT_DIM, SPACE_DIM >::mElements, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes, Node< SPACE_DIM >::rGetContainingElementIndices(), Node< SPACE_DIM >::rGetLocation(), and Node< SPACE_DIM >::rGetModifiableLocation().

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::IdentifySwapType(), and MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformVoidRemoval().

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 
) [inline, protected]

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:
pNodeA one of the nodes to perform the swap with
pNodeB the other node to perform the swap
rElementsContainingNodes set of common elements

Todo:
remove magic number? (see #1884 and #2401)

Definition at line 1345 of file MutableVertexMesh.cpp.

References EXCEPTION, Node< SPACE_DIM >::GetIndex(), Node< SPACE_DIM >::GetNumContainingElements(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetVectorFromAtoB(), Node< SPACE_DIM >::IsBoundaryNode(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementRatio, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementThreshold, VertexMesh< ELEMENT_DIM, SPACE_DIM >::mElements, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mLocationsOfT1Swaps, Node< SPACE_DIM >::rGetContainingElementIndices(), Node< SPACE_DIM >::rGetLocation(), Node< SPACE_DIM >::rGetModifiableLocation(), and Node< SPACE_DIM >::SetAsBoundaryNode().

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT2Swap ( VertexElement< ELEMENT_DIM, SPACE_DIM > &  rElement  )  [inline, protected]

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

Perform a T2 swap on a given triangular element whose area is smaller than mT2Threshold by replacing it with a new node located at the centroid of the former element and updating node/element ownership.

Parameters:
rElement the element to remove

Definition at line 1652 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::AddNode(), MutableElement< ELEMENT_DIM, SPACE_DIM >::DeleteNode(), EXCEPTION, VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetCentroidOfElement(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), Node< SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), MutableElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocalIndex(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), Node< SPACE_DIM >::IsBoundaryNode(), MutableElement< ELEMENT_DIM, SPACE_DIM >::MarkAsDeleted(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedElementIndices, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedNodeIndices, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mLastT2SwapLocation, AbstractElement< ELEMENT_DIM, SPACE_DIM >::ReplaceNode(), and Node< SPACE_DIM >::rGetContainingElementIndices().

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT3Swap ( Node< SPACE_DIM > *  pNode,
unsigned  elementIndex 
) [inline, protected]

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:
pNode pointer to the node
elementIndex global index of the element in the mesh

Todo:
the intersection location is sometimes overwritten when WidenEdgeOrCorrectIntersectionLocationIfNecessary

Definition at line 1724 of file MutableVertexMesh.cpp.

References MutableElement< ELEMENT_DIM, SPACE_DIM >::AddNode(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::AddNode(), MutableElement< ELEMENT_DIM, SPACE_DIM >::DeleteNode(), EXCEPTION, VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), Node< SPACE_DIM >::GetIndex(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLocalIndexForElementEdgeClosestToPoint(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), MutableElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeLocation(), Node< SPACE_DIM >::GetNumContainingElements(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetPreviousEdgeGradientOfElementAtNode(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetVectorFromAtoB(), Node< SPACE_DIM >::IsBoundaryNode(), Node< SPACE_DIM >::MarkAsDeleted(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementRatio, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementThreshold, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedNodeIndices, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mLocationsOfT3Swaps, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes, NEVER_REACHED, Node< SPACE_DIM >::rGetContainingElementIndices(), Node< SPACE_DIM >::rGetLocation(), Node< SPACE_DIM >::rGetModifiableLocation(), Node< SPACE_DIM >::SetAsBoundaryNode(), and MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::WidenEdgeOrCorrectIntersectionLocationIfNecessary().

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

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 
) [inline, protected]

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:
pNodeA one of the nodes on the short edge
pNodeB the other node on the short edge
pNodeC the other node in the triangular void

Definition at line 2431 of file MutableVertexMesh.cpp.

References Node< SPACE_DIM >::GetIndex(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetVectorFromAtoB(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformNodeMerge(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::RemoveDeletedNodes(), Node< SPACE_DIM >::rGetLocation(), Node< SPACE_DIM >::rGetModifiableLocation(), and Node< SPACE_DIM >::SetAsBoundaryNode().

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

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

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 815 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh ( VertexElementMap rElementMap  )  [inline, 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:
rElementMap a 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 771 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::CheckForIntersections(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::CheckForSwapsFromShortEdges(), EXCEPTION, VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumAllElements(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::RemoveDeletedNodes(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::RemoveDeletedNodesAndElements(), and VertexElementMap::Resize().

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::RemoveDeletedNodes (  )  [inline]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::RemoveDeletedNodesAndElements ( VertexElementMap rElementMap  )  [inline]

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

Parameters:
rElementMap a 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 701 of file MutableVertexMesh.cpp.

References VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetNumAllElements(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedElementIndices, VertexMesh< ELEMENT_DIM, SPACE_DIM >::mElements, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::RemoveDeletedNodes(), VertexElementMap::Resize(), VertexElementMap::SetDeleted(), and VertexElementMap::SetNewIndex().

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

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

Serialize the mesh.

Note that if you are calling this method (from subclasses) you should archive your member variables FIRST. So that this method can call a ReMesh (to convert from TrianglesMeshReader input format into your native format).

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

Todo:
: maybe we should archive the mLocationsOfT1Swaps and mDeletedNodeIndices etc. as well?

Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.

Reimplemented in Cylindrical2dVertexMesh, and Toroidal2dVertexMesh.

Definition at line 262 of file MutableVertexMesh.hpp.

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

Set method for mCellRearrangementRatio.

Parameters:
cellRearrangementRatio 

Definition at line 164 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementRatio.

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

Set method for mCellRearrangementThreshold.

Parameters:
cellRearrangementThreshold 

Definition at line 152 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementThreshold.

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

Set method for mCheckForInternalIntersections.

Parameters:
checkForInternalIntersections 

Definition at line 170 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCheckForInternalIntersections.

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

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

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

Definition at line 263 of file MutableVertexMesh.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes.

Referenced by VertexBasedCellPopulation< DIM >::SetNode(), and MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::WidenEdgeOrCorrectIntersectionLocationIfNecessary().

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

Set method for mT2Threshold.

Parameters:
t2Threshold 

Definition at line 158 of file MutableVertexMesh.cpp.

References MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mT2Threshold.

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 
) [inline, protected]

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:
indexA index of one of the nodes on the short edge
indexB index of the other node on the short edge
intersection the 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)

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 2457 of file MutableVertexMesh.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), VertexMesh< ELEMENT_DIM, SPACE_DIM >::GetVectorFromAtoB(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementRatio, MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementThreshold, and MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetNode().

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


Friends And Related Function Documentation

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

Needed for serialization.

Reimplemented from VertexMesh< ELEMENT_DIM, SPACE_DIM >.

Reimplemented in Cylindrical2dVertexMesh, and Toroidal2dVertexMesh.

Definition at line 249 of file MutableVertexMesh.hpp.


Member Data Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementRatio [protected]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCellRearrangementThreshold [protected]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mCheckForInternalIntersections [protected]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedElementIndices [protected]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedNodeIndices [protected]
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 101 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLastT2SwapLocation(), and MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT2Swap().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< c_vector<double, SPACE_DIM> > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mLocationsOfT1Swaps [protected]

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

Definition at line 96 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ClearLocationsOfT1Swaps(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLocationsOfT1Swaps(), and MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT1Swap().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< c_vector<double, SPACE_DIM> > MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::mLocationsOfT3Swaps [protected]

Locations of T3 swaps (the location of the intersection with the edge), stored so they can be accessed and output by the cell population. The locations are stored until they are cleared by ClearLocationsOfT3Swaps().

Definition at line 107 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::ClearLocationsOfT3Swaps(), MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetLocationsOfT3Swaps(), and MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::PerformT3Swap().

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 81 of file MutableVertexMesh.hpp.

Referenced by MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::GetT2Threshold(), MutableVertexMesh< DIM, DIM >::serialize(), and MutableVertexMesh< ELEMENT_DIM, SPACE_DIM >::SetT2Threshold().


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

Generated by  doxygen 1.6.2