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