OGS
MeshLib::FaceRule Class Reference

Detailed Description

Definition at line 18 of file FaceRule.h.

#include <FaceRule.h>

Inheritance diagram for MeshLib::FaceRule:
[legend]

Static Public Member Functions

static const ElementgetFace (const Element *e, unsigned i)
 Returns the face i of the element.
 
static bool testElementNodeOrder (Element const &e)
 
static Eigen::Vector3d getFirstSurfaceVector (Element const &e)
 
static Eigen::Vector3d getSecondSurfaceVector (Element const &e)
 
static Eigen::Vector3d getSurfaceNormal (Element const &e)
 Returns the surface normal of a 2D element.
 

Static Public Attributes

static const unsigned dimension = 2u
 Constant: Dimension of this mesh element.
 
static const unsigned n_faces = 0
 Constant: The number of faces.
 

Static Protected Member Functions

template<typename ElementRule >
static unsigned identifyFace (Node const *const *element_nodes, Node const *nodes[ElementRule::dimension])
 Returns the ID of an edge given an array of nodes.
 

Member Function Documentation

◆ getFace()

static const Element * MeshLib::FaceRule::getFace ( const Element * e,
unsigned i )
inlinestatic

Returns the face i of the element.

Definition at line 25 of file FaceRule.h.

25{ return e->getEdge(i); }

References MeshLib::Element::getEdge().

◆ getFirstSurfaceVector()

Eigen::Vector3d MeshLib::FaceRule::getFirstSurfaceVector ( Element const & e)
static
Returns
the first vector forming the surface' plane

Definition at line 26 of file FaceRule.cpp.

27{
28 Eigen::Vector3d const v =
29 e.getNode(0)->asEigenVector3d() - e.getNode(1)->asEigenVector3d();
30 return v;
31}

References MathLib::Point3d::asEigenVector3d(), and MeshLib::Element::getNode().

Referenced by getSurfaceNormal().

◆ getSecondSurfaceVector()

Eigen::Vector3d MeshLib::FaceRule::getSecondSurfaceVector ( Element const & e)
static
Returns
the second vector forming the surface' plane

Definition at line 33 of file FaceRule.cpp.

34{
35 Eigen::Vector3d const v =
36 e.getNode(2)->asEigenVector3d() - e.getNode(1)->asEigenVector3d();
37 return v;
38}

References MathLib::Point3d::asEigenVector3d(), and MeshLib::Element::getNode().

Referenced by getSurfaceNormal().

◆ getSurfaceNormal()

◆ identifyFace()

template<typename ElementRule >
static unsigned MeshLib::FaceRule::identifyFace ( Node const *const * element_nodes,
Node const * nodes[ElementRule::dimension] )
inlinestaticprotected

Returns the ID of an edge given an array of nodes.

Definition at line 48 of file FaceRule.h.

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 }

◆ testElementNodeOrder()

bool MeshLib::FaceRule::testElementNodeOrder ( Element const & e)
static

Checks if the node order of an element is correct by testing surface normals. For 2D elements true is returned if the normal points (roughly) upwards.

Definition at line 21 of file FaceRule.cpp.

22{
23 return getSurfaceNormal(e)[2] < 0;
24}
static Eigen::Vector3d getSurfaceNormal(Element const &e)
Returns the surface normal of a 2D element.
Definition FaceRule.cpp:40

References getSurfaceNormal().

Member Data Documentation

◆ dimension

const unsigned MeshLib::FaceRule::dimension = 2u
static

Constant: Dimension of this mesh element.

Definition at line 22 of file FaceRule.h.

◆ n_faces

const unsigned MeshLib::FaceRule::n_faces = 0
static

Constant: The number of faces.

Definition at line 28 of file FaceRule.h.


The documentation for this class was generated from the following files: