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