OGS
PyramidRule13.cpp
Go to the documentation of this file.
1 
11 #include "PyramidRule13.h"
12 
13 #include "BaseLib/Logging.h"
14 #include "MeshLib/Node.h"
15 #include "Quad.h"
16 #include "Tri.h"
17 
18 namespace MeshLib
19 {
20 const unsigned PyramidRule13::face_nodes[5][8] = {
21  {0, 1, 4, 5, 10, 9, 99, 99}, // Face 0
22  {1, 2, 4, 6, 11, 10, 99, 99}, // Face 1
23  {2, 3, 4, 7, 12, 11, 99, 99}, // Face 2
24  {3, 0, 4, 8, 9, 12, 99, 99}, // Face 3
25  {0, 3, 2, 1, 8, 7, 6, 5} // Face 4
26 };
27 
28 const unsigned PyramidRule13::edge_nodes[8][3] = {
29  {0, 1, 5}, // Edge 0
30  {1, 2, 6}, // Edge 1
31  {2, 3, 7}, // Edge 2
32  {0, 3, 8}, // Edge 3
33  {0, 4, 9}, // Edge 4
34  {1, 4, 10}, // Edge 5
35  {2, 4, 11}, // Edge 6
36  {3, 4, 12} // Edge 7
37 };
38 
39 const unsigned PyramidRule13::n_face_nodes[5] = {6, 6, 6, 6, 8};
40 
41 const Element* PyramidRule13::getFace(const Element* e, unsigned i)
42 {
43  if (i < e->getNumberOfFaces())
44  {
45  unsigned nFaceNodes(PyramidRule13::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 Tri6(nodes, e->getID());
55  }
56 
57  return new Quad8(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(char const *fmt, Args const &... args)
Definition: Logging.h:42
Definition of the Node class.
Definition of the Quad class.
Definition of the Tri class.
virtual const Node * getNode(unsigned idx) const =0
virtual std::size_t getID() const final
Returns the ID of the element.
Definition: Element.h:82
static const unsigned edge_nodes[8][3]
Constant: Local node index table for edge.
Definition: PyramidRule13.h:56
static const unsigned n_face_nodes[5]
Constant: Table for the number of nodes for each face.
Definition: PyramidRule13.h:59
static const unsigned face_nodes[5][8]
Constant: Local node index table for faces.
Definition: PyramidRule13.h:53
static const Element * getFace(const Element *e, unsigned i)
Returns the i-th face of the element.
TemplateElement< MeshLib::QuadRule8 > Quad8
Definition: Quad.h:29
TemplateElement< MeshLib::TriRule6 > Tri6
Definition: Tri.h:27