OGS
PyramidRule.cpp
Go to the documentation of this file.
1
10#include "PyramidRule.h"
11
13#include "MeshLib/Node.h"
14#include "Quad.h"
15
16namespace MeshLib
17{
18double PyramidRule::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[4]) +
24 MathLib::calcTetrahedronVolume(*element_nodes[2],
25 *element_nodes[3],
26 *element_nodes[0],
27 *element_nodes[4]);
28}
29
30bool PyramidRule::isPntInElement(Node const* const* nodes,
31 MathLib::Point3d const& pnt,
32 double eps)
33{
35 pnt, *nodes[0], *nodes[1], *nodes[2], *nodes[4], eps) ||
37 pnt, *nodes[0], *nodes[2], *nodes[3], *nodes[4], eps));
38}
39
41{
42 ElementErrorCode error_code;
44
45 std::unique_ptr<MeshLib::Quad const> const base{
46 dynamic_cast<MeshLib::Quad const*>(e->getFace(4))};
47 if (base)
48 {
49 error_code |= base->validate();
51 }
52 else
53 {
55 }
56
57 return error_code;
58}
59
60} // 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)
static double computeVolume(Node const *const *element_nodes)
static bool isPntInElement(Node const *const *nodes, MathLib::Point3d const &pnt, double eps)
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