52 std::vector<double> &values,
53 const unsigned int)
const
55 Assert(values.size() == points.size(),
58 for (
unsigned int i = 0; i < points.size(); ++i)
77 std::vector<double> &values,
78 const unsigned int)
const
80 Assert(values.size() == points.size(),
83 for (
unsigned int i = 0; i < points.size(); ++i)
113 const unsigned int)
const
115 Assert(gradients.size() == points.size(),
118 for (
unsigned int i = 0; i < points.size(); ++i)
139 std::vector<double> &values,
140 const unsigned int)
const
143 Assert(values.size() == points.size(),
146 for (
unsigned int i = 0; i < points.size(); ++i)
149 values[i] = p[0] * p[1];
161 Assert(values.size() == points.size(),
165 for (
unsigned int i = 0; i < points.size(); ++i)
168 values[i](0) = p[0] * p[1];
185 std::vector<double> &values,
186 const unsigned int)
const
189 Assert(values.size() == points.size(),
192 for (
unsigned int i = 0; i < points.size(); ++i)
215 const unsigned int)
const
218 Assert(gradients.size() == points.size(),
221 for (
unsigned int i = 0; i < points.size(); ++i)
223 gradients[i][0] = points[i][1];
224 gradients[i][1] = points[i][0];
236 Assert(gradients.size() == points.size(),
238 Assert(gradients[0].size() == 1,
241 for (
unsigned int i = 0; i < points.size(); ++i)
243 gradients[i][0][0] = points[i][1];
244 gradients[i][0][1] = points[i][0];
265 return 1. - p[0] * p[0] + offset;
267 return (1. - p[0] * p[0]) * (1. - p[1] * p[1]) + offset;
269 return (1. - p[0] * p[0]) * (1. - p[1] * p[1]) * (1. - p[2] * p[2]) +
280 std::vector<double> &values,
281 const unsigned int)
const
283 Assert(values.size() == points.size(),
286 for (
unsigned int i = 0; i < points.size(); ++i)
292 values[i] = 1. - p[0] * p[0] + offset;
295 values[i] = (1. - p[0] * p[0]) * (1. - p[1] * p[1]) + offset;
299 (1. - p[0] * p[0]) * (1. - p[1] * p[1]) * (1. - p[2] * p[2]) +
319 return -2. * ((1. - p[0] * p[0]) + (1. - p[1] * p[1]));
321 return -2. * ((1. - p[0] * p[0]) * (1. - p[1] * p[1]) +
322 (1. - p[1] * p[1]) * (1. - p[2] * p[2]) +
323 (1. - p[2] * p[2]) * (1. - p[0] * p[0]));
333 std::vector<double> &values,
334 const unsigned int)
const
336 Assert(values.size() == points.size(),
339 for (
unsigned int i = 0; i < points.size(); ++i)
348 values[i] = -2. * ((1. - p[0] * p[0]) + (1. - p[1] * p[1]));
351 values[i] = -2. * ((1. - p[0] * p[0]) * (1. - p[1] * p[1]) +
352 (1. - p[1] * p[1]) * (1. - p[2] * p[2]) +
353 (1. - p[2] * p[2]) * (1. - p[0] * p[0]));
369 result[0] = -2. * p[0];
372 result[0] = -2. * p[0] * (1. - p[1] * p[1]);
373 result[1] = -2. * p[1] * (1. - p[0] * p[0]);
376 result[0] = -2. * p[0] * (1. - p[1] * p[1]) * (1. - p[2] * p[2]);
377 result[1] = -2. * p[1] * (1. - p[0] * p[0]) * (1. - p[2] * p[2]);
378 result[2] = -2. * p[2] * (1. - p[0] * p[0]) * (1. - p[1] * p[1]);
390 const unsigned int)
const
392 Assert(gradients.size() == points.size(),
395 for (
unsigned int i = 0; i < points.size(); ++i)
401 gradients[i][0] = -2. * p[0];
404 gradients[i][0] = -2. * p[0] * (1. - p[1] * p[1]);
405 gradients[i][1] = -2. * p[1] * (1. - p[0] * p[0]);
409 -2. * p[0] * (1. - p[1] * p[1]) * (1. - p[2] * p[2]);
411 -2. * p[1] * (1. - p[0] * p[0]) * (1. - p[2] * p[2]);
413 -2. * p[2] * (1. - p[0] * p[0]) * (1. - p[1] * p[1]);
454 std::vector<double> &values,
455 const unsigned int)
const
457 Assert(values.size() == points.size(),
460 for (
unsigned int i = 0; i < points.size(); ++i)
461 values[i] = value(points[i]);
471 Assert(values.size() == points.size(),
474 for (
unsigned int i = 0; i < points.size(); ++i)
476 const double v = value(points[i]);
477 for (
unsigned int k = 0; k < values[i].size(); ++k)
510 std::vector<double> &values,
511 const unsigned int)
const
513 Assert(values.size() == points.size(),
516 for (
unsigned int i = 0; i < points.size(); ++i)
517 values[i] = laplacian(points[i]);
557 const unsigned int)
const
559 Assert(gradients.size() == points.size(),
562 for (
unsigned int i = 0; i < points.size(); ++i)
634 result[0][0] = cococo;
635 result[1][1] = cococo;
636 result[2][2] = cococo;
638 result[0][1] = sisico;
639 result[0][2] = sicosi;
640 result[1][2] = cosisi;
654 const unsigned int)
const
656 Assert(hessians.size() == points.size(),
661 for (
unsigned int i = 0; i < points.size(); ++i)
675 hessians[i][0][0] = coco;
676 hessians[i][1][1] = coco;
678 hessians[i][0][1] = sisi;
696 hessians[i][0][0] = cococo;
697 hessians[i][1][1] = cococo;
698 hessians[i][2][2] = cococo;
700 hessians[i][0][1] = sisico;
701 hessians[i][0][2] = sicosi;
702 hessians[i][1][2] = cosisi;
722 const unsigned int d)
const
725 const unsigned int d1 = (d + 1) % dim;
726 const unsigned int d2 = (d + 2) % dim;
782 std::vector<double> &values,
783 const unsigned int d)
const
785 Assert(values.size() == points.size(),
788 const unsigned int d1 = (d + 1) % dim;
789 const unsigned int d2 = (d + 2) % dim;
791 for (
unsigned int i = 0; i < points.size(); ++i)
821 Assert(values.size() == points.size(),
824 for (
unsigned int i = 0; i < points.size(); ++i)
859 const unsigned int d)
const
868 const unsigned int d)
const
871 const unsigned int d1 = (d + 1) % dim;
872 const unsigned int d2 = (d + 2) % dim;
909 const unsigned int d)
const
912 const unsigned int d1 = (d + 1) % dim;
913 const unsigned int d2 = (d + 2) % dim;
916 Assert(gradients.size() == points.size(),
918 for (
unsigned int i = 0; i < points.size(); ++i)
961 for (
unsigned int i = 0; i < points.size(); ++i)
975 gradients[i][0][0] = coco;
976 gradients[i][1][1] = coco;
977 gradients[i][0][1] = sisi;
978 gradients[i][1][0] = sisi;
996 gradients[i][0][0] = cococo;
997 gradients[i][1][1] = cococo;
998 gradients[i][2][2] = cococo;
999 gradients[i][0][1] = sisico;
1000 gradients[i][1][0] = sisico;
1001 gradients[i][0][2] = sicosi;
1002 gradients[i][2][0] = sicosi;
1003 gradients[i][1][2] = cosisi;
1004 gradients[i][2][1] = cosisi;
1037 std::vector<double> &values,
1038 const unsigned int)
const
1040 Assert(values.size() == points.size(),
1043 for (
unsigned int i = 0; i < points.size(); ++i)
1084 std::vector<double> &values,
1085 const unsigned int)
const
1087 Assert(values.size() == points.size(),
1090 for (
unsigned int i = 0; i < points.size(); ++i)
1122 result[1] = result[0];
1126 result[1] = result[0];
1127 result[2] = result[0];
1139 const unsigned int)
const
1141 Assert(gradients.size() == points.size(),
1144 for (
unsigned int i = 0; i < points.size(); ++i)
1154 gradients[i][1] = gradients[i][0];
1159 gradients[i][1] = gradients[i][0];
1160 gradients[i][2] = gradients[i][0];
1174 const double x = p[0];
1175 const double y = p[1];
1177 if ((x >= 0) && (y >= 0))
1180 const double phi = std::atan2(y, -x) +
numbers::PI;
1181 const double r_squared = x * x + y * y;
1183 return std::cbrt(r_squared) *
std::sin(2. / 3. * phi);
1190 std::vector<double> &values,
1191 const unsigned int)
const
1193 Assert(values.size() == points.size(),
1196 for (
unsigned int i = 0; i < points.size(); ++i)
1198 const double x = points[i][0];
1199 const double y = points[i][1];
1201 if ((x >= 0) && (y >= 0))
1205 const double phi = std::atan2(y, -x) +
numbers::PI;
1206 const double r_squared = x * x + y * y;
1208 values[i] = std::cbrt(r_squared) *
std::sin(2. / 3. * phi);
1217 const std::vector<
Point<2>> &points,
1220 Assert(values.size() == points.size(),
1223 for (
unsigned int i = 0; i < points.size(); ++i)
1225 Assert(values[i].size() == 1,
1227 const double x = points[i][0];
1228 const double y = points[i][1];
1230 if ((x >= 0) && (y >= 0))
1234 const double phi = std::atan2(y, -x) +
numbers::PI;
1235 const double r_squared = x * x + y * y;
1237 values[i](0) = std::cbrt(r_squared) *
std::sin(2. / 3. * phi);
1255 std::vector<double> &values,
1256 const unsigned int)
const
1258 Assert(values.size() == points.size(),
1261 for (
unsigned int i = 0; i < points.size(); ++i)
1270 const double x = p[0];
1271 const double y = p[1];
1272 const double phi = std::atan2(y, -x) +
numbers::PI;
1273 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1276 result[0] = 2. / 3. *
1279 result[1] = 2. / 3. *
1290 const unsigned int)
const
1292 Assert(gradients.size() == points.size(),
1295 for (
unsigned int i = 0; i < points.size(); ++i)
1298 const double x = p[0];
1299 const double y = p[1];
1300 const double phi = std::atan2(y, -x) +
numbers::PI;
1301 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1316 const std::vector<
Point<2>> &points,
1317 std::vector<std::vector<
Tensor<1, 2>>> &gradients)
const
1319 Assert(gradients.size() == points.size(),
1322 for (
unsigned int i = 0; i < points.size(); ++i)
1324 Assert(gradients[i].size() == 1,
1327 const double x = p[0];
1328 const double y = p[1];
1329 const double phi = std::atan2(y, -x) +
numbers::PI;
1330 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1332 gradients[i][0][0] =
1335 gradients[i][0][1] =
1354 const double x = p[0];
1355 const double y = p[1];
1356 const double phi = std::atan2(y, -x) +
numbers::PI;
1357 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1361 (d == 0 ? (
std::cos(2. / 3. * phi) * y) :
1369 std::vector<double> &values,
1370 const unsigned int d)
const
1375 for (
unsigned int i = 0; i < points.size(); ++i)
1378 const double x = p[0];
1379 const double y = p[1];
1380 const double phi = std::atan2(y, -x) +
numbers::PI;
1381 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1383 values[i] = 2. / 3. *
1385 (d == 0 ? (
std::cos(2. / 3. * phi) * y) :
1394 const std::vector<
Point<2>> &points,
1397 Assert(values.size() == points.size(),
1400 for (
unsigned int i = 0; i < points.size(); ++i)
1404 const double x = p[0];
1405 const double y = p[1];
1406 const double phi = std::atan2(y, -x) +
numbers::PI;
1407 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1421 const unsigned int)
const
1429 std::vector<double> &values,
1430 const unsigned int)
const
1432 Assert(values.size() == points.size(),
1435 for (
unsigned int i = 0; i < points.size(); ++i)
1443 const unsigned int )
const
1454 const unsigned int )
const
1473 const unsigned int)
const
1475 const double x = p[0];
1476 const double y = p[1];
1478 const double phi = std::atan2(x, y) +
numbers::PI;
1479 const double r_squared = x * x + y * y;
1489 std::vector<double> &values,
1490 const unsigned int)
const
1492 Assert(values.size() == points.size(),
1495 for (
unsigned int i = 0; i < points.size(); ++i)
1497 const double x = points[i][0];
1498 const double y = points[i][1];
1500 const double phi = std::atan2(x, y) +
numbers::PI;
1501 const double r_squared = x * x + y * y;
1514 Assert(values.size() == points.size(),
1517 for (
unsigned int i = 0; i < points.size(); ++i)
1519 Assert(values[i].size() == 1,
1522 const double x = points[i][0];
1523 const double y = points[i][1];
1525 const double phi = std::atan2(x, y) +
numbers::PI;
1526 const double r_squared = x * x + y * y;
1536 const unsigned int)
const
1546 std::vector<double> &values,
1547 const unsigned int)
const
1549 Assert(values.size() == points.size(),
1552 for (
unsigned int i = 0; i < points.size(); ++i)
1560 const unsigned int)
const
1562 const double x = p[0];
1563 const double y = p[1];
1564 const double phi = std::atan2(x, y) +
numbers::PI;
1565 const double r64 =
std::pow(x * x + y * y, 3. / 4.);
1568 result[0] = 1. / 2. *
1571 result[1] = 1. / 2. *
1583 const unsigned int)
const
1585 Assert(gradients.size() == points.size(),
1588 for (
unsigned int i = 0; i < points.size(); ++i)
1591 const double x = p[0];
1592 const double y = p[1];
1593 const double phi = std::atan2(x, y) +
numbers::PI;
1594 const double r64 =
std::pow(x * x + y * y, 3. / 4.);
1602 for (
unsigned int d = 2; d < dim; ++d)
1603 gradients[i][d] = 0.;
1613 Assert(gradients.size() == points.size(),
1616 for (
unsigned int i = 0; i < points.size(); ++i)
1618 Assert(gradients[i].size() == 1,
1622 const double x = p[0];
1623 const double y = p[1];
1624 const double phi = std::atan2(x, y) +
numbers::PI;
1625 const double r64 =
std::pow(x * x + y * y, 3. / 4.);
1627 gradients[i][0][0] =
1630 gradients[i][0][1] =
1633 for (
unsigned int d = 2; d < dim; ++d)
1634 gradients[i][0][d] = 0.;
1643 const unsigned int)
const
1645 const double x = p[0];
1646 const double y = p[1];
1648 const double phi = std::atan2(x, y) +
numbers::PI;
1649 const double r_squared = x * x + y * y;
1657 std::vector<double> &values,
1658 const unsigned int)
const
1660 Assert(values.size() == points.size(),
1663 for (
unsigned int i = 0; i < points.size(); ++i)
1665 const double x = points[i][0];
1666 const double y = points[i][1];
1668 const double phi = std::atan2(x, y) +
numbers::PI;
1669 const double r_squared = x * x + y * y;
1678 const std::vector<
Point<2>> &points,
1681 Assert(values.size() == points.size(),
1684 for (
unsigned int i = 0; i < points.size(); ++i)
1686 Assert(values[i].size() == 1,
1689 const double x = points[i][0];
1690 const double y = points[i][1];
1692 const double phi = std::atan2(x, y) +
numbers::PI;
1693 const double r_squared = x * x + y * y;
1702 const unsigned int)
const
1710 const std::vector<
Point<2>> &points,
1711 std::vector<double> &values,
1712 const unsigned int)
const
1714 Assert(values.size() == points.size(),
1717 for (
unsigned int i = 0; i < points.size(); ++i)
1724 const unsigned int)
const
1726 const double x = p[0];
1727 const double y = p[1];
1728 const double phi = std::atan2(x, y) +
numbers::PI;
1729 const double r78 =
std::pow(x * x + y * y, 7. / 8.);
1733 result[0] = 1. / 4. *
1736 result[1] = 1. / 4. *
1745 const std::vector<
Point<2>> &points,
1747 const unsigned int)
const
1749 Assert(gradients.size() == points.size(),
1752 for (
unsigned int i = 0; i < points.size(); ++i)
1755 const double x = p[0];
1756 const double y = p[1];
1757 const double phi = std::atan2(x, y) +
numbers::PI;
1758 const double r78 =
std::pow(x * x + y * y, 7. / 8.);
1772 const std::vector<
Point<2>> &points,
1773 std::vector<std::vector<
Tensor<1, 2>>> &gradients)
const
1775 Assert(gradients.size() == points.size(),
1778 for (
unsigned int i = 0; i < points.size(); ++i)
1780 Assert(gradients[i].size() == 1,
1784 const double x = p[0];
1785 const double y = p[1];
1786 const double phi = std::atan2(x, y) +
numbers::PI;
1787 const double r78 =
std::pow(x * x + y * y, 7. / 8.);
1789 gradients[i][0][0] =
1792 gradients[i][0][1] =
1802 const double steepness)
1803 : direction(direction)
1804 , steepness(steepness)
1815 angle = std::numeric_limits<double>::signaling_NaN();
1828 const double x = steepness * (-cosine * p[0] + sine * p[1]);
1837 std::vector<double> &values,
1838 const unsigned int)
const
1840 Assert(values.size() == p.size(),
1843 for (
unsigned int i = 0; i < p.size(); ++i)
1845 const double x = steepness * (-cosine * p[i][0] + sine * p[i][1]);
1855 const double x = steepness * (-cosine * p[0] + sine * p[1]);
1856 const double r = 1 + x * x;
1857 return 2 * steepness * steepness * x / (r * r);
1864 std::vector<double> &values,
1865 const unsigned int)
const
1867 Assert(values.size() == p.size(),
1870 double f = 2 * steepness * steepness;
1872 for (
unsigned int i = 0; i < p.size(); ++i)
1874 const double x = steepness * (-cosine * p[i][0] + sine * p[i][1]);
1875 const double r = 1 + x * x;
1876 values[i] = f * x / (r * r);
1886 const double x = steepness * (-cosine * p[0] + sine * p[1]);
1887 const double r = -steepness * (1 + x * x);
1889 erg[0] = cosine * r;
1900 const unsigned int)
const
1902 Assert(gradients.size() == p.size(),
1905 for (
unsigned int i = 0; i < p.size(); ++i)
1907 const double x = steepness * (cosine * p[i][0] + sine * p[i][1]);
1908 const double r = -steepness * (1 + x * x);
1909 gradients[i][0] = cosine * r;
1910 gradients[i][1] = sine * r;
1922 return sizeof(*this);
1934 , fourier_coefficients(fourier_coefficients)
1942 const unsigned int component)
const
1946 return std::cos(fourier_coefficients * p);
1954 const unsigned int component)
const
1958 return -fourier_coefficients *
std::sin(fourier_coefficients * p);
1966 const unsigned int component)
const
1970 return (fourier_coefficients * fourier_coefficients) *
1971 (-
std::cos(fourier_coefficients * p));
1984 , fourier_coefficients(fourier_coefficients)
1992 const unsigned int component)
const
1996 return std::sin(fourier_coefficients * p);
2004 const unsigned int component)
const
2008 return fourier_coefficients *
std::cos(fourier_coefficients * p);
2016 const unsigned int component)
const
2020 return (fourier_coefficients * fourier_coefficients) *
2021 (-
std::sin(fourier_coefficients * p));
2032 const std::vector<
Point<dim>> &fourier_coefficients,
2033 const std::vector<double> &weights)
2035 , fourier_coefficients(fourier_coefficients)
2048 const unsigned int component)
const
2053 const unsigned int n = weights.size();
2055 for (
unsigned int s = 0; s < n; ++s)
2056 sum += weights[s] *
std::sin(fourier_coefficients[s] * p);
2066 const unsigned int component)
const
2071 const unsigned int n = weights.size();
2073 for (
unsigned int s = 0; s < n; ++s)
2074 sum += fourier_coefficients[s] *
std::cos(fourier_coefficients[s] * p);
2084 const unsigned int component)
const
2089 const unsigned int n = weights.size();
2091 for (
unsigned int s = 0; s < n; ++s)
2092 sum -= (fourier_coefficients[s] * fourier_coefficients[s]) *
2093 std::sin(fourier_coefficients[s] * p);
2106 const std::vector<
Point<dim>> &fourier_coefficients,
2107 const std::vector<double> &weights)
2109 , fourier_coefficients(fourier_coefficients)
2122 const unsigned int component)
const
2127 const unsigned int n = weights.size();
2129 for (
unsigned int s = 0; s < n; ++s)
2130 sum += weights[s] *
std::cos(fourier_coefficients[s] * p);
2140 const unsigned int component)
const
2145 const unsigned int n = weights.size();
2147 for (
unsigned int s = 0; s < n; ++s)
2148 sum -= fourier_coefficients[s] *
std::sin(fourier_coefficients[s] * p);
2158 const unsigned int component)
const
2163 const unsigned int n = weights.size();
2165 for (
unsigned int s = 0; s < n; ++s)
2166 sum -= (fourier_coefficients[s] * fourier_coefficients[s]) *
2167 std::cos(fourier_coefficients[s] * p);
2178 template <
int dim,
typename Number>
2180 const unsigned int n_components)
2181 :
Function<dim, Number>(n_components)
2182 , exponents(exponents)
2187 template <
int dim,
typename Number>
2190 const unsigned int component)
const
2196 for (
unsigned int s = 0; s < dim; ++s)
2199 Assert(std::floor(exponents[s]) == exponents[s],
2200 ExcMessage(
"Exponentiation of a negative base number with "
2201 "a real exponent can't be performed."));
2202 prod *=
std::pow(p[s], exponents[s]);
2209 template <
int dim,
typename Number>
2214 Assert(values.size() == this->n_components,
2217 for (
unsigned int i = 0; i < values.size(); ++i)
2223 template <
int dim,
typename Number>
2226 const unsigned int component)
const
2232 for (
unsigned int d = 0; d < dim; ++d)
2235 for (
unsigned int s = 0; s < dim; ++s)
2237 if ((s == d) && (exponents[s] == 0) && (p[s] == 0))
2245 Assert(std::floor(exponents[s]) == exponents[s],
2247 "Exponentiation of a negative base number with "
2248 "a real exponent can't be performed."));
2250 (s == d ? exponents[s] *
std::pow(p[s], exponents[s] - 1) :
2262 template <
int dim,
typename Number>
2265 std::vector<Number> &values,
2266 const unsigned int component)
const
2268 Assert(values.size() == points.size(),
2271 for (
unsigned int i = 0; i < points.size(); ++i)
2278 const double wave_number,
2281 , wave_number(wave_number)
2293 return std_cxx17::cyl_bessel_j(order, r * wave_number);
2300 std::vector<double> &values,
2301 const unsigned int)
const
2305 for (
unsigned int k = 0; k < points.size(); ++k)
2307 const double r = points[k].distance(
center);
2308 values[k] = std_cxx17::cyl_bessel_j(order, r * wave_number);
2319 const double co = (r == 0.) ? 0. : (p[0] -
center[0]) / r;
2320 const double si = (r == 0.) ? 0. : (p[1] -
center[1]) / r;
2324 (-std_cxx17::cyl_bessel_j(1, r * wave_number)) :
2325 (.5 * (std_cxx17::cyl_bessel_j(order - 1, wave_number * r) -
2326 std_cxx17::cyl_bessel_j(order + 1, wave_number * r)));
2328 result[0] = wave_number * co * dJn;
2329 result[1] = wave_number * si * dJn;
2339 const unsigned int)
const
2343 for (
unsigned int k = 0; k < points.size(); ++k)
2347 const double co = (r == 0.) ? 0. : (p[0] -
center[0]) / r;
2348 const double si = (r == 0.) ? 0. : (p[1] -
center[1]) / r;
2352 (-std_cxx17::cyl_bessel_j(1, r * wave_number)) :
2353 (.5 * (std_cxx17::cyl_bessel_j(order - 1, wave_number * r) -
2354 std_cxx17::cyl_bessel_j(order + 1, wave_number * r)));
2356 result[0] = wave_number * co * dJn;
2357 result[1] = wave_number * si * dJn;
2373 return ((1 - xi[0]) * data_values[ix[0]] +
2374 xi[0] * data_values[ix[0] + 1]);
2382 return (((1 - p_unit[0]) * data_values[ix[0]][ix[1]] +
2383 p_unit[0] * data_values[ix[0] + 1][ix[1]]) *
2385 ((1 - p_unit[0]) * data_values[ix[0]][ix[1] + 1] +
2386 p_unit[0] * data_values[ix[0] + 1][ix[1] + 1]) *
2395 return ((((1 - p_unit[0]) * data_values[ix[0]][ix[1]][ix[2]] +
2396 p_unit[0] * data_values[ix[0] + 1][ix[1]][ix[2]]) *
2398 ((1 - p_unit[0]) * data_values[ix[0]][ix[1] + 1][ix[2]] +
2399 p_unit[0] * data_values[ix[0] + 1][ix[1] + 1][ix[2]]) *
2402 (((1 - p_unit[0]) * data_values[ix[0]][ix[1]][ix[2] + 1] +
2403 p_unit[0] * data_values[ix[0] + 1][ix[1]][ix[2] + 1]) *
2405 ((1 - p_unit[0]) * data_values[ix[0]][ix[1] + 1][ix[2] + 1] +
2406 p_unit[0] * data_values[ix[0] + 1][ix[1] + 1][ix[2] + 1]) *
2424 grad[0] = (data_values[ix[0] + 1] - data_values[ix[0]]) / dx[0];
2436 double u00 = data_values[ix[0]][ix[1]],
2437 u01 = data_values[ix[0] + 1][ix[1]],
2438 u10 = data_values[ix[0]][ix[1] + 1],
2439 u11 = data_values[ix[0] + 1][ix[1] + 1];
2442 ((1 - p_unit[1]) * (u01 - u00) + p_unit[1] * (u11 - u10)) /
dx[0];
2444 ((1 - p_unit[0]) * (u10 - u00) + p_unit[0] * (u11 - u01)) /
dx[1];
2456 double u000 = data_values[ix[0]][ix[1]][ix[2]],
2457 u001 = data_values[ix[0] + 1][ix[1]][ix[2]],
2458 u010 = data_values[ix[0]][ix[1] + 1][ix[2]],
2459 u100 = data_values[ix[0]][ix[1]][ix[2] + 1],
2460 u011 = data_values[ix[0] + 1][ix[1] + 1][ix[2]],
2461 u101 = data_values[ix[0] + 1][ix[1]][ix[2] + 1],
2462 u110 = data_values[ix[0]][ix[1] + 1][ix[2] + 1],
2463 u111 = data_values[ix[0] + 1][ix[1] + 1][ix[2] + 1];
2467 ((1 - p_unit[1]) * (u001 - u000) + p_unit[1] * (u011 - u010)) +
2469 ((1 - p_unit[1]) * (u101 - u100) + p_unit[1] * (u111 - u110))) /
2473 ((1 - p_unit[0]) * (u010 - u000) + p_unit[0] * (u011 - u001)) +
2475 ((1 - p_unit[0]) * (u110 - u100) + p_unit[0] * (u111 - u101))) /
2479 ((1 - p_unit[0]) * (u100 - u000) + p_unit[0] * (u101 - u001)) +
2481 ((1 - p_unit[0]) * (u110 - u010) + p_unit[0] * (u111 - u011))) /
2492 const std::array<std::vector<double>, dim> &coordinate_values,
2494 : coordinate_values(coordinate_values)
2495 , data_values(data_values)
2497 for (
unsigned int d = 0; d < dim; ++d)
2502 "Coordinate arrays must have at least two coordinate values!"));
2507 "Coordinate arrays must be sorted in strictly ascending order."));
2511 "Data and coordinate tables do not have the same size."));
2519 std::array<std::vector<double>, dim> &&coordinate_values,
2521 : coordinate_values(
std::move(coordinate_values))
2522 , data_values(
std::move(data_values))
2524 for (
unsigned int d = 0; d < dim; ++d)
2529 "Coordinate arrays must have at least two coordinate values!"));
2534 "Coordinate arrays must be sorted in strictly ascending order."));
2536 Assert(this->data_values.size()[d] == this->coordinate_values[d].size(),
2538 "Data and coordinate tables do not have the same size."));
2554 for (
unsigned int d = 0; d < dim; ++d)
2558 ix[d] = (std::lower_bound(coordinate_values[d].begin(),
2559 coordinate_values[d].end(),
2561 coordinate_values[d].begin());
2570 if (ix[d] == coordinate_values[d].size())
2571 ix[d] = coordinate_values[d].size() - 2;
2585 return sizeof(*this) +
2587 sizeof(coordinate_values) +
2589 sizeof(data_values);
2607 const unsigned int component)
const
2613 "This is a scalar function object, the component can only be zero."));
2622 for (
unsigned int d = 0; d < dim; ++d)
2624 (coordinate_values[d][ix[d] + 1] -
2625 coordinate_values[d][ix[d]]),
2629 return interpolate(data_values, ix, p_unit);
2638 const unsigned int component)
const
2644 "This is a scalar function object, the component can only be zero."));
2650 for (
unsigned int d = 0; d < dim; ++d)
2651 dx[d] = coordinate_values[d][ix[d] + 1] - coordinate_values[d][ix[d]];
2654 for (
unsigned int d = 0; d < dim; ++d)
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."));
2690 std::array<std::pair<double, double>, dim> &&interval_endpoints,
2691 std::array<unsigned int, dim> &&n_subintervals,
2693 : interval_endpoints(
std::move(interval_endpoints))
2694 , n_subintervals(
std::move(n_subintervals))
2695 , data_values(
std::move(data_values))
2697 for (
unsigned int d = 0; d < dim; ++d)
2700 ExcMessage(
"There needs to be at least one subinterval in each "
2701 "coordinate direction."));
2704 ExcMessage(
"The interval in each coordinate direction needs "
2705 "to have positive size"));
2706 Assert(this->data_values.size()[d] == this->n_subintervals[d] + 1,
2707 ExcMessage(
"The data table does not have the correct size."));
2716 const unsigned int component)
const
2722 "This is a scalar function object, the component can only be zero."));
2727 for (
unsigned int d = 0; d < dim; ++d)
2729 const double delta_x =
2730 ((interval_endpoints[d].second - interval_endpoints[d].first) /
2732 if (p[d] <= interval_endpoints[d].
first)
2734 else if (p[d] >= interval_endpoints[d].
second - delta_x)
2735 ix[d] = n_subintervals[d] - 1;
2737 ix[d] =
static_cast<unsigned int>(
2738 (p[d] - interval_endpoints[d].first) / delta_x);
2745 for (
unsigned int d = 0; d < dim; ++d)
2747 const double delta_x =
2748 ((interval_endpoints[d].second - interval_endpoints[d].first) /
2757 return interpolate(data_values, ix, p_unit);
2765 const unsigned int component)
const
2771 "This is a scalar function object, the component can only be zero."));
2776 for (
unsigned int d = 0; d < dim; ++d)
2778 const double delta_x = ((this->interval_endpoints[d].second -
2779 this->interval_endpoints[d].first) /
2780 this->n_subintervals[d]);
2781 if (p[d] <= this->interval_endpoints[d].
first)
2783 else if (p[d] >= this->interval_endpoints[d].
second - delta_x)
2784 ix[d] = this->n_subintervals[d] - 1;
2786 ix[d] =
static_cast<unsigned int>(
2787 (p[d] - this->interval_endpoints[d].first) / delta_x);
2795 for (
unsigned int d = 0; d < dim; ++d)
2797 delta_x[d] = ((this->interval_endpoints[d].second -
2798 this->interval_endpoints[d].first) /
2799 this->n_subintervals[d]);
2802 ix[d] * delta_x[d]) /
2808 return gradient_interpolate(this->data_values, ix, p_unit, delta_x);
2817 return sizeof(*this) + data_values.memory_consumption() -
2818 sizeof(data_values);
2838 const std::vector<double> &coefficients)
2840 , exponents(exponents)
2841 , coefficients(coefficients)
2854 const unsigned int component)
const
2860 for (
unsigned int monom = 0; monom < exponents.n_rows(); ++monom)
2863 for (
unsigned int s = 0; s < dim; ++s)
2866 Assert(std::floor(exponents[monom][s]) == exponents[monom][s],
2867 ExcMessage(
"Exponentiation of a negative base number with "
2868 "a real exponent can't be performed."));
2869 prod *=
std::pow(p[s], exponents[monom][s]);
2871 sum += coefficients[monom] * prod;
2881 std::vector<double> &values,
2882 const unsigned int component)
const
2884 Assert(values.size() == points.size(),
2887 for (
unsigned int i = 0; i < points.size(); ++i)
2896 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
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)
#define DEAL_II_NOT_IMPLEMENTED()
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
constexpr T fixed_power(const T t)
static constexpr double PI_2
static constexpr double PI
::VectorizedArray< Number, width > exp(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, 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)