PolyFEM
Loading...
Searching...
No Matches
auto_q_bases_1d_grad.cpp
Go to the documentation of this file.
2
3
4namespace polyfem {
5namespace autogen {
6namespace {
7void q_0_basis_grad_value_1d_single_0(double x, double *val) {
8{val[0] = 0;}
9}
10
11
12
13void q_0_basis_grad_value_1d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val){
14val.resize(uv.rows(), 1);
15double gradient[1];
16switch(local_index){
17 case 0:
18 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
19 q_0_basis_grad_value_1d_single_0(uv(i, 0), gradient);
20 val(i, 0) = gradient[0];
21 }
22 break;
23 default: assert(false);
24}
25}
26
27void q_1_basis_grad_value_1d_single_0(double x, double *val) {
28{val[0] = -1.0;}
29}
30
31void q_1_basis_grad_value_1d_single_1(double x, double *val) {
32{val[0] = 1.0;}
33}
34
35
36
37void q_1_basis_grad_value_1d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val){
38val.resize(uv.rows(), 1);
39double gradient[1];
40switch(local_index){
41 case 0:
42 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
43 q_1_basis_grad_value_1d_single_0(uv(i, 0), gradient);
44 val(i, 0) = gradient[0];
45 }
46 break;
47 case 1:
48 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
49 q_1_basis_grad_value_1d_single_1(uv(i, 0), gradient);
50 val(i, 0) = gradient[0];
51 }
52 break;
53 default: assert(false);
54}
55}
56
57void q_2_basis_grad_value_1d_single_0(double x, double *val) {
58{val[0] = 4.0*x - 3.0;}
59}
60
61void q_2_basis_grad_value_1d_single_1(double x, double *val) {
62{val[0] = 4.0 - 8.0*x;}
63}
64
65void q_2_basis_grad_value_1d_single_2(double x, double *val) {
66{val[0] = 4.0*x - 1.0;}
67}
68
69
70
71void q_2_basis_grad_value_1d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val){
72val.resize(uv.rows(), 1);
73double gradient[1];
74switch(local_index){
75 case 0:
76 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
77 q_2_basis_grad_value_1d_single_0(uv(i, 0), gradient);
78 val(i, 0) = gradient[0];
79 }
80 break;
81 case 1:
82 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
83 q_2_basis_grad_value_1d_single_1(uv(i, 0), gradient);
84 val(i, 0) = gradient[0];
85 }
86 break;
87 case 2:
88 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
89 q_2_basis_grad_value_1d_single_2(uv(i, 0), gradient);
90 val(i, 0) = gradient[0];
91 }
92 break;
93 default: assert(false);
94}
95}
96
97void q_3_basis_grad_value_1d_single_0(double x, double *val) {
98{val[0] = -13.5*pow(x, 2) + 18.0*x - 5.5;}
99}
100
101void q_3_basis_grad_value_1d_single_1(double x, double *val) {
102{val[0] = 40.499999999999986*pow(x, 2) - 44.999999999999986*x + 8.9999999999999982;}
103}
104
105void q_3_basis_grad_value_1d_single_2(double x, double *val) {
106{val[0] = -40.499999999999986*pow(x, 2) + 35.999999999999993*x - 4.4999999999999991;}
107}
108
109void q_3_basis_grad_value_1d_single_3(double x, double *val) {
110{val[0] = 13.499999999999996*pow(x, 2) - 8.9999999999999964*x + 0.99999999999999956;}
111}
112
113
114
115void q_3_basis_grad_value_1d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val){
116val.resize(uv.rows(), 1);
117double gradient[1];
118switch(local_index){
119 case 0:
120 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
121 q_3_basis_grad_value_1d_single_0(uv(i, 0), gradient);
122 val(i, 0) = gradient[0];
123 }
124 break;
125 case 1:
126 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
127 q_3_basis_grad_value_1d_single_1(uv(i, 0), gradient);
128 val(i, 0) = gradient[0];
129 }
130 break;
131 case 2:
132 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
133 q_3_basis_grad_value_1d_single_2(uv(i, 0), gradient);
134 val(i, 0) = gradient[0];
135 }
136 break;
137 case 3:
138 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
139 q_3_basis_grad_value_1d_single_3(uv(i, 0), gradient);
140 val(i, 0) = gradient[0];
141 }
142 break;
143 default: assert(false);
144}
145}
146
147void q_m2_basis_grad_value_1d_single_0(double x, double *val) {
148{val[0] = 4.0*x - 3.0;}
149}
150
151void q_m2_basis_grad_value_1d_single_1(double x, double *val) {
152{val[0] = 4.0 - 8.0*x;}
153}
154
155void q_m2_basis_grad_value_1d_single_2(double x, double *val) {
156{val[0] = 4.0*x - 1.0;}
157}
158
159
160
161void q_m2_basis_grad_value_1d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val){
162val.resize(uv.rows(), 1);
163double gradient[1];
164switch(local_index){
165 case 0:
166 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
167 q_m2_basis_grad_value_1d_single_0(uv(i, 0), gradient);
168 val(i, 0) = gradient[0];
169 }
170 break;
171 case 1:
172 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
173 q_m2_basis_grad_value_1d_single_1(uv(i, 0), gradient);
174 val(i, 0) = gradient[0];
175 }
176 break;
177 case 2:
178 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
179 q_m2_basis_grad_value_1d_single_2(uv(i, 0), gradient);
180 val(i, 0) = gradient[0];
181 }
182 break;
183 default: assert(false);
184}
185}
186
187void q_4_basis_grad_value_1d_single_0(double x, double *val) {
188{val[0] = 42.666666666666664*pow(x, 3) - 80.0*pow(x, 2) + 46.666666666666657*x - 8.3333333333333339;}
189}
190
191void q_4_basis_grad_value_1d_single_1(double x, double *val) {
192{val[0] = -170.66666666666666*pow(x, 3) + 288.0*pow(x, 2) - 138.66666666666666*x + 16.0;}
193}
194
195void q_4_basis_grad_value_1d_single_2(double x, double *val) {
196{val[0] = 256.0*pow(x, 3) - 384.0*pow(x, 2) + 152.0*x - 12.0;}
197}
198
199void q_4_basis_grad_value_1d_single_3(double x, double *val) {
200{val[0] = -170.66666666666666*pow(x, 3) + 223.99999999999997*pow(x, 2) - 74.666666666666657*x + 5.333333333333333;}
201}
202
203void q_4_basis_grad_value_1d_single_4(double x, double *val) {
204{val[0] = 42.666666666666664*pow(x, 3) - 48.0*pow(x, 2) + 14.666666666666666*x - 1.0;}
205}
206
207
208
209void q_4_basis_grad_value_1d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val){
210val.resize(uv.rows(), 1);
211double gradient[1];
212switch(local_index){
213 case 0:
214 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
215 q_4_basis_grad_value_1d_single_0(uv(i, 0), gradient);
216 val(i, 0) = gradient[0];
217 }
218 break;
219 case 1:
220 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
221 q_4_basis_grad_value_1d_single_1(uv(i, 0), gradient);
222 val(i, 0) = gradient[0];
223 }
224 break;
225 case 2:
226 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
227 q_4_basis_grad_value_1d_single_2(uv(i, 0), gradient);
228 val(i, 0) = gradient[0];
229 }
230 break;
231 case 3:
232 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
233 q_4_basis_grad_value_1d_single_3(uv(i, 0), gradient);
234 val(i, 0) = gradient[0];
235 }
236 break;
237 case 4:
238 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
239 q_4_basis_grad_value_1d_single_4(uv(i, 0), gradient);
240 val(i, 0) = gradient[0];
241 }
242 break;
243 default: assert(false);
244}
245}
246
247void q_5_basis_grad_value_1d_single_0(double x, double *val) {
248{val[0] = -130.20833333333337*pow(x, 4) + 312.5*pow(x, 3) - 265.625*pow(x, 2) + 93.75*x - 11.416666666666668;}
249}
250
251void q_5_basis_grad_value_1d_single_1(double x, double *val) {
252{val[0] = 651.04166666666652*pow(x, 4) - 1458.333333333333*pow(x, 3) + 1109.3749999999998*pow(x, 2) - 320.83333333333331*x + 25.0;}
253}
254
255void q_5_basis_grad_value_1d_single_2(double x, double *val) {
256{val[0] = -1302.0833333333337*pow(x, 4) + 2708.3333333333339*pow(x, 3) - 1843.7500000000005*pow(x, 2) + 445.83333333333348*x - 25.000000000000007;}
257}
258
259void q_5_basis_grad_value_1d_single_3(double x, double *val) {
260{val[0] = 1302.0833333333333*pow(x, 4) - 2500.0*pow(x, 3) + 1531.25*pow(x, 2) - 324.99999999999994*x + 16.666666666666664;}
261}
262
263void q_5_basis_grad_value_1d_single_4(double x, double *val) {
264{val[0] = -651.0416666666664*pow(x, 4) + 1145.833333333333*pow(x, 3) - 640.62499999999977*pow(x, 2) + 127.08333333333327*x - 6.2499999999999982;}
265}
266
267void q_5_basis_grad_value_1d_single_5(double x, double *val) {
268{val[0] = 130.20833333333337*pow(x, 4) - 208.3333333333334*pow(x, 3) + 109.37500000000003*pow(x, 2) - 20.833333333333339*x + 1.0000000000000002;}
269}
270
271
272
273void q_5_basis_grad_value_1d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val){
274val.resize(uv.rows(), 1);
275double gradient[1];
276switch(local_index){
277 case 0:
278 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
279 q_5_basis_grad_value_1d_single_0(uv(i, 0), gradient);
280 val(i, 0) = gradient[0];
281 }
282 break;
283 case 1:
284 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
285 q_5_basis_grad_value_1d_single_1(uv(i, 0), gradient);
286 val(i, 0) = gradient[0];
287 }
288 break;
289 case 2:
290 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
291 q_5_basis_grad_value_1d_single_2(uv(i, 0), gradient);
292 val(i, 0) = gradient[0];
293 }
294 break;
295 case 3:
296 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
297 q_5_basis_grad_value_1d_single_3(uv(i, 0), gradient);
298 val(i, 0) = gradient[0];
299 }
300 break;
301 case 4:
302 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
303 q_5_basis_grad_value_1d_single_4(uv(i, 0), gradient);
304 val(i, 0) = gradient[0];
305 }
306 break;
307 case 5:
308 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
309 q_5_basis_grad_value_1d_single_5(uv(i, 0), gradient);
310 val(i, 0) = gradient[0];
311 }
312 break;
313 default: assert(false);
314}
315}
316
317void q_6_basis_grad_value_1d_single_0(double x, double *val) {
318{val[0] = 388.80000000000001*pow(x, 5) - 1134.0*pow(x, 4) + 1260.0*pow(x, 3) - 661.5*pow(x, 2) + 162.39999999999998*x - 14.699999999999999;}
319}
320
321void q_6_basis_grad_value_1d_single_1(double x, double *val) {
322{val[0] = -2332.7999999999988*pow(x, 5) + 6479.9999999999982*pow(x, 4) - 6695.9999999999973*pow(x, 3) + 3131.9999999999986*pow(x, 2) - 626.39999999999975*x + 35.999999999999986;}
323}
324
325void q_6_basis_grad_value_1d_single_2(double x, double *val) {
326{val[0] = 5831.9999999999982*pow(x, 5) - 15389.999999999993*pow(x, 4) + 14795.999999999993*pow(x, 3) - 6223.4999999999982*pow(x, 2) + 1052.9999999999995*x - 44.999999999999986;}
327}
328
329void q_6_basis_grad_value_1d_single_3(double x, double *val) {
330{val[0] = -7775.9999999999991*pow(x, 5) + 19439.999999999996*pow(x, 4) - 17423.999999999993*pow(x, 3) + 6695.9999999999973*pow(x, 2) - 1015.9999999999997*x + 39.999999999999986;}
331}
332
333void q_6_basis_grad_value_1d_single_4(double x, double *val) {
334{val[0] = 5831.9999999999982*pow(x, 5) - 13769.999999999996*pow(x, 4) + 11555.999999999996*pow(x, 3) - 4144.4999999999982*pow(x, 2) + 593.99999999999989*x - 22.499999999999993;}
335}
336
337void q_6_basis_grad_value_1d_single_5(double x, double *val) {
338{val[0] = -2332.7999999999988*pow(x, 5) + 5183.9999999999982*pow(x, 4) - 4103.9999999999982*pow(x, 3) + 1403.9999999999995*pow(x, 2) - 194.39999999999989*x + 7.1999999999999957;}
339}
340
341void q_6_basis_grad_value_1d_single_6(double x, double *val) {
342{val[0] = 388.80000000000001*pow(x, 5) - 810.0*pow(x, 4) + 612.0*pow(x, 3) - 202.5*pow(x, 2) + 27.399999999999995*x - 0.99999999999999967;}
343}
344
345
346
347void q_6_basis_grad_value_1d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val){
348val.resize(uv.rows(), 1);
349double gradient[1];
350switch(local_index){
351 case 0:
352 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
353 q_6_basis_grad_value_1d_single_0(uv(i, 0), gradient);
354 val(i, 0) = gradient[0];
355 }
356 break;
357 case 1:
358 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
359 q_6_basis_grad_value_1d_single_1(uv(i, 0), gradient);
360 val(i, 0) = gradient[0];
361 }
362 break;
363 case 2:
364 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
365 q_6_basis_grad_value_1d_single_2(uv(i, 0), gradient);
366 val(i, 0) = gradient[0];
367 }
368 break;
369 case 3:
370 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
371 q_6_basis_grad_value_1d_single_3(uv(i, 0), gradient);
372 val(i, 0) = gradient[0];
373 }
374 break;
375 case 4:
376 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
377 q_6_basis_grad_value_1d_single_4(uv(i, 0), gradient);
378 val(i, 0) = gradient[0];
379 }
380 break;
381 case 5:
382 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
383 q_6_basis_grad_value_1d_single_5(uv(i, 0), gradient);
384 val(i, 0) = gradient[0];
385 }
386 break;
387 case 6:
388 for (Eigen::Index i = 0; i < uv.rows(); ++i) {
389 q_6_basis_grad_value_1d_single_6(uv(i, 0), gradient);
390 val(i, 0) = gradient[0];
391 }
392 break;
393 default: assert(false);
394}
395}
396
397}
398
399void q_grad_basis_value_1d(const int q, const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val){
400switch(q){
401 case 0: q_0_basis_grad_value_1d(local_index, uv, val); break;
402 case 1: q_1_basis_grad_value_1d(local_index, uv, val); break;
403 case 2: q_2_basis_grad_value_1d(local_index, uv, val); break;
404 case 3: q_3_basis_grad_value_1d(local_index, uv, val); break;
405 case -2: q_m2_basis_grad_value_1d(local_index, uv, val); break;
406 case 4: q_4_basis_grad_value_1d(local_index, uv, val); break;
407 case 5: q_5_basis_grad_value_1d(local_index, uv, val); break;
408 case 6: q_6_basis_grad_value_1d(local_index, uv, val); break;
409 default: assert(false);
410}}
411}}
double val
Definition Assembler.cpp:86
int x
void q_grad_basis_value_1d(const int q, const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val)