Chaste Release::3.1
MutableMesh< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <MutableMesh.hpp>

Inheritance diagram for MutableMesh< ELEMENT_DIM, SPACE_DIM >:
Collaboration diagram for MutableMesh< ELEMENT_DIM, SPACE_DIM >:

List of all members.

Public Member Functions

 MutableMesh ()
 MutableMesh (std::vector< Node< SPACE_DIM > * > nodes)
virtual ~MutableMesh ()
void Clear ()
unsigned GetNumNodes () const
unsigned GetNumElements () const
unsigned GetNumBoundaryElements () const
void RescaleMeshFromBoundaryNode (ChastePoint< 1 > updatedPoint, unsigned boundaryNodeIndex)
virtual unsigned AddNode (Node< SPACE_DIM > *pNewNode)
virtual void SetNode (unsigned index, ChastePoint< SPACE_DIM > point, bool concreteMove=true)
void MoveMergeNode (unsigned index, unsigned targetIndex, bool concreteMove=true)
virtual void DeleteNode (unsigned index)
void DeleteNodePriorToReMesh (unsigned index)
unsigned RefineElement (Element< ELEMENT_DIM, SPACE_DIM > *pElement, ChastePoint< SPACE_DIM > point)
void DeleteBoundaryNodeAt (unsigned index)
void ReIndex (NodeMap &map)
virtual void ReMesh (NodeMap &map)
void ReMesh ()
bool CheckIsVoronoi (double maxPenetration=0.0)
template<>
void RescaleMeshFromBoundaryNode (ChastePoint< 1 > updatedPoint, unsigned boundaryNodeIndex)

Protected Attributes

std::vector< unsignedmDeletedElementIndices
std::vector< unsignedmDeletedBoundaryElementIndices
std::vector< unsignedmDeletedNodeIndices
bool mAddedNodes

Private Member Functions

template<class Archive >
void serialize (Archive &archive, const unsigned int version)
bool CheckIsVoronoi (Element< ELEMENT_DIM, SPACE_DIM > *pElement, double maxPenetration)

Friends

class boost::serialization::access

Detailed Description

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

A concrete mutable mesh class.

Definition at line 49 of file MutableMesh.hpp.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 53 of file MutableMesh.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mMeshChangesDuringSimulation.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
MutableMesh< ELEMENT_DIM, SPACE_DIM >::MutableMesh ( std::vector< Node< SPACE_DIM > * >  nodes)

Constructor which takes in a vector of nodes.

Parameters:
nodesa vector of nodes

Definition at line 60 of file MutableMesh.cpp.

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

Destructor.

Definition at line 75 of file MutableMesh.cpp.


Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableMesh< ELEMENT_DIM, SPACE_DIM >::AddNode ( Node< SPACE_DIM > *  pNewNode) [virtual]

Add a node to the mesh.

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

Parameters:
pNewNodepointer to the new node

Reimplemented in NodesOnlyMesh< SPACE_DIM >, and NodesOnlyMesh< DIM >.

Definition at line 81 of file MutableMesh.cpp.

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

Referenced by NodesOnlyMesh< SPACE_DIM >::AddNode().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableMesh< ELEMENT_DIM, SPACE_DIM >::CheckIsVoronoi ( Element< ELEMENT_DIM, SPACE_DIM > *  pElement,
double  maxPenetration 
) [private]

Check whether any neighbouring node is inside the circumsphere of this element.

Parameters:
pElementpointer to an element
maxPenetrationis the maximum distance a node is allowed to be inside the circumsphere of the element, as a proportion of the circumsphere radius.

Definition at line 760 of file MutableMesh.cpp.

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

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableMesh< ELEMENT_DIM, SPACE_DIM >::CheckIsVoronoi ( double  maxPenetration = 0.0)

Checks the entire mesh element by element and checks whether any neighbouring node is inside the circumsphere of this element.

