Chaste
Release::3.4
|
#include <MutableMesh.hpp>
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) |
unsigned | AddElement (Element< ELEMENT_DIM, SPACE_DIM > *pNewElement) |
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) |
virtual void | DeleteElement (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 () |
std::vector< c_vector < unsigned, 5 > > | SplitLongEdges (double cutoffLength) |
c_vector< unsigned, 3 > | SplitEdge (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB) |
bool | CheckIsVoronoi (double maxPenetration=0.0) |
template<> | |
void | RescaleMeshFromBoundaryNode (ChastePoint< 1 > updatedPoint, unsigned boundaryNodeIndex) |
Public Member Functions inherited from TetrahedralMesh< ELEMENT_DIM, SPACE_DIM > | |
TetrahedralMesh () | |
void | ConstructFromMeshReader (AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader) |
void | ReadNodesPerProcessorFile (const std::string &rNodesPerProcessorFile) |
bool | CheckIsConforming () |
double | GetVolume () |
double | GetSurfaceArea () |
void | RefreshMesh () |
void | PermuteNodes () |
void | PermuteNodes (const std::vector< unsigned > &perm) |
unsigned | GetContainingElementIndexWithInitialGuess (const ChastePoint< SPACE_DIM > &rTestPoint, unsigned startingElementGuess, bool strict=false) |
unsigned | GetNearestElementIndex (const ChastePoint< SPACE_DIM > &rTestPoint) |
std::vector< unsigned > | GetContainingElementIndices (const ChastePoint< SPACE_DIM > &rTestPoint) |
double | GetAngleBetweenNodes (unsigned indexA, unsigned indexB) |
virtual void | RefreshJacobianCachedData () |
virtual void | GetJacobianForElement (unsigned elementIndex, c_matrix< double, SPACE_DIM, SPACE_DIM > &rJacobian, double &rJacobianDeterminant) const |
virtual void | GetInverseJacobianForElement (unsigned elementIndex, c_matrix< double, SPACE_DIM, ELEMENT_DIM > &rJacobian, double &rJacobianDeterminant, c_matrix< double, ELEMENT_DIM, SPACE_DIM > &rInverseJacobian) const |
virtual void | GetWeightedDirectionForElement (unsigned elementIndex, c_vector< double, SPACE_DIM > &rWeightedDirection, double &rJacobianDeterminant) const |
virtual void | GetWeightedDirectionForBoundaryElement (unsigned elementIndex, c_vector< double, SPACE_DIM > &rWeightedDirection, double &rJacobianDeterminant) const |
EdgeIterator | EdgesBegin () |
EdgeIterator | EdgesEnd () |
Public Member Functions inherited from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > | |
ElementIterator | GetElementIteratorBegin (bool skipDeletedElements=true) |
ElementIterator | GetElementIteratorEnd () |
AbstractTetrahedralMesh () | |
virtual | ~AbstractTetrahedralMesh () |
virtual unsigned | GetNumLocalElements () const |
virtual unsigned | GetNumLocalBoundaryElements () const |
unsigned | GetNumAllElements () const |
unsigned | GetNumAllBoundaryElements () const |
virtual unsigned | GetNumCableElements () const |
virtual unsigned | GetNumVertices () const |
virtual unsigned | GetMaximumNodeIndex () |
Element< ELEMENT_DIM, SPACE_DIM > * | GetElement (unsigned index) const |
BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > * | GetBoundaryElement (unsigned index) const |
void | ConstructFromMesh (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rOtherMesh) |
BoundaryElementIterator | GetBoundaryElementIteratorBegin () const |
BoundaryElementIterator | GetBoundaryElementIteratorEnd () const |
void | CheckOutwardNormals () |
virtual void | ConstructLinearMesh (unsigned width) |
virtual void | ConstructRectangularMesh (unsigned width, unsigned height, bool stagger=true) |
virtual void | ConstructCuboid (unsigned width, unsigned height, unsigned depth) |
void | ConstructRegularSlabMesh (double spaceStep, double width, double height=0, double depth=0) |
void | ConstructRegularSlabMeshWithDimensionSplit (unsigned dimension, double spaceStep, double width, double height=0, double depth=0) |
virtual bool | CalculateDesignatedOwnershipOfBoundaryElement (unsigned faceIndex) |
virtual bool | CalculateDesignatedOwnershipOfElement (unsigned elementIndex) |
unsigned | CalculateMaximumNodeConnectivityPerProcess () const |
virtual void | GetHaloNodeIndices (std::vector< unsigned > &rHaloIndices) const |
void | CalculateNodeExchange (std::vector< std::vector< unsigned > > &rNodesToSendPerProcess, std::vector< std::vector< unsigned > > &rNodesToReceivePerProcess) |
virtual c_vector< double, 2 > | CalculateMinMaxEdgeLengths () |
unsigned | GetContainingElementIndex (const ChastePoint< SPACE_DIM > &rTestPoint, bool strict=false, std::set< unsigned > testElements=std::set< unsigned >(), bool onlyTryWithTestElements=false) |
unsigned | GetNearestElementIndexFromTestElements (const ChastePoint< SPACE_DIM > &rTestPoint, std::set< unsigned > testElements) |
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 DistributedVectorFactory * | GetDistributedVectorFactory () |
virtual void | SetDistributedVectorFactory (DistributedVectorFactory *pFactory) |
BoundaryNodeIterator | GetBoundaryNodeIteratorBegin () const |
BoundaryNodeIterator | GetBoundaryNodeIteratorEnd () const |
std::string | GetMeshFileBaseName () const |
bool | IsMeshOnDisk () const |
const std::vector< unsigned > & | rGetNodePermutation () const |
virtual c_vector< double, SPACE_DIM > | GetVectorFromAtoB (const c_vector< double, SPACE_DIM > &rLocationA, const c_vector< double, SPACE_DIM > &rLocationB) |
double | GetDistanceBetweenNodes (unsigned indexA, unsigned indexB) |
virtual double | GetWidth (const unsigned &rDimension) const |
virtual 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) |
bool | IsMeshChanging () const |
unsigned | CalculateMaximumContainingElementsPerProcess () const |
void | SetMeshHasChangedSinceLoading () |
Private Member Functions | |
template<class Archive > | |
void | save (Archive &archive, const unsigned int version) const |
template<class Archive > | |
void | load (Archive &archive, const unsigned int version) |
bool | CheckIsVoronoi (Element< ELEMENT_DIM, SPACE_DIM > *pElement, double maxPenetration) |
Friends | |
class | boost::serialization::access |
Additional Inherited Members | |
Public Types inherited from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > | |
typedef std::vector < BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > * >::const_iterator | BoundaryElementIterator |
Public Types inherited from AbstractMesh< ELEMENT_DIM, SPACE_DIM > | |
typedef std::vector< Node < SPACE_DIM > * >::const_iterator | BoundaryNodeIterator |
Protected Member Functions inherited from TetrahedralMesh< ELEMENT_DIM, SPACE_DIM > | |
unsigned | SolveNodeMapping (unsigned index) const |
unsigned | SolveElementMapping (unsigned index) const |
unsigned | SolveBoundaryElementMapping (unsigned index) const |
template<class MESHER_IO > | |
void | ExportToMesher (NodeMap &map, MESHER_IO &mesherInput, int *elementList=NULL) |
template<class MESHER_IO > | |
void | ImportFromMesher (MESHER_IO &mesherOutput, unsigned numberOfElements, int *elementList, unsigned numberOfFaces, int *faceList, int *edgeMarkerList) |
void | InitialiseTriangulateIo (triangulateio &mesherIo) |
void | FreeTriangulateIo (triangulateio &mesherIo) |
Protected Member Functions inherited from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > | |
void | SetElementOwnerships () |
Protected Member Functions inherited from AbstractMesh< ELEMENT_DIM, SPACE_DIM > | |
ChasteCuboid< SPACE_DIM > | CalculateBoundingBox (const std::vector< Node< SPACE_DIM > * > &rNodes) const |
A concrete mutable mesh class.
Definition at line 50 of file MutableMesh.hpp.
MutableMesh< ELEMENT_DIM, SPACE_DIM >::MutableMesh | ( | ) |
Constructor.
Definition at line 52 of file MutableMesh.cpp.
References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mMeshChangesDuringSimulation.
MutableMesh< ELEMENT_DIM, SPACE_DIM >::MutableMesh | ( | std::vector< Node< SPACE_DIM > * > | nodes | ) |
Constructor which takes in a vector of nodes.
nodes | a vector of nodes |
Definition at line 59 of file MutableMesh.cpp.
|
virtual |
Destructor.
Definition at line 74 of file MutableMesh.cpp.
unsigned MutableMesh< ELEMENT_DIM, SPACE_DIM >::AddElement | ( | Element< ELEMENT_DIM, SPACE_DIM > * | pNewElement | ) |
Helper method to add an element to the mesh.
pNewElement | pointer to the new element object. The object will be updated with the index assigned to the element. |
Definition at line 100 of file MutableMesh.cpp.
References AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), and Element< ELEMENT_DIM, SPACE_DIM >::ResetIndex().
|
virtual |
Add a node to the mesh.
NB. After calling this one or more times, you must then call ReMesh
pNewNode | pointer to the new node |
Reimplemented in NodesOnlyMesh< SPACE_DIM >, NodesOnlyMesh< DIM >, and NodesOnlyMesh< 2 >.
Definition at line 80 of file MutableMesh.cpp.
References Node< SPACE_DIM >::GetIndex(), and Node< SPACE_DIM >::SetIndex().
Referenced by Cylindrical2dMesh::AddNode(), Cylindrical2dMesh::CreateHaloNodes(), and Cylindrical2dMesh::CreateMirrorNodes().
|
private |
pElement | pointer to an element |
maxPenetration | is 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 995 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().
bool MutableMesh< ELEMENT_DIM, SPACE_DIM >::CheckIsVoronoi | ( | double | maxPenetration = 0.0 | ) |
maxPenetration | is 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. |
Definition at line 1079 of file MutableMesh.cpp.
|
virtual |
Clear all the data in the mesh.
Reimplemented from TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Reimplemented in NodesOnlyMesh< DIM >, and NodesOnlyMesh< 2 >.
Definition at line 124 of file MutableMesh.cpp.
References TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::Clear().
Referenced by NodesOnlyMesh< SPACE_DIM >::Clear().
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.
index | The index of the node to remove. |
Definition at line 516 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().
|
virtual |
Delete an element from the mesh. Any remaining nodes not connected to an element are also removed.
index | The index of the element to be deleted |
Definition at line 267 of file MutableMesh.cpp.
|
virtual |
Delete a node from the mesh by finding an appropriate neighbour node to merge it with.
index | is the index of the node to be deleted |
Reimplemented in NodesOnlyMesh< SPACE_DIM >, NodesOnlyMesh< DIM >, and NodesOnlyMesh< 2 >.
Definition at line 231 of file MutableMesh.cpp.
References EXCEPTION, and AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex().
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).
index | The index of the node to delete |
Definition at line 299 of file MutableMesh.cpp.
Referenced by HoneycombMeshGenerator::GetCircularMesh(), and MeshBasedCellPopulation< ELEMENT_DIM, SPACE_DIM >::RemoveDeadCells().
|
virtual |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 135 of file MutableMesh.cpp.
|
virtual |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 141 of file MutableMesh.cpp.
|
virtual |
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Reimplemented in NodesOnlyMesh< DIM >, and NodesOnlyMesh< 2 >.
Definition at line 147 of file MutableMesh.cpp.
Referenced by HoneycombMeshGenerator::GetCellLocationIndices(), HoneycombMeshGenerator::GetCircularMesh(), and MutableMesh< SPACE_DIM, SPACE_DIM >::load().
|
inlineprivate |
Load the mesh, along with attributes if saved nodes have attributes. Loading of attributes is covered in TestNodesOnlyMesh.
archive | the archive to save to. |
version | the version number. |
Definition at line 93 of file MutableMesh.hpp.
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.
index | is the index of the node to be moved |
targetIndex | is the index of the node to move to |
concreteMove | can 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 306 of file MutableMesh.cpp.
References EXCEPTION.
unsigned MutableMesh< ELEMENT_DIM, SPACE_DIM >::RefineElement | ( | Element< ELEMENT_DIM, SPACE_DIM > * | pElement, |
ChastePoint< SPACE_DIM > | point | ||
) |
Refine an element at a given point.
pElement | pointer to the element |
point | a point located in the element |
Definition at line 460 of file MutableMesh.cpp.
References EXCEPTION, Element< ELEMENT_DIM, SPACE_DIM >::IncludesPoint(), ChastePoint< DIM >::rGetLocation(), and Element< ELEMENT_DIM, SPACE_DIM >::UpdateNode().
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReIndex | ( | NodeMap & | map | ) |
Re-index a mesh so that it has no deleted elements or nodes.
map | is 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 565 of file MutableMesh.cpp.
References NodeMap::Resize(), NodeMap::SetDeleted(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::SetIndex(), and NodeMap::SetNewIndex().
|
virtual |
Re-mesh a mesh using triangle (via library calls) or tetgen
map | is 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 NodesOnlyMesh< SPACE_DIM >, NodesOnlyMesh< DIM >, NodesOnlyMesh< 2 >, and Cylindrical2dMesh.
Definition at line 677 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().
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh | ( | ) |
Alternative version of remesh which takes no parameters, i.e. does not require a NodeMap. It will create one and call the other ReMesh method. Note: inherited classes should overload ReMesh(NodeMap&)
Definition at line 810 of file MutableMesh.cpp.
Referenced by MutableMesh< SPACE_DIM, SPACE_DIM >::load(), and Cylindrical2dMesh::ReMesh().
void MutableMesh< 1, 1 >::RescaleMeshFromBoundaryNode | ( | ChastePoint< 1 > | updatedPoint, |
unsigned | boundaryNodeIndex | ||
) |
The RescaleMeshFromBoundaryNode method is only defined for 1D meshes.
updatedPoint | point determining the scale factor |
boundaryNodeIndex | index of the boundary node |
Definition at line 159 of file MutableMesh.cpp.
void MutableMesh< ELEMENT_DIM, SPACE_DIM >::RescaleMeshFromBoundaryNode | ( | ChastePoint< 1 > | updatedPoint, |
unsigned | boundaryNodeIndex | ||
) |
Rescale the mesh from a boundary node.
updatedPoint | point determining the scale factor |
boundaryNodeIndex | index of the boundary node |
|
inlineprivate |
Save the mesh, along with attributes if nodes have attributes. Saving of attributes is covered in TestNodesOnlyMesh.
archive | the archive to save to. |
version | the version number. |
Definition at line 62 of file MutableMesh.hpp.
|
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.
index | is the index of the node to be moved |
point | is the new target location of the node |
concreteMove | is set to false if we want to skip the signed area tests (defaults to true) |
Reimplemented in NodesOnlyMesh< SPACE_DIM >, NodesOnlyMesh< DIM >, and NodesOnlyMesh< 2 >.
Definition at line 174 of file MutableMesh.cpp.
References EXCEPTION.
Referenced by MeshBasedCellPopulation< ELEMENT_DIM, SPACE_DIM >::SetNode(), Cylindrical2dMesh::SetNode(), and MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateGhostPositions().
c_vector< unsigned, 3 > MutableMesh< ELEMENT_DIM, SPACE_DIM >::SplitEdge | ( | Node< SPACE_DIM > * | pNodeA, |
Node< SPACE_DIM > * | pNodeB | ||
) |
Splits an edge in two and create all the relevant new elements and nodes
pNodeA | first point defining the edge |
pNodeB | second point defining the edge |
Definition at line 914 of file MutableMesh.cpp.
References Node< SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), NEVER_REACHED, AbstractElement< ELEMENT_DIM, SPACE_DIM >::ReplaceNode(), Node< SPACE_DIM >::rGetContainingElementIndices(), Node< SPACE_DIM >::rGetLocation(), and UNSIGNED_UNSET.
std::vector< c_vector< unsigned, 5 > > MutableMesh< ELEMENT_DIM, SPACE_DIM >::SplitLongEdges | ( | double | cutoffLength | ) |
Find edges in the mesh longer than the given cutoff length and split them creating new elements as required.
cutoffLength | cutoff length for edge splitting |
Definition at line 817 of file MutableMesh.cpp.
References Node< SPACE_DIM >::GetIndex().
|
friend |
Needed for serialization.
Definition at line 53 of file MutableMesh.hpp.
|
protected |
Whether any nodes have been added to the mesh.
Definition at line 151 of file MutableMesh.hpp.
|
protected |
Indices of boundary elements that have been marked as deleted. These indices can be reused when adding new boundary elements.
Definition at line 142 of file MutableMesh.hpp.
|
protected |
Indices of elements that have been marked as deleted. These indices can be reused when adding new elements.
Definition at line 136 of file MutableMesh.hpp.
|
protected |
Indices of nodes that have been marked as deleted. These indices can be reused when adding new nodes.
Definition at line 148 of file MutableMesh.hpp.