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
18namespace MeshLib
19{
20const unsigned PrismRule15::face_nodes[5][8] = {
21 {0, 2, 1, 8, 7, 6, 99, 99}, // Face 0
22 {0, 1, 4, 3, 6, 13, 9, 12}, // Face 1
23 {1, 2, 5, 4, 7, 14, 10, 13}, // Face 2
24 {2, 0, 3, 5, 8, 12, 11, 14}, // Face 3
25 {3, 4, 5, 9, 10, 11, 99, 99} // Face 4
26};
27
28const 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, 12}, // Edge 3
33 {1, 4, 13}, // Edge 4
34 {2, 5, 14}, // Edge 5
35 {3, 4, 9}, // Edge 6
36 {4, 5, 10}, // Edge 7
37 {3, 5, 11} // Edge 8
38};
39
40const unsigned PrismRule15::n_face_nodes[5] = {6, 8, 8, 8, 6};
41
42const 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(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][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.
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 PrismRule.h:29
TemplateElement< MeshLib::QuadRule8 > Quad8
Definition Quad.h:29
TemplateElement< MeshLib::TriRule6 > Tri6
Definition Tri.h:27