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