Flow123d  jenkins-Flow123d-linux-release-multijob-198
ngh_interface.hh
Go to the documentation of this file.
1 /*
2  * ngh_interface.hh
3  *
4  * Created on: Apr 18, 2014
5  * Author: jb
6  */
7 
8 #ifndef NGH_INTERFACE_HH_
9 #define NGH_INTERFACE_HH_
10 
11 #include "mesh/elements.h"
13 #include "mesh/ngh/include/point.h"
16 
17 namespace ngh {
18  /**
19  * Create tetrahedron from element
20  */
22  ASSERT(( ele->dim() == 3 ), "Dimension of element must be 3!\n");
23 
24  te.SetPoints(TPoint(ele->node[0]->point()(0), ele->node[0]->point()(1), ele->node[0]->point()(2)),
25  TPoint(ele->node[1]->point()(0), ele->node[1]->point()(1), ele->node[1]->point()(2)),
26  TPoint(ele->node[2]->point()(0), ele->node[2]->point()(1), ele->node[2]->point()(2)),
27  TPoint(ele->node[3]->point()(0), ele->node[3]->point()(1), ele->node[3]->point()(2)) );
28  }
29 
30  /**
31  * Create triangle from element
32  */
33  inline void set_triangle_from_element(TTriangle &tr, const Element *ele) {
34  ASSERT(( ele->dim() == 2 ), "Dimension of element must be 2!\n");
35 
36  tr.SetPoints(TPoint(ele->node[0]->point()(0), ele->node[0]->point()(1), ele->node[0]->point()(2)),
37  TPoint(ele->node[1]->point()(0), ele->node[1]->point()(1), ele->node[1]->point()(2)),
38  TPoint(ele->node[2]->point()(0), ele->node[2]->point()(1), ele->node[2]->point()(2)) );
39  }
40 
41  /**
42  * Create abscissa from element
43  */
44  inline void set_abscissa_from_element(TAbscissa &ab, const Element *ele) {
45  ASSERT(( ele->dim() == 1 ), "Dimension of element must be 1!\n");
46 
47  ab.SetPoints(TPoint(ele->node[0]->point()(0), ele->node[0]->point()(1), ele->node[0]->point()(2)),
48  TPoint(ele->node[1]->point()(0), ele->node[1]->point()(1), ele->node[1]->point()(2)) );
49  }
50 
51  /**
52  * Create point from element
53  */
54  inline void set_point_from_element(TPoint &p, const Element *ele) {
55  ASSERT(( ele->dim() == 0 ), "Dimension of element must be 0!\n");
56 
57  p.SetCoord( ele->node[0]->point()(0), ele->node[0]->point()(1), ele->node[0]->point()(2) );
58  }
59 
60 } // namespace ngh
61 
62 #endif /* NGH_INTERFACE_HH_ */
void SetPoints(const TPoint &P1, const TPoint &P2, const TPoint &P3, const TPoint &P4)
void set_point_from_element(TPoint &p, const Element *ele)
void SetPoints(const TPoint &, const TPoint &)
Definition: abscissa.cpp:48
Node ** node
Definition: elements.h:90
void set_tetrahedron_from_element(TTetrahedron &te, Element *ele)
unsigned int dim() const
#define ASSERT(...)
Definition: global_defs.h:121
Definition: point.h:10
void SetPoints(const TPoint &, const TPoint &, const TPoint &)
Definition: triangle.cpp:111
void SetCoord(double, double, double)
Definition: point.cpp:79
void set_abscissa_from_element(TAbscissa &ab, const Element *ele)
void set_triangle_from_element(TTriangle &tr, const Element *ele)
arma::vec3 & point()
Definition: nodes.hh:80