Loading [MathJax]/jax/input/TeX/config.js
NiHu  2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
line_1_gauss_shape_set.hpp
Go to the documentation of this file.
1 
5 #ifndef LINE_1_GAUSS_SHAPE_SET_HPP_INCLUDED
6 #define LINE_1_GAUSS_SHAPE_SET_HPP_INCLUDED
7 
8 #include "../core/shapeset.hpp"
9 #include "lib_domain.hpp"
10 
11 // define the new shape set's traits
12 namespace NiHu
13 {
14 
15 // predefine the new shape set
16 class line_1_gauss_shape_set;
17 
18 namespace shape_set_traits
19 {
22  // the shape set is defined over the line domain
23  template <>
25 
26  // it has 2 shapeset nodes
27  template <>
28  struct num_nodes<line_1_gauss_shape_set> { enum { value = 2 }; };
29 
32  // N(xi) is first order
33  template <>
34  struct polynomial_order<line_1_gauss_shape_set> { enum { value = 1 }; };
35 
36  // if used as geometrical shape set, Jacobian is 0-st order in xi
37  template <>
38  struct jacobian_order<line_1_gauss_shape_set> { enum { value = 0 }; };
39 
40  // N(xi) is computed on the fly
41  template <>
43  {
45  };
46 
47  // N'(xi) is constant
48  template <>
50  {
52  };
53 
54  // N''(xi) is zero
55  template <>
57  {
59  };
60 
61  // DOF locations are inside the element (1DOF)
62  template <>
64  {
66  };
67 
68  template <>
70  {
72  };
73 } // end of namespace shape_set_traits
74 
75 
76 // define the new shape set class
78  : public NiHu::shape_set_base<line_1_gauss_shape_set>
79 {
80 public:
81  // return iterator to corners
82  static corner_iterator_t corner_begin_impl(void)
83  {
84  return m_corners.cbegin();
85  }
86 
87 protected:
88  static const corners_t m_corners;
89 };
90 
91 // define expression for computing the zeroth order derivative N(xi)
92 template <>
94 {
95  typedef shape_set_traits::shape_value_type<line_1_gauss_shape_set, 0>::type shape_t;
97 public:
98  static shape_t eval(xi_t const &_xi)
99  {
100  auto xi = _xi[0];
101  return ( line_1_gauss_shape_set::shape_t() <<
102  (1.0 - std::sqrt(3.0)*xi),
103  (1.0 + std::sqrt(3.0)*xi)
104  ).finished() / 2.0;
105  }
106 };
107 
108 
109 // define expression for computing the first order derivative N(xi)
110 template <>
112 {
113  typedef shape_set_traits::shape_value_type<line_1_gauss_shape_set, 1>::type shape_t;
115 public:
116  static shape_t eval(xi_t const &)
117  {
118  return ( line_1_gauss_shape_set::dshape_t() <<
119  -std::sqrt(3.0),
120  +std::sqrt(3.0)
121  ).finished() / 2.0;
122  }
123 };
124 
125 
126 // define expression for computing the first order derivative N(xi)
127 template <>
129 {
130  typedef shape_set_traits::shape_value_type<line_1_gauss_shape_set, 2>::type shape_t;
132 public:
133  static shape_t eval(xi_t const &)
134  {
135  return shape_t::Zero();
136  }
137 };
138 
139 } // end of namespace NiHu
140 
141 #endif // LINE_1_GAUSS_SHAPE_SET_HPP_INCLUDED
NiHu::shape_set_traits::domain
Defines the domain where the shape function set is defined.
Definition: shapeset.hpp:106
NiHu::shape_set_traits::position_dof_vector
defines the nodal degrees of freedoms of the shape functions
Definition: shapeset.hpp:164
NiHu::shape_set_base
Shapeset base class for CRTP.
Definition: shapeset.hpp:195
tmp::vector
Compile time vector with an arbitrary number of arguments.
Definition: vector.hpp:42
NiHu::line_domain
a 1D line domain
Definition: lib_domain.hpp:53
NiHu::line_1_gauss_shape_set
Definition: line_1_gauss_shape_set.hpp:77
NiHu::shape_set_traits::jacobian_order
Defines the polynomial order of the shape set's Jacobian.
Definition: shapeset.hpp:130
NiHu::shape_set_traits::num_nodes
Defines the number of shape functions in the set.
Definition: shapeset.hpp:110
NiHu::matrix_function_complexity::zero
the returned matrix is a zero expression
Definition: conditional_precompute.hpp:36
NiHu::shape_set_traits::polynomial_order
Defines the polynomial order of the shape set.
Definition: shapeset.hpp:124
NiHu::matrix_function_complexity::general
the returned matrix should be computed on the fly
Definition: conditional_precompute.hpp:40
lib_domain.hpp
implementation of library domains
NiHu::matrix_function_complexity::constant
the returned matrix is constant and can be stored
Definition: conditional_precompute.hpp:38
NiHu::shape_function
Definition: shapeset.hpp:82
NiHu::shape_set_traits::shape_complexity
Defines the complexity to determine if the shape functions can be precomputed or not.
Definition: shapeset.hpp:134
NiHu::shape_set_traits::corner_index_vector
Definition: shapeset.hpp:176