OGS
MeshLib::QuadRule4 Class Reference

Detailed Description

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

2
3-----------2
| |
| |
3| |1
| |
| |
0-----------1
0

Definition at line 37 of file QuadRule4.h.

#include <QuadRule4.h>

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

Public Types

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

Static Public Member Functions

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::FaceRule
static const ElementgetFace (const Element *e, unsigned i)
 Returns the face i of the element. More...
 
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. More...
 

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::QUAD
 Constant: The geometric type of the element. More...
 
static const CellType cell_type = CellType::QUAD4
 Constant: The FEM type of the element. More...
 
static const unsigned n_edges = 4
 Constant: The number of edges. More...
 
static const unsigned n_neighbors = 4
 Constant: The number of neighbors. More...
 
static const unsigned edge_nodes [4][2]
 Constant: Local node index table for edge. More...
 
- Static Public Attributes inherited from MeshLib::FaceRule
static const unsigned dimension = 2u
 Constant: Dimension of this mesh element. More...
 
static const unsigned n_faces = 0
 Constant: The number of faces. More...
 

Member Typedef Documentation

◆ EdgeReturn

Returns the i-th edge of the element.

Definition at line 62 of file QuadRule4.h.

Member Function Documentation

◆ computeVolume()

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

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

Definition at line 25 of file QuadRule4.cpp.

26 {
27  return MathLib::calcTriangleArea(*_nodes[0], *_nodes[1], *_nodes[2]) +
28  MathLib::calcTriangleArea(*_nodes[2], *_nodes[3], *_nodes[0]);
29 }
double calcTriangleArea(MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c)

References MathLib::calcTriangleArea().

◆ identifyFace()

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

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

Definition at line 40 of file QuadRule4.cpp.

42 {
43  for (unsigned i = 0; i < 4; i++)
44  {
45  unsigned flag(0);
46  for (unsigned j = 0; j < 2; j++)
47  {
48  for (unsigned k = 0; k < 2; k++)
49  {
50  if (_nodes[edge_nodes[i][j]] == nodes[k])
51  {
52  flag++;
53  }
54  }
55  }
56  if (flag == 2)
57  {
58  return i;
59  }
60  }
61  return std::numeric_limits<unsigned>::max();
62 }
static const unsigned edge_nodes[4][2]
Constant: Local node index table for edge.
Definition: QuadRule4.h:59

References edge_nodes.

◆ isPntInElement()

bool MeshLib::QuadRule4::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 31 of file QuadRule4.cpp.

34 {
35  return (
36  MathLib::isPointInTriangle(pnt, *nodes[0], *nodes[1], *nodes[2], eps) ||
37  MathLib::isPointInTriangle(pnt, *nodes[0], *nodes[2], *nodes[3], eps));
38 }
bool isPointInTriangle(MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, double eps_pnt_out_of_plane, double eps_pnt_out_of_tri, MathLib::TriangleTest algorithm)

References MathLib::isPointInTriangle().

◆ validate()

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

Tests if the element is geometrically valid.

Definition at line 64 of file QuadRule4.cpp.

65 {
66  ElementErrorCode error_code;
68  Node const* const* _nodes = e->getNodes();
69  error_code[ElementErrorFlag::NonCoplanar] =
70  (!MathLib::isCoplanar(*_nodes[0], *_nodes[1], *_nodes[2], *_nodes[3]));
71  // for collapsed quads (i.e. reduced to a line) this test might result
72  // "false" as all four points are actually located on a line.
73  if (!error_code[ElementErrorFlag::ZeroVolume])
74  {
75  error_code[ElementErrorFlag::NonConvex] =
77  *_nodes[0], *_nodes[2], *_nodes[1], *_nodes[3]) &&
79  *_nodes[1], *_nodes[3], *_nodes[0], *_nodes[2])));
80  }
81  error_code[ElementErrorFlag::NodeOrder] = !e->testElementNodeOrder();
82  return error_code;
83 }
Collects error flags for mesh elements.
bool isCoplanar(const MathLib::Point3d &a, const MathLib::Point3d &b, const MathLib::Point3d &c, const MathLib::Point3d &d)
Checks if the four given points are located on a plane.
bool dividedByPlane(const MathLib::Point3d &a, const MathLib::Point3d &b, const MathLib::Point3d &c, const MathLib::Point3d &d)
bool hasZeroVolume(MeshLib::Element const &element)
Returns true if the element has zero length/area/volume.
Definition: Element.cpp:119

References MathLib::dividedByPlane(), MeshLib::Element::getNodes(), MeshLib::hasZeroVolume(), MathLib::isCoplanar(), NodeOrder, NonConvex, NonCoplanar, MeshLib::Element::testElementNodeOrder(), and ZeroVolume.

Member Data Documentation

◆ cell_type

const CellType MeshLib::QuadRule4::cell_type = CellType::QUAD4
static

Constant: The FEM type of the element.

Definition at line 50 of file QuadRule4.h.

◆ edge_nodes

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

Constant: Local node index table for edge.

Definition at line 59 of file QuadRule4.h.

Referenced by identifyFace().

◆ mesh_elem_type

const MeshElemType MeshLib::QuadRule4::mesh_elem_type = MeshElemType::QUAD
static

Constant: The geometric type of the element.

Definition at line 47 of file QuadRule4.h.

◆ n_all_nodes

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

Constant: The number of all nodes for this element.

Definition at line 44 of file QuadRule4.h.

◆ n_base_nodes

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

Constant: The number of base nodes for this element.

Definition at line 41 of file QuadRule4.h.

◆ n_edges

const unsigned MeshLib::QuadRule4::n_edges = 4
static

Constant: The number of edges.

Definition at line 53 of file QuadRule4.h.

◆ n_neighbors

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

Constant: The number of neighbors.

Definition at line 56 of file QuadRule4.h.


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