PolyFEM
Loading...
Searching...
No Matches
auto_q_bases_2d_val.cpp
Go to the documentation of this file.
2
3
4namespace polyfem {
5namespace autogen {
6namespace {
7void q_0_basis_value_2d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &result_0){
8
9auto x=uv.col(0).array();
10auto y=uv.col(1).array();
11
12result_0.resize(x.size(),1);
13switch(local_index){
14 case 0: {result_0.setOnes();} break;
15 default: assert(false);
16}}
17void q_1_basis_value_2d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &result_0){
18
19auto x=uv.col(0).array();
20auto y=uv.col(1).array();
21
22switch(local_index){
23 case 0: {result_0 = 1.0*(x - 1)*(y - 1);} break;
24 case 1: {result_0 = -1.0*x*(y - 1);} break;
25 case 2: {result_0 = 1.0*x*y;} break;
26 case 3: {result_0 = -1.0*y*(x - 1);} break;
27 default: assert(false);
28}}
29void q_2_basis_value_2d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &result_0){
30
31auto x=uv.col(0).array();
32auto y=uv.col(1).array();
33
34switch(local_index){
35 case 0: {result_0 = 1.0*(x - 1)*(2.0*x - 1.0)*(y - 1)*(2.0*y - 1.0);} break;
36 case 1: {result_0 = 1.0*x*(2.0*x - 1.0)*(y - 1)*(2.0*y - 1.0);} break;
37 case 2: {result_0 = 1.0*x*y*(2.0*x - 1.0)*(2.0*y - 1.0);} break;
38 case 3: {result_0 = 1.0*y*(x - 1)*(2.0*x - 1.0)*(2.0*y - 1.0);} break;
39 case 4: {result_0 = -4.0*x*(x - 1)*(y - 1)*(2.0*y - 1.0);} break;
40 case 5: {result_0 = -4.0*x*y*(2.0*x - 1.0)*(y - 1);} break;
41 case 6: {result_0 = -4.0*x*y*(x - 1)*(2.0*y - 1.0);} break;
42 case 7: {result_0 = -4.0*y*(x - 1)*(2.0*x - 1.0)*(y - 1);} break;
43 case 8: {result_0 = 16.0*x*y*(x - 1)*(y - 1);} break;
44 default: assert(false);
45}}
46void q_3_basis_value_2d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &result_0){
47
48auto x=uv.col(0).array();
49auto y=uv.col(1).array();
50
51switch(local_index){
52 case 0: {result_0 = 1.0*(x - 1)*(1.5*x - 1.0)*(3.0*x - 1.0)*(y - 1)*(1.5*y - 1.0)*(3.0*y - 1.0);} break;
53 case 1: {result_0 = -1.0*x*(1.4999999999999998*x - 0.49999999999999989)*(2.9999999999999996*x - 1.9999999999999996)*(y - 1)*(1.5*y - 1.0)*(3.0*y - 1.0);} break;
54 case 2: {result_0 = 1.0*x*y*(1.4999999999999998*x - 0.49999999999999989)*(2.9999999999999996*x - 1.9999999999999996)*(1.4999999999999998*y - 0.49999999999999989)*(2.9999999999999996*y - 1.9999999999999996);} break;
55 case 3: {result_0 = -1.0*y*(x - 1)*(1.5*x - 1.0)*(3.0*x - 1.0)*(1.4999999999999998*y - 0.49999999999999989)*(2.9999999999999996*y - 1.9999999999999996);} break;
56 case 4: {result_0 = -4.4999999999999991*x*(x - 1)*(3.0*x - 2.0)*(y - 1)*(1.5*y - 1.0)*(3.0*y - 1.0);} break;
57 case 5: {result_0 = 4.4999999999999991*x*(x - 1)*(3.0*x - 1.0)*(y - 1)*(1.5*y - 1.0)*(3.0*y - 1.0);} break;
58 case 6: {result_0 = 4.4999999999999991*x*y*(1.4999999999999998*x - 0.49999999999999989)*(2.9999999999999996*x - 1.9999999999999996)*(y - 1)*(3.0*y - 2.0);} break;
59 case 7: {result_0 = -4.4999999999999991*x*y*(1.4999999999999998*x - 0.49999999999999989)*(2.9999999999999996*x - 1.9999999999999996)*(y - 1)*(3.0*y - 1.0);} break;
60 case 8: {result_0 = -4.4999999999999991*x*y*(x - 1)*(3.0*x - 1.0)*(1.4999999999999998*y - 0.49999999999999989)*(2.9999999999999996*y - 1.9999999999999996);} break;
61 case 9: {result_0 = 4.4999999999999991*x*y*(x - 1)*(3.0*x - 2.0)*(1.4999999999999998*y - 0.49999999999999989)*(2.9999999999999996*y - 1.9999999999999996);} break;
62 case 10: {result_0 = 4.4999999999999991*y*(x - 1)*(1.5*x - 1.0)*(3.0*x - 1.0)*(y - 1)*(3.0*y - 1.0);} break;
63 case 11: {result_0 = -4.4999999999999991*y*(x - 1)*(1.5*x - 1.0)*(3.0*x - 1.0)*(y - 1)*(3.0*y - 2.0);} break;
64 case 12: {result_0 = 20.249999999999993*x*y*(x - 1)*(3.0*x - 2.0)*(y - 1)*(3.0*y - 2.0);} break;
65 case 13: {result_0 = -20.249999999999993*x*y*(x - 1)*(3.0*x - 2.0)*(y - 1)*(3.0*y - 1.0);} break;
66 case 14: {result_0 = -20.249999999999993*x*y*(x - 1)*(3.0*x - 1.0)*(y - 1)*(3.0*y - 2.0);} break;
67 case 15: {result_0 = 20.249999999999993*x*y*(x - 1)*(3.0*x - 1.0)*(y - 1)*(3.0*y - 1.0);} break;
68 default: assert(false);
69}}
70void q_m2_basis_value_2d(const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &result_0){
71
72auto x=uv.col(0).array();
73auto y=uv.col(1).array();
74
75switch(local_index){
76 case 0: {result_0 = -1.0*(x - 1)*(y - 1)*(2*x + 2*y - 1);} break;
77 case 1: {result_0 = 1.0*x*(y - 1)*(-2*x + 2*y + 1);} break;
78 case 2: {result_0 = x*y*(2.0*x + 2.0*y - 3.0);} break;
79 case 3: {result_0 = 1.0*y*(x - 1)*(2*x - 2*y + 1);} break;
80 case 4: {result_0 = 4*x*(x - 1)*(y - 1);} break;
81 case 5: {result_0 = -4*x*y*(y - 1);} break;
82 case 6: {result_0 = -4*x*y*(x - 1);} break;
83 case 7: {result_0 = 4*y*(x - 1)*(y - 1);} break;
84 default: assert(false);
85}}
86}
87
88void q_basis_value_2d(const int q, const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val){
89switch(q){
90 case 0: q_0_basis_value_2d(local_index, uv, val); break;
91 case 1: q_1_basis_value_2d(local_index, uv, val); break;
92 case 2: q_2_basis_value_2d(local_index, uv, val); break;
93 case 3: q_3_basis_value_2d(local_index, uv, val); break;
94 case -2: q_m2_basis_value_2d(local_index, uv, val); break;
95 default: assert(false);
96}}
97}}
double val
Definition Assembler.cpp:86
int y
int x
void q_basis_value_2d(const int q, const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val)