OGS
TriRule3.cpp
Go to the documentation of this file.
1 
11 #include "TriRule3.h"
12 
14 #include "MeshLib/Node.h"
15 
16 namespace MeshLib
17 {
18 const unsigned TriRule3::edge_nodes[3][2] = {
19  {0, 1}, // Edge 0
20  {1, 2}, // Edge 1
21  {2, 0}, // Edge 2
22 };
23 
24 double TriRule3::computeVolume(Node const* const* _nodes)
25 {
26  return MathLib::calcTriangleArea(*_nodes[0], *_nodes[1], *_nodes[2]);
27 }
28 
29 bool TriRule3::isPntInElement(Node const* const* nodes,
30  MathLib::Point3d const& pnt, double eps)
31 {
32  return MathLib::isPointInTriangle(pnt, *nodes[0], *nodes[1], *nodes[2],
33  eps);
34 }
35 
36 unsigned TriRule3::identifyFace(Node const* const* _nodes, Node const* nodes[3])
37 {
38  for (unsigned i = 0; i < 3; i++)
39  {
40  unsigned flag(0);
41  for (unsigned j = 0; j < 2; j++)
42  {
43  for (unsigned k = 0; k < 2; k++)
44  {
45  if (_nodes[edge_nodes[i][j]] == nodes[k])
46  {
47  flag++;
48  }
49  }
50  }
51  if (flag == 2)
52  {
53  return i;
54  }
55  }
56  return std::numeric_limits<unsigned>::max();
57 }
58 
60 {
61  ElementErrorCode error_code;
64  return error_code;
65 }
66 
67 } // end namespace MeshLib
Definition of the Node class.
Collects error flags for mesh elements.
virtual bool testElementNodeOrder() const =0
static ElementErrorCode validate(const Element *e)
Definition: TriRule3.cpp:59
static bool isPntInElement(Node const *const *nodes, MathLib::Point3d const &pnt, double eps)
Definition: TriRule3.cpp:29
static unsigned identifyFace(Node const *const *, Node const *nodes[3])
Returns the ID of a face given an array of nodes.
Definition: TriRule3.cpp:36
static double computeVolume(Node const *const *_nodes)
Calculates the volume of a convex hexahedron by partitioning it into six tetrahedra.
Definition: TriRule3.cpp:24
static const unsigned edge_nodes[3][2]
Constant: Local node index table for edge.
Definition: TriRule3.h:60
double calcTriangleArea(MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c)
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)
bool hasZeroVolume(MeshLib::Element const &element)
Returns true if the element has zero length/area/volume.
Definition: Element.cpp:119