OGS
PyramidRule5.cpp
Go to the documentation of this file.
1
11#include "PyramidRule5.h"
12
13#include "BaseLib/Logging.h"
14#include "MeshLib/Node.h"
15#include "Quad.h"
16#include "Tri.h"
17
18namespace MeshLib
19{
20const unsigned PyramidRule5::face_nodes[5][4] = {
21 {0, 1, 4, 99}, // Face 0
22 {1, 2, 4, 99}, // Face 1
23 {2, 3, 4, 99}, // Face 2
24 {3, 0, 4, 99}, // Face 3
25 {0, 3, 2, 1} // Face 4
26};
27
28const unsigned PyramidRule5::edge_nodes[8][2] = {
29 {0, 1}, // Edge 0
30 {1, 2}, // Edge 1
31 {2, 3}, // Edge 2
32 {0, 3}, // Edge 3
33 {0, 4}, // Edge 4
34 {1, 4}, // Edge 5
35 {2, 4}, // Edge 6
36 {3, 4} // Edge 7
37};
38
39const unsigned PyramidRule5::n_face_nodes[5] = {3, 3, 3, 3, 4};
40
41const Element* PyramidRule5::getFace(const Element* e, unsigned i)
42{
43 if (i < n_faces)
44 {
45 unsigned nFaceNodes(PyramidRule5::n_face_nodes[i]);
46 auto** nodes = new Node*[nFaceNodes];
47 for (unsigned j = 0; j < nFaceNodes; j++)
48 {
49 nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
50 }
51
52 if (i < 4)
53 {
54 return new Tri(nodes, e->getID());
55 }
56
57 return new Quad(nodes, e->getID());
58 }
59 ERR("Error in MeshLib::Element::getFace() - Index {:d} does not exist.", i);
60 return nullptr;
61}
62
63} // end namespace MeshLib
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:45
Definition of the Node class.
Definition of the Quad class.
Definition of the Tri class.
virtual const Node * getNode(unsigned idx) const =0
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
static const unsigned face_nodes[5][4]
Constant: Local node index table for faces.
static const unsigned n_face_nodes[5]
Constant: Table for the number of nodes for each face.
static const Element * getFace(const Element *e, unsigned i)
Returns the i-th face of the element.
static const unsigned edge_nodes[8][2]
Constant: Local node index table for edge.
static const unsigned n_faces
Constant: The number of faces.
Definition PyramidRule.h:30
TemplateElement< MeshLib::QuadRule4 > Quad
Definition Quad.h:28
TemplateElement< MeshLib::TriRule3 > Tri
Definition Tri.h:26