OGS
MeshLib::PyramidRule5 Class Reference

Detailed Description

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

4
//|\
// | \
7// | \6
// |5 \
// | \
3/.... |.....2
./ | 2 /
./4 | /
3./ | /1
./ | /
./ |/
0------------1
0

Definition at line 43 of file PyramidRule5.h.

#include <PyramidRule5.h>

Inheritance diagram for MeshLib::PyramidRule5:
[legend]
Collaboration diagram for MeshLib::PyramidRule5:
[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 = 5u
 Constant: The number of base nodes for this element. More...
 
static const unsigned n_all_nodes = 5u
 Constant: The number of all nodes for this element. More...
 
static const MeshElemType mesh_elem_type = MeshElemType::PYRAMID
 Constant: The geometric type of the element. More...
 
static const CellType cell_type = CellType::PYRAMID5
 Constant: The FEM type of the element. More...
 
static const unsigned n_faces = 5
 Constant: The number of faces. More...
 
static const unsigned n_edges = 8
 Constant: The number of edges. More...
 
static const unsigned n_neighbors = 5
 Constant: The number of neighbors. More...
 
static const unsigned face_nodes [5][4]
 Constant: Local node index table for faces. More...
 
static const unsigned edge_nodes [8][2]
 Constant: Local node index table for edge. More...
 
static const unsigned n_face_nodes [5] = {3, 3, 3, 3, 4}
 Constant: Table for the number of nodes for each face. 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 PyramidRule5.h.

Member Function Documentation

◆ computeVolume()

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

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

Definition at line 64 of file PyramidRule5.cpp.

65 {
67  *_nodes[0], *_nodes[1], *_nodes[2], *_nodes[4]) +
69  *_nodes[2], *_nodes[3], *_nodes[0], *_nodes[4]);
70 }
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::PyramidRule5::getFace ( const Element e,
unsigned  i 
)
static

Returns the i-th face of the element.

Definition at line 42 of file PyramidRule5.cpp.

43 {
44  if (i < e->getNumberOfFaces())
45  {
46  unsigned nFaceNodes(PyramidRule5::n_face_nodes[i]);
47  auto** nodes = new Node*[nFaceNodes];
48  for (unsigned j = 0; j < nFaceNodes; j++)
49  {
50  nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
51  }
52 
53  if (i < 4)
54  {
55  return new Tri(nodes, e->getID());
56  }
57 
58  return new Quad(nodes, e->getID());
59  }
60  ERR("Error in MeshLib::Element::getFace() - Index {:d} does not exist.", i);
61  return nullptr;
62 }
void ERR(char const *fmt, Args const &... args)
Definition: Logging.h:42
static const unsigned face_nodes[5][4]
Constant: Local node index table for faces.
Definition: PyramidRule5.h:68
static const unsigned n_face_nodes[5]
Constant: Table for the number of nodes for each face.
Definition: PyramidRule5.h:74
TemplateElement< MeshLib::TriRule3 > Tri
Definition: Tri.h:26
TemplateElement< MeshLib::QuadRule4 > Quad
Definition: Quad.h:28

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

◆ identifyFace()

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

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

Definition at line 82 of file PyramidRule5.cpp.

84 {
85  for (unsigned i = 0; i < 5; i++)
86  {
87  unsigned flag(0);
88  for (unsigned j = 0; j < 4; j++)
89  {
90  for (unsigned k = 0; k < 3; k++)
91  {
92  if (face_nodes[i][j] != 99 &&
93  _nodes[face_nodes[i][j]] == nodes[k])
94  {
95  flag++;
96  }
97  }
98  }
99  if (flag == 3)
100  {
101  return i;
102  }
103  }
104  return std::numeric_limits<unsigned>::max();
105 }

References face_nodes.

◆ isPntInElement()

bool MeshLib::PyramidRule5::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 72 of file PyramidRule5.cpp.

75 {
77  pnt, *nodes[0], *nodes[1], *nodes[2], *nodes[4], eps) ||
79  pnt, *nodes[0], *nodes[2], *nodes[3], *nodes[4], eps));
80 }
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::PyramidRule5::validate ( const Element e)
static

Tests if the element is geometrically valid.

Definition at line 107 of file PyramidRule5.cpp.

108 {
109  ElementErrorCode error_code;
111 
112  std::unique_ptr<MeshLib::Quad const> const base{
113  dynamic_cast<MeshLib::Quad const*>(e->getFace(4))};
114  if (base)
115  {
116  error_code |= base->validate();
117  error_code[ElementErrorFlag::NodeOrder] = !e->testElementNodeOrder();
118  }
119  else
120  {
121  error_code.set(ElementErrorFlag::NodeOrder);
122  }
123 
124  return error_code;
125 }
Collects error flags for mesh elements.
void set(ElementErrorFlag e)
Set a specific flag.
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, ElementErrorCode::set(), MeshLib::Element::testElementNodeOrder(), and ZeroVolume.

Member Data Documentation

◆ cell_type

const CellType MeshLib::PyramidRule5::cell_type = CellType::PYRAMID5
static

Constant: The FEM type of the element.

Definition at line 56 of file PyramidRule5.h.

◆ edge_nodes

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

Constant: Local node index table for edge.

Definition at line 71 of file PyramidRule5.h.

◆ face_nodes

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

Constant: Local node index table for faces.

Definition at line 68 of file PyramidRule5.h.

Referenced by getFace(), and identifyFace().

◆ mesh_elem_type

const MeshElemType MeshLib::PyramidRule5::mesh_elem_type = MeshElemType::PYRAMID
static

Constant: The geometric type of the element.

Definition at line 53 of file PyramidRule5.h.

◆ n_all_nodes

const unsigned MeshLib::PyramidRule5::n_all_nodes = 5u
static

Constant: The number of all nodes for this element.

Definition at line 50 of file PyramidRule5.h.

◆ n_base_nodes

const unsigned MeshLib::PyramidRule5::n_base_nodes = 5u
static

Constant: The number of base nodes for this element.

Definition at line 47 of file PyramidRule5.h.

◆ n_edges

const unsigned MeshLib::PyramidRule5::n_edges = 8
static

Constant: The number of edges.

Definition at line 62 of file PyramidRule5.h.

◆ n_face_nodes

const unsigned MeshLib::PyramidRule5::n_face_nodes = {3, 3, 3, 3, 4}
static

Constant: Table for the number of nodes for each face.

Definition at line 74 of file PyramidRule5.h.

Referenced by getFace().

◆ n_faces

const unsigned MeshLib::PyramidRule5::n_faces = 5
static

Constant: The number of faces.

Definition at line 59 of file PyramidRule5.h.

◆ n_neighbors

const unsigned MeshLib::PyramidRule5::n_neighbors = 5
static

Constant: The number of neighbors.

Definition at line 65 of file PyramidRule5.h.


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