33#include <Kokkos_Macros.hpp>
70 std::vector<double> &values,
71 const unsigned int)
const
73 Assert(values.size() == points.size(),
76 for (
unsigned int i = 0; i < points.size(); ++i)
95 std::vector<double> &values,
96 const unsigned int)
const
98 Assert(values.size() == points.size(),
101 for (
unsigned int i = 0; i < points.size(); ++i)
131 const unsigned int)
const
133 Assert(gradients.size() == points.size(),
136 for (
unsigned int i = 0; i < points.size(); ++i)
157 std::vector<double> &values,
158 const unsigned int)
const
161 Assert(values.size() == points.size(),
164 for (
unsigned int i = 0; i < points.size(); ++i)
167 values[i] = p[0] * p[1];
179 Assert(values.size() == points.size(),
183 for (
unsigned int i = 0; i < points.size(); ++i)
186 values[i](0) = p[0] * p[1];
203 std::vector<double> &values,
204 const unsigned int)
const
207 Assert(values.size() == points.size(),
210 for (
unsigned int i = 0; i < points.size(); ++i)
233 const unsigned int)
const
236 Assert(gradients.size() == points.size(),
239 for (
unsigned int i = 0; i < points.size(); ++i)
241 gradients[i][0] = points[i][1];
242 gradients[i][1] = points[i][0];
254 Assert(gradients.size() == points.size(),
259 for (
unsigned int i = 0; i < points.size(); ++i)
261 gradients[i][0][0] = points[i][1];
262 gradients[i][0][1] = points[i][0];
283 return 1. - p[0] * p[0] + offset;
285 return (1. - p[0] * p[0]) * (1. - p[1] * p[1]) + offset;
287 return (1. - p[0] * p[0]) * (1. - p[1] * p[1]) * (1. - p[2] * p[2]) +
298 std::vector<double> &values,
299 const unsigned int)
const
301 Assert(values.size() == points.size(),
304 for (
unsigned int i = 0; i < points.size(); ++i)
310 values[i] = 1. - p[0] * p[0] + offset;
313 values[i] = (1. - p[0] * p[0]) * (1. - p[1] * p[1]) + offset;
317 (1. - p[0] * p[0]) * (1. - p[1] * p[1]) * (1. - p[2] * p[2]) +
337 return -2. * ((1. - p[0] * p[0]) + (1. - p[1] * p[1]));
339 return -2. * ((1. - p[0] * p[0]) * (1. - p[1] * p[1]) +
340 (1. - p[1] * p[1]) * (1. - p[2] * p[2]) +
341 (1. - p[2] * p[2]) * (1. - p[0] * p[0]));
351 std::vector<double> &values,
352 const unsigned int)
const
354 Assert(values.size() == points.size(),
357 for (
unsigned int i = 0; i < points.size(); ++i)
366 values[i] = -2. * ((1. - p[0] * p[0]) + (1. - p[1] * p[1]));
369 values[i] = -2. * ((1. - p[0] * p[0]) * (1. - p[1] * p[1]) +
370 (1. - p[1] * p[1]) * (1. - p[2] * p[2]) +
371 (1. - p[2] * p[2]) * (1. - p[0] * p[0]));
387 result[0] = -2. * p[0];
390 result[0] = -2. * p[0] * (1. - p[1] * p[1]);
391 result[1] = -2. * p[1] * (1. - p[0] * p[0]);
394 result[0] = -2. * p[0] * (1. - p[1] * p[1]) * (1. - p[2] * p[2]);
395 result[1] = -2. * p[1] * (1. - p[0] * p[0]) * (1. - p[2] * p[2]);
396 result[2] = -2. * p[2] * (1. - p[0] * p[0]) * (1. - p[1] * p[1]);
408 const unsigned int)
const
410 Assert(gradients.size() == points.size(),
413 for (
unsigned int i = 0; i < points.size(); ++i)
419 gradients[i][0] = -2. * p[0];
422 gradients[i][0] = -2. * p[0] * (1. - p[1] * p[1]);
423 gradients[i][1] = -2. * p[1] * (1. - p[0] * p[0]);
427 -2. * p[0] * (1. - p[1] * p[1]) * (1. - p[2] * p[2]);
429 -2. * p[1] * (1. - p[0] * p[0]) * (1. - p[2] * p[2]);
431 -2. * p[2] * (1. - p[0] * p[0]) * (1. - p[1] * p[1]);
472 std::vector<double> &values,
473 const unsigned int)
const
475 Assert(values.size() == points.size(),
478 for (
unsigned int i = 0; i < points.size(); ++i)
479 values[i] = value(points[i]);
489 Assert(values.size() == points.size(),
492 for (
unsigned int i = 0; i < points.size(); ++i)
494 const double v = value(points[i]);
495 for (
unsigned int k = 0; k < values[i].size(); ++k)
528 std::vector<double> &values,
529 const unsigned int)
const
531 Assert(values.size() == points.size(),
534 for (
unsigned int i = 0; i < points.size(); ++i)
535 values[i] = laplacian(points[i]);
575 const unsigned int)
const
577 Assert(gradients.size() == points.size(),
580 for (
unsigned int i = 0; i < points.size(); ++i)
652 result[0][0] = cococo;
653 result[1][1] = cococo;
654 result[2][2] = cococo;
656 result[0][1] = sisico;
657 result[0][2] = sicosi;
658 result[1][2] = cosisi;
672 const unsigned int)
const
674 Assert(hessians.size() == points.size(),
679 for (
unsigned int i = 0; i < points.size(); ++i)
693 hessians[i][0][0] = coco;
694 hessians[i][1][1] = coco;
696 hessians[i][0][1] = sisi;
714 hessians[i][0][0] = cococo;
715 hessians[i][1][1] = cococo;
716 hessians[i][2][2] = cococo;
718 hessians[i][0][1] = sisico;
719 hessians[i][0][2] = sicosi;
720 hessians[i][1][2] = cosisi;
740 const unsigned int d)
const
743 const unsigned int d1 = (d + 1) % dim;
744 const unsigned int d2 = (d + 2) % dim;
800 std::vector<double> &values,
801 const unsigned int d)
const
803 Assert(values.size() == points.size(),
806 const unsigned int d1 = (d + 1) % dim;
807 const unsigned int d2 = (d + 2) % dim;
809 for (
unsigned int i = 0; i < points.size(); ++i)
839 Assert(values.size() == points.size(),
842 for (
unsigned int i = 0; i < points.size(); ++i)
877 const unsigned int d)
const
886 const unsigned int d)
const
889 const unsigned int d1 = (d + 1) % dim;
890 const unsigned int d2 = (d + 2) % dim;
927 const unsigned int d)
const
930 const unsigned int d1 = (d + 1) % dim;
931 const unsigned int d2 = (d + 2) % dim;
934 Assert(gradients.size() == points.size(),
936 for (
unsigned int i = 0; i < points.size(); ++i)
979 for (
unsigned int i = 0; i < points.size(); ++i)
993 gradients[i][0][0] = coco;
994 gradients[i][1][1] = coco;
995 gradients[i][0][1] = sisi;
996 gradients[i][1][0] = sisi;
1014 gradients[i][0][0] = cococo;
1015 gradients[i][1][1] = cococo;
1016 gradients[i][2][2] = cococo;
1017 gradients[i][0][1] = sisico;
1018 gradients[i][1][0] = sisico;
1019 gradients[i][0][2] = sicosi;
1020 gradients[i][2][0] = sicosi;
1021 gradients[i][1][2] = cosisi;
1022 gradients[i][2][1] = cosisi;
1055 std::vector<double> &values,
1056 const unsigned int)
const
1058 Assert(values.size() == points.size(),
1061 for (
unsigned int i = 0; i < points.size(); ++i)
1102 std::vector<double> &values,
1103 const unsigned int)
const
1105 Assert(values.size() == points.size(),
1108 for (
unsigned int i = 0; i < points.size(); ++i)
1140 result[1] = result[0];
1144 result[1] = result[0];
1145 result[2] = result[0];
1157 const unsigned int)
const
1159 Assert(gradients.size() == points.size(),
1162 for (
unsigned int i = 0; i < points.size(); ++i)
1172 gradients[i][1] = gradients[i][0];
1177 gradients[i][1] = gradients[i][0];
1178 gradients[i][2] = gradients[i][0];
1192 const double x = p[0];
1193 const double y = p[1];
1195 if ((x >= 0) && (y >= 0))
1198 const double phi = std::atan2(y, -x) +
numbers::PI;
1199 const double r_squared = x * x + y * y;
1201 return std::cbrt(r_squared) *
std::sin(2. / 3. * phi);
1208 std::vector<double> &values,
1209 const unsigned int)
const
1211 Assert(values.size() == points.size(),
1214 for (
unsigned int i = 0; i < points.size(); ++i)
1216 const double x = points[i][0];
1217 const double y = points[i][1];
1219 if ((x >= 0) && (y >= 0))
1223 const double phi = std::atan2(y, -x) +
numbers::PI;
1224 const double r_squared = x * x + y * y;
1226 values[i] = std::cbrt(r_squared) *
std::sin(2. / 3. * phi);
1235 const std::vector<
Point<2>> &points,
1238 Assert(values.size() == points.size(),
1241 for (
unsigned int i = 0; i < points.size(); ++i)
1245 const double x = points[i][0];
1246 const double y = points[i][1];
1248 if ((x >= 0) && (y >= 0))
1252 const double phi = std::atan2(y, -x) +
numbers::PI;
1253 const double r_squared = x * x + y * y;
1255 values[i](0) = std::cbrt(r_squared) *
std::sin(2. / 3. * phi);
1273 std::vector<double> &values,
1274 const unsigned int)
const
1276 Assert(values.size() == points.size(),
1279 for (
unsigned int i = 0; i < points.size(); ++i)
1288 const double x = p[0];
1289 const double y = p[1];
1290 const double phi = std::atan2(y, -x) +
numbers::PI;
1291 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1294 result[0] = 2. / 3. *
1297 result[1] = 2. / 3. *
1308 const unsigned int)
const
1310 Assert(gradients.size() == points.size(),
1313 for (
unsigned int i = 0; i < points.size(); ++i)
1316 const double x = p[0];
1317 const double y = p[1];
1318 const double phi = std::atan2(y, -x) +
numbers::PI;
1319 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1334 const std::vector<
Point<2>> &points,
1335 std::vector<std::vector<
Tensor<1, 2>>> &gradients)
const
1337 Assert(gradients.size() == points.size(),
1340 for (
unsigned int i = 0; i < points.size(); ++i)
1345 const double x = p[0];
1346 const double y = p[1];
1347 const double phi = std::atan2(y, -x) +
numbers::PI;
1348 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1350 gradients[i][0][0] =
1353 gradients[i][0][1] =
1372 const double x = p[0];
1373 const double y = p[1];
1374 const double phi = std::atan2(y, -x) +
numbers::PI;
1375 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1379 (d == 0 ? (
std::cos(2. / 3. * phi) * y) :
1387 std::vector<double> &values,
1388 const unsigned int d)
const
1393 for (
unsigned int i = 0; i < points.size(); ++i)
1396 const double x = p[0];
1397 const double y = p[1];
1398 const double phi = std::atan2(y, -x) +
numbers::PI;
1399 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1401 values[i] = 2. / 3. *
1403 (d == 0 ? (
std::cos(2. / 3. * phi) * y) :
1412 const std::vector<
Point<2>> &points,
1415 Assert(values.size() == points.size(),
1418 for (
unsigned int i = 0; i < points.size(); ++i)
1422 const double x = p[0];
1423 const double y = p[1];
1424 const double phi = std::atan2(y, -x) +
numbers::PI;
1425 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1439 const unsigned int)
const
1447 std::vector<double> &values,
1448 const unsigned int)
const
1450 Assert(values.size() == points.size(),
1453 for (
unsigned int i = 0; i < points.size(); ++i)
1461 const unsigned int )
const
1472 const unsigned int )
const
1491 const unsigned int)
const
1493 const double x = p[0];
1494 const double y = p[1];
1496 const double phi = std::atan2(x, y) +
numbers::PI;
1497 const double r_squared = x * x + y * y;
1507 std::vector<double> &values,
1508 const unsigned int)
const
1510 Assert(values.size() == points.size(),
1513 for (
unsigned int i = 0; i < points.size(); ++i)
1515 const double x = points[i][0];
1516 const double y = points[i][1];
1518 const double phi = std::atan2(x, y) +
numbers::PI;
1519 const double r_squared = x * x + y * y;
1532 Assert(values.size() == points.size(),
1535 for (
unsigned int i = 0; i < points.size(); ++i)
1540 const double x = points[i][0];
1541 const double y = points[i][1];
1543 const double phi = std::atan2(x, y) +
numbers::PI;
1544 const double r_squared = x * x + y * y;
1554 const unsigned int)
const
1564 std::vector<double> &values,
1565 const unsigned int)
const
1567 Assert(values.size() == points.size(),
1570 for (
unsigned int i = 0; i < points.size(); ++i)
1578 const unsigned int)
const
1580 const double x = p[0];
1581 const double y = p[1];
1582 const double phi = std::atan2(x, y) +
numbers::PI;
1583 const double r64 =
std::pow(x * x + y * y, 3. / 4.);
1586 result[0] = 1. / 2. *
1589 result[1] = 1. / 2. *
1601 const unsigned int)
const
1603 Assert(gradients.size() == points.size(),
1606 for (
unsigned int i = 0; i < points.size(); ++i)
1609 const double x = p[0];
1610 const double y = p[1];
1611 const double phi = std::atan2(x, y) +
numbers::PI;
1612 const double r64 =
std::pow(x * x + y * y, 3. / 4.);
1620 for (
unsigned int d = 2; d < dim; ++d)
1621 gradients[i][d] = 0.;
1631 Assert(gradients.size() == points.size(),
1634 for (
unsigned int i = 0; i < points.size(); ++i)
1640 const double x = p[0];
1641 const double y = p[1];
1642 const double phi = std::atan2(x, y) +
numbers::PI;
1643 const double r64 =
std::pow(x * x + y * y, 3. / 4.);
1645 gradients[i][0][0] =
1648 gradients[i][0][1] =
1651 for (
unsigned int d = 2; d < dim; ++d)
1652 gradients[i][0][d] = 0.;
1661 const unsigned int)
const
1663 const double x = p[0];
1664 const double y = p[1];
1666 const double phi = std::atan2(x, y) +
numbers::PI;
1667 const double r_squared = x * x + y * y;
1675 std::vector<double> &values,
1676 const unsigned int)
const
1678 Assert(values.size() == points.size(),
1681 for (
unsigned int i = 0; i < points.size(); ++i)
1683 const double x = points[i][0];
1684 const double y = points[i][1];
1686 const double phi = std::atan2(x, y) +
numbers::PI;
1687 const double r_squared = x * x + y * y;
1696 const std::vector<
Point<2>> &points,
1699 Assert(values.size() == points.size(),
1702 for (
unsigned int i = 0; i < points.size(); ++i)
1707 const double x = points[i][0];
1708 const double y = points[i][1];
1710 const double phi = std::atan2(x, y) +
numbers::PI;
1711 const double r_squared = x * x + y * y;
1720 const unsigned int)
const
1728 const std::vector<
Point<2>> &points,
1729 std::vector<double> &values,
1730 const unsigned int)
const
1732 Assert(values.size() == points.size(),
1735 for (
unsigned int i = 0; i < points.size(); ++i)
1742 const unsigned int)
const
1744 const double x = p[0];
1745 const double y = p[1];
1746 const double phi = std::atan2(x, y) +
numbers::PI;
1747 const double r78 =
std::pow(x * x + y * y, 7. / 8.);
1751 result[0] = 1. / 4. *
1754 result[1] = 1. / 4. *
1763 const std::vector<
Point<2>> &points,
1765 const unsigned int)
const
1767 Assert(gradients.size() == points.size(),
1770 for (
unsigned int i = 0; i < points.size(); ++i)
1773 const double x = p[0];
1774 const double y = p[1];
1775 const double phi = std::atan2(x, y) +
numbers::PI;
1776 const double r78 =
std::pow(x * x + y * y, 7. / 8.);
1790 const std::vector<
Point<2>> &points,
1791 std::vector<std::vector<
Tensor<1, 2>>> &gradients)
const
1793 Assert(gradients.size() == points.size(),
1796 for (
unsigned int i = 0; i < points.size(); ++i)
1802 const double x = p[0];
1803 const double y = p[1];
1804 const double phi = std::atan2(x, y) +
numbers::PI;
1805 const double r78 =
std::pow(x * x + y * y, 7. / 8.);
1807 gradients[i][0][0] =
1810 gradients[i][0][1] =
1820 const double steepness)
1821 : direction(direction)
1822 , steepness(steepness)
1833 angle = std::numeric_limits<double>::signaling_NaN();
1846 const double x = steepness * (-cosine * p[0] + sine * p[1]);
1855 std::vector<double> &values,
1856 const unsigned int)
const
1858 Assert(values.size() == p.size(),
1861 for (
unsigned int i = 0; i < p.size(); ++i)
1863 const double x = steepness * (-cosine * p[i][0] + sine * p[i][1]);
1873 const double x = steepness * (-cosine * p[0] + sine * p[1]);
1874 const double r = 1 + x * x;
1875 return 2 * steepness * steepness * x / (r * r);
1882 std::vector<double> &values,
1883 const unsigned int)
const
1885 Assert(values.size() == p.size(),
1888 double f = 2 * steepness * steepness;
1890 for (
unsigned int i = 0; i < p.size(); ++i)
1892 const double x = steepness * (-cosine * p[i][0] + sine * p[i][1]);
1893 const double r = 1 + x * x;
1894 values[i] = f * x / (r * r);
1904 const double x = steepness * (-cosine * p[0] + sine * p[1]);
1905 const double r = -steepness * (1 + x * x);
1907 erg[0] = cosine * r;
1918 const unsigned int)
const
1920 Assert(gradients.size() == p.size(),
1923 for (
unsigned int i = 0; i < p.size(); ++i)
1925 const double x = steepness * (cosine * p[i][0] + sine * p[i][1]);
1926 const double r = -steepness * (1 + x * x);
1927 gradients[i][0] = cosine * r;
1928 gradients[i][1] = sine * r;
1940 return sizeof(*this);
1952 , fourier_coefficients(fourier_coefficients)
1960 const unsigned int component)
const
1963 return std::cos(fourier_coefficients * p);
1971 const unsigned int component)
const
1974 return -fourier_coefficients *
std::sin(fourier_coefficients * p);
1982 const unsigned int component)
const
1985 return (fourier_coefficients * fourier_coefficients) *
1986 (-
std::cos(fourier_coefficients * p));
1999 , fourier_coefficients(fourier_coefficients)
2007 const unsigned int component)
const
2010 return std::sin(fourier_coefficients * p);
2018 const unsigned int component)
const
2021 return fourier_coefficients *
std::cos(fourier_coefficients * p);
2029 const unsigned int component)
const
2032 return (fourier_coefficients * fourier_coefficients) *
2033 (-
std::sin(fourier_coefficients * p));
2044 const std::vector<
Point<dim>> &fourier_coefficients,
2045 const std::vector<double> &weights)
2047 , fourier_coefficients(fourier_coefficients)
2060 const unsigned int component)
const
2064 const unsigned int n = weights.size();
2066 for (
unsigned int s = 0; s < n; ++s)
2067 sum += weights[s] *
std::sin(fourier_coefficients[s] * p);
2077 const unsigned int component)
const
2081 const unsigned int n = weights.size();
2083 for (
unsigned int s = 0; s < n; ++s)
2084 sum += fourier_coefficients[s] *
std::cos(fourier_coefficients[s] * p);
2094 const unsigned int component)
const
2098 const unsigned int n = weights.size();
2100 for (
unsigned int s = 0; s < n; ++s)
2101 sum -= (fourier_coefficients[s] * fourier_coefficients[s]) *
2102 std::sin(fourier_coefficients[s] * p);
2115 const std::vector<
Point<dim>> &fourier_coefficients,
2116 const std::vector<double> &weights)
2118 , fourier_coefficients(fourier_coefficients)
2131 const unsigned int component)
const
2135 const unsigned int n = weights.size();
2137 for (
unsigned int s = 0; s < n; ++s)
2138 sum += weights[s] *
std::cos(fourier_coefficients[s] * p);
2148 const unsigned int component)
const
2152 const unsigned int n = weights.size();
2154 for (
unsigned int s = 0; s < n; ++s)
2155 sum -= fourier_coefficients[s] *
std::sin(fourier_coefficients[s] * p);
2165 const unsigned int component)
const
2169 const unsigned int n = weights.size();
2171 for (
unsigned int s = 0; s < n; ++s)
2172 sum -= (fourier_coefficients[s] * fourier_coefficients[s]) *
2173 std::cos(fourier_coefficients[s] * p);
2184 template <
int dim,
typename Number>
2186 const unsigned int n_components)
2187 :
Function<dim, Number>(n_components)
2188 , exponents(exponents)
2193 template <
int dim,
typename Number>
2196 const unsigned int component)
const
2201 for (
unsigned int s = 0; s < dim; ++s)
2204 Assert(std::floor(exponents[s]) == exponents[s],
2205 ExcMessage(
"Exponentiation of a negative base number with "
2206 "a real exponent can't be performed."));
2207 prod *=
std::pow(p[s], exponents[s]);
2214 template <
int dim,
typename Number>
2219 Assert(values.size() == this->n_components,
2222 for (
unsigned int i = 0; i < values.size(); ++i)
2228 template <
int dim,
typename Number>
2231 const unsigned int component)
const
2236 for (
unsigned int d = 0; d < dim; ++d)
2239 for (
unsigned int s = 0; s < dim; ++s)
2241 if ((s == d) && (exponents[s] == 0) && (p[s] == 0))
2249 Assert(std::floor(exponents[s]) == exponents[s],
2251 "Exponentiation of a negative base number with "
2252 "a real exponent can't be performed."));
2254 (s == d ? exponents[s] *
std::pow(p[s], exponents[s] - 1) :
2266 template <
int dim,
typename Number>
2269 std::vector<Number> &values,
2270 const unsigned int component)
const
2272 Assert(values.size() == points.size(),
2275 for (
unsigned int i = 0; i < points.size(); ++i)
2282 const double wave_number,
2285 , wave_number(wave_number)
2296 const double r = p.
distance(center);
2297 return std_cxx17::cyl_bessel_j(order, r * wave_number);
2304 std::vector<double> &values,
2305 const unsigned int)
const
2309 for (
unsigned int k = 0; k < points.size(); ++k)
2311 const double r = points[k].distance(center);
2312 values[k] = std_cxx17::cyl_bessel_j(order, r * wave_number);
2322 const double r = p.
distance(center);
2323 const double co = (r == 0.) ? 0. : (p[0] - center[0]) / r;
2324 const double si = (r == 0.) ? 0. : (p[1] - center[1]) / r;
2328 (-std_cxx17::cyl_bessel_j(1, r * wave_number)) :
2329 (.5 * (std_cxx17::cyl_bessel_j(order - 1, wave_number * r) -
2330 std_cxx17::cyl_bessel_j(order + 1, wave_number * r)));
2332 result[0] = wave_number * co * dJn;
2333 result[1] = wave_number * si * dJn;
2343 const unsigned int)
const
2347 for (
unsigned int k = 0; k < points.size(); ++k)
2350 const double r = p.
distance(center);
2351 const double co = (r == 0.) ? 0. : (p[0] - center[0]) / r;
2352 const double si = (r == 0.) ? 0. : (p[1] - center[1]) / r;
2356 (-std_cxx17::cyl_bessel_j(1, r * wave_number)) :
2357 (.5 * (std_cxx17::cyl_bessel_j(order - 1, wave_number * r) -
2358 std_cxx17::cyl_bessel_j(order + 1, wave_number * r)));
2360 result[0] = wave_number * co * dJn;
2361 result[1] = wave_number * si * dJn;
2377 return ((1 - xi[0]) * data_values[ix[0]] +
2378 xi[0] * data_values[ix[0] + 1]);
2386 return (((1 - p_unit[0]) * data_values[ix[0]][ix[1]] +
2387 p_unit[0] * data_values[ix[0] + 1][ix[1]]) *
2389 ((1 - p_unit[0]) * data_values[ix[0]][ix[1] + 1] +
2390 p_unit[0] * data_values[ix[0] + 1][ix[1] + 1]) *
2399 return ((((1 - p_unit[0]) * data_values[ix[0]][ix[1]][ix[2]] +
2400 p_unit[0] * data_values[ix[0] + 1][ix[1]][ix[2]]) *
2402 ((1 - p_unit[0]) * data_values[ix[0]][ix[1] + 1][ix[2]] +
2403 p_unit[0] * data_values[ix[0] + 1][ix[1] + 1][ix[2]]) *
2406 (((1 - p_unit[0]) * data_values[ix[0]][ix[1]][ix[2] + 1] +
2407 p_unit[0] * data_values[ix[0] + 1][ix[1]][ix[2] + 1]) *
2409 ((1 - p_unit[0]) * data_values[ix[0]][ix[1] + 1][ix[2] + 1] +
2410 p_unit[0] * data_values[ix[0] + 1][ix[1] + 1][ix[2] + 1]) *
2427 grad[0] = (data_values[ix[0] + 1] - data_values[ix[0]]) / dx[0];
2439 double u00 = data_values[ix[0]][ix[1]],
2440 u01 = data_values[ix[0] + 1][ix[1]],
2441 u10 = data_values[ix[0]][ix[1] + 1],
2442 u11 = data_values[ix[0] + 1][ix[1] + 1];
2445 ((1 - p_unit[1]) * (u01 - u00) + p_unit[1] * (u11 - u10)) /
dx[0];
2447 ((1 - p_unit[0]) * (u10 - u00) + p_unit[0] * (u11 - u01)) /
dx[1];
2459 double u000 = data_values[ix[0]][ix[1]][ix[2]],
2460 u001 = data_values[ix[0] + 1][ix[1]][ix[2]],
2461 u010 = data_values[ix[0]][ix[1] + 1][ix[2]],
2462 u100 = data_values[ix[0]][ix[1]][ix[2] + 1],
2463 u011 = data_values[ix[0] + 1][ix[1] + 1][ix[2]],
2464 u101 = data_values[ix[0] + 1][ix[1]][ix[2] + 1],
2465 u110 = data_values[ix[0]][ix[1] + 1][ix[2] + 1],
2466 u111 = data_values[ix[0] + 1][ix[1] + 1][ix[2] + 1];
2470 ((1 - p_unit[1]) * (u001 - u000) + p_unit[1] * (u011 - u010)) +
2472 ((1 - p_unit[1]) * (u101 - u100) + p_unit[1] * (u111 - u110))) /
2476 ((1 - p_unit[0]) * (u010 - u000) + p_unit[0] * (u011 - u001)) +
2478 ((1 - p_unit[0]) * (u110 - u100) + p_unit[0] * (u111 - u101))) /
2482 ((1 - p_unit[0]) * (u100 - u000) + p_unit[0] * (u101 - u001)) +
2484 ((1 - p_unit[0]) * (u110 - u010) + p_unit[0] * (u111 - u011))) /
2495 const std::array<std::vector<double>, dim> &coordinate_values,
2497 : coordinate_values(coordinate_values)
2498 , data_values(data_values)
2500 for (
unsigned int d = 0; d < dim; ++d)
2505 "Coordinate arrays must have at least two coordinate values!"));
2510 "Coordinate arrays must be sorted in strictly ascending order."));
2514 "Data and coordinate tables do not have the same size."));
2522 std::array<std::vector<double>, dim> &&coordinate_values,
2524 : coordinate_values(
std::move(coordinate_values))
2525 , data_values(
std::move(data_values))
2527 for (
unsigned int d = 0; d < dim; ++d)
2532 "Coordinate arrays must have at least two coordinate values!"));
2537 "Coordinate arrays must be sorted in strictly ascending order."));
2539 Assert(this->data_values.size()[d] == this->coordinate_values[d].size(),
2541 "Data and coordinate tables do not have the same size."));
2557 for (
unsigned int d = 0; d < dim; ++d)
2561 ix[d] = (std::lower_bound(coordinate_values[d].
begin(),
2562 coordinate_values[d].
end(),
2564 coordinate_values[d].begin());
2573 if (ix[d] == coordinate_values[d].
size())
2574 ix[d] = coordinate_values[d].
size() - 2;
2588 return sizeof(*this) +
2590 sizeof(coordinate_values) +
2592 sizeof(data_values);
2610 const unsigned int component)
const
2615 "This is a scalar function object, the component can only be zero."));
2624 for (
unsigned int d = 0; d < dim; ++d)
2625 p_unit[d] = std::clamp((p[d] - coordinate_values[d][ix[d]]) /
2626 (coordinate_values[d][ix[d] + 1] -
2627 coordinate_values[d][ix[d]]),
2631 return interpolate(data_values, ix, p_unit);
2640 const unsigned int component)
const
2645 "This is a scalar function object, the component can only be zero."));
2651 for (
unsigned int d = 0; d < dim; ++d)
2652 dx[d] = coordinate_values[d][ix[d] + 1] - coordinate_values[d][ix[d]];
2655 for (
unsigned int d = 0; d < dim; ++d)
2657 std::clamp((p[d] - coordinate_values[d][ix[d]]) / dx[d], 0., 1.);
2659 return gradient_interpolate(data_values, ix, p_unit, dx);
2666 const std::array<std::pair<double, double>, dim> &interval_endpoints,
2667 const std::array<unsigned int, dim> &n_subintervals,
2669 : interval_endpoints(interval_endpoints)
2670 , n_subintervals(n_subintervals)
2671 , data_values(data_values)
2673 for (
unsigned int d = 0; d < dim; ++d)
2676 ExcMessage(
"There needs to be at least one subinterval in each "
2677 "coordinate direction."));
2679 ExcMessage(
"The interval in each coordinate direction needs "
2680 "to have positive size"));
2682 ExcMessage(
"The data table does not have the correct size."));
2695 std::array<std::pair<double, double>, dim> &&interval_endpoints,
2696 std::array<unsigned int, dim> &&n_subintervals,
2698 : interval_endpoints(
std::move(interval_endpoints))
2699 , n_subintervals(
std::move(n_subintervals))
2700 , data_values(
std::move(data_values))
2702 for (
unsigned int d = 0; d < dim; ++d)
2705 ExcMessage(
"There needs to be at least one subinterval in each "
2706 "coordinate direction."));
2709 ExcMessage(
"The interval in each coordinate direction needs "
2710 "to have positive size"));
2711 Assert(this->data_values.size()[d] == this->n_subintervals[d] + 1,
2712 ExcMessage(
"The data table does not have the correct size."));
2726 const unsigned int component)
const
2731 "This is a scalar function object, the component can only be zero."));
2736 for (
unsigned int d = 0; d < dim; ++d)
2739 const double delta_x = this->delta_x[d];
2740 if (p[d] <= interval_endpoints[d].
first)
2742 else if (p[d] >= interval_endpoints[d].
second - delta_x)
2743 ix[d] = n_subintervals[d] - 1;
2745 ix[d] =
static_cast<unsigned int>(
2746 (p[d] - interval_endpoints[d].first) / delta_x);
2753 for (
unsigned int d = 0; d < dim; ++d)
2756 const double delta_x = this->delta_x[d];
2759 std::clamp((p[d] - interval_endpoints[d].
first - ix[d] * delta_x) /
2765 return interpolate(data_values, ix, p_unit);
2773 const unsigned int component)
const
2778 "This is a scalar function object, the component can only be zero."));
2783 for (
unsigned int d = 0; d < dim; ++d)
2785 const double delta_x = this->delta_x[d];
2786 if (p[d] <= this->interval_endpoints[d].
first)
2788 else if (p[d] >= this->interval_endpoints[d].
second - delta_x)
2789 ix[d] = this->n_subintervals[d] - 1;
2791 ix[d] =
static_cast<unsigned int>(
2792 (p[d] - this->interval_endpoints[d].first) / delta_x);
2800 for (
unsigned int d = 0; d < dim; ++d)
2802 delta_x[d] = this->delta_x[d];
2803 p_unit[d] = std::clamp((p[d] - this->interval_endpoints[d].
first -
2804 ix[d] * delta_x[d]) /
2810 return gradient_interpolate(this->data_values, ix, p_unit, delta_x);
2819 return sizeof(*this) + data_values.memory_consumption() -
2820 sizeof(data_values);
2840 const std::vector<double> &coefficients)
2842 , exponents(exponents)
2843 , coefficients(coefficients)
2856 const unsigned int component)
const
2861 for (
unsigned int monom = 0; monom < exponents.n_rows(); ++monom)
2864 for (
unsigned int s = 0; s < dim; ++s)
2867 Assert(std::floor(exponents[monom][s]) == exponents[monom][s],
2868 ExcMessage(
"Exponentiation of a negative base number with "
2869 "a real exponent can't be performed."));
2870 prod *=
std::pow(p[s], exponents[monom][s]);
2872 sum += coefficients[monom] * prod;
2882 std::vector<double> &values,
2883 const unsigned int component)
const
2885 Assert(values.size() == points.size(),
2888 for (
unsigned int i = 0; i < points.size(); ++i)
2897 const unsigned int component)
const
2903 for (
unsigned int d = 0; d < dim; ++d)
2907 for (
unsigned int monom = 0; monom < exponents.n_rows(); ++monom)
2910 for (
unsigned int s = 0; s < dim; ++s)
2912 if ((s == d) && (exponents[monom][s] == 0) && (p[s] == 0))
2920 Assert(std::floor(exponents[monom][s]) ==
2921 exponents[monom][s],
2923 "Exponentiation of a negative base number with "
2924 "a real exponent can't be performed."));
2926 (s == d ? exponents[monom][s] *
2927 std::pow(p[s], exponents[monom][s] - 1) :
2928 std::pow(p[s], exponents[monom][s]));
2931 sum += coefficients[monom] * prod;
2946 sizeof(coefficients);
2965 const double pi_t =
numbers::PI / T * this->get_time();
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual double value(const Point< dim > &points, const unsigned int component=0) const override
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const override
Bessel1(const unsigned int order, const double wave_number, const Point< dim > center=Point< dim >())
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
CosineFunction(const unsigned int n_components=1)
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
virtual SymmetricTensor< 2, dim > hessian(const Point< dim > &p, const unsigned int component=0) const override
virtual void vector_value_list(const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const override
virtual void hessian_list(const std::vector< Point< dim > > &points, std::vector< SymmetricTensor< 2, dim > > &hessians, const unsigned int component=0) const override
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component) const override
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component) const override
virtual void vector_value_list(const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const override
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component) const override
virtual double value(const Point< dim > &p, const unsigned int component) const override
virtual void vector_value(const Point< dim > &p, Vector< double > &values) const override
virtual double laplacian(const Point< dim > &p, const unsigned int component) const override
virtual void vector_gradient_list(const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim > > > &gradients) const override
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const override
FourierCosineFunction(const Tensor< 1, dim > &fourier_coefficients)
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
const std::vector< Point< dim > > fourier_coefficients
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
FourierCosineSum(const std::vector< Point< dim > > &fourier_coefficients, const std::vector< double > &weights)
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
const std::vector< double > weights
FourierSineFunction(const Tensor< 1, dim > &fourier_coefficients)
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
const std::vector< Point< dim > > fourier_coefficients
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
FourierSineSum(const std::vector< Point< dim > > &fourier_coefficients, const std::vector< double > &weights)
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
const std::vector< double > weights
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
InterpolatedTensorProductGridData(const std::array< std::vector< double >, dim > &coordinate_values, const Table< dim, double > &data_values)
const Table< dim, double > & get_data() const
TableIndices< dim > table_index_of_point(const Point< dim > &p) const
virtual std::size_t memory_consumption() const override
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
const std::array< std::vector< double >, dim > coordinate_values
const Table< dim, double > data_values
const Point< dim > direction
virtual std::size_t memory_consumption() const override
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
JumpFunction(const Point< dim > &direction, const double steepness)
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const override
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
virtual void laplacian_list(const std::vector< Point< 2 > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< 2 > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual Tensor< 1, 2 > gradient(const Point< 2 > &p, const unsigned int component=0) const override
virtual double laplacian(const Point< 2 > &p, const unsigned int component=0) const override
virtual double value(const Point< 2 > &p, const unsigned int component=0) const override
virtual void vector_gradient_list(const std::vector< Point< 2 > > &, std::vector< std::vector< Tensor< 1, 2 > > > &) const override
virtual void gradient_list(const std::vector< Point< 2 > > &points, std::vector< Tensor< 1, 2 > > &gradients, const unsigned int component=0) const override
virtual void vector_value_list(const std::vector< Point< 2 > > &points, std::vector< Vector< double > > &values) const override
virtual void vector_gradient_list(const std::vector< Point< 2 > > &, std::vector< std::vector< Tensor< 1, 2 > > > &) const override
virtual double laplacian(const Point< 2 > &p, const unsigned int component) const override
virtual void value_list(const std::vector< Point< 2 > > &points, std::vector< double > &values, const unsigned int component) const override
virtual void vector_value_list(const std::vector< Point< 2 > > &points, std::vector< Vector< double > > &values) const override
virtual void laplacian_list(const std::vector< Point< 2 > > &points, std::vector< double > &values, const unsigned int component) const override
LSingularityGradFunction()
virtual void gradient_list(const std::vector< Point< 2 > > &points, std::vector< Tensor< 1, 2 > > &gradients, const unsigned int component) const override
virtual Tensor< 1, 2 > gradient(const Point< 2 > &p, const unsigned int component) const override
virtual double value(const Point< 2 > &p, const unsigned int component) const override
virtual Number value(const Point< dim > &p, const unsigned int component=0) const override
virtual Tensor< 1, dim, Number > gradient(const Point< dim > &p, const unsigned int component=0) const override
Monomial(const Tensor< 1, dim, Number > &exponents, const unsigned int n_components=1)
virtual void vector_value(const Point< dim > &p, Vector< Number > &values) const override
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< Number > &values, const unsigned int component=0) const override
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const override
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
PillowFunction(const double offset=0.)
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
const Table< 2, double > exponents
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual std::size_t memory_consumption() const override
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
const std::vector< double > coefficients
Polynomial(const Table< 2, double > &exponents, const std::vector< double > &coefficients)
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const override
virtual void vector_value_list(const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const override
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
virtual void vector_gradient_list(const std::vector< Point< dim > > &, std::vector< std::vector< Tensor< 1, dim > > > &) const override
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
RayleighKotheVortex(const double T=1.0)
virtual void vector_value(const Point< dim > &point, Vector< double > &values) const override
virtual void gradient_list(const std::vector< Point< 2 > > &points, std::vector< Tensor< 1, 2 > > &gradients, const unsigned int component=0) const override
virtual void laplacian_list(const std::vector< Point< 2 > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< 2 > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual void vector_gradient_list(const std::vector< Point< 2 > > &, std::vector< std::vector< Tensor< 1, 2 > > > &) const override
virtual double value(const Point< 2 > &p, const unsigned int component=0) const override
virtual void vector_value_list(const std::vector< Point< 2 > > &points, std::vector< Vector< double > > &values) const override
virtual double laplacian(const Point< 2 > &p, const unsigned int component=0) const override
virtual Tensor< 1, 2 > gradient(const Point< 2 > &p, const unsigned int component=0) const override
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
virtual void vector_value_list(const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const override
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual void vector_gradient_list(const std::vector< Point< dim > > &, std::vector< std::vector< Tensor< 1, dim > > > &) const override
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const override
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual void vector_value(const Point< dim > &p, Vector< double > &values) const override
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const override
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
virtual void vector_gradient(const Point< dim > &p, std::vector< Tensor< 1, dim > > &gradient) const override
numbers::NumberTraits< Number >::real_type distance(const Point< dim, Number > &p) const
constexpr numbers::NumberTraits< Number >::real_type square() const
static constexpr std::size_t memory_consumption()
virtual size_type size() const override
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NOT_IMPLEMENTED()
static ::ExceptionBase & ExcZero()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertVectorVectorDimension(VEC, DIM1, DIM2)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
::VectorizedArray< Number, width > exp(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > cos(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sin(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > pow(const ::VectorizedArray< Number, width > &, const Number p)
inline ::VectorizedArray< Number, width > atan(const ::VectorizedArray< Number, width > &x)