OGS
FaceRule.h
Go to the documentation of this file.
1
11#pragma once
12
13#include "Element.h"
14
15namespace MeshLib
16{
17
19{
20public:
22 static const unsigned dimension = 2u;
23
25 static const Element* getFace(const Element* e, unsigned i) { return e->getEdge(i); }
26
28 static const unsigned n_faces = 0;
29
34 static bool testElementNodeOrder(Element const& e);
35
37 static Eigen::Vector3d getFirstSurfaceVector(Element const& e);
38
40 static Eigen::Vector3d getSecondSurfaceVector(Element const& e);
41
43 static Eigen::Vector3d getSurfaceNormal(Element const& e);
44
45protected:
47 template <typename ElementRule>
48 static unsigned identifyFace(Node const* const* element_nodes,
49 Node const* nodes[ElementRule::dimension])
50 {
51 for (unsigned i = 0; i < ElementRule::n_edges; i++)
52 {
53 unsigned flag(0);
54 constexpr std::size_t n = sizeof(ElementRule::edge_nodes[0]) /
55 sizeof(ElementRule::edge_nodes[0][0]);
56 for (unsigned j = 0; j < n; j++)
57 {
58 for (unsigned k = 0; k < ElementRule::dimension; k++)
59 {
60 if (element_nodes[ElementRule::edge_nodes[i][j]] ==
61 nodes[k])
62 {
63 flag++;
64 }
65 }
66 }
67 if (flag == ElementRule::dimension)
68 {
69 return i;
70 }
71 }
72 return std::numeric_limits<unsigned>::max();
73 }
74
75}; /* class */
76
77} // namespace MeshLib
Definition of the Element class.
virtual const Element * getEdge(unsigned i) const =0
Returns the i-th edge of the element.
static const unsigned dimension
Constant: Dimension of this mesh element.
Definition FaceRule.h:22
static bool testElementNodeOrder(Element const &e)
Definition FaceRule.cpp:21
static Eigen::Vector3d getSecondSurfaceVector(Element const &e)
Definition FaceRule.cpp:33
static const Element * getFace(const Element *e, unsigned i)
Returns the face i of the element.
Definition FaceRule.h:25
static const unsigned n_faces
Constant: The number of faces.
Definition FaceRule.h:28
static Eigen::Vector3d getFirstSurfaceVector(Element const &e)
Definition FaceRule.cpp:26
static unsigned identifyFace(Node const *const *element_nodes, Node const *nodes[ElementRule::dimension])
Returns the ID of an edge given an array of nodes.
Definition FaceRule.h:48
static Eigen::Vector3d getSurfaceNormal(Element const &e)
Returns the surface normal of a 2D element.
Definition FaceRule.cpp:40