#include <QuadraticMesh.hpp>
Public Member Functions | |
QuadraticMesh (const std::string &rFileName, bool boundaryElemFileIsQuadratic) | |
QuadraticMesh (double xEnd, double yEnd, unsigned numElemX, unsigned numElemY) | |
QuadraticMesh (double xEnd, double yEnd, double zEnd, unsigned numElemX, unsigned numElemY, unsigned numElemZ) | |
void | WriteBoundaryElementFile (std::string directory, std::string fileName) |
unsigned | GetNumVertices () |
Private Member Functions | |
void | LoadFromFile (const std::string &rFileName, bool boundaryElemFileIsQuadratic) |
void | AddNodesToBoundaryElements () |
void | AddNodeToBoundaryElement (BoundaryElement< DIM-1, DIM > *pBoundaryElement, Element< DIM, DIM > *pElement, unsigned internalNode) |
void | AddExtraBoundaryNodes (BoundaryElement< DIM-1, DIM > *pBoundaryElement, Element< DIM, DIM > *pElement, unsigned nodeIndexOppositeToFace) |
void | HelperMethod1 (unsigned boundaryElemNode0, unsigned boundaryElemNode1, Element< DIM, DIM > *pElement, unsigned node0, unsigned node1, unsigned node2, unsigned &rOffset, bool &rReverse) |
void | HelperMethod2 (BoundaryElement< DIM-1, DIM > *pBoundaryElement, Element< DIM, DIM > *pElement, unsigned internalNode0, unsigned internalNode1, unsigned internalNode2, unsigned offset, bool reverse) |
void | RunMesherAndReadMesh (std::string binary, std::string outputDir, std::string fileStem) |
Private Attributes | |
std::vector< bool > | mIsInternalNode |
unsigned | mNumVertices |
Definition at line 40 of file QuadraticMesh.hpp.
QuadraticMesh< DIM >::QuadraticMesh | ( | const std::string & | rFileName, | |
bool | boundaryElemFileIsQuadratic | |||
) | [inline] |
Constructs a new Quadratic Mesh
rFileName | The name of the quadratic mesh file to load | |
boundaryElemFileIsQuadratic | Whether the boundary element file has a quadratic number of nodes (eg 3 in 2d) or linear number. Note tetgen with '-o2' creates files with quadratic elements but linear boundary elements. The AddExtraBoundaryNodes method will compute the extra info in boundaryElemFileIsQuadratic==false (slow). |
Definition at line 41 of file QuadraticMesh.cpp.
References AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElementIteratorBegin(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElementIteratorEnd(), and QuadraticMesh< DIM >::LoadFromFile().
QuadraticMesh< DIM >::QuadraticMesh | ( | double | xEnd, | |
double | yEnd, | |||
unsigned | numElemX, | |||
unsigned | numElemY | |||
) | [inline] |
xEnd | the width of the rectangle | |
yEnd | the breadth of the rectangle | |
numElemX | the number of elements in the x direction | |
numElemY | the number of elements in the y direction |
Definition at line 60 of file QuadraticMesh.cpp.
References QuadraticMesh< DIM >::AddNodesToBoundaryElements(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::mBoundaryElements, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mBoundaryNodes, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::mElements, QuadraticMesh< DIM >::mIsInternalNode, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes, QuadraticMesh< DIM >::mNumVertices, and TetrahedralMesh< DIM, DIM >::RefreshJacobianCachedData().
QuadraticMesh< DIM >::QuadraticMesh | ( | double | xEnd, | |
double | yEnd, | |||
double | zEnd, | |||
unsigned | numElemX, | |||
unsigned | numElemY, | |||
unsigned | numElemZ | |||
) | [inline] |
Create a quadratic mesh on a cuboid (so 3D only!) from (0,0,0) to (xEnd,yEnd,zEnd) with the given number of elements in each direction. This writes a temporary node file and uses triangle to mesh this nodefile.
xEnd | the width of the cuboid | |
yEnd | the breadth of the cuboid | |
zEnd | the height of the cuboid | |
numElemX | the number of elements in the x direction | |
numElemY | the number of elements in the y direction | |
numElemZ | the number of elements in the z direction |
Definition at line 201 of file QuadraticMesh.cpp.
References OutputFileHandler::GetOutputDirectoryFullPath(), OutputFileHandler::OpenOutputFile(), and QuadraticMesh< DIM >::RunMesherAndReadMesh().
void QuadraticMesh< DIM >::LoadFromFile | ( | const std::string & | rFileName, | |
bool | boundaryElemFileIsQuadratic | |||
) | [inline, private] |
Load a quadratic mesh from a file.
rFileName | the name of the file to load the mesh from. | |
boundaryElemFileIsQuadratic | Whether the boundary element file has a quadratic number of nodes (eg 3 in 2d) or linear number. Note tetgen with '-o2' creates files with quadratic elements but linear boundary elements. QuadraticMesh will compute the extra info in boundaryElemFileIsQuadratic==false (slow). |
Definition at line 301 of file QuadraticMesh.cpp.
References QuadraticMesh< DIM >::AddNodesToBoundaryElements(), TetrahedralMesh< DIM, DIM >::ConstructFromMeshReader(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElementIteratorBegin(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElementIteratorEnd(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextElementData(), TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextFaceData(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), QuadraticMesh< DIM >::mIsInternalNode, QuadraticMesh< DIM >::mNumVertices, ElementData::NodeIndices, and TrianglesMeshReader< ELEMENT_DIM, SPACE_DIM >::Reset().
Referenced by QuadraticMesh< DIM >::QuadraticMesh(), and QuadraticMesh< DIM >::RunMesherAndReadMesh().
void QuadraticMesh< DIM >::AddNodesToBoundaryElements | ( | ) | [inline, private] |
Top level method for making 2D edges have 3 nodes not 2 and making 3D faces have 6 nodes not 3.
Definition at line 389 of file QuadraticMesh.cpp.
References QuadraticMesh< DIM >::AddExtraBoundaryNodes(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElementIteratorBegin(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElementIteratorEnd(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), and AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumElements().
Referenced by QuadraticMesh< DIM >::LoadFromFile(), and QuadraticMesh< DIM >::QuadraticMesh().
void QuadraticMesh< DIM >::AddNodeToBoundaryElement | ( | BoundaryElement< DIM-1, DIM > * | pBoundaryElement, | |
Element< DIM, DIM > * | pElement, | |||
unsigned | internalNode | |||
) | [inline, private] |
This method adds the given node (defined by an element and a node index) to the given boundary element, and also sets the node as a boundary element and adds it to the std::vector of boundary elements.
pBoundaryElement | pointer to a boundary element in the mesh | |
pElement | pointer to an element in the mesh | |
internalNode | index of a node in the mesh |
Definition at line 471 of file QuadraticMesh.cpp.
References AbstractElement< ELEMENT_DIM, SPACE_DIM >::AddNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), Node< SPACE_DIM >::IsBoundaryNode(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mBoundaryNodes, and Node< SPACE_DIM >::SetAsBoundaryNode().
Referenced by QuadraticMesh< DIM >::AddExtraBoundaryNodes(), and QuadraticMesh< DIM >::HelperMethod2().
void QuadraticMesh< DIM >::AddExtraBoundaryNodes | ( | BoundaryElement< DIM-1, DIM > * | pBoundaryElement, | |
Element< DIM, DIM > * | pElement, | |||
unsigned | nodeIndexOppositeToFace | |||
) | [inline, private] |
Given a face in an element (defined by giving an element and the opposite node number to the face) that corresponds to a given boundary element, this method adds in the face's internal nodes to the boundary element (in the correct order).
pBoundaryElement | pointer to a boundary element in the mesh | |
pElement | pointer to an element in the mesh | |
nodeIndexOppositeToFace | index of a node in the mesh |
Definition at line 492 of file QuadraticMesh.cpp.
References QuadraticMesh< DIM >::AddNodeToBoundaryElement(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), QuadraticMesh< DIM >::HelperMethod1(), and QuadraticMesh< DIM >::HelperMethod2().
Referenced by QuadraticMesh< DIM >::AddNodesToBoundaryElements().
void QuadraticMesh< DIM >::HelperMethod1 | ( | unsigned | boundaryElemNode0, | |
unsigned | boundaryElemNode1, | |||
Element< DIM, DIM > * | pElement, | |||
unsigned | node0, | |||
unsigned | node1, | |||
unsigned | node2, | |||
unsigned & | rOffset, | |||
bool & | rReverse | |||
) | [inline, private] |
Nasty helper method for AddNodeToBoundaryElement() in 3D.
This method takes in the three vertices of a face which match the given boundary element, and figure out if the order of the nodes in the face is reversed in the boundary element (returned in the bool 'rReverse'). Also, the offset between the first node in the face (as given to this method) and the first node in the boundary element is computed (returned in the variable 'rOffset'). Offset should then be applied before reverse to match the face nodes to the boundary element nodes.
boundaryElemNode0 | ||
boundaryElemNode1 | ||
pElement | ||
node0 | ||
node1 | ||
node2 | ||
rOffset | ||
rReverse |
Definition at line 594 of file QuadraticMesh.cpp.
References AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex().
Referenced by QuadraticMesh< DIM >::AddExtraBoundaryNodes().
void QuadraticMesh< DIM >::HelperMethod2 | ( | BoundaryElement< DIM-1, DIM > * | pBoundaryElement, | |
Element< DIM, DIM > * | pElement, | |||
unsigned | internalNode0, | |||
unsigned | internalNode1, | |||
unsigned | internalNode2, | |||
unsigned | offset, | |||
bool | reverse | |||
) | [inline, private] |
Nasty helper method for AddNodeToBoundaryElement() in 3D.
This method takes the three internal nodes for some face in some element, applies the given offset and reverse (see HelperMethod1) to them, to get the ordered internal nodes which should given to the boundary element. It then calls AddNodeToBoundaryElement with each of the three internal nodes.
pBoundaryElement | ||
pElement | ||
internalNode0 | ||
internalNode1 | ||
internalNode2 | ||
offset | ||
reverse |
Definition at line 646 of file QuadraticMesh.cpp.
References QuadraticMesh< DIM >::AddNodeToBoundaryElement().
Referenced by QuadraticMesh< DIM >::AddExtraBoundaryNodes().
void QuadraticMesh< DIM >::RunMesherAndReadMesh | ( | std::string | binary, | |
std::string | outputDir, | |||
std::string | fileStem | |||
) | [inline, private] |
Helper method which runs triangle or tetgen and reads in the created mesh files.
binary | ||
outputDir | ||
fileStem |
Definition at line 257 of file QuadraticMesh.cpp.
References QuadraticMesh< DIM >::LoadFromFile().
Referenced by QuadraticMesh< DIM >::QuadraticMesh().
void QuadraticMesh< DIM >::WriteBoundaryElementFile | ( | std::string | directory, | |
std::string | fileName | |||
) | [inline] |
Write the boundary elements to file (in case the boundary elements were linear when read and the quadratic versions have been computed.
directory | Directory relative to CHASTE_TEST_OUTPUT. Not cleaned | |
fileName | Boundary element file name. |
Definition at line 542 of file QuadraticMesh.cpp.
References AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElementIteratorBegin(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetBoundaryElementIteratorEnd(), and OutputFileHandler::OpenOutputFile().
unsigned QuadraticMesh< DIM >::GetNumVertices | ( | ) | [inline] |
Get the number of vertices, ie non-internal (non-quadratic), nodes.
Definition at line 250 of file QuadraticMesh.cpp.
References QuadraticMesh< DIM >::mNumVertices.
std::vector<bool> QuadraticMesh< DIM >::mIsInternalNode [private] |
Vector of bools, one for one node, saying whether the node is internal (if not, it is a vertex).
Definition at line 48 of file QuadraticMesh.hpp.
Referenced by QuadraticMesh< DIM >::LoadFromFile(), and QuadraticMesh< DIM >::QuadraticMesh().
unsigned QuadraticMesh< DIM >::mNumVertices [private] |
Number of vertices, ie non-internal (non-quadratic), nodes.
Definition at line 51 of file QuadraticMesh.hpp.
Referenced by QuadraticMesh< DIM >::GetNumVertices(), QuadraticMesh< DIM >::LoadFromFile(), and QuadraticMesh< DIM >::QuadraticMesh().