OGS
PrismRule15.cpp
Go to the documentation of this file.
1 
11 #include "PrismRule15.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 PrismRule15::face_nodes[5][8] = {
21  {0, 2, 1, 8, 7, 6, 99, 99}, // Face 0
22  {0, 1, 4, 3, 6, 10, 12, 9}, // Face 1
23  {1, 2, 5, 4, 7, 11, 13, 10}, // Face 2
24  {2, 0, 3, 5, 8, 9, 14, 11}, // Face 3
25  {3, 4, 5, 12, 13, 14, 99, 99} // Face 4
26 };
27 
28 const unsigned PrismRule15::edge_nodes[9][3] = {
29  {0, 1, 6}, // Edge 0
30  {1, 2, 7}, // Edge 1
31  {0, 2, 8}, // Edge 2
32  {0, 3, 9}, // Edge 3
33  {1, 4, 10}, // Edge 4
34  {2, 5, 11}, // Edge 5
35  {3, 4, 12}, // Edge 6
36  {4, 5, 13}, // Edge 7
37  {3, 5, 14} // Edge 8
38 };
39 
40 const unsigned PrismRule15::n_face_nodes[5] = {6, 8, 8, 8, 6};
41 
42 const Element* PrismRule15::getFace(const Element* e, unsigned i)
43 {
44  if (i < n_faces)
45  {
46  unsigned nFaceNodes(PrismRule15::n_face_nodes[i]);
47  auto** nodes = new Node*[nFaceNodes];
48  for (unsigned j = 0; j < nFaceNodes; j++)
49  {
50  nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
51  }
52 
53  if (i == 0 || i == 4)
54  {
55  return new Tri6(nodes, e->getID());
56  }
57 
58  return new Quad8(nodes);
59  }
60  ERR("Error in MeshLib::Element::getFace() - Index {:d} does not exist.", i);
61  return nullptr;
62 }
63 
64 } // 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 face_nodes[5][8]
Constant: Local node index table for faces.
Definition: PrismRule15.h:54
static const Element * getFace(const Element *e, unsigned i)
Returns the i-th face of the element.
Definition: PrismRule15.cpp:42
static const unsigned edge_nodes[9][3]
Constant: Local node index table for edge.
Definition: PrismRule15.h:57
static const unsigned n_face_nodes[5]
Constant: Table for the number of nodes for each face.
Definition: PrismRule15.h:60
static const unsigned n_faces
Constant: The number of faces.
Definition: PrismRule6.h:60
TemplateElement< MeshLib::QuadRule8 > Quad8
Definition: Quad.h:29
TemplateElement< MeshLib::TriRule6 > Tri6
Definition: Tri.h:27