#include <Cylindrical2dMesh.hpp>
Public Member Functions | |
Cylindrical2dMesh (double width) | |
Cylindrical2dMesh (double width, std::vector< Node< 2 > * > nodes) | |
~Cylindrical2dMesh () | |
void | ReMesh (NodeMap &map) |
c_vector< double, 2 > | GetVectorFromAtoB (const c_vector< double, 2 > &rLocation1, const c_vector< double, 2 > &rLocation2) |
void | SetNode (unsigned index, ChastePoint< 2 > point, bool concreteMove) |
double | GetWidth (const unsigned &rDimension) const |
unsigned | AddNode (Node< 2 > *pNewNode) |
Private Member Functions | |
void | UpdateTopAndBottom () |
void | CreateHaloNodes () |
void | CreateMirrorNodes () |
void | ReconstructCylindricalMesh () |
void | DeleteHaloNodes () |
void | CorrectNonPeriodicMesh () |
void | GenerateVectorsOfElementsStraddlingPeriodicBoundaries () |
unsigned | GetCorrespondingNodeIndex (unsigned nodeIndex) |
void | UseTheseElementsToDecideMeshing (std::set< unsigned > mainSideElements) |
bool | IsThisIndexInList (const unsigned &rNodeIndex, const std::vector< unsigned > &rListOfNodes) |
template<class Archive> | |
void | serialize (Archive &archive, const unsigned int version) |
Private Attributes | |
double | mWidth |
double | mTop |
double | mBottom |
std::vector< unsigned > | mLeftOriginals |
std::vector< unsigned > | mLeftImages |
std::map< unsigned, unsigned > | mImageToLeftOriginalNodeMap |
std::vector< unsigned > | mRightOriginals |
std::vector< unsigned > | mRightImages |
std::map< unsigned, unsigned > | mImageToRightOriginalNodeMap |
std::set< unsigned > | mLeftPeriodicBoundaryElementIndices |
std::set< unsigned > | mRightPeriodicBoundaryElementIndices |
std::vector< unsigned > | mTopHaloNodes |
std::vector< unsigned > | mBottomHaloNodes |
Friends | |
class | TestCylindrical2dMesh |
class | boost::serialization::access |
The class works by overriding calls such as ReMesh() and GetVectorFromAtoB() so that simulation classes can treat this class in exactly the same way as a MutableMesh<2,2>.
Definition at line 50 of file Cylindrical2dMesh.hpp.
Cylindrical2dMesh::Cylindrical2dMesh | ( | double | width | ) |
Constructor.
width | the width of the crypt (circumference) |
Definition at line 34 of file Cylindrical2dMesh.cpp.
Cylindrical2dMesh::Cylindrical2dMesh | ( | double | width, | |
std::vector< Node< 2 > * > | nodes | |||
) |
A constructor which reads in a width and collection of nodes, then calls a ReMesh() command to create the elements of the mesh.
width | the periodic length scale. | |
nodes | a collection of nodes to construct the mesh with. |
Definition at line 42 of file Cylindrical2dMesh.cpp.
References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes, MutableMesh< 2, 2 >::ReMesh(), and Node< SPACE_DIM >::rGetLocation().
Cylindrical2dMesh::~Cylindrical2dMesh | ( | ) | [inline] |
Destructor.
Definition at line 237 of file Cylindrical2dMesh.hpp.
void Cylindrical2dMesh::UpdateTopAndBottom | ( | ) | [private] |
Calls TetrahedralMesh<2,2>::GetWidthExtremes() to calculate mTop and mBottom for the cylindrical mesh.
This method should only ever be called by the public ReMesh() method.
Definition at line 61 of file Cylindrical2dMesh.cpp.
References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetWidthExtremes(), mBottom, and mTop.
Referenced by CreateHaloNodes().
void Cylindrical2dMesh::CreateHaloNodes | ( | ) | [private] |
This method creates a compressed row of nodes, just above and below the main mesh at a constant height (a 'halo'). These will mesh to a known configuration (each one on the boundary), this avoids boundary elements of lengths over half a crypt width which prevent the process of cylindrical meshing.
The nodes which are created are later removed by DeleteHaloNodes().
Definition at line 132 of file Cylindrical2dMesh.cpp.
References MutableMesh< ELEMENT_DIM, SPACE_DIM >::AddNode(), mBottom, mBottomHaloNodes, mTop, mTopHaloNodes, mWidth, and UpdateTopAndBottom().
Referenced by ReMesh().
void Cylindrical2dMesh::CreateMirrorNodes | ( | ) | [private] |
Creates a set of mirrored nodes for a cylindrical re-mesh. Updates mRightImages and mLeftImages. All mesh points should be 0<x<mWidth.
This method should only ever be called by the public ReMesh() method.
Definition at line 69 of file Cylindrical2dMesh.cpp.
References MutableMesh< ELEMENT_DIM, SPACE_DIM >::AddNode(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorBegin(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNodeIteratorEnd(), mImageToLeftOriginalNodeMap, mImageToRightOriginalNodeMap, mLeftImages, mLeftOriginals, mLeftPeriodicBoundaryElementIndices, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes, mRightImages, mRightOriginals, mRightPeriodicBoundaryElementIndices, and mWidth.
Referenced by ReMesh().
void Cylindrical2dMesh::ReconstructCylindricalMesh | ( | ) | [private] |
After any corrections have been made to the boundary elements (see UseTheseElementsToDecideMeshing()) this method deletes the mirror image nodes, elements and boundary elements created for a cylindrical remesh by cycling through the elements and changing elements with partly real and partly imaginary elements to be real with periodic real nodes instead of mirror image nodes. We end up with very strangely shaped elements which cross the whole mesh but specify the correct connections between nodes.
This method should only ever be called by the public ReMesh() method.
Definition at line 288 of file Cylindrical2dMesh.cpp.
References AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElement(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorEnd(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumAllBoundaryElements(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::IsDeleted(), BoundaryElement< ELEMENT_DIM, SPACE_DIM >::MarkAsDeleted(), MutableMesh< 2, 2 >::mDeletedBoundaryElementIndices, MutableMesh< 2, 2 >::mDeletedElementIndices, MutableMesh< 2, 2 >::mDeletedNodeIndices, mImageToLeftOriginalNodeMap, mImageToRightOriginalNodeMap, mLeftImages, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes, mRightImages, and AbstractElement< ELEMENT_DIM, SPACE_DIM >::ReplaceNode().
Referenced by ReMesh().
void Cylindrical2dMesh::DeleteHaloNodes | ( | ) | [private] |
This method should only ever be called by the public ReMesh method.
This method removes the nodes which were added by CreateHaloNodes() before the remeshing algorithm was called.
Definition at line 422 of file Cylindrical2dMesh.cpp.
References MutableMesh< 2, 2 >::DeleteBoundaryNodeAt(), mBottomHaloNodes, and mTopHaloNodes.
Referenced by ReMesh().
void Cylindrical2dMesh::CorrectNonPeriodicMesh | ( | ) | [private] |
This method should only ever be called by the public ReMesh() method.
Uses mLeftPeriodicBoundaryElementIndices and mRightPeriodicBoundaryElementIndices and compares the nodes in each to ensure that both boundaries have been meshed identically. If they have not it calls UseTheseElementsToDecideMeshing() to sort out the troublesome elements which have been meshed differently on each side and uses the meshing of the elements on the right hand boundary to decide on how to mesh the left hand side.
Definition at line 520 of file Cylindrical2dMesh.cpp.
References GenerateVectorsOfElementsStraddlingPeriodicBoundaries(), GetCorrespondingNodeIndex(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), mLeftPeriodicBoundaryElementIndices, mRightPeriodicBoundaryElementIndices, and UseTheseElementsToDecideMeshing().
Referenced by ReMesh().
void Cylindrical2dMesh::GenerateVectorsOfElementsStraddlingPeriodicBoundaries | ( | ) | [private] |
This method should only ever be called by the public ReMesh method.
The elements which straddle the periodic boundaries need to be identified in order to compare the list on the right with the list on the left and reconstruct a cylindrical mesh.
Empties and repopulates the member variables mLeftPeriodicBoundaryElementIndices and mRightPeriodicBoundaryElementIndices
Definition at line 690 of file Cylindrical2dMesh.cpp.
References AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorEnd(), mImageToLeftOriginalNodeMap, mImageToRightOriginalNodeMap, mLeftPeriodicBoundaryElementIndices, and mRightPeriodicBoundaryElementIndices.
Referenced by CorrectNonPeriodicMesh().
unsigned Cylindrical2dMesh::GetCorrespondingNodeIndex | ( | unsigned | nodeIndex | ) | [private] |
This method should only ever be called by the public ReMesh() method.
nodeIndex | The index of an original/mirrored node |
Definition at line 731 of file Cylindrical2dMesh.cpp.
References IsThisIndexInList(), mLeftImages, mLeftOriginals, mRightImages, and mRightOriginals.
Referenced by CorrectNonPeriodicMesh(), and UseTheseElementsToDecideMeshing().
void Cylindrical2dMesh::UseTheseElementsToDecideMeshing | ( | std::set< unsigned > | mainSideElements | ) | [private] |
This method takes in two elements which are not meshed in the same way on the opposite boundary. It deletes the corresponding two elements (connecting the same four nodes) and makes two new elements which are connected in the same way. We should then be able to reconstruct the cylindrical mesh properly.
mainSideElements | two elements (usually in a square) which have been meshed differently on the opposite boundary |
Definition at line 611 of file Cylindrical2dMesh.cpp.
References GetCorrespondingNodeIndex(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorEnd(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumAllElements(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumAllNodes(), MutableMesh< 2, 2 >::mDeletedElementIndices, TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::mElementInverseJacobians, TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::mElementJacobianDeterminants, TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::mElementJacobians, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::mElements, and MutableMesh< 2, 2 >::ReIndex().
Referenced by CorrectNonPeriodicMesh().
bool Cylindrical2dMesh::IsThisIndexInList | ( | const unsigned & | rNodeIndex, | |
const std::vector< unsigned > & | rListOfNodes | |||
) | [private] |
Returns true if an unsigned is contained in a vector of unsigneds
rNodeIndex | an unsigned value | |
rListOfNodes | a list of unsigned values |
Definition at line 479 of file Cylindrical2dMesh.cpp.
Referenced by GetCorrespondingNodeIndex().
void Cylindrical2dMesh::serialize | ( | Archive & | archive, | |
const unsigned int | version | |||
) | [inline, private] |
Archives the member variables of the Cylindrical2dMesh class which have to be preserved during the lifetime of the mesh.
The remaining member variables are re-initialised before being used by each ReMesh() call so they do not need to be archived.
archive | the archive | |
version | the current version of this class the current version of this class |
Reimplemented from MutableMesh< 2, 2 >.
Definition at line 207 of file Cylindrical2dMesh.hpp.
void Cylindrical2dMesh::ReMesh | ( | NodeMap & | map | ) | [virtual] |
Conducts a cylindrical remesh (OVERRIDDEN constructor of main ReMesh function)
Firstly calls CreateMirrorNodes to create mirror image nodes Then calls remesher Maps new node indices calls ReconstructCylindricalMesh to remove surplus nodes to create a fully periodic mesh.
&map | a reference to a nodemap which should be created with the required number of nodes. |
Reimplemented from MutableMesh< 2, 2 >.
Definition at line 162 of file Cylindrical2dMesh.cpp.
References CorrectNonPeriodicMesh(), CreateHaloNodes(), CreateMirrorNodes(), DeleteHaloNodes(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), NodeMap::GetNewIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumAllElements(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumAllNodes(), NodeMap::IsDeleted(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::IsDeleted(), NodeMap::IsIdentityMap(), mBottomHaloNodes, TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::mBoundaryElementJacobianDeterminants, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::mBoundaryElements, TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::mBoundaryElementWeightedDirections, mImageToLeftOriginalNodeMap, mImageToRightOriginalNodeMap, mLeftImages, mLeftOriginals, mLeftPeriodicBoundaryElementIndices, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes, mRightImages, mRightOriginals, mRightPeriodicBoundaryElementIndices, mTopHaloNodes, ReconstructCylindricalMesh(), BoundaryElement< ELEMENT_DIM, SPACE_DIM >::RegisterWithNodes(), MutableMesh< 2, 2 >::ReIndex(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh(), NodeMap::ResetToIdentity(), NodeMap::Resize(), NodeMap::SetDeleted(), NodeMap::SetNewIndex(), and NodeMap::Size().
c_vector< double, 2 > Cylindrical2dMesh::GetVectorFromAtoB | ( | const c_vector< double, 2 > & | rLocation1, | |
const c_vector< double, 2 > & | rLocation2 | |||
) |
This OVERRIDDEN method evaluates the (surface) distance between two points in a 2D Cylindrical geometry.
rLocation1 | the x and y co-ordinates of point 1 | |
rLocation2 | the x and y co-ordinates of point 2 |
Definition at line 433 of file Cylindrical2dMesh.cpp.
References mWidth.
void Cylindrical2dMesh::SetNode | ( | unsigned | index, | |
ChastePoint< 2 > | point, | |||
bool | concreteMove | |||
) |
OVERRIDDEN function to set the location of a node.
If the location should be set outside a cylindrical boundary move it back onto the cylinder.
SetNode moves 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 |
Definition at line 460 of file Cylindrical2dMesh.cpp.
References mWidth, ChastePoint< DIM >::rGetLocation(), ChastePoint< DIM >::SetCoordinate(), and MutableMesh< ELEMENT_DIM, SPACE_DIM >::SetNode().
Referenced by AddNode().
double Cylindrical2dMesh::GetWidth | ( | const unsigned & | rDimension | ) | const [virtual] |
OVERRIDDEN FUNCTION
rDimension | must be 0 (x) or 1 (y) |
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 492 of file Cylindrical2dMesh.cpp.
References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetWidth(), and mWidth.
unsigned Cylindrical2dMesh::AddNode | ( | Node< 2 > * | pNewNode | ) |
Add a node to the mesh.
After calling this method one or more times, you must then call ReMesh.
pNewNode | the node to be added to the mesh |
Definition at line 508 of file Cylindrical2dMesh.cpp.
References MutableMesh< ELEMENT_DIM, SPACE_DIM >::AddNode(), Node< SPACE_DIM >::GetPoint(), and SetNode().
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from MutableMesh< 2, 2 >.
Definition at line 195 of file Cylindrical2dMesh.hpp.
double Cylindrical2dMesh::mWidth [private] |
The circumference of the cylinder
Definition at line 56 of file Cylindrical2dMesh.hpp.
Referenced by CreateHaloNodes(), CreateMirrorNodes(), GetVectorFromAtoB(), GetWidth(), serialize(), and SetNode().
double Cylindrical2dMesh::mTop [private] |
The top of the cylinder (y coordinate)
Definition at line 59 of file Cylindrical2dMesh.hpp.
Referenced by CreateHaloNodes(), serialize(), and UpdateTopAndBottom().
double Cylindrical2dMesh::mBottom [private] |
The bottom of the cylinder (y coordinate)
Definition at line 62 of file Cylindrical2dMesh.hpp.
Referenced by CreateHaloNodes(), serialize(), and UpdateTopAndBottom().
std::vector<unsigned> Cylindrical2dMesh::mLeftOriginals [private] |
The left nodes which have been mirrored during the remesh
Definition at line 65 of file Cylindrical2dMesh.hpp.
Referenced by CreateMirrorNodes(), GetCorrespondingNodeIndex(), and ReMesh().
std::vector<unsigned> Cylindrical2dMesh::mLeftImages [private] |
The image nodes corresponding to these left nodes (on right of mesh)
Definition at line 68 of file Cylindrical2dMesh.hpp.
Referenced by CreateMirrorNodes(), GetCorrespondingNodeIndex(), ReconstructCylindricalMesh(), and ReMesh().
std::map<unsigned, unsigned> Cylindrical2dMesh::mImageToLeftOriginalNodeMap [private] |
A map from image node index (on right of mesh) to original node index (on left of mesh)
Definition at line 71 of file Cylindrical2dMesh.hpp.
Referenced by CreateMirrorNodes(), GenerateVectorsOfElementsStraddlingPeriodicBoundaries(), ReconstructCylindricalMesh(), and ReMesh().
std::vector<unsigned> Cylindrical2dMesh::mRightOriginals [private] |
The right nodes which have been mirrored during the remesh
Definition at line 74 of file Cylindrical2dMesh.hpp.
Referenced by CreateMirrorNodes(), GetCorrespondingNodeIndex(), and ReMesh().
std::vector<unsigned> Cylindrical2dMesh::mRightImages [private] |
The image nodes corresponding to these right nodes (on left of mesh)
Definition at line 77 of file Cylindrical2dMesh.hpp.
Referenced by CreateMirrorNodes(), GetCorrespondingNodeIndex(), ReconstructCylindricalMesh(), and ReMesh().
std::map<unsigned, unsigned> Cylindrical2dMesh::mImageToRightOriginalNodeMap [private] |
A map from image node index (on left of mesh) to original node index (on right of mesh)
Definition at line 80 of file Cylindrical2dMesh.hpp.
Referenced by CreateMirrorNodes(), GenerateVectorsOfElementsStraddlingPeriodicBoundaries(), ReconstructCylindricalMesh(), and ReMesh().
std::set<unsigned> Cylindrical2dMesh::mLeftPeriodicBoundaryElementIndices [private] |
The indices of elements which straddle the left periodic boundary
Definition at line 83 of file Cylindrical2dMesh.hpp.
Referenced by CorrectNonPeriodicMesh(), CreateMirrorNodes(), GenerateVectorsOfElementsStraddlingPeriodicBoundaries(), and ReMesh().
std::set<unsigned> Cylindrical2dMesh::mRightPeriodicBoundaryElementIndices [private] |
The indices of elements which straddle the right periodic boundary
Definition at line 86 of file Cylindrical2dMesh.hpp.
Referenced by CorrectNonPeriodicMesh(), CreateMirrorNodes(), GenerateVectorsOfElementsStraddlingPeriodicBoundaries(), and ReMesh().
std::vector<unsigned > Cylindrical2dMesh::mTopHaloNodes [private] |
The indices of nodes on the top boundary
Definition at line 89 of file Cylindrical2dMesh.hpp.
Referenced by CreateHaloNodes(), DeleteHaloNodes(), and ReMesh().
std::vector<unsigned > Cylindrical2dMesh::mBottomHaloNodes [private] |
The indices of nodes on the bottom boundary
Definition at line 92 of file Cylindrical2dMesh.hpp.
Referenced by CreateHaloNodes(), DeleteHaloNodes(), and ReMesh().