OGS
MeshLib::TetRule4 Class Reference

Detailed Description

This class represents a 3d tetrahedron element. The following sketch shows the node and edge numbering.

3
/|\
/ | \
3/ | \5
/ |4 \
/ | \
0.....|.....2
\ | 2 /
\ | /
0\ | /1
\ | /
\|/
1

Definition at line 41 of file TetRule4.h.

#include <TetRule4.h>

Inheritance diagram for MeshLib::TetRule4:
[legend]
Collaboration diagram for MeshLib::TetRule4:
[legend]

Public Types

using EdgeReturn = MeshLib::LinearEdgeReturn
 Returns the i-th edge of the element. More...
 

Static Public Member Functions

static const ElementgetFace (const Element *e, unsigned i)
 Returns the i-th face of the element. More...
 
static bool isPntInElement (Node const *const *nodes, MathLib::Point3d const &pnt, double eps)
 
static ElementErrorCode validate (const Element *e)
 
static unsigned identifyFace (Node const *const *, Node const *nodes[3])
 Returns the ID of a face given an array of nodes. More...
 
static double computeVolume (Node const *const *_nodes)
 Calculates the volume of the element. More...
 
- Static Public Member Functions inherited from MeshLib::CellRule
static bool testElementNodeOrder (Element const &e)
 

Static Public Attributes

static const unsigned n_base_nodes = 4u
 Constant: The number of base nodes for this element. More...
 
static const unsigned n_all_nodes = 4u
 Constant: The number of all nodes for this element. More...
 
static const MeshElemType mesh_elem_type = MeshElemType::TETRAHEDRON
 Constant: The geometric type of the element. More...
 
static const CellType cell_type = CellType::TET4
 Constant: The FEM type of the element. More...
 
static const unsigned n_faces = 4
 Constant: The number of faces. More...
 
static const unsigned n_edges = 6
 Constant: The number of edges. More...
 
static const unsigned n_neighbors = 4
 Constant: The number of neighbors. More...
 
static const unsigned face_nodes [4][3]
 Constant: Local node index table for faces. More...
 
static const unsigned edge_nodes [6][2]
 Constant: Local node index table for edge. More...
 
- Static Public Attributes inherited from MeshLib::CellRule
static const unsigned dimension = 3u
 Constant: Dimension of this mesh element. More...
 

Member Typedef Documentation

◆ EdgeReturn

Returns the i-th edge of the element.

Definition at line 72 of file TetRule4.h.

Member Function Documentation

◆ computeVolume()

double MeshLib::TetRule4::computeVolume ( Node const *const *  _nodes)
static

Calculates the volume of the element.

Definition at line 54 of file TetRule4.cpp.

55 {
56  return MathLib::calcTetrahedronVolume(*_nodes[0], *_nodes[1], *_nodes[2],
57  *_nodes[3]);
58 }
double calcTetrahedronVolume(MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, MathLib::Point3d const &d)

References MathLib::calcTetrahedronVolume().

◆ getFace()

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

Returns the i-th face of the element.

Definition at line 39 of file TetRule4.cpp.

40 {
41  if (i < n_faces)
42  {
43  std::array<Node*, 3> nodes{};
44  for (unsigned j = 0; j < 3; j++)
45  {
46  nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
47  }
48  return new Tri(nodes, e->getID());
49  }
50  ERR("Error in MeshLib::Element::getFace() - Index {:d} does not exist.", i);
51  return nullptr;
52 }
void ERR(char const *fmt, Args const &... args)
Definition: Logging.h:42
static const unsigned face_nodes[4][3]
Constant: Local node index table for faces.
Definition: TetRule4.h:66
static const unsigned n_faces
Constant: The number of faces.
Definition: TetRule4.h:57
TemplateElement< MeshLib::TriRule3 > Tri
Definition: Tri.h:26

References ERR(), face_nodes, MeshLib::Element::getID(), MeshLib::Element::getNode(), and n_faces.

◆ identifyFace()

unsigned MeshLib::TetRule4::identifyFace ( Node const *const *  _nodes,
Node const *  nodes[3] 
)
static

