OGS
PrismRule.cpp
Go to the documentation of this file.
1
10#include "PrismRule.h"
11
13#include "MeshLib/Node.h"
14#include "Quad.h"
15
16namespace MeshLib
17{
18double PrismRule::computeVolume(Node const* const* element_nodes)
19{
20 return MathLib::calcTetrahedronVolume(*element_nodes[0],
21 *element_nodes[1],
22 *element_nodes[2],
23 *element_nodes[3]) +
24 MathLib::calcTetrahedronVolume(*element_nodes[1],
25 *element_nodes[4],
26 *element_nodes[2],
27 *element_nodes[3]) +
28 MathLib::calcTetrahedronVolume(*element_nodes[2],
29 *element_nodes[4],
30 *element_nodes[5],
31 *element_nodes[3]);
32}
33
34bool PrismRule::isPntInElement(Node const* const* nodes,
35 MathLib::Point3d const& pnt,
36 double eps)
37{
39 pnt, *nodes[0], *nodes[1], *nodes[2], *nodes[3], eps) ||
41 pnt, *nodes[1], *nodes[4], *nodes[2], *nodes[3], eps) ||
43 pnt, *nodes[2], *nodes[4], *nodes[5], *nodes[3], eps));
44}
45
47{
48 ElementErrorCode error_code;
50
51 for (unsigned i = 1; i < 4; ++i)
52 {
53 const auto* quad(dynamic_cast<const MeshLib::Quad*>(e->getFace(i)));
54 if (quad)
55 {
56 error_code |= quad->validate();
57 }
58 else
59 {
61 }
62 delete quad;
63 }
65 return error_code;
66}
67
68} // end namespace MeshLib
Definition of the Node class.
Definition of the Quad class.
Collects error flags for mesh elements.
void set(ElementErrorFlag e)
Set a specific flag.
virtual const Element * getFace(unsigned i) const =0
Returns the i-th face of the element.
virtual bool testElementNodeOrder() const =0
static ElementErrorCode validate(const Element *e)
Definition PrismRule.cpp:46
static bool isPntInElement(Node const *const *nodes, MathLib::Point3d const &pnt, double eps)
Definition PrismRule.cpp:34
static double computeVolume(Node const *const *element_nodes)
Definition PrismRule.cpp:18
double calcTetrahedronVolume(MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, MathLib::Point3d const &d)
bool isPointInTetrahedron(MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, MathLib::Point3d const &d, double eps)
bool hasZeroVolume(MeshLib::Element const &element)
Returns true if the element has zero length/area/volume.
Definition Element.cpp:119