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