OGS
MeshLib::QuadRule Class Reference

Detailed Description

This class represents a 2d quad element in 3d space.

Definition at line 23 of file QuadRule.h.

#include <QuadRule.h>

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

Static Public Member Functions

static bool isPntInElement (Node const *const *nodes, MathLib::Point3d const &pnt, double eps)
 
static ElementErrorCode validate (const Element *e)
 
static double computeVolume (Node const *const *element_nodes)
 Calculates the area of a quad with straight edges.
 
- Static Public Member Functions inherited from MeshLib::FaceRule
static const ElementgetFace (const Element *e, unsigned i)
 Returns the face i of the element.
 
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.
 

Static Public Attributes

static const unsigned n_base_nodes = 4u
 Constant: The number of base nodes for this element.
 
static const MeshElemType mesh_elem_type = MeshElemType::QUAD
 Constant: The geometric type of the element.
 
static const unsigned n_edges = 4
 Constant: The number of edges.
 
static const unsigned n_neighbors = 4
 Constant: The number of neighbors.
 
- Static Public Attributes inherited from MeshLib::FaceRule
static const unsigned dimension = 2u
 Constant: Dimension of this mesh element.
 
static const unsigned n_faces = 0
 Constant: The number of faces.
 

Additional Inherited Members

- Static Protected Member Functions inherited from MeshLib::FaceRule
template<typename ElementRule >
static unsigned identifyFace (Node const *const *element_nodes, Node const *nodes[ElementRule::dimension])
 Returns the ID of an edge given an array of nodes.
 

Member Function Documentation

◆ computeVolume()

double MeshLib::QuadRule::computeVolume ( Node const *const * element_nodes)
static

Calculates the area of a quad with straight edges.

Definition at line 17 of file QuadRule.cpp.

18{
20 *element_nodes[0], *element_nodes[1], *element_nodes[2]) +
22 *element_nodes[2], *element_nodes[3], *element_nodes[0]);
23}
double calcTriangleArea(MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c)

References MathLib::calcTriangleArea().

◆ isPntInElement()

bool MeshLib::QuadRule::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 25 of file QuadRule.cpp.

28{
29 return (
30 MathLib::isPointInTriangle(pnt, *nodes[0], *nodes[1], *nodes[2], eps) ||
31 MathLib::isPointInTriangle(pnt, *nodes[0], *nodes[2], *nodes[3], eps));
32}
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::QuadRule::validate ( const Element * e)
static

Tests if the element is geometrically valid.

Definition at line 34 of file QuadRule.cpp.

35{
36 ElementErrorCode error_code;
38 Node const* const* element_nodes = e->getNodes();
40 (!MathLib::isCoplanar(*element_nodes[0],
41 *element_nodes[1],
42 *element_nodes[2],
43 *element_nodes[3]));
44 // for collapsed quads (i.e. reduced to a line) this test might result
45 // "false" as all four points are actually located on a line.
46 if (!error_code[ElementErrorFlag::ZeroVolume])
47 {
48 error_code[ElementErrorFlag::NonConvex] =
49 (!(MathLib::dividedByPlane(*element_nodes[0],
50 *element_nodes[2],
51 *element_nodes[1],
52 *element_nodes[3]) &&
53 MathLib::dividedByPlane(*element_nodes[1],
54 *element_nodes[3],
55 *element_nodes[0],
56 *element_nodes[2])));
57 }
58 error_code[ElementErrorFlag::NodeOrder] = !e->testElementNodeOrder();
59 return error_code;
60}
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

◆ mesh_elem_type

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

Constant: The geometric type of the element.

Definition at line 30 of file QuadRule.h.

◆ n_base_nodes

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

Constant: The number of base nodes for this element.

Definition at line 27 of file QuadRule.h.

◆ n_edges

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

Constant: The number of edges.

Definition at line 33 of file QuadRule.h.

◆ n_neighbors

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

Constant: The number of neighbors.

Definition at line 36 of file QuadRule.h.


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