Rheolef  7.1
an efficient C++ finite element environment
bubble.cc
Go to the documentation of this file.
1 // file automatically generated by "../../../rheolef/fem/lib/basis_symbolic_cxx.cc"
22 #include "bubble.h"
23 #include "piola_fem_lagrange.h"
24 namespace rheolef {
25 using namespace std;
26 template<class T>
27 class basis_bubble_p {
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_bubble_e {
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 class basis_bubble_t {
46 public:
47  typedef basis_rep<T> base;
48  typedef typename base::size_type size_type;
49  static void evaluate (const point_basic<T>& hat_x, Eigen::Matrix<T,Eigen::Dynamic,1>& values);
50  static void grad_evaluate (const point_basic<T>& hat_x, Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values);
51  static void hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&);
52 };
53 template<class T>
54 class basis_bubble_T {
55 public:
56  typedef basis_rep<T> base;
57  typedef typename base::size_type size_type;
58  static void evaluate (const point_basic<T>& hat_x, Eigen::Matrix<T,Eigen::Dynamic,1>& values);
59  static void grad_evaluate (const point_basic<T>& hat_x, Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values);
60  static void hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&);
61 };
62 template<class T>
63 void
65  const point_basic<T>& hat_x,
66  Eigen::Matrix<T,Eigen::Dynamic,1>& values)
67 {
68  values.resize(1);
69  values[0] = 1.0;
70 }
71 template<class T>
72 void
73 basis_bubble_p<T>::grad_evaluate (
74  const point_basic<T>& hat_x,
75  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
76 {
77  values.resize(1);
78 }
79 template<class T>
80 void
81 basis_bubble_p<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
82 {
83  x.resize(1);
84  x[0] = point_basic<T>();
85 }
86 template<class T>
87 void
89  const point_basic<T>& hat_x,
90  Eigen::Matrix<T,Eigen::Dynamic,1>& values)
91 {
92  values.resize(1);
93  values[0] = 4.0*hat_x[0]+-4.0*(hat_x[0]*hat_x[0]);
94 }
95 template<class T>
96 void
97 basis_bubble_e<T>::grad_evaluate (
98  const point_basic<T>& hat_x,
99  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
100 {
101  values.resize(1);
102  values[0][0] = -8.0*hat_x[0]+4.0;
103 }
104 template<class T>
105 void
106 basis_bubble_e<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
107 {
108  x.resize(1);
109  x[0] = point_basic<T>(5.0000000000000000e-01);
110 }
111 template<class T>
112 void
114  const point_basic<T>& hat_x,
115  Eigen::Matrix<T,Eigen::Dynamic,1>& values)
116 {
117  values.resize(1);
118  values[0] = -27.0*hat_x[1]*( (hat_x[0]*hat_x[0])-hat_x[0])+-27.0*(hat_x[1]*hat_x[1])*hat_x[0];
119 }
120 template<class T>
121 void
122 basis_bubble_t<T>::grad_evaluate (
123  const point_basic<T>& hat_x,
124  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
125 {
126  values.resize(1);
127  values[0][0] = -27.0*(hat_x[1]*hat_x[1])+-27.0*( 2.0*hat_x[0]-1.0)*hat_x[1];
128  values[0][1] = -54.0*hat_x[0]*hat_x[1]+27.0*hat_x[0]+-27.0*(hat_x[0]*hat_x[0]);
129 }
130 template<class T>
131 void
132 basis_bubble_t<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
133 {
134  x.resize(1);
135  x[0] = point_basic<T>((1.0/3.0), (1.0/3.0));
136 }
137 template<class T>
138 void
140  const point_basic<T>& hat_x,
141  Eigen::Matrix<T,Eigen::Dynamic,1>& values)
142 {
143  values.resize(1);
144  values[0] = -256.0*hat_x[0]*hat_x[1]*(hat_x[2]*hat_x[2])+-256.0*hat_x[2]*( hat_x[0]*(hat_x[1]*hat_x[1])-hat_x[1]*( hat_x[0]-(hat_x[0]*hat_x[0])));
145 }
146 template<class T>
147 void
148 basis_bubble_T<T>::grad_evaluate (
149  const point_basic<T>& hat_x,
150  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
151 {
152  values.resize(1);
153  values[0][0] = -256.0*hat_x[1]*(hat_x[2]*hat_x[2])+-256.0*hat_x[2]*( (hat_x[1]*hat_x[1])+hat_x[1]*( 2.0*hat_x[0]-1.0));
154  values[0][1] = -256.0*hat_x[2]*( 2.0*hat_x[1]*hat_x[0]+(hat_x[0]*hat_x[0])-hat_x[0])+-256.0*(hat_x[2]*hat_x[2])*hat_x[0];
155  values[0][2] = -256.0*(hat_x[1]*hat_x[1])*hat_x[0]+-256.0*hat_x[1]*( (hat_x[0]*hat_x[0])-hat_x[0])+-512.0*hat_x[1]*hat_x[2]*hat_x[0];
156 }
157 template<class T>
158 void
159 basis_bubble_T<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
160 {
161  x.resize(1);
162  x[0] = point_basic<T>(2.5000000000000000e-01, 2.5000000000000000e-01, 2.5000000000000000e-01);
163 }
164 template<class T>
166  : base(basis_option()), _hat_node()
167 {
169  base::_name = "bubble";
170  base::_piola_fem.piola_fem<T>::base::operator= (new_macro(piola_fem_lagrange<T>));
171 }
172 template<class T>
174 {
175 }
176 template<class T>
179 {
180  return 4;
181 }
182 template<class T>
183 void
185  reference_element hat_K,
186  const point_basic<T>& hat_x,
187  Eigen::Matrix<T,Eigen::Dynamic,1>& values) const
188 {
189  switch (hat_K.variant()) {
190  case reference_element::p: {
191  return basis_bubble_p<T>::evaluate (hat_x, values);
192  }
193  case reference_element::e: {
194  return basis_bubble_e<T>::evaluate (hat_x, values);
195  }
196  case reference_element::t: {
197  return basis_bubble_t<T>::evaluate (hat_x, values);
198  }
199  case reference_element::T: {
200  return basis_bubble_T<T>::evaluate (hat_x, values);
201  }
202  default : {
203  error_macro ("evaluate: unsupported `" << hat_K.name() << "' element type");
204  }
205  }
206 }
207 template<class T>
208 void
210  reference_element hat_K,
211  const point_basic<T>& hat_x,
212  Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values) const
213 {
214  switch (hat_K.variant()) {
215  case reference_element::p: {
216  return basis_bubble_p<T>::grad_evaluate (hat_x, values);
217  }
218  case reference_element::e: {
219  return basis_bubble_e<T>::grad_evaluate (hat_x, values);
220  }
221  case reference_element::t: {
222  return basis_bubble_t<T>::grad_evaluate (hat_x, values);
223  }
224  case reference_element::T: {
225  return basis_bubble_T<T>::grad_evaluate (hat_x, values);
226  }
227  default : {
228  error_macro ("grad_evaluate: unsupported `" << hat_K.name() << "' element type");
229  }
230  }
231 }
232 template<class T>
233 void
235  reference_element hat_K,
236  const Eigen::Matrix<T,Eigen::Dynamic,1>& f_xnod,
237  Eigen::Matrix<T,Eigen::Dynamic,1>& dof) const
238 {
239  dof = f_xnod;
240 }
241 template<class T>
242 void
244 {
246  0,
247  false,
248  base::_ndof_on_subgeo,
249  base::_nnod_on_subgeo,
250  base::_first_idof_by_dimension,
251  base::_first_inod_by_dimension);
252 }
253 template<class T>
254 void
256  reference_element hat_K) const
257 {
258  switch (hat_K.variant()) {
259  case reference_element::p: {
260  return basis_bubble_p<T>::hat_node (_hat_node[hat_K.variant()]);
261  }
262  case reference_element::e: {
263  return basis_bubble_e<T>::hat_node (_hat_node[hat_K.variant()]);
264  }
265  case reference_element::t: {
266  return basis_bubble_t<T>::hat_node (_hat_node[hat_K.variant()]);
267  }
268  case reference_element::T: {
269  return basis_bubble_T<T>::hat_node (_hat_node[hat_K.variant()]);
270  }
271  default : {
272  error_macro ("hat_node: unsupported `" << hat_K.name() << "' element type");
273  }
274  }
275 }
276 // instantiation in library:
277 template class basis_bubble<Float>;
278 } // namespace rheolef
field::size_type size_type
Definition: branch.cc:425
base::size_type size_type
Definition: bubble.h:34
size_type degree() const
Definition: bubble.cc:178
void _initialize_cstor_sizes() const
Definition: bubble.cc:243
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: bubble.cc:234
void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &values) const
Definition: bubble.cc:184
void grad_evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &values) const
Definition: bubble.cc:209
void _initialize_data(reference_element hat_K) const
Definition: bubble.cc:255
static void initialize_local_first(size_type k, bool is_continuous, std::array< std::array< size_type, reference_element::max_variant >, 4 > &ndof_on_subgeo, std::array< std::array< size_type, reference_element::max_variant >, 4 > &nnod_on_subgeo, std::array< std::array< size_type, 5 >, reference_element::max_variant > &first_idof_by_dimension, std::array< std::array< size_type, 5 >, reference_element::max_variant > &first_inod_by_dimension)
see the basis_option page for the full documentation
Definition: basis_option.h:93
piola_fem< T > _piola_fem
Definition: basis.h:394
std::string _name
Definition: basis.h:392
see the reference_element page for the full documentation
static const variant_type e
static const variant_type p
variant_type variant() const
static const variant_type T
static const variant_type t
size_t size_type
Definition: basis_get.cc:76
point_basic< T >
Definition: piola_fem.h:135
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