OGS
MeshLib::LineRule2 Class Reference

Detailed Description

A 1d Edge or Line Element.

0--------1

Definition at line 27 of file LineRule2.h.

#include <LineRule2.h>

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

Public Types

using EdgeReturn = MeshLib::LinearEdgeReturn
 Edge rule. More...
 

Static Public Member Functions

static bool isPntInElement (Node const *const *nodes, MathLib::Point3d const &pnt, double eps)
 
static ElementErrorCode validate (const Element *e)
 
static unsigned identifyFace (Node const *const *, Node const *nodes[1])
 Returns the ID of a face given an array of nodes. More...
 
static double computeVolume (Node const *const *_nodes)
 Calculates the length of a line. More...
 
- Static Public Member Functions inherited from MeshLib::EdgeRule
static const ElementgetFace (const Element *, unsigned)
 Returns the i-th face of the element. More...
 
static bool testElementNodeOrder (Element const &)
 

Static Public Attributes

static const unsigned n_base_nodes = 2u
 Constant: The number of base nodes for this element. More...
 
static const unsigned n_all_nodes = 2u
 Constant: The number of all nodes for this element. More...
 
static const MeshElemType mesh_elem_type = MeshElemType::LINE
 Constant: The geometric type of the element. More...
 
static const CellType cell_type = CellType::LINE2
 Constant: The FEM type of the element. More...
 
static const unsigned n_neighbors = 2
 Constant: The number of neighbors. More...
 
static const unsigned edge_nodes [1][2]
 Constant: Local node index table for edge. More...
 
- Static Public Attributes inherited from MeshLib::EdgeRule
static const unsigned dimension = 1u
 Constant: Dimension of this mesh element. More...
 
static const unsigned n_faces = 0
 Constant: The number of faces. More...
 
static const unsigned n_edges = 1
 Constant: The number of edges. More...
 

Member Typedef Documentation

◆ EdgeReturn

Edge rule.

Definition at line 49 of file LineRule2.h.

Member Function Documentation

◆ computeVolume()

double MeshLib::LineRule2::computeVolume ( Node const *const *  _nodes)
static

Calculates the length of a line.

Definition at line 22 of file LineRule2.cpp.

23 {
24  return std::sqrt(MathLib::sqrDist(*_nodes[0], *_nodes[1]));
25 }
double sqrDist(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
Definition: Point3d.h:48

References MathLib::sqrDist().

◆ identifyFace()

unsigned MeshLib::LineRule2::identifyFace ( Node const *const *  _nodes,
Node const *  nodes[1] 
)
static

Returns the ID of a face given an array of nodes.

Definition at line 37 of file LineRule2.cpp.

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 }

◆ isPntInElement()

bool MeshLib::LineRule2::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 27 of file LineRule2.cpp.

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 }
double calcProjPntToLineAndDists(Point3d const &pp, Point3d const &pa, Point3d const &pb, double &lambda, double &d0)
Definition: MathTools.cpp:19

References MathLib::calcProjPntToLineAndDists().

◆ validate()

ElementErrorCode MeshLib::LineRule2::validate ( const Element e)
static

Tests if the element is geometrically valid.

Definition at line 51 of file LineRule2.cpp.

52 {
53  ElementErrorCode error_code;
55  return error_code;
56 }
Collects error flags for mesh elements.
bool hasZeroVolume(MeshLib::Element const &element)
Returns true if the element has zero length/area/volume.
Definition: Element.cpp:121

References MeshLib::hasZeroVolume(), and ZeroVolume.

Member Data Documentation

◆ cell_type

const CellType MeshLib::LineRule2::cell_type = CellType::LINE2
static

Constant: The FEM type of the element.

Definition at line 40 of file LineRule2.h.

◆ edge_nodes

const unsigned MeshLib::LineRule2::edge_nodes
static
Initial value:
= {
{0, 1}
}

Constant: Local node index table for edge.

Definition at line 46 of file LineRule2.h.

◆ mesh_elem_type

const MeshElemType MeshLib::LineRule2::mesh_elem_type = MeshElemType::LINE
static

Constant: The geometric type of the element.

Definition at line 37 of file LineRule2.h.

◆ n_all_nodes

const unsigned MeshLib::LineRule2::n_all_nodes = 2u
static

Constant: The number of all nodes for this element.

Definition at line 34 of file LineRule2.h.

◆ n_base_nodes

const unsigned MeshLib::LineRule2::n_base_nodes = 2u
static

Constant: The number of base nodes for this element.

Definition at line 31 of file LineRule2.h.

◆ n_neighbors

const unsigned MeshLib::LineRule2::n_neighbors = 2
static

Constant: The number of neighbors.

Definition at line 43 of file LineRule2.h.


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