Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
P0.cc
Go to the documentation of this file.
1// file automatically generated by "../../../rheolef/fem/lib/basis_symbolic_cxx.cc"
22#include "P0.h"
23#include "piola_fem_lagrange.h"
24namespace rheolef {
25using namespace std;
26template<class T>
27class basis_P0_p {
28public:
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};
35template<class T>
36class basis_P0_e {
37public:
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};
44template<class T>
45class basis_P0_t {
46public:
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};
53template<class T>
54class basis_P0_q {
55public:
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};
62template<class T>
63class basis_P0_T {
64public:
65 typedef basis_rep<T> base;
66 typedef typename base::size_type size_type;
67 static void evaluate (const point_basic<T>& hat_x, Eigen::Matrix<T,Eigen::Dynamic,1>& values);
68 static void grad_evaluate (const point_basic<T>& hat_x, Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values);
69 static void hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&);
70};
71template<class T>
72class basis_P0_P {
73public:
74 typedef basis_rep<T> base;
75 typedef typename base::size_type size_type;
76 static void evaluate (const point_basic<T>& hat_x, Eigen::Matrix<T,Eigen::Dynamic,1>& values);
77 static void grad_evaluate (const point_basic<T>& hat_x, Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values);
78 static void hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&);
79};
80template<class T>
81class basis_P0_H {
82public:
83 typedef basis_rep<T> base;
84 typedef typename base::size_type size_type;
85 static void evaluate (const point_basic<T>& hat_x, Eigen::Matrix<T,Eigen::Dynamic,1>& values);
86 static void grad_evaluate (const point_basic<T>& hat_x, Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values);
87 static void hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>&);
88};
89template<class T>
90void
91basis_P0_p<T>::evaluate (
92 const point_basic<T>& hat_x,
93 Eigen::Matrix<T,Eigen::Dynamic,1>& values)
94{
95 values.resize(1);
96 values[0] = 1.0;
97}
98template<class T>
99void
100basis_P0_p<T>::grad_evaluate (
101 const point_basic<T>& hat_x,
102 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
103{
104 values.resize(1);
105}
106template<class T>
107void
108basis_P0_p<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
109{
110 x.resize(1);
111 x[0] = point_basic<T>();
112}
113template<class T>
114void
115basis_P0_e<T>::evaluate (
116 const point_basic<T>& hat_x,
117 Eigen::Matrix<T,Eigen::Dynamic,1>& values)
118{
119 values.resize(1);
120 values[0] = 1.0;
121}
122template<class T>
123void
124basis_P0_e<T>::grad_evaluate (
125 const point_basic<T>& hat_x,
126 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
127{
128 values.resize(1);
129 values[0][0] = 0.0;
130}
131template<class T>
132void
133basis_P0_e<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
134{
135 x.resize(1);
136 x[0] = point_basic<T>(5.0000000000000000e-01);
137}
138template<class T>
139void
140basis_P0_t<T>::evaluate (
141 const point_basic<T>& hat_x,
142 Eigen::Matrix<T,Eigen::Dynamic,1>& values)
143{
144 values.resize(1);
145 values[0] = 1.0;
146}
147template<class T>
148void
149basis_P0_t<T>::grad_evaluate (
150 const point_basic<T>& hat_x,
151 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
152{
153 values.resize(1);
154 values[0][0] = 0.0;
155 values[0][1] = 0.0;
156}
157template<class T>
158void
159basis_P0_t<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
160{
161 x.resize(1);
162 x[0] = point_basic<T>((1.0/3.0), (1.0/3.0));
163}
164template<class T>
165void
166basis_P0_q<T>::evaluate (
167 const point_basic<T>& hat_x,
168 Eigen::Matrix<T,Eigen::Dynamic,1>& values)
169{
170 values.resize(1);
171 values[0] = 1.0;
172}
173template<class T>
174void
175basis_P0_q<T>::grad_evaluate (
176 const point_basic<T>& hat_x,
177 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
178{
179 values.resize(1);
180 values[0][0] = 0.0;
181 values[0][1] = 0.0;
182}
183template<class T>
184void
185basis_P0_q<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
186{
187 x.resize(1);
188 x[0] = point_basic<T>(0.0, 0.0);
189}
190template<class T>
191void
192basis_P0_T<T>::evaluate (
193 const point_basic<T>& hat_x,
194 Eigen::Matrix<T,Eigen::Dynamic,1>& values)
195{
196 values.resize(1);
197 values[0] = 1.0;
198}
199template<class T>
200void
201basis_P0_T<T>::grad_evaluate (
202 const point_basic<T>& hat_x,
203 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
204{
205 values.resize(1);
206 values[0][0] = 0.0;
207 values[0][1] = 0.0;
208 values[0][2] = 0.0;
209}
210template<class T>
211void
212basis_P0_T<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
213{
214 x.resize(1);
215 x[0] = point_basic<T>(2.5000000000000000e-01, 2.5000000000000000e-01, 2.5000000000000000e-01);
216}
217template<class T>
218void
219basis_P0_P<T>::evaluate (
220 const point_basic<T>& hat_x,
221 Eigen::Matrix<T,Eigen::Dynamic,1>& values)
222{
223 values.resize(1);
224 values[0] = 1.0;
225}
226template<class T>
227void
228basis_P0_P<T>::grad_evaluate (
229 const point_basic<T>& hat_x,
230 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
231{
232 values.resize(1);
233 values[0][0] = 0.0;
234 values[0][1] = 0.0;
235 values[0][2] = 0.0;
236}
237template<class T>
238void
239basis_P0_P<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
240{
241 x.resize(1);
242 x[0] = point_basic<T>((1.0/3.0), (1.0/3.0), 0.0);
243}
244template<class T>
245void
246basis_P0_H<T>::evaluate (
247 const point_basic<T>& hat_x,
248 Eigen::Matrix<T,Eigen::Dynamic,1>& values)
249{
250 values.resize(1);
251 values[0] = 1.0;
252}
253template<class T>
254void
255basis_P0_H<T>::grad_evaluate (
256 const point_basic<T>& hat_x,
257 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values)
258{
259 values.resize(1);
260 values[0][0] = 0.0;
261 values[0][1] = 0.0;
262 values[0][2] = 0.0;
263}
264template<class T>
265void
266basis_P0_H<T>::hat_node (Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& x)
267{
268 x.resize(1);
269 x[0] = point_basic<T>(0.0, 0.0, 0.0);
270}
271template<class T>
273 : base(basis_option()), _hat_node()
274{
275 base::_sopt.set_continuous(false);
277 base::_name = "P0";
278 base::_piola_fem.piola_fem<T>::base::operator= (new_macro(piola_fem_lagrange<T>));
279}
280template<class T>
284template<class T>
287{
288 return 0;
289}
290template<class T>
291void
293 reference_element hat_K,
294 const point_basic<T>& hat_x,
295 Eigen::Matrix<T,Eigen::Dynamic,1>& values) const
296{
297 switch (hat_K.variant()) {
299 return basis_P0_p<T>::evaluate (hat_x, values);
300 }
302 return basis_P0_e<T>::evaluate (hat_x, values);
303 }
305 return basis_P0_t<T>::evaluate (hat_x, values);
306 }
308 return basis_P0_q<T>::evaluate (hat_x, values);
309 }
311 return basis_P0_T<T>::evaluate (hat_x, values);
312 }
314 return basis_P0_P<T>::evaluate (hat_x, values);
315 }
317 return basis_P0_H<T>::evaluate (hat_x, values);
318 }
319 default : {
320 error_macro ("evaluate: unsupported `" << hat_K.name() << "' element type");
321 }
322 }
323}
324template<class T>
325void
327 reference_element hat_K,
328 const point_basic<T>& hat_x,
329 Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& values) const
330{
331 switch (hat_K.variant()) {
333 return basis_P0_p<T>::grad_evaluate (hat_x, values);
334 }
336 return basis_P0_e<T>::grad_evaluate (hat_x, values);
337 }
339 return basis_P0_t<T>::grad_evaluate (hat_x, values);
340 }
342 return basis_P0_q<T>::grad_evaluate (hat_x, values);
343 }
345 return basis_P0_T<T>::grad_evaluate (hat_x, values);
346 }
348 return basis_P0_P<T>::grad_evaluate (hat_x, values);
349 }
351 return basis_P0_H<T>::grad_evaluate (hat_x, values);
352 }
353 default : {
354 error_macro ("grad_evaluate: unsupported `" << hat_K.name() << "' element type");
355 }
356 }
357}
358template<class T>
359void
361 reference_element hat_K,
362 const Eigen::Matrix<T,Eigen::Dynamic,1>& f_xnod,
363 Eigen::Matrix<T,Eigen::Dynamic,1>& dof) const
364{
365 dof = f_xnod;
366}
367template<class T>
368void
370{
372 0,
373 base::is_continuous(),
374 base::_ndof_on_subgeo_internal,
375 base::_ndof_on_subgeo,
376 base::_nnod_on_subgeo_internal,
377 base::_nnod_on_subgeo,
378 base::_first_idof_by_dimension_internal,
379 base::_first_idof_by_dimension,
380 base::_first_inod_by_dimension_internal,
381 base::_first_inod_by_dimension);
382}
383template<class T>
384void
386 reference_element hat_K) const
387{
388 switch (hat_K.variant()) {
390 return basis_P0_p<T>::hat_node (_hat_node[hat_K.variant()]);
391 }
393 return basis_P0_e<T>::hat_node (_hat_node[hat_K.variant()]);
394 }
396 return basis_P0_t<T>::hat_node (_hat_node[hat_K.variant()]);
397 }
399 return basis_P0_q<T>::hat_node (_hat_node[hat_K.variant()]);
400 }
402 return basis_P0_T<T>::hat_node (_hat_node[hat_K.variant()]);
403 }
405 return basis_P0_P<T>::hat_node (_hat_node[hat_K.variant()]);
406 }
408 return basis_P0_H<T>::hat_node (_hat_node[hat_K.variant()]);
409 }
410 default : {
411 error_macro ("hat_node: unsupported `" << hat_K.name() << "' element type");
412 }
413 }
414}
415// instantiation in library:
416template class basis_P0<Float>;
417} // namespace rheolef
field::size_type size_type
Definition branch.cc:430
basis_rep< T > base
Definition P0.h:33
base::size_type size_type
Definition P0.h:34
void _initialize_cstor_sizes() const
Definition P0.cc:369
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 P0.cc:360
void evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< T, Eigen::Dynamic, 1 > &values) const
Definition P0.cc:292
size_type degree() const
Definition P0.cc:286
void grad_evaluate(reference_element hat_K, const point_basic< T > &hat_x, Eigen::Matrix< point_basic< T >, Eigen::Dynamic, 1 > &values) const
Definition P0.cc:326
void _initialize_data(reference_element hat_K) const
Definition P0.cc:385
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_internal, 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_internal, 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_internal, 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_internal, std::array< std::array< size_type, 5 >, reference_element::max_variant > &first_inod_by_dimension)
see the basis_option page for the full documentation
see the reference_element page for the full documentation
static const variant_type H
static const variant_type q
static const variant_type e
static const variant_type p
variant_type variant() const
static const variant_type T
static const variant_type P
static const variant_type t
#define error_macro(message)
Definition dis_macros.h:49
Expr1::float_type T
Definition field_expr.h:230
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
STL namespace.