OGS
LineRule2.cpp
Go to the documentation of this file.
1 
11 #include "LineRule2.h"
12 
13 #include "MathLib/MathTools.h"
14 #include "MeshLib/Node.h"
15 
16 namespace MeshLib
17 {
18 const unsigned LineRule2::edge_nodes[1][2] = {
19  {0, 1} // Edge 0
20 };
21 
22 double LineRule2::computeVolume(Node const* const* _nodes)
23 {
24  return std::sqrt(MathLib::sqrDist(*_nodes[0], *_nodes[1]));
25 }
26 
27 bool LineRule2::isPntInElement(Node const* const* nodes,
28  MathLib::Point3d const& pnt, double eps)
29 {
30  double tmp;
31  double tmp_dst(0);
32  double const dist = MathLib::calcProjPntToLineAndDists(
33  pnt, *nodes[0], *nodes[1], tmp, tmp_dst);
34  return (dist < eps);
35 }
36 
37 unsigned LineRule2::identifyFace(Node const* const* _nodes,
38  Node const* nodes[1])
39 {
40  if (nodes[0] == _nodes[0])
41  {
42  return 0;
43  }
44  if (nodes[0] == _nodes[1])
45  {
46  return 1;
47  }
48  return std::numeric_limits<unsigned>::max();
49 }
50 
52 {
53  ElementErrorCode error_code;
55  return error_code;
56 }
57 
58 } // end namespace MeshLib
Definition of the Node class.
Collects error flags for mesh elements.
static bool isPntInElement(Node const *const *nodes, MathLib::Point3d const &pnt, double eps)
Definition: LineRule2.cpp:27
static ElementErrorCode validate(const Element *e)
Definition: LineRule2.cpp:51
static const unsigned edge_nodes[1][2]
Constant: Local node index table for edge.
Definition: LineRule2.h:46
static double computeVolume(Node const *const *_nodes)
Calculates the length of a line.
Definition: LineRule2.cpp:22
static unsigned identifyFace(Node const *const *, Node const *nodes[1])
Returns the ID of a face given an array of nodes.
Definition: LineRule2.cpp:37
double calcProjPntToLineAndDists(Point3d const &pp, Point3d const &pa, Point3d const &pb, double &lambda, double &d0)
Definition: MathTools.cpp:19
double sqrDist(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
Definition: Point3d.h:48
bool hasZeroVolume(MeshLib::Element const &element)
Returns true if the element has zero length/area/volume.
Definition: Element.cpp:121