PolyFEM
Loading...
Searching...
No Matches
auto_mooney_rivlin_gradient_hessian.cpp
Go to the documentation of this file.
1
3
4namespace polyfem
5{
6 namespace autogen
7 {
8
9 template <>
10 void generate_gradient_templated(const double c1, const double c2, const double c3, const double d1, const Eigen::Matrix<double, 2, 2> &def_grad, Eigen::Matrix<double, 2, 2> &gradient)
11 {
12
13 const double helper_0 = def_grad(0) * def_grad(3) - def_grad(1) * def_grad(2);
14 const double helper_1 = 1.0 / helper_0;
15 const double helper_2 = 2 * def_grad(3);
16 const double helper_3 = d1 * log(helper_0);
17 const double helper_4 = 2 * def_grad(0);
18 const double helper_5 = def_grad(0) * def_grad(0) + def_grad(1) * def_grad(1);
19 const double helper_6 = def_grad(2) * def_grad(2) + def_grad(3) * def_grad(3);
20 const double helper_7 = helper_5 + helper_6;
21 const double helper_8 = helper_1 * helper_7;
22 const double helper_9 = helper_4 - helper_8 * def_grad(3);
23 const double helper_10 = pow(helper_0, -2);
24 const double helper_11 = def_grad(0) * def_grad(2) + def_grad(1) * def_grad(3);
25 const double helper_12 = 2 * helper_11 * helper_11 + helper_5 * helper_5 + helper_6 * helper_6 - helper_7 * helper_7;
26 const double helper_13 = (1.0 / 2.0) * c3;
27 const double helper_14 = helper_13 * (helper_10 * helper_12 + 4);
28 const double helper_15 = 2 * def_grad(2);
29 const double helper_16 = helper_1 * helper_12;
30 const double helper_17 = helper_11 * helper_15 - helper_16 * def_grad(3) + helper_4 * helper_5 - helper_4 * helper_7;
31 const double helper_18 = c2 * helper_1;
32 const double helper_19 = 2 - helper_8;
33 const double helper_20 = c3 * helper_1 * helper_19;
34 const double helper_21 = 2 * def_grad(1);
35 const double helper_22 = helper_21 + helper_8 * def_grad(2);
36 const double helper_23 = helper_13 * (helper_10 * helper_12 + 4);
37 const double helper_24 = helper_11 * helper_2 + helper_16 * def_grad(2) + helper_21 * helper_5 - helper_21 * helper_7;
38 const double helper_25 = helper_15 + helper_8 * def_grad(1);
39 const double helper_26 = helper_11 * helper_4 + helper_15 * helper_6 - helper_15 * helper_7 + helper_16 * def_grad(1);
40 const double helper_27 = helper_2 - helper_8 * def_grad(0);
41 const double helper_28 = helper_11 * helper_21 - helper_16 * def_grad(0) + helper_2 * helper_6 - helper_2 * helper_7;
42 gradient(0, 0) = helper_1 * (c1 * helper_9 - helper_14 * helper_9 - helper_17 * helper_18 + helper_17 * helper_20 + helper_2 * helper_3);
43 gradient(0, 1) = helper_1 * (c1 * helper_22 + c3 * helper_1 * helper_19 * helper_24 - helper_15 * helper_3 - helper_18 * helper_24 - helper_22 * helper_23);
44 gradient(1, 0) = helper_1 * (c1 * helper_25 + c3 * helper_1 * helper_19 * helper_26 - helper_18 * helper_26 - helper_21 * helper_3 - helper_23 * helper_25);
45 gradient(1, 1) = helper_1 * (c1 * helper_27 - helper_14 * helper_27 - helper_18 * helper_28 + helper_20 * helper_28 + helper_3 * helper_4);
46 }
47
48 template <>
49 void generate_hessian_templated(const double c1, const double c2, const double c3, const double d1, const Eigen::Matrix<double, 2, 2> &def_grad, Eigen::Matrix<double, 4, 4> &hessian)
50 {
51
52 const double helper_0 = def_grad(0) * def_grad(3);
53 const double helper_1 = def_grad(1) * def_grad(2);
54 const double helper_2 = helper_0 - helper_1;
55 const double helper_3 = 1.0 / helper_2;
56 const double helper_4 = def_grad(3) * def_grad(3);
57 const double helper_5 = log(helper_2);
58 const double helper_6 = 2 * d1;
59 const double helper_7 = helper_5 * helper_6;
60 const double helper_8 = helper_3 * helper_7;
61 const double helper_9 = pow(helper_2, -2);
62 const double helper_10 = def_grad(0) * def_grad(0);
63 const double helper_11 = def_grad(1) * def_grad(1);
64 const double helper_12 = helper_10 + helper_11;
65 const double helper_13 = def_grad(2) * def_grad(2);
66 const double helper_14 = helper_13 + helper_4;
67 const double helper_15 = helper_12 + helper_14;
68 const double helper_16 = helper_15 * helper_9;
69 const double helper_17 = 2 * helper_0;
70 const double helper_18 = -helper_17 * helper_3 + 1;
71 const double helper_19 = helper_16 * helper_4 + helper_18;
72 const double helper_20 = def_grad(0) * def_grad(2);
73 const double helper_21 = def_grad(1) * def_grad(3);
74 const double helper_22 = helper_20 + helper_21;
75 const double helper_23 = helper_12 * helper_12 + helper_14 * helper_14 - helper_15 * helper_15 + 2 * helper_22 * helper_22;
76 const double helper_24 = helper_23 * helper_9;
77 const double helper_25 = helper_24 + 4;
78 const double helper_26 = c3 * helper_25;
79 const double helper_27 = 2 * def_grad(3);
80 const double helper_28 = helper_12 * def_grad(0);
81 const double helper_29 = helper_22 * def_grad(2);
82 const double helper_30 = helper_15 * def_grad(0);
83 const double helper_31 = helper_28 + helper_29 - helper_30;
84 const double helper_32 = 8 * helper_3;
85 const double helper_33 = 3 * helper_24;
86 const double helper_34 = helper_27 + helper_31 * helper_32 - helper_33 * def_grad(3);
87 const double helper_35 = helper_23 * helper_3;
88 const double helper_36 = 2 * helper_28 + 2 * helper_29 - 2 * helper_30 - helper_35 * def_grad(3);
89 const double helper_37 = 2 * def_grad(0);
90 const double helper_38 = helper_15 * helper_3;
91 const double helper_39 = helper_37 - helper_38 * def_grad(3);
92 const double helper_40 = c3 * helper_9;
93 const double helper_41 = helper_39 * helper_40;
94 const double helper_42 = 2 - helper_38;
95 const double helper_43 = c3 * helper_3 * helper_42;
96 const double helper_44 = helper_27 * def_grad(2);
97 const double helper_45 = def_grad(2) * def_grad(3);
98 const double helper_46 = -helper_20 + helper_21 + helper_38 * helper_45;
99 const double helper_47 = 2 * c1;
100 const double helper_48 = helper_12 * def_grad(1);
101 const double helper_49 = helper_15 * def_grad(1);
102 const double helper_50 = helper_22 * helper_27 + helper_35 * def_grad(2) + 2 * helper_48 - 2 * helper_49;
103 const double helper_51 = c3 * helper_3;
104 const double helper_52 = helper_39 * helper_51;
105 const double helper_53 = 2 * def_grad(1);
106 const double helper_54 = helper_38 * def_grad(2) + helper_53;
107 const double helper_55 = helper_36 * helper_51;
108 const double helper_56 = 4 * helper_3;
109 const double helper_57 = helper_31 * helper_56;
110 const double helper_58 = helper_22 * def_grad(3) + helper_48 - helper_49;
111 const double helper_59 = helper_56 * def_grad(3);
112 const double helper_60 = -helper_33 * helper_45 + helper_44 + helper_57 * def_grad(2) - helper_58 * helper_59;
113 const double helper_61 = helper_9 * (-c2 * helper_60 + c3 * helper_25 * helper_46 + c3 * helper_42 * helper_60 - d1 * helper_44 + 2 * d1 * helper_5 * def_grad(2) * def_grad(3) - helper_46 * helper_47 - helper_50 * helper_52 - helper_54 * helper_55);
114 const double helper_62 = 2 * helper_21;
115 const double helper_63 = def_grad(0) * def_grad(1);
116 const double helper_64 = helper_21 * helper_38 + helper_45 - helper_63;
117 const double helper_65 = helper_14 * def_grad(2);
118 const double helper_66 = helper_15 * def_grad(2);
119 const double helper_67 = helper_22 * helper_37 + helper_35 * def_grad(1) + 2 * helper_65 - 2 * helper_66;
120 const double helper_68 = 2 * def_grad(2);
121 const double helper_69 = helper_38 * def_grad(1) + helper_68;
122 const double helper_70 = helper_22 * def_grad(0) + helper_65 - helper_66;
123 const double helper_71 = -helper_21 * helper_33 + helper_57 * def_grad(1) - helper_59 * helper_70 + helper_62;
124 const double helper_72 = helper_9 * (-c2 * helper_71 + c3 * helper_25 * helper_64 + c3 * helper_42 * helper_71 + 2 * d1 * helper_5 * def_grad(1) * def_grad(3) - d1 * helper_62 - helper_47 * helper_64 - helper_52 * helper_67 - helper_55 * helper_69);
125 const double helper_73 = 3 * helper_10 + helper_11 + helper_13 - helper_17 * helper_38 + 3 * helper_4;
126 const double helper_74 = helper_14 * helper_27 - helper_15 * helper_27 + helper_22 * helper_53 - helper_35 * def_grad(0);
127 const double helper_75 = helper_3 * helper_30;
128 const double helper_76 = helper_27 - helper_75;
129 const double helper_77 = helper_40 * helper_76;
130 const double helper_78 = helper_14 * def_grad(3) - helper_15 * def_grad(3) + helper_22 * def_grad(1);
131 const double helper_79 = -4 * helper_0 + 3 * helper_23 * helper_9 * def_grad(0) * def_grad(3) - helper_35 - helper_57 * def_grad(0) - helper_59 * helper_78 + 2 * def_grad(1) * def_grad(2);
132 const double helper_80 = c2 * helper_3;
133 const double helper_81 = helper_3 * (-c1 * helper_3 * helper_73 + (1.0 / 2.0) * c3 * helper_25 * helper_3 * helper_73 + c3 * helper_3 * helper_42 * helper_79 + 2 * d1 * helper_3 * def_grad(0) * def_grad(3) - helper_0 * helper_8 - helper_36 * helper_77 - helper_41 * helper_74 + helper_7 - helper_79 * helper_80);
134 const double helper_82 = 2 * helper_1;
135 const double helper_83 = helper_3 * helper_82 + 1;
136 const double helper_84 = helper_13 * helper_16 + helper_83;
137 const double helper_85 = helper_32 * helper_58 + helper_33 * def_grad(2) - helper_68;
138 const double helper_86 = helper_40 * helper_54;
139 const double helper_87 = helper_10 + 3 * helper_11 + 3 * helper_13 + helper_38 * helper_82 + helper_4;
140 const double helper_88 = helper_40 * helper_69;
141 const double helper_89 = helper_56 * def_grad(2);
142 const double helper_90 = helper_56 * helper_58;
143 const double helper_91 = helper_1 * helper_33 - 4 * helper_1 + helper_17 + helper_35 + helper_70 * helper_89 + helper_90 * def_grad(1);
144 const double helper_92 = helper_3 * (c1 * helper_3 * helper_87 + c3 * helper_3 * helper_42 * helper_91 + 2 * d1 * helper_3 * def_grad(1) * def_grad(2) - helper_1 * helper_8 - 1.0 / 2.0 * helper_26 * helper_3 * helper_87 - helper_50 * helper_88 - helper_67 * helper_86 - helper_7 - helper_80 * helper_91);
145 const double helper_93 = helper_20 * helper_38 - helper_45 + helper_63;
146 const double helper_94 = helper_51 * helper_74;
147 const double helper_95 = helper_51 * helper_76;
148 const double helper_96 = -helper_20 * helper_33 + 2 * helper_20 + helper_78 * helper_89 - helper_90 * def_grad(0);
149 const double helper_97 = helper_9 * (-c2 * helper_96 + c3 * helper_25 * helper_93 + c3 * helper_42 * helper_96 + 2 * d1 * helper_5 * def_grad(0) * def_grad(2) - helper_20 * helper_6 - helper_47 * helper_93 - helper_50 * helper_95 - helper_54 * helper_94);
150 const double helper_98 = helper_11 * helper_16 + helper_83;
151 const double helper_99 = helper_32 * helper_70 + helper_33 * def_grad(1) - helper_53;
152 const double helper_100 = helper_37 * def_grad(1);
153 const double helper_101 = helper_20 - helper_21 + helper_75 * def_grad(1);
154 const double helper_102 = helper_100 - helper_33 * helper_63 - helper_56 * helper_70 * def_grad(0) + helper_56 * helper_78 * def_grad(1);
155 const double helper_103 = helper_9 * (-c2 * helper_102 + c3 * helper_101 * helper_25 + c3 * helper_102 * helper_42 - d1 * helper_100 + 2 * d1 * helper_5 * def_grad(0) * def_grad(1) - helper_101 * helper_47 - helper_67 * helper_95 - helper_69 * helper_94);
156 const double helper_104 = helper_10 * helper_16 + helper_18;
157 const double helper_105 = helper_32 * helper_78 - helper_33 * def_grad(0) + helper_37;
158 hessian(0, 0) = helper_3 * (2 * c1 * helper_19 + c2 * helper_3 * helper_34 * def_grad(3) + 2 * d1 * helper_3 * helper_4 - helper_19 * helper_26 - helper_34 * helper_43 * def_grad(3) - 2 * helper_36 * helper_41 - helper_4 * helper_8);
159 hessian(0, 1) = helper_61;
160 hessian(0, 2) = helper_72;
161 hessian(0, 3) = helper_81;
162 hessian(1, 0) = helper_61;
163 hessian(1, 1) = helper_3 * (2 * c1 * helper_84 + c3 * helper_3 * helper_42 * helper_85 * def_grad(2) + 2 * d1 * helper_13 * helper_3 - helper_13 * helper_8 - helper_26 * helper_84 - 2 * helper_50 * helper_86 - helper_80 * helper_85 * def_grad(2));
164 hessian(1, 2) = helper_92;
165 hessian(1, 3) = helper_97;
166 hessian(2, 0) = helper_72;
167 hessian(2, 1) = helper_92;
168 hessian(2, 2) = helper_3 * (2 * c1 * helper_98 + c3 * helper_3 * helper_42 * helper_99 * def_grad(1) + 2 * d1 * helper_11 * helper_3 - helper_11 * helper_8 - helper_26 * helper_98 - 2 * helper_67 * helper_88 - helper_80 * helper_99 * def_grad(1));
169 hessian(2, 3) = helper_103;
170 hessian(3, 0) = helper_81;
171 hessian(3, 1) = helper_97;
172 hessian(3, 2) = helper_103;
173 hessian(3, 3) = helper_3 * (2 * c1 * helper_104 + c2 * helper_105 * helper_3 * def_grad(0) + 2 * d1 * helper_10 * helper_3 - helper_10 * helper_8 - helper_104 * helper_26 - helper_105 * helper_43 * def_grad(0) - 2 * helper_74 * helper_77);
174 }
175
176 template <>
177 void generate_gradient_templated(const double c1, const double c2, const double c3, const double d1, const Eigen::Matrix<double, 3, 3> &def_grad, Eigen::Matrix<double, 3, 3> &gradient)
178 {
179
180 const double helper_0 = def_grad(4) * def_grad(8);
181 const double helper_1 = def_grad(5) * def_grad(6);
182 const double helper_2 = def_grad(3) * def_grad(7);
183 const double helper_3 = def_grad(5) * def_grad(7);
184 const double helper_4 = def_grad(3) * def_grad(8);
185 const double helper_5 = def_grad(4) * def_grad(6);
186 const double helper_6 = helper_0 * def_grad(0) + helper_1 * def_grad(1) + helper_2 * def_grad(2) - helper_3 * def_grad(0) - helper_4 * def_grad(1) - helper_5 * def_grad(2);
187 const double helper_7 = 1.0 / helper_6;
188 const double helper_8 = helper_0 - helper_3;
189 const double helper_9 = helper_7 * helper_8;
190 const double helper_10 = d1 * log(helper_6);
191 const double helper_11 = pow(helper_6, -2.0 / 3.0);
192 const double helper_12 = 3 * def_grad(0);
193 const double helper_13 = def_grad(0) * def_grad(0) + def_grad(1) * def_grad(1) + def_grad(2) * def_grad(2);
194 const double helper_14 = def_grad(3) * def_grad(3) + def_grad(4) * def_grad(4) + def_grad(5) * def_grad(5);
195 const double helper_15 = def_grad(6) * def_grad(6) + def_grad(7) * def_grad(7) + def_grad(8) * def_grad(8);
196 const double helper_16 = helper_13 + helper_14 + helper_15;
197 const double helper_17 = helper_11 * (-helper_12 + helper_16 * helper_9);
198 const double helper_18 = (1.0 / 3.0) * c1;
199 const double helper_19 = pow(helper_6, -4.0 / 3.0);
200 const double helper_20 = def_grad(0) * def_grad(3) + def_grad(1) * def_grad(4) + def_grad(2) * def_grad(5);
201 const double helper_21 = def_grad(0) * def_grad(6) + def_grad(1) * def_grad(7) + def_grad(2) * def_grad(8);
202 const double helper_22 = def_grad(3) * def_grad(6) + def_grad(4) * def_grad(7) + def_grad(5) * def_grad(8);
203 const double helper_23 = helper_13 * helper_13 + helper_14 * helper_14 + helper_15 * helper_15 - helper_16 * helper_16 + 2 * helper_20 * helper_20 + 2 * helper_21 * helper_21 + 2 * helper_22 * helper_22;
204 const double helper_24 = (1.0 / 6.0) * c3;
205 const double helper_25 = helper_24 * (helper_19 * helper_23 + 6);
206 const double helper_26 = 3 * def_grad(3);
207 const double helper_27 = 3 * def_grad(6);
208 const double helper_28 = -helper_12 * helper_13 + 3 * helper_16 * def_grad(0) - helper_20 * helper_26 - helper_21 * helper_27 + helper_23 * helper_7 * helper_8;
209 const double helper_29 = (1.0 / 3.0) * helper_19;
210 const double helper_30 = c2 * helper_29;
211 const double helper_31 = -helper_11 * helper_16 + 3;
212 const double helper_32 = c3 * helper_29 * helper_31;
213 const double helper_33 = helper_7 * (-helper_1 + helper_4);
214 const double helper_34 = 3 * def_grad(1);
215 const double helper_35 = helper_16 * helper_33 + helper_34;
216 const double helper_36 = helper_11 * helper_24 * (helper_19 * helper_23 + 6);
217 const double helper_37 = 3 * def_grad(4);
218 const double helper_38 = 3 * def_grad(7);
219 const double helper_39 = helper_13 * helper_34 - helper_16 * helper_34 + helper_20 * helper_37 + helper_21 * helper_38 + helper_23 * helper_33;
220 const double helper_40 = helper_2 - helper_5;
221 const double helper_41 = helper_40 * helper_7;
222 const double helper_42 = 3 * def_grad(2);
223 const double helper_43 = helper_16 * helper_41 - helper_42;
224 const double helper_44 = helper_11 * helper_18;
225 const double helper_45 = helper_11 * helper_25;
226 const double helper_46 = 3 * def_grad(5);
227 const double helper_47 = 3 * def_grad(8);
228 const double helper_48 = -helper_13 * helper_42 + 3 * helper_16 * def_grad(2) - helper_20 * helper_46 - helper_21 * helper_47 + helper_23 * helper_40 * helper_7;
229 const double helper_49 = helper_7 * (def_grad(1) * def_grad(8) - def_grad(2) * def_grad(7));
230 const double helper_50 = helper_16 * helper_49 + helper_26;
231 const double helper_51 = helper_12 * helper_20 + helper_14 * helper_26 - helper_16 * helper_26 + helper_22 * helper_27 + helper_23 * helper_49;
232 const double helper_52 = def_grad(0) * def_grad(8) - def_grad(2) * def_grad(6);
233 const double helper_53 = helper_52 * helper_7;
234 const double helper_54 = helper_16 * helper_53 - helper_37;
235 const double helper_55 = -helper_14 * helper_37 + 3 * helper_16 * def_grad(4) - helper_20 * helper_34 - helper_22 * helper_38 + helper_23 * helper_52 * helper_7;
236 const double helper_56 = helper_7 * (def_grad(0) * def_grad(7) - def_grad(1) * def_grad(6));
237 const double helper_57 = helper_16 * helper_56 + helper_46;
238 const double helper_58 = helper_14 * helper_46 - helper_16 * helper_46 + helper_20 * helper_42 + helper_22 * helper_47 + helper_23 * helper_56;
239 const double helper_59 = def_grad(1) * def_grad(5) - def_grad(2) * def_grad(4);
240 const double helper_60 = helper_59 * helper_7;
241 const double helper_61 = helper_16 * helper_60 - helper_27;
242 const double helper_62 = -helper_12 * helper_21 - helper_15 * helper_27 + 3 * helper_16 * def_grad(6) - helper_22 * helper_26 + helper_23 * helper_59 * helper_7;
243 const double helper_63 = helper_7 * (def_grad(0) * def_grad(5) - def_grad(2) * def_grad(3));
244 const double helper_64 = helper_16 * helper_63 + helper_38;
245 const double helper_65 = helper_15 * helper_38 - helper_16 * helper_38 + helper_21 * helper_34 + helper_22 * helper_37 + helper_23 * helper_63;
246 const double helper_66 = def_grad(0) * def_grad(4) - def_grad(1) * def_grad(3);
247 const double helper_67 = helper_66 * helper_7;
248 const double helper_68 = helper_16 * helper_67 - helper_47;
249 const double helper_69 = -helper_15 * helper_47 + 3 * helper_16 * def_grad(8) - helper_21 * helper_42 - helper_22 * helper_46 + helper_23 * helper_66 * helper_7;
250 gradient(0, 0) = 2 * helper_10 * helper_9 - 2 * helper_17 * helper_18 + 2 * helper_17 * helper_25 + 2 * helper_28 * helper_30 - 2 * helper_28 * helper_32;
251 gradient(0, 1) = (2.0 / 3.0) * c1 * helper_11 * helper_35 + (2.0 / 3.0) * c3 * helper_19 * helper_31 * helper_39 - 2 * helper_10 * helper_33 - 2 * helper_30 * helper_39 - 2 * helper_35 * helper_36;
252 gradient(0, 2) = 2 * helper_10 * helper_41 + 2 * helper_30 * helper_48 - 2 * helper_32 * helper_48 - 2 * helper_43 * helper_44 + 2 * helper_43 * helper_45;
253 gradient(1, 0) = (2.0 / 3.0) * c1 * helper_11 * helper_50 + (2.0 / 3.0) * c3 * helper_19 * helper_31 * helper_51 - 2 * helper_10 * helper_49 - 2 * helper_30 * helper_51 - 2 * helper_36 * helper_50;
254 gradient(1, 1) = 2 * helper_10 * helper_53 + 2 * helper_30 * helper_55 - 2 * helper_32 * helper_55 - 2 * helper_44 * helper_54 + 2 * helper_45 * helper_54;
255 gradient(1, 2) = (2.0 / 3.0) * c1 * helper_11 * helper_57 + (2.0 / 3.0) * c3 * helper_19 * helper_31 * helper_58 - 2 * helper_10 * helper_56 - 2 * helper_30 * helper_58 - 2 * helper_36 * helper_57;
256 gradient(2, 0) = 2 * helper_10 * helper_60 + 2 * helper_30 * helper_62 - 2 * helper_32 * helper_62 - 2 * helper_44 * helper_61 + 2 * helper_45 * helper_61;
257 gradient(2, 1) = (2.0 / 3.0) * c1 * helper_11 * helper_64 + (2.0 / 3.0) * c3 * helper_19 * helper_31 * helper_65 - 2 * helper_10 * helper_63 - 2 * helper_30 * helper_65 - 2 * helper_36 * helper_64;
258 gradient(2, 2) = 2 * helper_10 * helper_67 + 2 * helper_30 * helper_69 - 2 * helper_32 * helper_69 - 2 * helper_44 * helper_68 + 2 * helper_45 * helper_68;
259 }
260
261 template <>
262 void generate_hessian_templated(const double c1, const double c2, const double c3, const double d1, const Eigen::Matrix<double, 3, 3> &def_grad, Eigen::Matrix<double, 9, 9> &hessian)
263 {
264
265 const double helper_0 = def_grad(4) * def_grad(8);
266 const double helper_1 = def_grad(5) * def_grad(7);
267 const double helper_2 = helper_0 - helper_1;
268 const double helper_3 = helper_2 * helper_2;
269 const double helper_4 = def_grad(5) * def_grad(6);
270 const double helper_5 = def_grad(3) * def_grad(7);
271 const double helper_6 = def_grad(3) * def_grad(8);
272 const double helper_7 = def_grad(4) * def_grad(6);
273 const double helper_8 = helper_0 * def_grad(0) - helper_1 * def_grad(0) + helper_4 * def_grad(1) + helper_5 * def_grad(2) - helper_6 * def_grad(1) - helper_7 * def_grad(2);
274 const double helper_9 = pow(helper_8, -2);
275 const double helper_10 = log(helper_8);
276 const double helper_11 = d1 * helper_9;
277 const double helper_12 = pow(helper_8, -2.0 / 3.0);
278 const double helper_13 = 1.0 / helper_8;
279 const double helper_14 = helper_13 * helper_2;
280 const double helper_15 = 12 * helper_14;
281 const double helper_16 = helper_3 * helper_9;
282 const double helper_17 = def_grad(0) * def_grad(0);
283 const double helper_18 = def_grad(1) * def_grad(1);
284 const double helper_19 = def_grad(2) * def_grad(2);
285 const double helper_20 = helper_17 + helper_18 + helper_19;
286 const double helper_21 = def_grad(3) * def_grad(3);
287 const double helper_22 = def_grad(4) * def_grad(4);
288 const double helper_23 = def_grad(5) * def_grad(5);
289 const double helper_24 = helper_21 + helper_22 + helper_23;
290 const double helper_25 = def_grad(6) * def_grad(6);
291 const double helper_26 = def_grad(7) * def_grad(7);
292 const double helper_27 = def_grad(8) * def_grad(8);
293 const double helper_28 = helper_25 + helper_26 + helper_27;
294 const double helper_29 = helper_20 + helper_24 + helper_28;
295 const double helper_30 = 5 * helper_29;
296 const double helper_31 = -helper_15 * def_grad(0) + helper_16 * helper_30 + 9;
297 const double helper_32 = pow(helper_8, -4.0 / 3.0);
298 const double helper_33 = def_grad(0) * def_grad(3);
299 const double helper_34 = def_grad(1) * def_grad(4);
300 const double helper_35 = def_grad(2) * def_grad(5);
301 const double helper_36 = helper_33 + helper_34 + helper_35;
302 const double helper_37 = def_grad(0) * def_grad(6);
303 const double helper_38 = def_grad(1) * def_grad(7);
304 const double helper_39 = def_grad(2) * def_grad(8);
305 const double helper_40 = helper_37 + helper_38 + helper_39;
306 const double helper_41 = def_grad(3) * def_grad(6);
307 const double helper_42 = def_grad(4) * def_grad(7);
308 const double helper_43 = def_grad(5) * def_grad(8);
309 const double helper_44 = helper_41 + helper_42 + helper_43;
310 const double helper_45 = helper_20 * helper_20 + helper_24 * helper_24 + helper_28 * helper_28 - helper_29 * helper_29 + 2 * helper_36 * helper_36 + 2 * helper_40 * helper_40 + 2 * helper_44 * helper_44;
311 const double helper_46 = helper_32 * helper_45 + 6;
312 const double helper_47 = (1.0 / 18.0) * c3 * helper_46;
313 const double helper_48 = 7 * helper_45;
314 const double helper_49 = helper_20 * def_grad(0);
315 const double helper_50 = helper_36 * def_grad(3);
316 const double helper_51 = helper_40 * def_grad(6);
317 const double helper_52 = helper_29 * def_grad(0);
318 const double helper_53 = helper_49 + helper_50 + helper_51 - helper_52;
319 const double helper_54 = 9 * helper_23;
320 const double helper_55 = 9 * helper_27;
321 const double helper_56 = helper_54 + helper_55;
322 const double helper_57 = 9 * helper_22;
323 const double helper_58 = 9 * helper_26;
324 const double helper_59 = helper_57 + helper_58;
325 const double helper_60 = 24 * helper_14 * helper_53 - helper_16 * helper_48 + helper_56 + helper_59;
326 const double helper_61 = helper_13 * helper_2 * helper_45 + 3 * helper_29 * def_grad(0) - 3 * helper_49 - 3 * helper_50 - 3 * helper_51;
327 const double helper_62 = 3 * def_grad(0);
328 const double helper_63 = helper_14 * helper_29;
329 const double helper_64 = c3 * helper_9;
330 const double helper_65 = helper_64 * (-helper_62 + helper_63);
331 const double helper_66 = -helper_12 * helper_29 + 3;
332 const double helper_67 = (1.0 / 9.0) * helper_32;
333 const double helper_68 = c3 * helper_66 * helper_67;
334 const double helper_69 = -helper_4 + helper_6;
335 const double helper_70 = helper_11 * helper_2;
336 const double helper_71 = helper_69 * helper_70;
337 const double helper_72 = 6 * def_grad(0);
338 const double helper_73 = 6 * helper_2;
339 const double helper_74 = 5 * helper_63;
340 const double helper_75 = -helper_69 * helper_72 + helper_69 * helper_74 + helper_73 * def_grad(1);
341 const double helper_76 = pow(helper_8, -5.0 / 3.0);
342 const double helper_77 = (1.0 / 9.0) * c1 * helper_76;
343 const double helper_78 = helper_47 * helper_76;
344 const double helper_79 = 3 * def_grad(1);
345 const double helper_80 = helper_13 * helper_69;
346 const double helper_81 = helper_29 * helper_80;
347 const double helper_82 = helper_64 * (helper_79 + helper_81);
348 const double helper_83 = (2.0 / 9.0) * helper_61;
349 const double helper_84 = helper_20 * def_grad(1);
350 const double helper_85 = helper_36 * def_grad(4);
351 const double helper_86 = helper_40 * def_grad(7);
352 const double helper_87 = helper_29 * def_grad(1);
353 const double helper_88 = 3 * helper_87;
354 const double helper_89 = -helper_88;
355 const double helper_90 = helper_45 * helper_80 + 3 * helper_84 + 3 * helper_85 + 3 * helper_86 + helper_89;
356 const double helper_91 = (2.0 / 9.0) * helper_65;
357 const double helper_92 = 9 * def_grad(3);
358 const double helper_93 = helper_92 * def_grad(4);
359 const double helper_94 = 9 * def_grad(6);
360 const double helper_95 = helper_94 * def_grad(7);
361 const double helper_96 = 12 * helper_53;
362 const double helper_97 = helper_84 + helper_85 + helper_86 - helper_87;
363 const double helper_98 = helper_48 * helper_9;
364 const double helper_99 = helper_2 * helper_98;
365 const double helper_100 = -helper_15 * helper_97 - helper_69 * helper_99 + helper_80 * helper_96 + helper_93 + helper_95;
366 const double helper_101 = c2 * helper_67;
367 const double helper_102 = 2 * helper_10 * helper_71 - 2 * helper_100 * helper_101 + 2 * helper_100 * helper_68 - 2 * helper_71 - 2 * helper_75 * helper_77 + 2 * helper_75 * helper_78 + 2 * helper_82 * helper_83 + 2 * helper_90 * helper_91;
368 const double helper_103 = helper_5 - helper_7;
369 const double helper_104 = helper_103 * helper_72 - helper_103 * helper_74 + helper_73 * def_grad(2);
370 const double helper_105 = 3 * def_grad(2);
371 const double helper_106 = helper_103 * helper_13;
372 const double helper_107 = helper_106 * helper_29;
373 const double helper_108 = -helper_105 + helper_107;
374 const double helper_109 = helper_64 * helper_83;
375 const double helper_110 = helper_20 * def_grad(2);
376 const double helper_111 = helper_36 * def_grad(5);
377 const double helper_112 = helper_40 * def_grad(8);
378 const double helper_113 = helper_29 * def_grad(2);
379 const double helper_114 = 3 * helper_113;
380 const double helper_115 = -helper_114;
381 const double helper_116 = helper_103 * helper_13 * helper_45 - 3 * helper_110 - 3 * helper_111 - 3 * helper_112 - helper_115;
382 const double helper_117 = helper_92 * def_grad(5);
383 const double helper_118 = helper_94 * def_grad(8);
384 const double helper_119 = helper_110 + helper_111 + helper_112 - helper_113;
385 const double helper_120 = helper_103 * helper_99 - helper_106 * helper_96 + helper_117 + helper_118 - helper_119 * helper_15;
386 const double helper_121 = (1.0 / 9.0) * c3 * helper_104 * helper_46 * helper_76 + (2.0 / 9.0) * c3 * helper_120 * helper_32 * helper_66 + 2 * d1 * helper_103 * helper_2 * helper_9 - 2 * helper_10 * helper_103 * helper_70 - 2 * helper_101 * helper_120 - 2 * helper_104 * helper_77 - 2 * helper_108 * helper_109 - 2 * helper_116 * helper_91;
387 const double helper_122 = def_grad(1) * def_grad(8);
388 const double helper_123 = def_grad(2) * def_grad(7);
389 const double helper_124 = helper_122 - helper_123;
390 const double helper_125 = helper_124 * helper_70;
391 const double helper_126 = -helper_124 * helper_72 + helper_124 * helper_74 + helper_73 * def_grad(3);
392 const double helper_127 = 3 * def_grad(3);
393 const double helper_128 = helper_124 * helper_13;
394 const double helper_129 = helper_128 * helper_29;
395 const double helper_130 = helper_127 + helper_129;
396 const double helper_131 = helper_24 * def_grad(3);
397 const double helper_132 = helper_44 * def_grad(6);
398 const double helper_133 = helper_29 * def_grad(3);
399 const double helper_134 = 3 * helper_133;
400 const double helper_135 = -helper_134;
401 const double helper_136 = helper_128 * helper_45 + 3 * helper_131 + 3 * helper_132 + helper_135 + helper_36 * helper_62;
402 const double helper_137 = 9 * helper_34;
403 const double helper_138 = 9 * helper_35;
404 const double helper_139 = helper_131 + helper_132 - helper_133 + helper_36 * def_grad(0);
405 const double helper_140 = -helper_124 * helper_99 + helper_128 * helper_96 + helper_137 + helper_138 - helper_139 * helper_15;
406 const double helper_141 = 2 * helper_10 * helper_125 - 2 * helper_101 * helper_140 + 2 * helper_109 * helper_130 - 2 * helper_125 - 2 * helper_126 * helper_77 + 2 * helper_126 * helper_78 + 2 * helper_136 * helper_91 + 2 * helper_140 * helper_68;
407 const double helper_142 = def_grad(0) * def_grad(8);
408 const double helper_143 = def_grad(2) * def_grad(6);
409 const double helper_144 = helper_142 - helper_143;
410 const double helper_145 = d1 * helper_10 * helper_13;
411 const double helper_146 = helper_145 * def_grad(8);
412 const double helper_147 = helper_29 * def_grad(8);
413 const double helper_148 = 3 * helper_147;
414 const double helper_149 = helper_144 * helper_72 - helper_144 * helper_74 + helper_148 + helper_73 * def_grad(4);
415 const double helper_150 = 3 * def_grad(4);
416 const double helper_151 = helper_13 * helper_144;
417 const double helper_152 = helper_151 * helper_29;
418 const double helper_153 = -helper_150 + helper_152;
419 const double helper_154 = helper_24 * def_grad(4);
420 const double helper_155 = helper_44 * def_grad(7);
421 const double helper_156 = helper_29 * def_grad(4);
422 const double helper_157 = 3 * helper_156;
423 const double helper_158 = helper_13 * helper_144 * helper_45 - 3 * helper_154 - 3 * helper_155 + helper_157 - helper_36 * helper_79;
424 const double helper_159 = def_grad(0) * def_grad(4);
425 const double helper_160 = def_grad(1) * def_grad(3);
426 const double helper_161 = helper_154 + helper_155 - helper_156 + helper_36 * def_grad(1);
427 const double helper_162 = 3 * def_grad(8);
428 const double helper_163 = helper_13 * helper_45;
429 const double helper_164 = helper_162 * helper_163;
430 const double helper_165 = -helper_144 * helper_99 + helper_15 * helper_161 + helper_151 * helper_96 + 18 * helper_159 - 9 * helper_160 + helper_164;
431 const double helper_166 = (2.0 / 9.0) * c2 * helper_165 * helper_32 + (1.0 / 9.0) * c3 * helper_149 * helper_46 * helper_76 + 2 * d1 * helper_144 * helper_2 * helper_9 - 2 * helper_10 * helper_144 * helper_70 - 2 * helper_109 * helper_153 + 2 * helper_146 - 2 * helper_149 * helper_77 - 2 * helper_158 * helper_91 - 2 * helper_165 * helper_68;
432 const double helper_167 = def_grad(0) * def_grad(7);
433 const double helper_168 = def_grad(1) * def_grad(6);
434 const double helper_169 = helper_167 - helper_168;
435 const double helper_170 = helper_29 * def_grad(7);
436 const double helper_171 = 3 * helper_170;
437 const double helper_172 = -helper_171;
438 const double helper_173 = -helper_169 * helper_72 + helper_169 * helper_74 + helper_172 + helper_73 * def_grad(5);
439 const double helper_174 = def_grad(0) * def_grad(5);
440 const double helper_175 = def_grad(2) * def_grad(3);
441 const double helper_176 = helper_13 * helper_169;
442 const double helper_177 = helper_24 * def_grad(5);
443 const double helper_178 = helper_44 * def_grad(8);
444 const double helper_179 = helper_29 * def_grad(5);
445 const double helper_180 = helper_177 + helper_178 - helper_179 + helper_36 * def_grad(2);
446 const double helper_181 = 3 * def_grad(7);
447 const double helper_182 = helper_163 * helper_181;
448 const double helper_183 = helper_15 * helper_180 + helper_169 * helper_99 + 18 * helper_174 - 9 * helper_175 - helper_176 * helper_96 - helper_182;
449 const double helper_184 = helper_145 * def_grad(7);
450 const double helper_185 = helper_169 * helper_70;
451 const double helper_186 = 3 * helper_179;
452 const double helper_187 = -helper_186;
453 const double helper_188 = helper_105 * helper_36 + helper_176 * helper_45 + 3 * helper_177 + 3 * helper_178 + helper_187;
454 const double helper_189 = 3 * def_grad(5);
455 const double helper_190 = helper_176 * helper_29;
456 const double helper_191 = helper_189 + helper_190;
457 const double helper_192 = helper_10 * helper_185 + helper_101 * helper_183 + helper_109 * helper_191 - helper_183 * helper_68 - helper_184 - helper_185 + helper_188 * helper_91;
458 const double helper_193 = 9 * helper_38;
459 const double helper_194 = 9 * helper_39;
460 const double helper_195 = def_grad(1) * def_grad(5);
461 const double helper_196 = def_grad(2) * def_grad(4);
462 const double helper_197 = helper_195 - helper_196;
463 const double helper_198 = helper_13 * helper_197;
464 const double helper_199 = helper_28 * def_grad(6);
465 const double helper_200 = helper_29 * def_grad(6);
466 const double helper_201 = helper_199 - helper_200 + helper_40 * def_grad(0) + helper_44 * def_grad(3);
467 const double helper_202 = -helper_15 * helper_201 + helper_193 + helper_194 + helper_197 * helper_99 - helper_198 * helper_96;
468 const double helper_203 = helper_197 * helper_72 - helper_197 * helper_74 + helper_73 * def_grad(6);
469 const double helper_204 = 3 * helper_200;
470 const double helper_205 = -helper_204;
471 const double helper_206 = -helper_127 * helper_44 + helper_13 * helper_197 * helper_45 - 3 * helper_199 - helper_205 - helper_40 * helper_62;
472 const double helper_207 = 3 * def_grad(6);
473 const double helper_208 = helper_198 * helper_29;
474 const double helper_209 = -helper_207 + helper_208;
475 const double helper_210 = -1.0 / 18.0 * c3 * helper_203 * helper_46 * helper_76 - d1 * helper_197 * helper_2 * helper_9 + helper_10 * helper_197 * helper_70 + helper_109 * helper_209 + helper_203 * helper_77 + helper_206 * helper_91;
476 const double helper_211 = helper_174 - helper_175;
477 const double helper_212 = helper_187 - helper_211 * helper_72 + helper_211 * helper_74 + helper_73 * def_grad(7);
478 const double helper_213 = helper_13 * helper_211;
479 const double helper_214 = helper_28 * def_grad(7);
480 const double helper_215 = -helper_170 + helper_214 + helper_40 * def_grad(1) + helper_44 * def_grad(4);
481 const double helper_216 = helper_163 * helper_189;
482 const double helper_217 = helper_15 * helper_215 + 18 * helper_167 - 9 * helper_168 + helper_211 * helper_99 - helper_213 * helper_96 - helper_216;
483 const double helper_218 = helper_145 * def_grad(5);
484 const double helper_219 = helper_211 * helper_70;
485 const double helper_220 = helper_150 * helper_44 + helper_172 + helper_213 * helper_45 + 3 * helper_214 + helper_40 * helper_79;
486 const double helper_221 = helper_213 * helper_29;
487 const double helper_222 = helper_181 + helper_221;
488 const double helper_223 = helper_10 * helper_219 + helper_101 * helper_217 + helper_109 * helper_222 - helper_217 * helper_68 - helper_218 - helper_219 + helper_220 * helper_91;
489 const double helper_224 = helper_159 - helper_160;
490 const double helper_225 = helper_145 * def_grad(4);
491 const double helper_226 = helper_157 + helper_224 * helper_72 - helper_224 * helper_74 + helper_73 * def_grad(8);
492 const double helper_227 = helper_13 * helper_224;
493 const double helper_228 = -helper_162 + helper_227 * helper_29;
494 const double helper_229 = helper_28 * def_grad(8);
495 const double helper_230 = -helper_105 * helper_40 + helper_13 * helper_224 * helper_45 - helper_189 * helper_44 - 3 * helper_229 + 3 * helper_29 * def_grad(8);
496 const double helper_231 = -helper_147 + helper_229 + helper_40 * def_grad(2) + helper_44 * def_grad(5);
497 const double helper_232 = helper_150 * helper_163;
498 const double helper_233 = 18 * helper_142 - 9 * helper_143 + helper_15 * helper_231 - helper_224 * helper_99 + helper_227 * helper_96 + helper_232;
499 const double helper_234 = (2.0 / 9.0) * c2 * helper_233 * helper_32 + (1.0 / 9.0) * c3 * helper_226 * helper_46 * helper_76 + 2 * d1 * helper_2 * helper_224 * helper_9 - 2 * helper_10 * helper_224 * helper_70 - 2 * helper_109 * helper_228 + 2 * helper_225 - 2 * helper_226 * helper_77 - 2 * helper_230 * helper_91 - 2 * helper_233 * helper_68;
500 const double helper_235 = helper_69 * helper_69;
501 const double helper_236 = 12 * helper_80;
502 const double helper_237 = helper_235 * helper_30 * helper_9 + helper_236 * def_grad(1) + 9;
503 const double helper_238 = helper_12 * helper_47;
504 const double helper_239 = 9 * helper_21;
505 const double helper_240 = 9 * helper_25;
506 const double helper_241 = helper_239 + helper_240;
507 const double helper_242 = 24 * helper_13 * helper_69 * helper_97 + 7 * helper_235 * helper_45 * helper_9 - helper_241 - helper_56;
508 const double helper_243 = helper_11 * helper_69;
509 const double helper_244 = helper_103 * helper_243;
510 const double helper_245 = 6 * def_grad(1);
511 const double helper_246 = 6 * helper_69;
512 const double helper_247 = 5 * helper_81;
513 const double helper_248 = helper_103 * helper_245 + helper_103 * helper_247 - helper_246 * def_grad(2);
514 const double helper_249 = helper_108 * helper_64;
515 const double helper_250 = (2.0 / 9.0) * helper_90;
516 const double helper_251 = (2.0 / 9.0) * helper_82;
517 const double helper_252 = 9 * def_grad(4) * def_grad(5);
518 const double helper_253 = 9 * def_grad(7) * def_grad(8);
519 const double helper_254 = 12 * helper_103 * helper_13 * helper_97 + 7 * helper_103 * helper_45 * helper_69 * helper_9 - helper_119 * helper_236 - helper_252 - helper_253;
520 const double helper_255 = 2 * helper_10 * helper_244 + 2 * helper_101 * helper_254 + 2 * helper_116 * helper_251 - 2 * helper_244 - 2 * helper_248 * helper_77 + 2 * helper_248 * helper_78 + 2 * helper_249 * helper_250 - 2 * helper_254 * helper_68;
521 const double helper_256 = helper_124 * helper_245 + helper_124 * helper_247 + helper_148 + helper_246 * def_grad(3);
522 const double helper_257 = helper_250 * helper_64;
523 const double helper_258 = 12 * helper_97;
524 const double helper_259 = helper_69 * helper_98;
525 const double helper_260 = helper_124 * helper_259 + helper_128 * helper_258 + helper_139 * helper_236 + 9 * helper_159 - 18 * helper_160 + helper_164;
526 const double helper_261 = (2.0 / 9.0) * c1 * helper_256 * helper_76 + (2.0 / 9.0) * c3 * helper_260 * helper_32 * helper_66 + 2 * d1 * helper_124 * helper_69 * helper_9 - 2 * helper_10 * helper_124 * helper_243 - 2 * helper_101 * helper_260 - 2 * helper_130 * helper_257 - 2 * helper_136 * helper_251 - 2 * helper_146 - 2 * helper_256 * helper_78;
527 const double helper_262 = helper_144 * helper_243;
528 const double helper_263 = helper_144 * helper_245 + helper_144 * helper_247 - helper_246 * def_grad(4);
529 const double helper_264 = 9 * helper_33;
530 const double helper_265 = helper_138 - helper_144 * helper_259 - helper_151 * helper_258 + helper_161 * helper_236 + helper_264;
531 const double helper_266 = 2 * helper_10 * helper_262 - 2 * helper_101 * helper_265 + 2 * helper_153 * helper_257 + 2 * helper_158 * helper_251 - 2 * helper_262 - 2 * helper_263 * helper_77 + 2 * helper_263 * helper_78 + 2 * helper_265 * helper_68;
532 const double helper_267 = helper_145 * def_grad(6);
533 const double helper_268 = helper_169 * helper_245 + helper_169 * helper_247 + helper_205 + helper_246 * def_grad(5);
534 const double helper_269 = helper_163 * helper_207;
535 const double helper_270 = helper_169 * helper_259 + helper_176 * helper_258 + helper_180 * helper_236 - 18 * helper_195 + 9 * helper_196 - helper_269;
536 const double helper_271 = (2.0 / 9.0) * c1 * helper_268 * helper_76 + (2.0 / 9.0) * c3 * helper_270 * helper_32 * helper_66 + 2 * d1 * helper_169 * helper_69 * helper_9 - 2 * helper_10 * helper_169 * helper_243 - 2 * helper_101 * helper_270 - 2 * helper_188 * helper_251 - 2 * helper_191 * helper_257 + 2 * helper_267 - 2 * helper_268 * helper_78;
537 const double helper_272 = helper_197 * helper_243;
538 const double helper_273 = helper_186 + helper_197 * helper_245 + helper_197 * helper_247 - helper_246 * def_grad(6);
539 const double helper_274 = -9 * helper_167 + 18 * helper_168 + helper_197 * helper_259 + helper_198 * helper_258 - helper_201 * helper_236 + helper_216;
540 const double helper_275 = 2 * helper_10 * helper_272 + 2 * helper_101 * helper_274 + 2 * helper_206 * helper_251 + 2 * helper_209 * helper_257 + 2 * helper_218 - 2 * helper_272 - 2 * helper_273 * helper_77 + 2 * helper_273 * helper_78 - 2 * helper_274 * helper_68;
541 const double helper_276 = helper_211 * helper_245 + helper_211 * helper_247 + helper_246 * def_grad(7);
542 const double helper_277 = 9 * helper_37;
543 const double helper_278 = helper_194 + helper_211 * helper_259 + helper_213 * helper_258 + helper_215 * helper_236 + helper_277;
544 const double helper_279 = (2.0 / 9.0) * c1 * helper_276 * helper_76 + (2.0 / 9.0) * c3 * helper_278 * helper_32 * helper_66 + 2 * d1 * helper_211 * helper_69 * helper_9 - 2 * helper_10 * helper_211 * helper_243 - 2 * helper_101 * helper_278 - 2 * helper_220 * helper_251 - 2 * helper_222 * helper_257 - 2 * helper_276 * helper_78;
545 const double helper_280 = helper_224 * helper_243;
546 const double helper_281 = helper_145 * def_grad(3);
547 const double helper_282 = helper_135 + helper_224 * helper_245 + helper_224 * helper_247 - helper_246 * def_grad(8);
548 const double helper_283 = helper_127 * helper_163;
549 const double helper_284 = 18 * helper_122 - 9 * helper_123 + helper_224 * helper_259 + helper_227 * helper_258 - helper_231 * helper_236 - helper_283;
550 const double helper_285 = 2 * helper_10 * helper_280 + 2 * helper_101 * helper_284 + 2 * helper_228 * helper_257 + 2 * helper_230 * helper_251 - 2 * helper_280 - 2 * helper_281 - 2 * helper_282 * helper_77 + 2 * helper_282 * helper_78 - 2 * helper_284 * helper_68;
551 const double helper_286 = helper_103 * helper_103;
552 const double helper_287 = 12 * helper_106;
553 const double helper_288 = helper_286 * helper_9;
554 const double helper_289 = -helper_287 * def_grad(2) + helper_288 * helper_30 + 9;
555 const double helper_290 = 24 * helper_106 * helper_119 + helper_241 - helper_288 * helper_48 + helper_59;
556 const double helper_291 = helper_103 * helper_11;
557 const double helper_292 = helper_124 * helper_291;
558 const double helper_293 = 6 * def_grad(2);
559 const double helper_294 = 6 * helper_103;
560 const double helper_295 = 5 * helper_107;
561 const double helper_296 = -helper_124 * helper_293 + helper_124 * helper_295 + helper_171 + helper_294 * def_grad(3);
562 const double helper_297 = helper_130 * helper_64;
563 const double helper_298 = (2.0 / 9.0) * helper_116;
564 const double helper_299 = (2.0 / 9.0) * helper_249;
565 const double helper_300 = 12 * helper_119;
566 const double helper_301 = helper_103 * helper_98;
567 const double helper_302 = helper_124 * helper_301 - helper_128 * helper_300 + helper_139 * helper_287 - 9 * helper_174 + 18 * helper_175 + helper_182;
568 const double helper_303 = 2 * helper_10 * helper_292 + 2 * helper_101 * helper_302 + 2 * helper_136 * helper_299 + 2 * helper_184 - 2 * helper_292 - 2 * helper_296 * helper_77 + 2 * helper_296 * helper_78 + 2 * helper_297 * helper_298 - 2 * helper_302 * helper_68;
569 const double helper_304 = -helper_144 * helper_293 + helper_144 * helper_295 + helper_204 - helper_294 * def_grad(4);
570 const double helper_305 = helper_144 * helper_301 - helper_151 * helper_300 - helper_161 * helper_287 + 9 * helper_195 - 18 * helper_196 + helper_269;
571 const double helper_306 = helper_298 * helper_64;
572 const double helper_307 = -1.0 / 9.0 * c3 * helper_305 * helper_32 * helper_66 - d1 * helper_103 * helper_144 * helper_9 + helper_10 * helper_144 * helper_291 + helper_101 * helper_305 + helper_153 * helper_306 + helper_158 * helper_299 + helper_267;
573 const double helper_308 = helper_169 * helper_291;
574 const double helper_309 = -helper_169 * helper_293 + helper_169 * helper_295 + helper_294 * def_grad(5);
575 const double helper_310 = helper_137 - helper_169 * helper_301 + helper_176 * helper_300 - helper_180 * helper_287 + helper_264;
576 const double helper_311 = 2 * helper_10 * helper_308 - 2 * helper_101 * helper_310 + 2 * helper_188 * helper_299 + 2 * helper_191 * helper_306 - 2 * helper_308 - 2 * helper_309 * helper_77 + 2 * helper_309 * helper_78 + 2 * helper_310 * helper_68;
577 const double helper_312 = helper_157 - helper_197 * helper_293 + helper_197 * helper_295 - helper_294 * def_grad(6);
578 const double helper_313 = 9 * helper_142 - 18 * helper_143 + helper_197 * helper_301 - helper_198 * helper_300 - helper_201 * helper_287 + helper_232;
579 const double helper_314 = -1.0 / 9.0 * c3 * helper_313 * helper_32 * helper_66 - d1 * helper_103 * helper_197 * helper_9 + helper_10 * helper_197 * helper_291 + helper_101 * helper_313 + helper_206 * helper_299 + helper_209 * helper_306 + helper_225;
580 const double helper_315 = helper_211 * helper_291;
581 const double helper_316 = helper_134 - helper_211 * helper_293 + helper_211 * helper_295 + helper_294 * def_grad(7);
582 const double helper_317 = -9 * helper_122 + 18 * helper_123 + helper_211 * helper_301 - helper_213 * helper_300 + helper_215 * helper_287 + helper_283;
583 const double helper_318 = 2 * helper_10 * helper_315 + 2 * helper_101 * helper_317 + 2 * helper_220 * helper_299 + 2 * helper_222 * helper_306 + 2 * helper_281 - 2 * helper_315 - 2 * helper_316 * helper_77 + 2 * helper_316 * helper_78 - 2 * helper_317 * helper_68;
584 const double helper_319 = helper_193 + helper_224 * helper_301 - helper_227 * helper_300 - helper_231 * helper_287 + helper_277;
585 const double helper_320 = helper_224 * helper_293 - helper_224 * helper_295 + helper_294 * def_grad(8);
586 const double helper_321 = -1.0 / 18.0 * c3 * helper_320 * helper_46 * helper_76 - d1 * helper_103 * helper_224 * helper_9 + helper_10 * helper_224 * helper_291 + helper_228 * helper_306 + helper_230 * helper_299 + helper_320 * helper_77;
587 const double helper_322 = helper_124 * helper_124;
588 const double helper_323 = 12 * helper_128;
589 const double helper_324 = helper_30 * helper_322 * helper_9 + helper_323 * def_grad(3) + 9;
590 const double helper_325 = 9 * helper_19;
591 const double helper_326 = helper_325 + helper_55;
592 const double helper_327 = 9 * helper_18;
593 const double helper_328 = helper_327 + helper_58;
594 const double helper_329 = 24 * helper_124 * helper_13 * helper_139 + 7 * helper_322 * helper_45 * helper_9 - helper_326 - helper_328;
595 const double helper_330 = helper_11 * helper_124;
596 const double helper_331 = helper_144 * helper_330;
597 const double helper_332 = 6 * def_grad(3);
598 const double helper_333 = 6 * helper_124;
599 const double helper_334 = 5 * helper_129;
600 const double helper_335 = helper_144 * helper_332 + helper_144 * helper_334 - helper_333 * def_grad(4);
601 const double helper_336 = helper_153 * helper_64;
602 const double helper_337 = (2.0 / 9.0) * helper_136;
603 const double helper_338 = (2.0 / 9.0) * helper_297;
604 const double helper_339 = 9 * def_grad(0);
605 const double helper_340 = helper_339 * def_grad(1);
606 const double helper_341 = 12 * helper_139;
607 const double helper_342 = helper_124 * helper_98;
608 const double helper_343 = -helper_144 * helper_342 - helper_151 * helper_341 + helper_161 * helper_323 + helper_340 + helper_95;
609 const double helper_344 = 2 * helper_10 * helper_331 - 2 * helper_101 * helper_343 + 2 * helper_158 * helper_338 - 2 * helper_331 - 2 * helper_335 * helper_77 + 2 * helper_335 * helper_78 + 2 * helper_336 * helper_337 + 2 * helper_343 * helper_68;
610 const double helper_345 = helper_169 * helper_332 + helper_169 * helper_334 + helper_333 * def_grad(5);
611 const double helper_346 = helper_337 * helper_64;
612 const double helper_347 = helper_339 * def_grad(2);
613 const double helper_348 = helper_118 + helper_169 * helper_342 + helper_176 * helper_341 + helper_180 * helper_323 + helper_347;
614 const double helper_349 = (2.0 / 9.0) * c1 * helper_345 * helper_76 + (2.0 / 9.0) * c3 * helper_32 * helper_348 * helper_66 + 2 * d1 * helper_124 * helper_169 * helper_9 - 2 * helper_10 * helper_169 * helper_330 - 2 * helper_101 * helper_348 - 2 * helper_188 * helper_338 - 2 * helper_191 * helper_346 - 2 * helper_345 * helper_78;
615 const double helper_350 = helper_197 * helper_330;
616 const double helper_351 = helper_197 * helper_332 + helper_197 * helper_334 - helper_333 * def_grad(6);
617 const double helper_352 = 9 * helper_42;
618 const double helper_353 = 9 * helper_43;
619 const double helper_354 = 7 * helper_124 * helper_197 * helper_45 * helper_9 + 12 * helper_13 * helper_139 * helper_197 - helper_201 * helper_323 - helper_352 - helper_353;
620 const double helper_355 = 2 * helper_10 * helper_350 + 2 * helper_101 * helper_354 + 2 * helper_206 * helper_338 + 2 * helper_209 * helper_346 - 2 * helper_350 - 2 * helper_351 * helper_77 + 2 * helper_351 * helper_78 - 2 * helper_354 * helper_68;
621 const double helper_356 = helper_145 * def_grad(2);
622 const double helper_357 = helper_115 + helper_211 * helper_332 + helper_211 * helper_334 + helper_333 * def_grad(7);
623 const double helper_358 = helper_105 * helper_163;
624 const double helper_359 = helper_211 * helper_342 + helper_213 * helper_341 + helper_215 * helper_323 - helper_358 - 18 * helper_5 + 9 * helper_7;
625 const double helper_360 = (2.0 / 9.0) * c1 * helper_357 * helper_76 + (2.0 / 9.0) * c3 * helper_32 * helper_359 * helper_66 + 2 * d1 * helper_124 * helper_211 * helper_9 - 2 * helper_10 * helper_211 * helper_330 - 2 * helper_101 * helper_359 - 2 * helper_220 * helper_338 - 2 * helper_222 * helper_346 + 2 * helper_356 - 2 * helper_357 * helper_78;
626 const double helper_361 = helper_224 * helper_330;
627 const double helper_362 = helper_145 * def_grad(1);
628 const double helper_363 = helper_224 * helper_332 + helper_224 * helper_334 - helper_333 * def_grad(8) + helper_89;
629 const double helper_364 = helper_163 * helper_79;
630 const double helper_365 = helper_224 * helper_342 + helper_227 * helper_341 - helper_231 * helper_323 - helper_364 - 9 * helper_4 + 18 * helper_6;
631 const double helper_366 = 2 * helper_10 * helper_361 + 2 * helper_101 * helper_365 + 2 * helper_228 * helper_346 + 2 * helper_230 * helper_338 - 2 * helper_361 - 2 * helper_362 - 2 * helper_363 * helper_77 + 2 * helper_363 * helper_78 - 2 * helper_365 * helper_68;
632 const double helper_367 = -helper_304;
633 const double helper_368 = helper_144 * helper_144;
634 const double helper_369 = 12 * helper_151;
635 const double helper_370 = helper_368 * helper_9;
636 const double helper_371 = helper_30 * helper_370 - helper_369 * def_grad(4) + 9;
637 const double helper_372 = 9 * helper_17;
638 const double helper_373 = helper_240 + helper_372;
639 const double helper_374 = 24 * helper_151 * helper_161 + helper_326 - helper_370 * helper_48 + helper_373;
640 const double helper_375 = 9 * def_grad(1) * def_grad(2);
641 const double helper_376 = 12 * helper_161;
642 const double helper_377 = -12 * helper_13 * helper_144 * helper_180 - 7 * helper_144 * helper_169 * helper_45 * helper_9 + helper_176 * helper_376 + helper_253 + helper_375;
643 const double helper_378 = -helper_377;
644 const double helper_379 = 6 * def_grad(4);
645 const double helper_380 = 6 * helper_144;
646 const double helper_381 = 5 * helper_152;
647 const double helper_382 = -helper_169 * helper_379 + helper_169 * helper_381 + helper_380 * def_grad(5);
648 const double helper_383 = helper_11 * helper_144;
649 const double helper_384 = helper_169 * helper_383;
650 const double helper_385 = (2.0 / 9.0) * helper_336;
651 const double helper_386 = helper_191 * helper_64;
652 const double helper_387 = (2.0 / 9.0) * helper_158;
653 const double helper_388 = helper_10 * helper_384 + helper_188 * helper_385 - helper_382 * helper_77 + helper_382 * helper_78 - helper_384 + helper_386 * helper_387;
654 const double helper_389 = helper_114 - 6 * helper_144 * def_grad(6) + helper_197 * helper_381 - 6 * helper_197 * def_grad(4);
655 const double helper_390 = -helper_389;
656 const double helper_391 = helper_144 * helper_98;
657 const double helper_392 = helper_197 * helper_391 - helper_198 * helper_376 - helper_201 * helper_369 + helper_358 + 9 * helper_5 - 18 * helper_7;
658 const double helper_393 = helper_387 * helper_64;
659 const double helper_394 = -1.0 / 9.0 * c3 * helper_32 * helper_392 * helper_66 - d1 * helper_144 * helper_197 * helper_9 + helper_10 * helper_197 * helper_383 + helper_101 * helper_392 + helper_206 * helper_385 + helper_209 * helper_393 + helper_356;
660 const double helper_395 = 9 * helper_41;
661 const double helper_396 = -12 * helper_13 * helper_144 * helper_215 - 7 * helper_144 * helper_211 * helper_45 * helper_9 + helper_213 * helper_376 + helper_353 + helper_395;
662 const double helper_397 = -helper_396;
663 const double helper_398 = -helper_211 * helper_379 + helper_211 * helper_381 + helper_380 * def_grad(7);
664 const double helper_399 = helper_211 * helper_383;
665 const double helper_400 = helper_10 * helper_399 + helper_220 * helper_385 + helper_222 * helper_393 - helper_398 * helper_77 + helper_398 * helper_78 - helper_399;
666 const double helper_401 = helper_145 * def_grad(0);
667 const double helper_402 = 3 * helper_52;
668 const double helper_403 = helper_224 * helper_379 - helper_224 * helper_381 + helper_380 * def_grad(8) + helper_402;
669 const double helper_404 = helper_163 * helper_62;
670 const double helper_405 = 18 * helper_0 - 9 * helper_1 - helper_224 * helper_391 + helper_227 * helper_376 + helper_231 * helper_369 + helper_404;
671 const double helper_406 = (2.0 / 9.0) * c2 * helper_32 * helper_405 + (1.0 / 9.0) * c3 * helper_403 * helper_46 * helper_76 + 2 * d1 * helper_144 * helper_224 * helper_9 - 2 * helper_10 * helper_224 * helper_383 - 2 * helper_228 * helper_393 - 2 * helper_230 * helper_385 + 2 * helper_401 - 2 * helper_403 * helper_77 - 2 * helper_405 * helper_68;
672 const double helper_407 = -helper_173;
673 const double helper_408 = helper_169 * helper_169;
674 const double helper_409 = 12 * helper_176;
675 const double helper_410 = helper_30 * helper_408 * helper_9 + helper_409 * def_grad(5) + 9;
676 const double helper_411 = 24 * helper_13 * helper_169 * helper_180 - helper_328 - helper_373 + 7 * helper_408 * helper_45 * helper_9;
677 const double helper_412 = helper_11 * helper_169;
678 const double helper_413 = helper_197 * helper_412;
679 const double helper_414 = 6 * helper_169;
680 const double helper_415 = 6 * def_grad(5);
681 const double helper_416 = 5 * helper_190;
682 const double helper_417 = helper_197 * helper_415 + helper_197 * helper_416 - helper_414 * def_grad(6) + helper_88;
683 const double helper_418 = (2.0 / 9.0) * helper_386;
684 const double helper_419 = helper_209 * helper_64;
685 const double helper_420 = (2.0 / 9.0) * helper_188;
686 const double helper_421 = 12 * helper_180;
687 const double helper_422 = helper_169 * helper_98;
688 const double helper_423 = helper_197 * helper_422 + helper_198 * helper_421 - helper_201 * helper_409 + helper_364 + 18 * helper_4 - 9 * helper_6;
689 const double helper_424 = 2 * helper_10 * helper_413 + 2 * helper_101 * helper_423 + 2 * helper_206 * helper_418 + 2 * helper_362 - 2 * helper_413 - 2 * helper_417 * helper_77 + 2 * helper_417 * helper_78 + 2 * helper_419 * helper_420 - 2 * helper_423 * helper_68;
690 const double helper_425 = helper_211 * helper_415 + helper_211 * helper_416 + helper_402 + helper_414 * def_grad(7);
691 const double helper_426 = helper_420 * helper_64;
692 const double helper_427 = 9 * helper_0 - 18 * helper_1 + helper_211 * helper_422 + helper_213 * helper_421 + helper_215 * helper_409 + helper_404;
693 const double helper_428 = (2.0 / 9.0) * c1 * helper_425 * helper_76 + (2.0 / 9.0) * c3 * helper_32 * helper_427 * helper_66 + 2 * d1 * helper_169 * helper_211 * helper_9 - 2 * helper_10 * helper_211 * helper_412 - 2 * helper_101 * helper_427 - 2 * helper_220 * helper_418 - 2 * helper_222 * helper_426 - 2 * helper_401 - 2 * helper_425 * helper_78;
694 const double helper_429 = helper_224 * helper_412;
695 const double helper_430 = helper_224 * helper_415 + helper_224 * helper_416 - helper_414 * def_grad(8);
696 const double helper_431 = 12 * helper_13 * helper_180 * helper_224 + 7 * helper_169 * helper_224 * helper_45 * helper_9 - helper_231 * helper_409 - helper_352 - helper_395;
697 const double helper_432 = 2 * helper_10 * helper_429 + 2 * helper_101 * helper_431 + 2 * helper_228 * helper_426 + 2 * helper_230 * helper_418 - 2 * helper_429 - 2 * helper_430 * helper_77 + 2 * helper_430 * helper_78 - 2 * helper_431 * helper_68;
698 const double helper_433 = -helper_202;
699 const double helper_434 = -helper_312;
700 const double helper_435 = helper_197 * helper_197;
701 const double helper_436 = 12 * helper_198;
702 const double helper_437 = helper_435 * helper_9;
703 const double helper_438 = helper_30 * helper_437 - helper_436 * def_grad(6) + 9;
704 const double helper_439 = helper_325 + helper_54;
705 const double helper_440 = helper_327 + helper_57;
706 const double helper_441 = 24 * helper_198 * helper_201 - helper_437 * helper_48 + helper_439 + helper_440;
707 const double helper_442 = helper_11 * helper_197;
708 const double helper_443 = helper_211 * helper_442;
709 const double helper_444 = 6 * def_grad(6);
710 const double helper_445 = 6 * helper_197;
711 const double helper_446 = 5 * helper_208;
712 const double helper_447 = -helper_211 * helper_444 + helper_211 * helper_446 + helper_445 * def_grad(7);
713 const double helper_448 = helper_222 * helper_64;
714 const double helper_449 = (2.0 / 9.0) * helper_206;
715 const double helper_450 = (2.0 / 9.0) * helper_419;
716 const double helper_451 = 12 * helper_201;
717 const double helper_452 = helper_197 * helper_98;
718 const double helper_453 = -helper_211 * helper_452 + helper_213 * helper_451 - helper_215 * helper_436 + helper_340 + helper_93;
719 const double helper_454 = 2 * helper_10 * helper_443 - 2 * helper_101 * helper_453 + 2 * helper_220 * helper_450 - 2 * helper_443 - 2 * helper_447 * helper_77 + 2 * helper_447 * helper_78 + 2 * helper_448 * helper_449 + 2 * helper_453 * helper_68;
720 const double helper_455 = helper_224 * helper_444 - helper_224 * helper_446 + helper_445 * def_grad(8);
721 const double helper_456 = helper_228 * helper_64;
722 const double helper_457 = helper_117 + helper_224 * helper_452 - helper_227 * helper_451 - helper_231 * helper_436 + helper_347;
723 const double helper_458 = (2.0 / 9.0) * c3 * helper_32 * helper_457 * helper_66 + (1.0 / 9.0) * c3 * helper_455 * helper_46 * helper_76 + 2 * d1 * helper_197 * helper_224 * helper_9 - 2 * helper_10 * helper_224 * helper_442 - 2 * helper_101 * helper_457 - 2 * helper_230 * helper_450 - 2 * helper_449 * helper_456 - 2 * helper_455 * helper_77;
724 const double helper_459 = -helper_212;
725 const double helper_460 = helper_211 * helper_211;
726 const double helper_461 = 12 * helper_213;
727 const double helper_462 = helper_30 * helper_460 * helper_9 + helper_461 * def_grad(7) + 9;
728 const double helper_463 = helper_239 + helper_372;
729 const double helper_464 = 24 * helper_13 * helper_211 * helper_215 - helper_439 + 7 * helper_45 * helper_460 * helper_9 - helper_463;
730 const double helper_465 = helper_11 * helper_211 * helper_224;
731 const double helper_466 = -6 * helper_211 * def_grad(8) + 5 * helper_221 * helper_224 + 6 * helper_224 * def_grad(7);
732 const double helper_467 = 12 * helper_13 * helper_215 * helper_224 + 7 * helper_211 * helper_224 * helper_45 * helper_9 - helper_231 * helper_461 - helper_252 - helper_375;
733 const double helper_468 = 2 * helper_10 * helper_465 + 2 * helper_101 * helper_467 + (4.0 / 9.0) * helper_220 * helper_456 + (4.0 / 9.0) * helper_230 * helper_448 - 2 * helper_465 - 2 * helper_466 * helper_77 + 2 * helper_466 * helper_78 - 2 * helper_467 * helper_68;
734 const double helper_469 = -helper_319;
735 const double helper_470 = helper_224 * helper_224;
736 const double helper_471 = helper_470 * helper_9;
737 const double helper_472 = -12 * helper_227 * def_grad(8) + helper_30 * helper_471 + 9;
738 const double helper_473 = 24 * helper_227 * helper_231 + helper_440 + helper_463 - helper_471 * helper_48;
739 hessian(0, 0) = (2.0 / 9.0) * c1 * helper_12 * helper_31 + (2.0 / 9.0) * c2 * helper_32 * helper_60 + 2 * d1 * helper_3 * helper_9 - 2 * helper_10 * helper_11 * helper_3 - 2 * helper_12 * helper_31 * helper_47 - 2 * helper_60 * helper_68 - 8.0 / 9.0 * helper_61 * helper_65;
740 hessian(0, 1) = helper_102;
741 hessian(0, 2) = helper_121;
742 hessian(0, 3) = helper_141;
743 hessian(0, 4) = helper_166;
744 hessian(0, 5) = -2 * helper_173 * helper_77 + 2 * helper_173 * helper_78 + 2 * helper_192;
745 hessian(0, 6) = (2.0 / 9.0) * c3 * helper_202 * helper_32 * helper_66 - 2 * helper_101 * helper_202 - 2 * helper_210;
746 hessian(0, 7) = -2 * helper_212 * helper_77 + 2 * helper_212 * helper_78 + 2 * helper_223;
747 hessian(0, 8) = helper_234;
748 hessian(1, 0) = helper_102;
749 hessian(1, 1) = (2.0 / 9.0) * c1 * helper_12 * helper_237 + (2.0 / 9.0) * c3 * helper_242 * helper_32 * helper_66 + 2 * d1 * helper_235 * helper_9 - 2 * helper_10 * helper_11 * helper_235 - 2 * helper_101 * helper_242 - 2 * helper_237 * helper_238 - 8.0 / 9.0 * helper_82 * helper_90;
750 hessian(1, 2) = helper_255;
751 hessian(1, 3) = helper_261;
752 hessian(1, 4) = helper_266;
753 hessian(1, 5) = helper_271;
754 hessian(1, 6) = helper_275;
755 hessian(1, 7) = helper_279;
756 hessian(1, 8) = helper_285;
757 hessian(2, 0) = helper_121;
758 hessian(2, 1) = helper_255;
759 hessian(2, 2) = (2.0 / 9.0) * c1 * helper_12 * helper_289 + (2.0 / 9.0) * c2 * helper_290 * helper_32 + 2 * d1 * helper_286 * helper_9 - 2 * helper_10 * helper_11 * helper_286 - 8.0 / 9.0 * helper_116 * helper_249 - 2 * helper_238 * helper_289 - 2 * helper_290 * helper_68;
760 hessian(2, 3) = helper_303;
761 hessian(2, 4) = (2.0 / 9.0) * c1 * helper_304 * helper_76 - 2 * helper_304 * helper_78 - 2 * helper_307;
762 hessian(2, 5) = helper_311;
763 hessian(2, 6) = (2.0 / 9.0) * c1 * helper_312 * helper_76 - 2 * helper_312 * helper_78 - 2 * helper_314;
764 hessian(2, 7) = helper_318;
765 hessian(2, 8) = (2.0 / 9.0) * c3 * helper_319 * helper_32 * helper_66 - 2 * helper_101 * helper_319 - 2 * helper_321;
766 hessian(3, 0) = helper_141;
767 hessian(3, 1) = helper_261;
768 hessian(3, 2) = helper_303;
769 hessian(3, 3) = (2.0 / 9.0) * c1 * helper_12 * helper_324 + (2.0 / 9.0) * c3 * helper_32 * helper_329 * helper_66 + 2 * d1 * helper_322 * helper_9 - 2 * helper_10 * helper_11 * helper_322 - 2 * helper_101 * helper_329 - 8.0 / 9.0 * helper_136 * helper_297 - 2 * helper_238 * helper_324;
770 hessian(3, 4) = helper_344;
771 hessian(3, 5) = helper_349;
772 hessian(3, 6) = helper_355;
773 hessian(3, 7) = helper_360;
774 hessian(3, 8) = helper_366;
775 hessian(4, 0) = helper_166;
776 hessian(4, 1) = helper_266;
777 hessian(4, 2) = (1.0 / 9.0) * c3 * helper_367 * helper_46 * helper_76 - 2 * helper_307 - 2 * helper_367 * helper_77;
778 hessian(4, 3) = helper_344;
779 hessian(4, 4) = (2.0 / 9.0) * c1 * helper_12 * helper_371 + (2.0 / 9.0) * c2 * helper_32 * helper_374 + 2 * d1 * helper_368 * helper_9 - 2 * helper_10 * helper_11 * helper_368 - 8.0 / 9.0 * helper_158 * helper_336 - 2 * helper_238 * helper_371 - 2 * helper_374 * helper_68;
780 hessian(4, 5) = 2 * helper_101 * helper_378 - 2 * helper_378 * helper_68 + 2 * helper_388;
781 hessian(4, 6) = (1.0 / 9.0) * c3 * helper_390 * helper_46 * helper_76 - 2 * helper_390 * helper_77 - 2 * helper_394;
782 hessian(4, 7) = 2 * helper_101 * helper_397 - 2 * helper_397 * helper_68 + 2 * helper_400;
783 hessian(4, 8) = helper_406;
784 hessian(5, 0) = 2 * helper_192 + 2 * helper_407 * helper_77 - 2 * helper_407 * helper_78;
785 hessian(5, 1) = helper_271;
786 hessian(5, 2) = helper_311;
787 hessian(5, 3) = helper_349;
788 hessian(5, 4) = -2 * helper_101 * helper_377 + 2 * helper_377 * helper_68 + 2 * helper_388;
789 hessian(5, 5) = (2.0 / 9.0) * c1 * helper_12 * helper_410 + (2.0 / 9.0) * c3 * helper_32 * helper_411 * helper_66 + 2 * d1 * helper_408 * helper_9 - 2 * helper_10 * helper_11 * helper_408 - 2 * helper_101 * helper_411 - 8.0 / 9.0 * helper_188 * helper_386 - 2 * helper_238 * helper_410;
790 hessian(5, 6) = helper_424;
791 hessian(5, 7) = helper_428;
792 hessian(5, 8) = helper_432;
793 hessian(6, 0) = (2.0 / 9.0) * c2 * helper_32 * helper_433 - 2 * helper_210 - 2 * helper_433 * helper_68;
794 hessian(6, 1) = helper_275;
795 hessian(6, 2) = (1.0 / 9.0) * c3 * helper_434 * helper_46 * helper_76 - 2 * helper_314 - 2 * helper_434 * helper_77;
796 hessian(6, 3) = helper_355;
797 hessian(6, 4) = (2.0 / 9.0) * c1 * helper_389 * helper_76 - 2 * helper_389 * helper_78 - 2 * helper_394;
798 hessian(6, 5) = helper_424;
799 hessian(6, 6) = (2.0 / 9.0) * c1 * helper_12 * helper_438 + (2.0 / 9.0) * c2 * helper_32 * helper_441 + 2 * d1 * helper_435 * helper_9 - 2 * helper_10 * helper_11 * helper_435 - 8.0 / 9.0 * helper_206 * helper_419 - 2 * helper_238 * helper_438 - 2 * helper_441 * helper_68;
800 hessian(6, 7) = helper_454;
801 hessian(6, 8) = helper_458;
802 hessian(7, 0) = 2 * helper_223 + 2 * helper_459 * helper_77 - 2 * helper_459 * helper_78;
803 hessian(7, 1) = helper_279;
804 hessian(7, 2) = helper_318;
805 hessian(7, 3) = helper_360;
806 hessian(7, 4) = -2 * helper_101 * helper_396 + 2 * helper_396 * helper_68 + 2 * helper_400;
807 hessian(7, 5) = helper_428;
808 hessian(7, 6) = helper_454;
809 hessian(7, 7) = (2.0 / 9.0) * c1 * helper_12 * helper_462 + (2.0 / 9.0) * c3 * helper_32 * helper_464 * helper_66 + 2 * d1 * helper_460 * helper_9 - 2 * helper_10 * helper_11 * helper_460 - 2 * helper_101 * helper_464 - 8.0 / 9.0 * helper_220 * helper_448 - 2 * helper_238 * helper_462;
810 hessian(7, 8) = helper_468;
811 hessian(8, 0) = helper_234;
812 hessian(8, 1) = helper_285;
813 hessian(8, 2) = (2.0 / 9.0) * c2 * helper_32 * helper_469 - 2 * helper_321 - 2 * helper_469 * helper_68;
814 hessian(8, 3) = helper_366;
815 hessian(8, 4) = helper_406;
816 hessian(8, 5) = helper_432;
817 hessian(8, 6) = helper_458;
818 hessian(8, 7) = helper_468;
819 hessian(8, 8) = (2.0 / 9.0) * c1 * helper_12 * helper_472 + (2.0 / 9.0) * c2 * helper_32 * helper_473 + 2 * d1 * helper_470 * helper_9 - 2 * helper_10 * helper_11 * helper_470 - 8.0 / 9.0 * helper_230 * helper_456 - 2 * helper_238 * helper_472 - 2 * helper_473 * helper_68;
820 }
821
822 void generate_gradient(const double c1, const double c2, const double c3, const double d1, const Eigen::MatrixXd &def_grad, Eigen::MatrixXd &gradient)
823 {
824 int dim = def_grad.rows();
825
826 if (dim == 2)
827 {
828 Eigen::Matrix<double, 2, 2> temp;
829 generate_gradient_templated<2>(c1, c2, c3, d1, def_grad, temp);
830 gradient = temp;
831 }
832 if (dim == 3)
833 {
834 Eigen::Matrix<double, 3, 3> temp;
835 generate_gradient_templated<3>(c1, c2, c3, d1, def_grad, temp);
836 gradient = temp;
837 }
838 }
839
840 void generate_hessian(const double c1, const double c2, const double c3, const double d1, const Eigen::MatrixXd &def_grad, Eigen::MatrixXd &hessian)
841 {
842 int dim = def_grad.rows();
843
844 if (dim == 2)
845 {
846 Eigen::Matrix<double, 4, 4> temp;
847 generate_hessian_templated<2>(c1, c2, c3, d1, def_grad, temp);
848 hessian = temp;
849 }
850 if (dim == 3)
851 {
852 Eigen::Matrix<double, 9, 9> temp;
853 generate_hessian_templated<3>(c1, c2, c3, d1, def_grad, temp);
854 hessian = temp;
855 }
856 }
857 } // namespace autogen
858} // namespace polyfem
void generate_hessian(const double c1, const double c2, const double c3, const double d1, const Eigen::MatrixXd &def_grad, Eigen::MatrixXd &hessian)
void generate_gradient_templated(const double c1, const double c2, const double c3, const double d1, const Eigen::Matrix< double, 2, 2 > &def_grad, Eigen::Matrix< double, 2, 2 > &gradient)
void generate_gradient(const double c1, const double c2, const double c3, const double d1, const Eigen::MatrixXd &def_grad, Eigen::MatrixXd &gradient)
void generate_hessian_templated(const double c1, const double c2, const double c3, const double d1, const Eigen::Matrix< double, 2, 2 > &def_grad, Eigen::Matrix< double, 4, 4 > &hessian)