OGS
MeshLib::HexRule8 Class Reference

Detailed Description

A 8-nodes Hexahedron Element.

6
7-----------6
/: /|
/ : / |
7/ : /5 |
/ 11: / | 10
/ : 4 / |
4-----------5 |
| : | 2 |
| 3.....|.....2
| . | /
8 | . |9 /
| 3. | / 1
| . | /
|. |/
0-----------1
0
TemplateElement< MeshLib::HexRule8 > Hex
Definition: Hex.h:25

Definition at line 46 of file HexRule8.h.

#include <HexRule8.h>

Inheritance diagram for MeshLib::HexRule8:
[legend]
Collaboration diagram for MeshLib::HexRule8:
[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 a convex hexahedron by partitioning it into six tetrahedra. More...
 
- Static Public Member Functions inherited from MeshLib::CellRule
static bool testElementNodeOrder (Element const &e)
 

Static Public Attributes

static const unsigned n_base_nodes = 8u
 Constant: The number of base nodes for this element. More...
 
static const unsigned n_all_nodes = 8u
 Constant: The number of all nodes for this element. More...
 
static const MeshElemType mesh_elem_type = MeshElemType::HEXAHEDRON
 Constant: The geometric type of the element. More...
 
static const CellType cell_type = CellType::HEX8
 Constant: The FEM type of the element. More...
 
static const unsigned n_faces = 6
 Constant: The number of faces. More...
 
static const unsigned n_edges = 12
 Constant: The number of edges. More...
 
static const unsigned n_neighbors = 6
 Constant: The number of neighbors. More...
 
static const unsigned face_nodes [6][4]
 Constant: Local node index table for faces. More...
 
static const unsigned edge_nodes [12][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 77 of file HexRule8.h.

Member Function Documentation

◆ computeVolume()

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

Calculates the volume of a convex hexahedron by partitioning it into six tetrahedra.

Definition at line 62 of file HexRule8.cpp.

63 {
65  *_nodes[4], *_nodes[7], *_nodes[5], *_nodes[0]) +
67  *_nodes[5], *_nodes[3], *_nodes[1], *_nodes[0]) +
69  *_nodes[5], *_nodes[7], *_nodes[3], *_nodes[0]) +
71  *_nodes[5], *_nodes[7], *_nodes[6], *_nodes[2]) +
73  *_nodes[1], *_nodes[3], *_nodes[5], *_nodes[2]) +
75  *_nodes[3], *_nodes[7], *_nodes[5], *_nodes[2]);
76 }
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::HexRule8::getFace ( const Element e,
unsigned  i 
)
static

Returns the i-th face of the element.

Definition at line 47 of file HexRule8.cpp.

48 {
49  if (i < n_faces)
50  {
51  std::array<Node*, 4> nodes{};
52  for (unsigned j = 0; j < 4; j++)
53  {
54  nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
55  }
56  return new Quad(nodes, e->getID());
57  }
58  ERR("Error in MeshLib::Element::getFace() - Index {:d} does not exist.", i);
59  return nullptr;
60 }
void ERR(char const *fmt, Args const &... args)
Definition: Logging.h:42
static const unsigned face_nodes[6][4]
Constant: Local node index table for faces.
Definition: HexRule8.h:71
static const unsigned n_faces
Constant: The number of faces.
Definition: HexRule8.h:62
TemplateElement< MeshLib::QuadRule4 > Quad
Definition: Quad.h:28

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

◆ identifyFace()

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

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

Definition at line 96 of file HexRule8.cpp.

97 {
98  for (unsigned i = 0; i < 6; i++)
99  {
100  unsigned flag(0);
101  for (unsigned j = 0; j < 4; j++)
102  {
103  for (unsigned k = 0; k < 3; k++)
104  {
105  if (_nodes[face_nodes[i][j]] == nodes[k])
106  {
107  flag++;
108  }
109  }
110  }
111  if (flag == 3)
112  {
113  return i;
114  }
115  }
116  return std::numeric_limits<unsigned>::max();
117 }

References face_nodes.

◆ isPntInElement()

bool MeshLib::HexRule8::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 78 of file HexRule8.cpp.

81 {
83  pnt, *nodes[4], *nodes[7], *nodes[5], *nodes[0], eps) ||
85  pnt, *nodes[5], *nodes[3], *nodes[1], *nodes[0], eps) ||
87  pnt, *nodes[5], *nodes[7], *nodes[3], *nodes[0], eps) ||
89  pnt, *nodes[5], *nodes[7], *nodes[6], *nodes[2], eps) ||
91  pnt, *nodes[1], *nodes[3], *nodes[5], *nodes[2], eps) ||
93  pnt, *nodes[3], *nodes[7], *nodes[5], *nodes[2], eps));
94 }
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::HexRule8::validate ( const Element e)
static

Tests if the element is geometrically valid.

Definition at line 119 of file HexRule8.cpp.

120 {
121  ElementErrorCode error_code;
123 
124  for (unsigned i = 0; i < 6; ++i)
125  {
126  if (error_code.all())
127  {
128  break;
129  }
130 
131  const MeshLib::Element* quad(e->getFace(i));
132  error_code |= quad->validate();
133  delete quad;
134  }
135  error_code[ElementErrorFlag::NodeOrder] = !e->testElementNodeOrder();
136  return error_code;
137 }
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::Element::getFace(), MeshLib::hasZeroVolume(), NodeOrder, MeshLib::Element::testElementNodeOrder(), MeshLib::Element::validate(), and ZeroVolume.

Member Data Documentation

◆ cell_type

const CellType MeshLib::HexRule8::cell_type = CellType::HEX8
static

Constant: The FEM type of the element.

Definition at line 59 of file HexRule8.h.

◆ edge_nodes

const unsigned MeshLib::HexRule8::edge_nodes
static
Initial value:
= {
{0, 1},
{1, 2},
{2, 3},
{0, 3},
{4, 5},
{5, 6},
{6, 7},
{4, 7},
{0, 4},
{1, 5},
{2, 6},
{3, 7}
}

Constant: Local node index table for edge.

Definition at line 74 of file HexRule8.h.

◆ face_nodes

const unsigned MeshLib::HexRule8::face_nodes
static
Initial value:
= {
{0, 3, 2, 1},
{0, 1, 5, 4},
{1, 2, 6, 5},
{2, 3, 7, 6},
{3, 0, 4, 7},
{4, 5, 6, 7}
}

Constant: Local node index table for faces.

Definition at line 71 of file HexRule8.h.

Referenced by getFace(), and identifyFace().

◆ mesh_elem_type

const MeshElemType MeshLib::HexRule8::mesh_elem_type = MeshElemType::HEXAHEDRON
static

Constant: The geometric type of the element.

Definition at line 56 of file HexRule8.h.

◆ n_all_nodes

const unsigned MeshLib::HexRule8::n_all_nodes = 8u
static

Constant: The number of all nodes for this element.

Definition at line 53 of file HexRule8.h.

◆ n_base_nodes

const unsigned MeshLib::HexRule8::n_base_nodes = 8u
static

Constant: The number of base nodes for this element.

Definition at line 50 of file HexRule8.h.

◆ n_edges

const unsigned MeshLib::HexRule8::n_edges = 12
static

Constant: The number of edges.

Definition at line 65 of file HexRule8.h.

◆ n_faces

const unsigned MeshLib::HexRule8::n_faces = 6
static

Constant: The number of faces.

Definition at line 62 of file HexRule8.h.

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

◆ n_neighbors

const unsigned MeshLib::HexRule8::n_neighbors = 6
static

Constant: The number of neighbors.

Definition at line 68 of file HexRule8.h.


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