Loading [MathJax]/extensions/tex2jax.js
NiHu  2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
elements.cpp
1 #include <iostream>
2 #include "core/element.hpp"
3 #include "library/lib_shape.hpp"
4 
5 void volume()
6 {
10 
12  Element::coords_t coords;
13  coords <<
14  0.0, 1.0, 1.0, 0.0,
15  0.0, 0.0, 1.0, 1.0;
16 
17  Element elem(coords);
19 
21  Element::xi_t xi;
22  xi << 0.0, 0.0;
24 
26  std::cout << "location:\n" << elem.get_x(xi) << std::endl;
28 
30  std::cout << "gradient:\n" << elem.get_dx(xi) << std::endl;
31  std::cout << "jacobian:\n" << elem.get_dx(xi).determinant() << std::endl;
33 
35  std::cout << "2nd derivative:\n" << elem.get_ddx(xi) << std::endl;
37 }
38 
39 
40 void surface()
41 {
44 
45  Element::coords_t coords;
46  coords <<
47  0.0, 1.0, 1.0, 0.0,
48  0.0, 0.0, 1.0, 1.0,
49  0.0, 0.0, 0.0, 0.0;
50 
51  Element elem(coords);
52 
53  Element::xi_t xi;
54  xi << 0.0, 0.0;
55 
56  std::cout << "location:\n" << elem.get_x(xi) << std::endl;
58 
60  std::cout << "gradient:\n" << elem.get_dx(xi) << std::endl;
61  std::cout << "normal:\n" << elem.get_normal(xi) << std::endl;
62  std::cout << "jacobian:\n" << elem.get_normal(xi).norm() << std::endl;
64 
66  std::cout << "2nd derivative:\n" << elem.get_ddx(xi) << std::endl;
68 }
69 
70 int main()
71 {
72  volume();
73  surface();
74  return 0;
75 }
NiHu::surface_element
class describing a surface element that provides a normal vector
Definition: element.hpp:451
element.hpp
Declaration of element classes.
lib_shape.hpp
definition of shape function sets
NiHu::volume_element
class describing a volume element that has no normal vector
Definition: element.hpp:455