Flow123d  release_2.2.0-914-gf1a3a4f
ngh_interface.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file ngh_interface.hh
15  * @brief
16  */
17 
18 #ifndef NGH_INTERFACE_HH_
19 #define NGH_INTERFACE_HH_
20 
21 #include "mesh/elements.h"
23 #include "mesh/ngh/include/point.h"
26 
27 namespace ngh {
28  /**
29  * Create tetrahedron from element
30  */
32  OLD_ASSERT(( ele->dim() == 3 ), "Dimension of element must be 3!\n");
33 
34  te.SetPoints(TPoint(ele->node[0]->point()(0), ele->node[0]->point()(1), ele->node[0]->point()(2)),
35  TPoint(ele->node[1]->point()(0), ele->node[1]->point()(1), ele->node[1]->point()(2)),
36  TPoint(ele->node[2]->point()(0), ele->node[2]->point()(1), ele->node[2]->point()(2)),
37  TPoint(ele->node[3]->point()(0), ele->node[3]->point()(1), ele->node[3]->point()(2)) );
38  }
39 
40  /**
41  * Create triangle from element
42  */
43  inline void set_triangle_from_element(TTriangle &tr, const Element *ele) {
44  OLD_ASSERT(( ele->dim() == 2 ), "Dimension of element must be 2!\n");
45 
46  tr.SetPoints(TPoint(ele->node[0]->point()(0), ele->node[0]->point()(1), ele->node[0]->point()(2)),
47  TPoint(ele->node[1]->point()(0), ele->node[1]->point()(1), ele->node[1]->point()(2)),
48  TPoint(ele->node[2]->point()(0), ele->node[2]->point()(1), ele->node[2]->point()(2)) );
49  }
50 
51  /**
52  * Create abscissa from element
53  */
54  inline void set_abscissa_from_element(TAbscissa &ab, const Element *ele) {
55  OLD_ASSERT(( ele->dim() == 1 ), "Dimension of element must be 1!\n");
56 
57  ab.SetPoints(TPoint(ele->node[0]->point()(0), ele->node[0]->point()(1), ele->node[0]->point()(2)),
58  TPoint(ele->node[1]->point()(0), ele->node[1]->point()(1), ele->node[1]->point()(2)) );
59  }
60 
61  /**
62  * Create point from element
63  */
64  inline void set_point_from_element(TPoint &p, const Element *ele) {
65  OLD_ASSERT(( ele->dim() == 0 ), "Dimension of element must be 0!\n");
66 
67  p.SetCoord( ele->node[0]->point()(0), ele->node[0]->point()(1), ele->node[0]->point()(2) );
68  }
69 
70 } // namespace ngh
71 
72 #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)
Definition: abscissa.h:25
Node ** node
Definition: elements.h:90
void set_tetrahedron_from_element(TTetrahedron &te, Element *ele)
void SetPoints(const TPoint &, const TPoint &)
Definition: abscissa.cpp:68
unsigned int dim() const
#define OLD_ASSERT(...)
Definition: global_defs.h:131
void set_abscissa_from_element(TAbscissa &ab, const Element *ele)
void SetCoord(double, double, double)
Definition: point.cpp:99
void set_triangle_from_element(TTriangle &tr, const Element *ele)
void SetPoints(const TPoint &, const TPoint &, const TPoint &)
Definition: triangle.cpp:129
arma::vec3 & point()
Definition: nodes.hh:68