Returns the ID of a face given an array of nodes.

Definition at line 67 of file TetRule4.cpp.

68 {
69  for (unsigned i = 0; i < 4; i++)
70  {
71  unsigned flag(0);
72  for (unsigned j = 0; j < 3; j++)
73  {
74  for (unsigned k = 0; k < 3; k++)
75  {
76  if (_nodes[face_nodes[i][j]] == nodes[k])
77  {
78  flag++;
79  }
80  }
81  }
82  if (flag == 3)
83  {
84  return i;
85  }
86  }
87  return std::numeric_limits<unsigned>::max();
88 }

References face_nodes.

◆ isPntInElement()

bool MeshLib::TetRule4::isPntInElement ( Node const *const *  nodes,
MathLib::Point3d const &  pnt,
double  eps 
)
static

Checks if a point is inside the element.

Parameters
pnta 3D MathLib::Point3d object
epstolerance for numerical algorithm used or computing the property
Returns
true if the point is not outside the element, false otherwise
Parameters
nodesthe nodes of the element.

Definition at line 60 of file TetRule4.cpp.

62 {
63  return MathLib::isPointInTetrahedron(pnt, *nodes[0], *nodes[1], *nodes[2],
64  *nodes[3], eps);
65 }
bool isPointInTetrahedron(MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, MathLib::Point3d const &d, double eps)

References MathLib::isPointInTetrahedron().

◆ validate()

ElementErrorCode MeshLib::TetRule4::validate ( const Element e)
static

Tests if the element is geometrically valid.

Definition at line 90 of file TetRule4.cpp.

91 {
92  ElementErrorCode error_code;
94  error_code[ElementErrorFlag::NodeOrder] = !e->testElementNodeOrder();
95  return error_code;
96 }
Collects error flags for mesh elements.
bool hasZeroVolume(MeshLib::Element const &element)
Returns true if the element has zero length/area/volume.
Definition: Element.cpp:121

References MeshLib::hasZeroVolume(), NodeOrder, MeshLib::Element::testElementNodeOrder(), and ZeroVolume.

Member Data Documentation

◆ cell_type

const CellType MeshLib::TetRule4::cell_type = CellType::TET4
static

Constant: The FEM type of the element.

Definition at line 54 of file TetRule4.h.

◆ edge_nodes

const unsigned MeshLib::TetRule4::edge_nodes
static
Initial value:
= {
{0, 1},
{1, 2},
{0, 2},
{0, 3},
{1, 3},
{2, 3}
}

Constant: Local node index table for edge.

Definition at line 69 of file TetRule4.h.

◆ face_nodes

const unsigned MeshLib::TetRule4::face_nodes
static
Initial value:
= {
{0, 2, 1},
{0, 1, 3},
{1, 2, 3},
{2, 0, 3}
}

Constant: Local node index table for faces.

Definition at line 66 of file TetRule4.h.

Referenced by getFace(), and identifyFace().

◆ mesh_elem_type

const MeshElemType MeshLib::TetRule4::mesh_elem_type = MeshElemType::TETRAHEDRON
static

Constant: The geometric type of the element.

Definition at line 51 of file TetRule4.h.

◆ n_all_nodes

const unsigned MeshLib::TetRule4::n_all_nodes = 4u
static

Constant: The number of all nodes for this element.

Definition at line 48 of file TetRule4.h.

◆ n_base_nodes

const unsigned MeshLib::TetRule4::n_base_nodes = 4u
static

Constant: The number of base nodes for this element.

Definition at line 45 of file TetRule4.h.

◆ n_edges

const unsigned MeshLib::TetRule4::n_edges = 6
static

Constant: The number of edges.

Definition at line 60 of file TetRule4.h.

◆ n_faces

const unsigned MeshLib::TetRule4::n_faces = 4
static

Constant: The number of faces.

Definition at line 57 of file TetRule4.h.

Referenced by MeshLib::TetRule10::getFace(), and getFace().

◆ n_neighbors

const unsigned MeshLib::TetRule4::n_neighbors = 4
static

Constant: The number of neighbors.

Definition at line 63 of file TetRule4.h.


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