Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
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"
24namespace rheolef {
25using namespace std;
26template<class T>
27class basis_bubble_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_bubble_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_bubble_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_bubble_T {
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>
63void
64basis_bubble_p<T>::evaluate (
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}
71template<class T>
72void
73basis_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}
79template<class T>
80void
81basis_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}
86template<class T>
87void
88basis_bubble_e<T>::evaluate (
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]*hat_x[0])+4.0*hat_x[0];
94}
95template<class T>
96void
97basis_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}
104template<class T>
105void
106basis_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}
111template<class T>
112void
113basis_bubble_t<T>::evaluate (
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[1])*hat_x[0]+-27.0*hat_x[1]*( (hat_x[0]*hat_x[0])-hat_x[0]);
119}
120template<class T>
121void
122basis_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*( 2.0*hat_x[0]-1.0)*hat_x[1]+-27.0*(hat_x[1]*hat_x[1]);
128 values[0][1] = -27.0*(hat_x[0]*hat_x[0])+27.0*hat_x[0]+-54.0*hat_x[0]*hat_x[1];
129}
130template<class T>
131void
132basis_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}
137template<class T>
138void
139basis_bubble_T<T>::evaluate (
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[1]*hat_x[1])*hat_x[0]+( (hat_x[0]*hat_x[0])-hat_x[0])*hat_x[1])*hat_x[2]+-256.0*hat_x[1]*(hat_x[2]*hat_x[2])*hat_x[0];
145}
146template<class T>
147void
148basis_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[1]*hat_x[1])+( 2.0*hat_x[0]-1.0)*hat_x[1])*hat_x[2];
154 values[0][1] = -256.0*hat_x[2]*( (hat_x[0]*hat_x[0])+2.0*hat_x[1]*hat_x[0]-hat_x[0])+-256.0*(hat_x[2]*hat_x[2])*hat_x[0];
155 values[0][2] = -512.0*hat_x[1]*hat_x[2]*hat_x[0]+-256.0*hat_x[1]*( (hat_x[0]*hat_x[0])-hat_x[0])+-256.0*(hat_x[1]*hat_x[1])*hat_x[0];
156}
157template<class T>
158void
159basis_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}
164template<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}
172template<class T>
176template<class T>
179{
180 return 4;
181}
182template<class T>
183void
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()) {
191 return basis_bubble_p<T>::evaluate (hat_x, values);
192 }
194 return basis_bubble_e<T>::evaluate (hat_x, values);
195 }
197 return basis_bubble_t<T>::evaluate (hat_x, values);
198 }
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}
207template<class T>
208void
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()) {
216 return basis_bubble_p<T>::grad_evaluate (hat_x, values);
217 }
219 return basis_bubble_e<T>::grad_evaluate (hat_x, values);
220 }
222 return basis_bubble_t<T>::grad_evaluate (hat_x, values);
223 }
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}
232template<class T>
233void
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}
241template<class T>
242void
244{
246 0,
247 false,
248 base::_ndof_on_subgeo_internal,
249 base::_ndof_on_subgeo,
250 base::_nnod_on_subgeo_internal,
251 base::_nnod_on_subgeo,
252 base::_first_idof_by_dimension_internal,
253 base::_first_idof_by_dimension,
254 base::_first_inod_by_dimension_internal,
255 base::_first_inod_by_dimension);
256}
257template<class T>
258void
260 reference_element hat_K) const
261{
262 switch (hat_K.variant()) {
264 return basis_bubble_p<T>::hat_node (_hat_node[hat_K.variant()]);
265 }
267 return basis_bubble_e<T>::hat_node (_hat_node[hat_K.variant()]);
268 }
270 return basis_bubble_t<T>::hat_node (_hat_node[hat_K.variant()]);
271 }
273 return basis_bubble_T<T>::hat_node (_hat_node[hat_K.variant()]);
274 }
275 default : {
276 error_macro ("hat_node: unsupported `" << hat_K.name() << "' element type");
277 }
278 }
279}
280// instantiation in library:
281template class basis_bubble<Float>;
282} // namespace rheolef
field::size_type size_type
Definition branch.cc:430
basis_rep< T > base
Definition bubble.h:33
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:259
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 e
static const variant_type p
variant_type variant() const
static const variant_type T
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.