PolyFEM
Loading...
Searching...
No Matches
AMIPS2d.hpp
Go to the documentation of this file.
1// Auto-generated code for AMIPS2d energy
2#pragma once
3#include <Eigen/Dense>
4
5namespace polyfem
6{
7 namespace autogen
8 {
9 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> AMIPS2d_gradient(const RowVectorNd &p, const double t, const int el_id, const Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> &F)
10 {
11 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> grad(2, 2);
12 const double F00 = F(0, 0);
13 const double F01 = F(0, 1);
14 const double F10 = F(1, 0);
15 const double F11 = F(1, 1);
16 std::array<double, 4> result_0;
17 const auto helper_0 = F00 * F11 - F01 * F10;
18 const auto helper_1 = pow(helper_0, -2);
19 const auto helper_2 = 2 * F01;
20 const auto helper_3 = F10 - 2 * F11;
21 const auto helper_4 = (1.0 / 2.0) * (3 * pow(F00, 2) + 3 * pow(F10, 2) + pow(helper_3, 2) + pow(F00 - helper_2, 2)) / helper_0;
22 result_0[0] = helper_1 * (2 * F00 - F01 - F11 * helper_4);
23 result_0[1] = helper_1 * (-F00 + F10 * helper_4 + helper_2);
24 result_0[2] = helper_1 * (F01 * helper_4 + 2 * F10 - F11);
25 result_0[3] = -helper_1 * (F00 * helper_4 + helper_3);
26 ;
27 grad(0, 0) = result_0[0];
28 grad(0, 1) = result_0[1];
29 grad(1, 0) = result_0[2];
30 grad(1, 1) = result_0[3];
31 return grad;
32 }
33
34 inline Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, 9, 9> AMIPS2d_hessian(const RowVectorNd &p, const double t, const int el_id, const Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> &F)
35 {
36 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, 9, 9> hess(4, 4);
37 std::array<double, 16> result_0;
38 const double F00 = F(0, 0);
39 const double F01 = F(0, 1);
40 const double F10 = F(1, 0);
41 const double F11 = F(1, 1);
42 const auto helper_0 = F01 * F10;
43 const auto helper_1 = F00 * F11 - helper_0;
44 const auto helper_2 = pow(helper_1, -2);
45 const auto helper_3 = 2 * F00;
46 const auto helper_4 = -F01 + helper_3;
47 const auto helper_5 = 1.0 / helper_1;
48 const auto helper_6 = pow(F00, 2);
49 const auto helper_7 = pow(F10, 2);
50 const auto helper_8 = 2 * F01;
51 const auto helper_9 = F00 - helper_8;
52 const auto helper_10 = pow(helper_9, 2);
53 const auto helper_11 = 2 * F11;
54 const auto helper_12 = F10 - helper_11;
55 const auto helper_13 = pow(helper_12, 2);
56 const auto helper_14 = helper_10 + helper_13 + 3 * helper_6 + 3 * helper_7;
57 const auto helper_15 = helper_14 * helper_2;
58 const auto helper_16 = (3.0 / 2.0) * helper_15;
59 const auto helper_17 = helper_2 * (-F10 * F11 * helper_16 + 2 * F10 * helper_4 * helper_5 + 2 * F11 * helper_5 * helper_9 - 1);
60 const auto helper_18 = pow(helper_1, -3);
61 const auto helper_19 = 2 * F10;
62 const auto helper_20 = -F11 + helper_19;
63 const auto helper_21 = (3.0 / 2.0) * helper_14 * helper_5;
64 const auto helper_22 = helper_18 * (-F01 * F11 * helper_21 + 2 * F01 * helper_4 - helper_11 * helper_20);
65 const auto helper_23 = (3.0 / 2.0) * helper_6;
66 const auto helper_24 = (3.0 / 2.0) * helper_7;
67 const auto helper_25 = (1.0 / 2.0) * helper_10 + (1.0 / 2.0) * helper_13 + helper_23 + helper_24;
68 const auto helper_26 = helper_18 * ((3.0 / 2.0) * F00 * F11 * helper_14 * helper_5 + 2 * F11 * helper_12 - helper_25 - helper_3 * helper_4);
69 const auto helper_27 = helper_18 * (helper_0 * helper_21 + helper_19 * helper_20 + helper_25 - helper_8 * helper_9);
70 const auto helper_28 = helper_18 * (-F00 * F10 * helper_21 + 2 * F00 * helper_9 - helper_12 * helper_19);
71 const auto helper_29 = helper_20 * helper_5;
72 const auto helper_30 = helper_12 * helper_5;
73 const auto helper_31 = -helper_2 * (F00 * F01 * helper_16 + helper_29 * helper_3 + helper_30 * helper_8 + 1);
74 result_0[0] = helper_2 * (pow(F11, 2) * helper_16 - 4 * F11 * helper_4 * helper_5 + 2);
75 result_0[1] = helper_17;
76 result_0[2] = helper_22;
77 result_0[3] = helper_26;
78 result_0[4] = helper_17;
79 result_0[5] = helper_2 * (-4 * F10 * helper_5 * helper_9 + helper_15 * helper_24 + 2);
80 result_0[6] = helper_27;
81 result_0[7] = helper_28;
82 result_0[8] = helper_22;
83 result_0[9] = helper_27;
84 result_0[10] = helper_2 * (pow(F01, 2) * helper_16 + 4 * F01 * helper_29 + 2);
85 result_0[11] = helper_31;
86 result_0[12] = helper_26;
87 result_0[13] = helper_28;
88 result_0[14] = helper_31;
89 result_0[15] = helper_2 * (4 * F00 * helper_30 + helper_15 * helper_23 + 2);
90 ;
91 hess(0, 0) = result_0[0];
92 hess(0, 1) = result_0[1];
93 hess(0, 2) = result_0[2];
94 hess(0, 3) = result_0[3];
95 hess(1, 0) = result_0[4];
96 hess(1, 1) = result_0[5];
97 hess(1, 2) = result_0[6];
98 hess(1, 3) = result_0[7];
99 hess(2, 0) = result_0[8];
100 hess(2, 1) = result_0[9];
101 hess(2, 2) = result_0[10];
102 hess(2, 3) = result_0[11];
103 hess(3, 0) = result_0[12];
104 hess(3, 1) = result_0[13];
105 hess(3, 2) = result_0[14];
106 hess(3, 3) = result_0[15];
107 return hess;
108 }
109 } // namespace autogen
110} // namespace polyfem
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > AMIPS2d_gradient(const RowVectorNd &p, const double t, const int el_id, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > &F)
Definition AMIPS2d.hpp:9
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, 9, 9 > AMIPS2d_hessian(const RowVectorNd &p, const double t, const int el_id, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > &F)
Definition AMIPS2d.hpp:34
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
Definition Types.hpp:13