NiHu  2.0
tria_1_gauss_shape_set.hpp
1 #ifndef TRIA_1_GAUSS_SHAPE_SET_HPP_INCLUDED
2 #define TRIA_1_GAUSS_SHAPE_SET_HPP_INCLUDED
3 
4 #include "../core/shapeset.hpp"
5 #include "lib_domain.hpp"
6 
7 // define the new shape set's traits
8 namespace NiHu
9 {
10 
11 // predefine the new shape set
12 class tria_1_gauss_shape_set;
13 
14 namespace shape_set_traits
15 {
16  // the shape set is defined over the tria domain
17  template <>
19 
20  // it has 4 shapeset nodes
21  template <>
22  struct num_nodes<tria_1_gauss_shape_set> { enum { value = 3 }; };
23 
24  // if used as geometrical shape set, Jacobian is 1-st order in xi/eta
25  template <>
26  struct jacobian_order<tria_1_gauss_shape_set> { enum { value = 0 }; };
27 
28  // N(xi,eta) is first order
29  template <>
30  struct polynomial_order<tria_1_gauss_shape_set> { enum { value = 1 }; };
31 
32  // N(xi, eta) is computed on the fly
33  template <>
35  {
37  };
38 
39  // N'(xi, eta) is constant
40  template <>
42  {
44  };
45 
46  // N''(xi, eta) is zero
47  template <>
49  {
51  };
52 
53  // DOF locations are inside the element (2DOF)
54  template <>
56  {
58  };
59 
60  template <>
62  {
64  };
65 
66 } // end of namespace shape_set_traits
67 
68 
69 // define the new shape set class
71  : public shape_set_base<tria_1_gauss_shape_set>
72 {
74 public:
75 
76  using base_t::corner_at;
77 
78  // return iterator to corners
79  static corner_iterator_t corner_begin_impl()
80  {
81  return m_corners.cbegin();
82  }
83 
84 protected:
85  static const corners_t m_corners;
86 };
87 
88 // define expression for computing the zeroth order derivative N(xi, eta)
89 template <>
91 {
92  typedef shape_set_traits::shape_value_type<tria_1_gauss_shape_set, 0>::type shape_t;
94 public:
95  static shape_t eval(xi_t const &_xi)
96  {
97  auto xi = _xi[0], eta = _xi[1];
98  return ( tria_1_gauss_shape_set::shape_t() <<
99  5./3. - 2.*xi - 2.*eta,
100  2. * xi - 1./3.,
101  2. * eta - 1./3.
102  ).finished();
103  }
104 };
105 
106 
107 // define expression for computing the first order derivative N(xi, eta)
108 template <>
110 {
111  typedef shape_set_traits::shape_value_type<tria_1_gauss_shape_set, 1>::type shape_t;
113 public:
114  static shape_t eval(xi_t const &)
115  {
116  return ( tria_1_gauss_shape_set::dshape_t() <<
117  -2., -2.,
118  2., 0.,
119  0., 2.
120  ).finished();
121  }
122 };
123 
124 } // end of namespace NiHu
125 
126 #endif // TRIA_1_GAUSS_SHAPE_SET_HPP_INCLUDED
NiHu::tria_domain
a 2D triangle domain
Definition: lib_domain.hpp:101
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
tmp::vector
Compile time vector with an arbitrary number of arguments.
Definition: vector.hpp:42
NiHu::tria_1_gauss_shape_set
Definition: tria_1_gauss_shape_set.hpp:70
NiHu::shape_set_base
Shapeset base class for CRTP.
Definition: shapeset.hpp:195
NiHu::shape_set_traits::corner_index_vector
Definition: shapeset.hpp:176
NiHu::shape_set_traits::jacobian_order
Defines the polynomial order of the shape set's Jacobian.
Definition: shapeset.hpp:130
NiHu::matrix_function_complexity::constant
the returned matrix is constant and can be stored
Definition: conditional_precompute.hpp:38
NiHu::matrix_function_complexity::general
the returned matrix should be computed on the fly
Definition: conditional_precompute.hpp:40
NiHu::matrix_function_complexity::zero
the returned matrix is a zero expression
Definition: conditional_precompute.hpp:36
lib_domain.hpp
implementation of library domains
NiHu::shape_set_traits::polynomial_order
Defines the polynomial order of the shape set.
Definition: shapeset.hpp:124
NiHu::shape_set_traits::num_nodes
Defines the number of shape functions in the set.
Definition: shapeset.hpp:110
NiHu::shape_function
Definition: shapeset.hpp:82
NiHu::shape_set_base< tria_1_gauss_shape_set >::corner_at
static const xi_t & corner_at(size_t idx)
return corner at a given node number
Definition: shapeset.hpp:255
NiHu::shape_set_traits::shape_complexity
Defines the complexity to determine if the shape functions can be precomputed or not.
Definition: shapeset.hpp:134