OGS
MeshLib::PrismRule6 Class Reference

Detailed Description

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

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

Definition at line 44 of file PrismRule6.h.

#include <PrismRule6.h>

Inheritance diagram for MeshLib::PrismRule6:
[legend]
Collaboration diagram for MeshLib::PrismRule6:
[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 = 6u
 Constant: The number of base nodes for this element. More...
 
static const unsigned n_all_nodes = 6u
 Constant: The number of all nodes for this element. More...
 
static const MeshElemType mesh_elem_type = MeshElemType::PRISM
 Constant: The geometric type of the element. More...
 
static const CellType cell_type = CellType::PRISM6
 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 = 9
 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 [9][2]
 Constant: Local node index table for edge. More...
 
static const unsigned n_face_nodes [5] = {3, 4, 4, 4, 3}
 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 78 of file PrismRule6.h.

Member Function Documentation

◆ computeVolume()

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

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

Definition at line 65 of file PrismRule6.cpp.

66 {
68  *_nodes[0], *_nodes[1], *_nodes[2], *_nodes[3]) +
70  *_nodes[1], *_nodes[4], *_nodes[2], *_nodes[3]) +
72  *_nodes[2], *_nodes[4], *_nodes[5], *_nodes[3]);
73 }
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::PrismRule6::getFace ( const Element e,
unsigned  i 
)
static

Returns the i-th face of the element.

Definition at line 43 of file PrismRule6.cpp.

44 {
45  if (i < n_faces)
46  {
47  unsigned nFaceNodes(PrismRule6::n_face_nodes[i]);
48  auto** nodes = new Node*[nFaceNodes];
49  for (unsigned j = 0; j < nFaceNodes; j++)
50  {
51  nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
52  }
53 
54  if (i == 0 || i == 4)
55  {
56  return new Tri(nodes, e->getID());
57  }
58 
59  return new Quad(nodes);
60  }
61  ERR("Error in MeshLib::Element::getFace() - Index {:d} does not exist.", i);
62  return nullptr;
63 }
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: PrismRule6.h:69
static const unsigned n_faces
Constant: The number of faces.
Definition: PrismRule6.h:60
static const unsigned n_face_nodes[5]
Constant: Table for the number of nodes for each face.
Definition: PrismRule6.h:75
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(), n_face_nodes, and n_faces.

◆ identifyFace()

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

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

Definition at line 87 of file PrismRule6.cpp.

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

References face_nodes.

◆ isPntInElement()

bool MeshLib::PrismRule6::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 75 of file PrismRule6.cpp.

78 {
80  pnt, *nodes[0], *nodes[1], *nodes[2], *nodes[3], eps) ||
82  pnt, *nodes[1], *nodes[4], *nodes[2], *nodes[3], eps) ||
84  pnt, *nodes[2], *nodes[4], *nodes[5], *nodes[3], eps));
85 }
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::PrismRule6::validate ( const Element e)
static

Tests if the element is geometrically valid.

Definition at line 112 of file PrismRule6.cpp.

113 {
114  ElementErrorCode error_code;
116 
117  for (unsigned i = 1; i < 4; ++i)
118  {
119  const auto* quad(dynamic_cast<const MeshLib::Quad*>(e->getFace(i)));
120  if (quad)
121  {
122  error_code |= quad->validate();
123  }
124  else
125  {
126  error_code.set(ElementErrorFlag::NodeOrder);
127  }
128  delete quad;
129  }
130  error_code[ElementErrorFlag::NodeOrder] = !e->testElementNodeOrder();
131  return error_code;
132 }
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::PrismRule6::cell_type = CellType::PRISM6
static

Constant: The FEM type of the element.

Definition at line 57 of file PrismRule6.h.

◆ edge_nodes

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

Constant: Local node index table for edge.

Definition at line 72 of file PrismRule6.h.

◆ face_nodes

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

Constant: Local node index table for faces.

Definition at line 69 of file PrismRule6.h.

Referenced by getFace(), and identifyFace().

◆ mesh_elem_type

const MeshElemType MeshLib::PrismRule6::mesh_elem_type = MeshElemType::PRISM
static

Constant: The geometric type of the element.

Definition at line 54 of file PrismRule6.h.

◆ n_all_nodes

const unsigned MeshLib::PrismRule6::n_all_nodes = 6u
static

Constant: The number of all nodes for this element.

Definition at line 51 of file PrismRule6.h.

◆ n_base_nodes

const unsigned MeshLib::PrismRule6::n_base_nodes = 6u
static

Constant: The number of base nodes for this element.

Definition at line 48 of file PrismRule6.h.

◆ n_edges

const unsigned MeshLib::PrismRule6::n_edges = 9
static

Constant: The number of edges.

Definition at line 63 of file PrismRule6.h.

◆ n_face_nodes

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

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

Definition at line 75 of file PrismRule6.h.

Referenced by getFace().

◆ n_faces

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

Constant: The number of faces.

Definition at line 60 of file PrismRule6.h.

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

◆ n_neighbors

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

Constant: The number of neighbors.

Definition at line 66 of file PrismRule6.h.


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