Rheolef  7.1
an efficient C++ finite element environment
P1qd.cc
Go to the documentation of this file.
1 // file automatically generated by "../../../rheolef/fem/lib/basis_symbolic_cxx.cc"
22 #include "P1qd.h"
23 #include "piola_fem_lagrange.h"
24 namespace rheolef {
25 using namespace std;
26 template<class T>
27 class basis_P1qd_q {
28 public:
29  typedef basis_rep<T> base;
30  typedef typename base::size_type size_type;
31  static void evaluate (const point_basic<T>& hat_x, Eigen::Matrix<T,Eigen::Dynamic,1>& values);
32  static void grad_evaluate (const point_basic<T>& hat_x, Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values);
33  static void hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&);
34 };
35 template<class T>
36 class basis_P1qd_H {
37 public:
38  typedef basis_rep<T> base;
39  typedef typename base::size_type size_type;
40  static void evaluate (const point_basic<T>& hat_x, Eigen::Matrix<T,Eigen::Dynamic,1>& values);
41  static void grad_evaluate (const point_basic<T>& hat_x, Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values);
42  static void hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&);
43 };
44 template<class T>
45 void
47  const point_basic<T>& hat_x,
48  Eigen::Matrix<T,Eigen::Dynamic,1>& values)
49 {
50  values.resize(3);
51  values[0] = hat_x[1]+5.0000000000000000e-01;
52  values[1] = hat_x[0]-hat_x[1];
53  values[2] = -hat_x[0]+5.0000000000000000e-01;
54 }
55 template<class T>
56 void
57 basis_P1qd_q<T>::grad_evaluate (
58  const point_basic<T>& hat_x,
59  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
60 {
61  values.resize(3);
62  values[0][0] = 0.0;
63  values[0][1] = 1.0;
64  values[1][0] = 1.0;
65  values[1][1] = -1.0000000000000000e+00;
66  values[2][0] = -1.0000000000000000e+00;
67  values[2][1] = 0.0;
68 }
69 template<class T>
70 void
71 basis_P1qd_q<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
72 {
73  x.resize(3);
74  x[0] = point_basic<T>(5.0000000000000000e-01, 5.0000000000000000e-01);
75  x[1] = point_basic<T>(5.0000000000000000e-01, -5.0000000000000000e-01);
76  x[2] = point_basic<T>(-5.0000000000000000e-01, -5.0000000000000000e-01);
77 }
78 template<class T>
79 void
81  const point_basic<T>& hat_x,
82  Eigen::Matrix<T,Eigen::Dynamic,1>& values)
83 {
84  values.resize(4);
85  values[0] = hat_x[2]+5.0000000000000000e-01;
86  values[1] = hat_x[1]-hat_x[2];
87  values[2] = hat_x[0]-hat_x[1];
88  values[3] = -hat_x[0]+5.0000000000000000e-01;
89 }
90 template<class T>
91 void
92 basis_P1qd_H<T>::grad_evaluate (
93  const point_basic<T>& hat_x,
94  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
95 {
96  values.resize(4);
97  values[0][0] = 0.0;
98  values[0][1] = 0.0;
99  values[0][2] = 1.0;
100  values[1][0] = 0.0;
101  values[1][1] = 1.0;
102  values[1][2] = -1.0000000000000000e+00;
103  values[2][0] = 1.0;
104  values[2][1] = -1.0000000000000000e+00;
105  values[2][2] = 0.0;
106  values[3][0] = -1.0000000000000000e+00;
107  values[3][1] = 0.0;
108  values[3][2] = 0.0;
109 }
110 template<class T>
111 void
112 basis_P1qd_H<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
113 {
114  x.resize(4);
115  x[0] = point_basic<T>(5.0000000000000000e-01, 5.0000000000000000e-01, 5.0000000000000000e-01);
116  x[1] = point_basic<T>(5.0000000000000000e-01, 5.0000000000000000e-01, -5.0000000000000000e-01);
117  x[2] = point_basic<T>(5.0000000000000000e-01, -5.0000000000000000e-01, -5.0000000000000000e-01);
118  x[3] = point_basic<T>(-5.0000000000000000e-01, -5.0000000000000000e-01, -5.0000000000000000e-01);
119 }
120 template<class T>
122  : base(basis_option()), _hat_node()
123 {
126  base::_name = "P1qd";
127  base::_piola_fem.piola_fem<T>::base::operator= (new_macro(piola_fem_lagrange<T>));
128 }
129 template<class T>
131 {
132 }
133 template<class T>
136 {
137  return 1;
138 }
139 template<class T>
140 void
142  reference_element hat_K,
143  const point_basic<T>& hat_x,
144  Eigen::Matrix<T,Eigen::Dynamic,1>& values) const
145 {
146  switch (hat_K.variant()) {
147  case reference_element::q: {
148  return basis_P1qd_q<T>::evaluate (hat_x, values);
149  }
150  case reference_element::H: {
151  return basis_P1qd_H<T>::evaluate (hat_x, values);
152  }
153  default : {
154  error_macro ("evaluate: unsupported `" << hat_K.name() << "' element type");
155  }
156  }
157 }
158 template<class T>
159 void
161  reference_element hat_K,
162  const point_basic<T>& hat_x,
163  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values) const
164 {
165  switch (hat_K.variant()) {
166  case reference_element::q: {
167  return basis_P1qd_q<T>::grad_evaluate (hat_x, values);
168  }
169  case reference_element::H: {
170  return basis_P1qd_H<T>::grad_evaluate (hat_x, values);
171  }
172  default : {
173  error_macro ("grad_evaluate: unsupported `" << hat_K.name() << "' element type");
174  }
175  }
176 }
177 template<class T>
178 void
180  reference_element hat_K,
181  const Eigen::Matrix<T,Eigen::Dynamic,1>& f_xnod,
182  Eigen::Matrix<T,Eigen::Dynamic,1>& dof) const
183 {
184  dof = f_xnod;
185 }
186 template<class T>
187 void
189 {
190  fatal_macro("::_initialize_cstor_sizes: not yet"); /* TODO */
191 }
192 template<class T>
193 void
195  reference_element hat_K) const
196 {
197  switch (hat_K.variant()) {
198  case reference_element::q: {
199  return basis_P1qd_q<T>::hat_node (_hat_node[hat_K.variant()]);
200  }
201  case reference_element::H: {
202  return basis_P1qd_H<T>::hat_node (_hat_node[hat_K.variant()]);
203  }
204  default : {
205  error_macro ("hat_node: unsupported `" << hat_K.name() << "' element type");
206  }
207  }
208 }
209 // instantiation in library:
210 template class basis_P1qd<Float>;
211 } // namespace rheolef
field::size_type size_type
Definition: branch.cc:425
base::size_type size_type
Definition: P1qd.h:32
void _initialize_cstor_sizes() const
Definition: P1qd.cc:188
void _compute_dofs(reference_element hat_K, const Eigen::Matrix< T, Eigen::Dynamic, 1 > &f_xnod, Eigen::Matrix< T, Eigen::Dynamic, 1 > &dof) const
Definition: P1qd.cc:179
void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &values) const
Definition: P1qd.cc:141
size_type degree() const
Definition: P1qd.cc:135
void grad_evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &values) const
Definition: P1qd.cc:160
void _initialize_data(reference_element hat_K) const
Definition: P1qd.cc:194
see the basis_option page for the full documentation
Definition: basis_option.h:93
void set_continuous(bool c=true)
Definition: basis_option.h:269
piola_fem< T > _piola_fem
Definition: basis.h:394
basis_option _sopt
Definition: basis.h:393
std::string _name
Definition: basis.h:392
see the reference_element page for the full documentation
static const variant_type H
static const variant_type q
variant_type variant() const
size_t size_type
Definition: basis_get.cc:76
point_basic< T >
Definition: piola_fem.h:135
#define error_macro(message)
Definition: dis_macros.h:49
#define fatal_macro(message)
Definition: dis_macros.h:33
Expr1::float_type T
Definition: field_expr.h:261
This file is part of Rheolef.
void evaluate(const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const