196 constexpr int dim = 3;
197 const Point<dim> p = p_ - coordinate_system_offset;
198 const std::array<double, dim> sp =
200 const std::array<double, dim> sg = sgradient(sp, component);
203 const double cos_theta =
std::cos(sp[1]);
204 const double sin_theta =
std::sin(sp[1]);
205 const double cos_phi =
std::cos(sp[2]);
206 const double sin_phi =
std::sin(sp[2]);
210 cos_theta, sin_theta, cos_phi, sin_phi, unit_r, unit_theta, unit_phi);
216 res += unit_r * sg[0];
219 if (sg[1] * sin_phi != 0.)
222 res += unit_theta * sg[1] / (sp[0] * sin_phi);
228 res += unit_phi * sg[2] / sp[0];
252 constexpr int dim = 3;
253 const Point<dim> p = p_ - coordinate_system_offset;
254 const std::array<double, dim> sp =
256 const std::array<double, dim> sg = sgradient(sp, component);
257 const std::array<double, 6> sh = shessian(sp, component);
260 const double cos_theta =
std::cos(sp[1]);
261 const double sin_theta =
std::sin(sp[1]);
262 const double cos_phi =
std::cos(sp[2]);
263 const double sin_phi =
std::sin(sp[2]);
264 const double r = sp[0];
268 cos_theta, sin_theta, cos_phi, sin_phi, unit_r, unit_theta, unit_phi);
270 const double sin_phi2 = sin_phi * sin_phi;
271 const double r2 = r * r;
274 const double c_utheta2 =
275 sg[0] / r + ((sin_phi != 0.) ? (cos_phi * sg[2]) / (r2 * sin_phi) +
276 sh[1] / (r2 * sin_phi2) :
278 const double c_utheta_ur =
279 ((sin_phi != 0.) ? (r * sh[3] - sg[1]) / (r2 * sin_phi) : 0.);
280 const double c_utheta_uphi =
281 ((sin_phi != 0.) ? (sh[5] * sin_phi - cos_phi * sg[1]) / (r2 * sin_phi2) :
283 const double c_ur2 = sh[0];
284 const double c_ur_uphi = (r * sh[4] - sg[2]) / r2;
285 const double c_uphi2 = (sh[2] + r * sg[0]) / r2;
290 add_outer_product(res, c_utheta2, unit_theta);
292 add_outer_product(res, c_utheta_ur, unit_theta, unit_r);
294 add_outer_product(res, c_utheta_uphi, unit_theta, unit_phi);
296 add_outer_product(res, c_ur2, unit_r);
298 add_outer_product(res, c_ur_uphi, unit_r, unit_phi);
300 add_outer_product(res, c_uphi2, unit_phi);