Parameters:
maxPenetrationis the maximum distance a node is allowed to be inside the circumsphere of an element that it is not a member of, as a proportion of the circumsphere radius.

Todo:
use ElementIterator here?

Definition at line 844 of file MutableMesh.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::Clear ( ) [virtual]

Clear all the data in the mesh.

Reimplemented from TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.

Reimplemented in NodesOnlyMesh< SPACE_DIM >, and NodesOnlyMesh< DIM >.

Definition at line 101 of file MutableMesh.cpp.

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

Referenced by NodesOnlyMesh< SPACE_DIM >::Clear().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::DeleteBoundaryNodeAt ( unsigned  index)

Remove a boundary node, and update all the appropriate data structures.

The deleted node is not removed from the list, merely marked as deleted, and can be reused when a new node is added to the mesh.

Any elements or boundary elements containing this node will be removed. The boundary nodes information will be updated with new boundary node(s). NB: New boundary elements WILL NOT be added.

Parameters:
indexThe index of the node to remove.

Definition at line 461 of file MutableMesh.cpp.

References EXCEPTION, AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), Node< SPACE_DIM >::IsDeleted(), Element< ELEMENT_DIM, SPACE_DIM >::MarkAsDeleted(), and Node< SPACE_DIM >::SetAsBoundaryNode().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::DeleteNode ( unsigned  index) [virtual]

Delete a node from the mesh by finding an appropriate neighbour node to merge it with.

Parameters:
indexis the index of the node to be deleted

Reimplemented in NodesOnlyMesh< SPACE_DIM >, and NodesOnlyMesh< DIM >.

Definition at line 208 of file MutableMesh.cpp.

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

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

Mark a 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. (Thus saves work compared to DeleteNode() function and does not MoveMerge the node and elements).

Parameters:
indexThe index of the node to delete

Definition at line 244 of file MutableMesh.cpp.

Referenced by HoneycombMeshGenerator::GetCircularMesh(), and MeshBasedCellPopulation< ELEMENT_DIM, SPACE_DIM >::RemoveDeadCells().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableMesh< ELEMENT_DIM, SPACE_DIM >::GetNumBoundaryElements ( ) const [virtual]

Get the number of boundary elements that are actually in use.

Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.

Definition at line 112 of file MutableMesh.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements ( ) const [virtual]

Get the number of elements that are actually in use.

Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.

Definition at line 118 of file MutableMesh.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes ( ) const [virtual]
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::MoveMergeNode ( unsigned  index,
unsigned  targetIndex,
bool  concreteMove = true 
)

Move one node to another (i.e. merges the nodes), refreshing/deleting elements as appropriate.

Parameters:
indexis the index of the node to be moved
targetIndexis the index of the node to move to
concreteMovecan be set to false if you just want to check whether this will work (defaults to true). Set it to true if you're doing the merger for real, in order to do all the bookkeeping.

Definition at line 251 of file MutableMesh.cpp.

References EXCEPTION.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned MutableMesh< ELEMENT_DIM, SPACE_DIM >::RefineElement ( Element< ELEMENT_DIM, SPACE_DIM > *  pElement,
ChastePoint< SPACE_DIM >  point 
)

Refine an element at a given point.

Parameters:
pElementpointer to the element
pointa point located in the element

Definition at line 405 of file MutableMesh.cpp.

References EXCEPTION, Element< ELEMENT_DIM, SPACE_DIM >::IncludesPoint(), ChastePoint< DIM >::rGetLocation(), and Element< ELEMENT_DIM, SPACE_DIM >::UpdateNode().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReIndex ( NodeMap map)

Re-index a mesh so that it has no deleted elements or nodes.

Parameters:
mapis a NodeMap which associates the indices of nodes in the old mesh with indices of nodes in the new mesh. This should be created with the correct size (NumAllNodes)

Definition at line 510 of file MutableMesh.cpp.

References NodeMap::Resize(), NodeMap::SetDeleted(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::SetIndex(), and NodeMap::SetNewIndex().

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

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

Definition at line 753 of file MutableMesh.cpp.

Referenced by MutableMesh< SPACE_DIM, SPACE_DIM >::serialize().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh ( NodeMap map) [virtual]

Re-mesh a mesh using triangle (via library calls) or tetgen

Parameters:
mapis a NodeMap which associates the indices of nodes in the old mesh with indices of nodes in the new mesh. This should be created with the correct size (NumAllNodes)

Reimplemented in Cylindrical2dMesh, NodesOnlyMesh< SPACE_DIM >, and NodesOnlyMesh< DIM >.

Definition at line 620 of file MutableMesh.cpp.

References EXCEPTION, Node< SPACE_DIM >::GetIndex(), NodeMap::Resize(), NodeMap::SetDeleted(), and NodeMap::SetNewIndex().

Referenced by CylindricalHoneycombMeshGenerator::CylindricalHoneycombMeshGenerator(), HoneycombMeshGenerator::GetCircularMesh(), and MeshBasedCellPopulation< ELEMENT_DIM, SPACE_DIM >::Update().

template<>
void MutableMesh< 1, 1 >::RescaleMeshFromBoundaryNode ( ChastePoint< 1 >  updatedPoint,
unsigned  boundaryNodeIndex 
)

The RescaleMeshFromBoundaryNode method is only defined for 1D meshes.

Parameters:
updatedPointpoint determining the scale factor
boundaryNodeIndexindex of the boundary node

Definition at line 136 of file MutableMesh.cpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::RescaleMeshFromBoundaryNode ( ChastePoint< 1 >  updatedPoint,
unsigned  boundaryNodeIndex 
)
Todo:
should unsigned GetNumBoundaryNodes() be overloaded too??

Rescale the mesh from a boundary node.

Parameters:
updatedPointpoint determining the scale factor
boundaryNodeIndexindex of the boundary node
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
template<class Archive >
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::serialize ( Archive &  archive,
const unsigned int  version 
) [inline, private]

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:
archivethe archive
versionthe current version of this class

Reimplemented from TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.

Reimplemented in Cylindrical2dMesh, NodesOnlyMesh< SPACE_DIM >, and NodesOnlyMesh< DIM >.

Definition at line 65 of file MutableMesh.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::SetNode ( unsigned  index,
ChastePoint< SPACE_DIM >  point,
bool  concreteMove = true 
) [virtual]

Move the node with a particular index to a new point in space and verifies that the signed areas of the supporting Elements are positive.

Parameters:
indexis the index of the node to be moved
pointis the new target location of the node
concreteMoveis set to false if we want to skip the signed area tests (defaults to true)

Definition at line 151 of file MutableMesh.cpp.

References EXCEPTION.

Referenced by MeshBasedCellPopulation< ELEMENT_DIM, SPACE_DIM >::SetNode(), MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateGhostPositions(), and NodeBasedCellPopulationWithParticles< DIM >::UpdateParticlePositions().


Friends And Related Function Documentation

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

Needed for serialization.

Reimplemented from TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.

Reimplemented in Cylindrical2dMesh, NodesOnlyMesh< SPACE_DIM >, and NodesOnlyMesh< DIM >.

Definition at line 52 of file MutableMesh.hpp.


Member Data Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool MutableMesh< ELEMENT_DIM, SPACE_DIM >::mAddedNodes [protected]

Whether any nodes have been added to the mesh.

Definition at line 98 of file MutableMesh.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> MutableMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedBoundaryElementIndices [protected]

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

Definition at line 89 of file MutableMesh.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> MutableMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedElementIndices [protected]

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

Definition at line 83 of file MutableMesh.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> MutableMesh< ELEMENT_DIM, SPACE_DIM >::mDeletedNodeIndices [protected]

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

Definition at line 95 of file MutableMesh.hpp.


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