53 std::vector<double> & values,
54 const unsigned int)
const
56 Assert(values.size() == points.size(),
59 for (
unsigned int i = 0; i < points.size(); ++i)
78 std::vector<double> & values,
79 const unsigned int)
const
81 Assert(values.size() == points.size(),
84 for (
unsigned int i = 0; i < points.size(); ++i)
114 const unsigned int)
const
116 Assert(gradients.size() == points.size(),
119 for (
unsigned int i = 0; i < points.size(); ++i)
140 std::vector<double> & values,
141 const unsigned int)
const
144 Assert(values.size() == points.size(),
147 for (
unsigned int i = 0; i < points.size(); ++i)
150 values[i] = p(0) * p(1);
162 Assert(values.size() == points.size(),
166 for (
unsigned int i = 0; i < points.size(); ++i)
169 values[i](0) = p(0) * p(1);
186 std::vector<double> & values,
187 const unsigned int)
const
190 Assert(values.size() == points.size(),
193 for (
unsigned int i = 0; i < points.size(); ++i)
216 const unsigned int)
const
219 Assert(gradients.size() == points.size(),
222 for (
unsigned int i = 0; i < points.size(); ++i)
224 gradients[i][0] = points[i](1);
225 gradients[i][1] = points[i](0);
237 Assert(gradients.size() == points.size(),
239 Assert(gradients[0].size() == 1,
242 for (
unsigned int i = 0; i < points.size(); ++i)
244 gradients[i][0][0] = points[i](1);
245 gradients[i][0][1] = points[i](0);
266 return 1. - p(0) * p(0) + offset;
268 return (1. - p(0) * p(0)) * (1. - p(1) * p(1)) + offset;
270 return (1. - p(0) * p(0)) * (1. - p(1) * p(1)) * (1. - p(2) * p(2)) +
281 std::vector<double> & values,
282 const unsigned int)
const
284 Assert(values.size() == points.size(),
287 for (
unsigned int i = 0; i < points.size(); ++i)
293 values[i] = 1. - p(0) * p(0) + offset;
296 values[i] = (1. - p(0) * p(0)) * (1. - p(1) * p(1)) + offset;
300 (1. - p(0) * p(0)) * (1. - p(1) * p(1)) * (1. - p(2) * p(2)) +
320 return -2. * ((1. - p(0) * p(0)) + (1. - p(1) * p(1)));
322 return -2. * ((1. - p(0) * p(0)) * (1. - p(1) * p(1)) +
323 (1. - p(1) * p(1)) * (1. - p(2) * p(2)) +
324 (1. - p(2) * p(2)) * (1. - p(0) * p(0)));
334 std::vector<double> & values,
335 const unsigned int)
const
337 Assert(values.size() == points.size(),
340 for (
unsigned int i = 0; i < points.size(); ++i)
349 values[i] = -2. * ((1. - p(0) * p(0)) + (1. - p(1) * p(1)));
352 values[i] = -2. * ((1. - p(0) * p(0)) * (1. - p(1) * p(1)) +
353 (1. - p(1) * p(1)) * (1. - p(2) * p(2)) +
354 (1. - p(2) * p(2)) * (1. - p(0) * p(0)));
370 result[0] = -2. * p(0);
373 result[0] = -2. * p(0) * (1. - p(1) * p(1));
374 result[1] = -2. * p(1) * (1. - p(0) * p(0));
377 result[0] = -2. * p(0) * (1. - p(1) * p(1)) * (1. - p(2) * p(2));
378 result[1] = -2. * p(1) * (1. - p(0) * p(0)) * (1. - p(2) * p(2));
379 result[2] = -2. * p(2) * (1. - p(0) * p(0)) * (1. - p(1) * p(1));
391 const unsigned int)
const
393 Assert(gradients.size() == points.size(),
396 for (
unsigned int i = 0; i < points.size(); ++i)
402 gradients[i][0] = -2. * p(0);
405 gradients[i][0] = -2. * p(0) * (1. - p(1) * p(1));
406 gradients[i][1] = -2. * p(1) * (1. - p(0) * p(0));
410 -2. * p(0) * (1. - p(1) * p(1)) * (1. - p(2) * p(2));
412 -2. * p(1) * (1. - p(0) * p(0)) * (1. - p(2) * p(2));
414 -2. * p(2) * (1. - p(0) * p(0)) * (1. - p(1) * p(1));
455 std::vector<double> & values,
456 const unsigned int)
const
458 Assert(values.size() == points.size(),
461 for (
unsigned int i = 0; i < points.size(); ++i)
462 values[i] = value(points[i]);
472 Assert(values.size() == points.size(),
475 for (
unsigned int i = 0; i < points.size(); ++i)
477 const double v = value(points[i]);
478 for (
unsigned int k = 0; k < values[i].size(); ++k)
511 std::vector<double> & values,
512 const unsigned int)
const
514 Assert(values.size() == points.size(),
517 for (
unsigned int i = 0; i < points.size(); ++i)
518 values[i] = laplacian(points[i]);
558 const unsigned int)
const
560 Assert(gradients.size() == points.size(),
563 for (
unsigned int i = 0; i < points.size(); ++i)
635 result[0][0] = cococo;
636 result[1][1] = cococo;
637 result[2][2] = cococo;
639 result[0][1] = sisico;
640 result[0][2] = sicosi;
641 result[1][2] = cosisi;
655 const unsigned int)
const
657 Assert(hessians.size() == points.size(),
662 for (
unsigned int i = 0; i < points.size(); ++i)
676 hessians[i][0][0] = coco;
677 hessians[i][1][1] = coco;
679 hessians[i][0][1] = sisi;
697 hessians[i][0][0] = cococo;
698 hessians[i][1][1] = cococo;
699 hessians[i][2][2] = cococo;
701 hessians[i][0][1] = sisico;
702 hessians[i][0][2] = sicosi;
703 hessians[i][1][2] = cosisi;
723 const unsigned int d)
const
726 const unsigned int d1 = (d + 1) % dim;
727 const unsigned int d2 = (d + 2) % dim;
783 std::vector<double> & values,
784 const unsigned int d)
const
786 Assert(values.size() == points.size(),
789 const unsigned int d1 = (d + 1) % dim;
790 const unsigned int d2 = (d + 2) % dim;
792 for (
unsigned int i = 0; i < points.size(); ++i)
822 Assert(values.size() == points.size(),
825 for (
unsigned int i = 0; i < points.size(); ++i)
860 const unsigned int d)
const
869 const unsigned int d)
const
872 const unsigned int d1 = (d + 1) % dim;
873 const unsigned int d2 = (d + 2) % dim;
910 const unsigned int d)
const
913 const unsigned int d1 = (d + 1) % dim;
914 const unsigned int d2 = (d + 2) % dim;
917 Assert(gradients.size() == points.size(),
919 for (
unsigned int i = 0; i < points.size(); ++i)
962 for (
unsigned int i = 0; i < points.size(); ++i)
976 gradients[i][0][0] = coco;
977 gradients[i][1][1] = coco;
978 gradients[i][0][1] = sisi;
979 gradients[i][1][0] = sisi;
997 gradients[i][0][0] = cococo;
998 gradients[i][1][1] = cococo;
999 gradients[i][2][2] = cococo;
1000 gradients[i][0][1] = sisico;
1001 gradients[i][1][0] = sisico;
1002 gradients[i][0][2] = sicosi;
1003 gradients[i][2][0] = sicosi;
1004 gradients[i][1][2] = cosisi;
1005 gradients[i][2][1] = cosisi;
1038 std::vector<double> & values,
1039 const unsigned int)
const
1041 Assert(values.size() == points.size(),
1044 for (
unsigned int i = 0; i < points.size(); ++i)
1085 std::vector<double> & values,
1086 const unsigned int)
const
1088 Assert(values.size() == points.size(),
1091 for (
unsigned int i = 0; i < points.size(); ++i)
1123 result[1] = result[0];
1127 result[1] = result[0];
1128 result[2] = result[0];
1140 const unsigned int)
const
1142 Assert(gradients.size() == points.size(),
1145 for (
unsigned int i = 0; i < points.size(); ++i)
1155 gradients[i][1] = gradients[i][0];
1160 gradients[i][1] = gradients[i][0];
1161 gradients[i][2] = gradients[i][0];
1175 const double x = p(0);
1176 const double y = p(1);
1178 if ((x >= 0) && (y >= 0))
1181 const double phi = std::atan2(y, -x) +
numbers::PI;
1182 const double r_squared = x * x + y * y;
1191 std::vector<double> & values,
1192 const unsigned int)
const
1194 Assert(values.size() == points.size(),
1197 for (
unsigned int i = 0; i < points.size(); ++i)
1199 const double x = points[i](0);
1200 const double y = points[i](1);
1202 if ((x >= 0) && (y >= 0))
1206 const double phi = std::atan2(y, -x) +
numbers::PI;
1207 const double r_squared = x * x + y * y;
1218 const std::vector<
Point<2>> &points,
1221 Assert(values.size() == points.size(),
1224 for (
unsigned int i = 0; i < points.size(); ++i)
1226 Assert(values[i].size() == 1,
1228 const double x = points[i](0);
1229 const double y = points[i](1);
1231 if ((x >= 0) && (y >= 0))
1235 const double phi = std::atan2(y, -x) +
numbers::PI;
1236 const double r_squared = x * x + y * y;
1257 std::vector<double> & values,
1258 const unsigned int)
const
1260 Assert(values.size() == points.size(),
1263 for (
unsigned int i = 0; i < points.size(); ++i)
1272 const double x = p(0);
1273 const double y = p(1);
1274 const double phi = std::atan2(y, -x) +
numbers::PI;
1275 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1278 result[0] = 2. / 3. *
1281 result[1] = 2. / 3. *
1292 const unsigned int)
const
1294 Assert(gradients.size() == points.size(),
1297 for (
unsigned int i = 0; i < points.size(); ++i)
1300 const double x = p(0);
1301 const double y = p(1);
1302 const double phi = std::atan2(y, -x) +
numbers::PI;
1303 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1318 const std::vector<
Point<2>> & points,
1319 std::vector<std::vector<
Tensor<1, 2>>> &gradients)
const
1321 Assert(gradients.size() == points.size(),
1324 for (
unsigned int i = 0; i < points.size(); ++i)
1326 Assert(gradients[i].size() == 1,
1329 const double x = p(0);
1330 const double y = p(1);
1331 const double phi = std::atan2(y, -x) +
numbers::PI;
1332 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1334 gradients[i][0][0] =
1337 gradients[i][0][1] =
1356 const double x = p(0);
1357 const double y = p(1);
1358 const double phi = std::atan2(y, -x) +
numbers::PI;
1359 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1363 (d == 0 ? (
std::cos(2. / 3. * phi) * y) :
1371 std::vector<double> & values,
1372 const unsigned int d)
const
1377 for (
unsigned int i = 0; i < points.size(); ++i)
1380 const double x = p(0);
1381 const double y = p(1);
1382 const double phi = std::atan2(y, -x) +
numbers::PI;
1383 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1385 values[i] = 2. / 3. *
1387 (d == 0 ? (
std::cos(2. / 3. * phi) * y) :
1396 const std::vector<
Point<2>> &points,
1399 Assert(values.size() == points.size(),
1402 for (
unsigned int i = 0; i < points.size(); ++i)
1406 const double x = p(0);
1407 const double y = p(1);
1408 const double phi = std::atan2(y, -x) +
numbers::PI;
1409 const double r43 =
std::pow(x * x + y * y, 2. / 3.);
1423 const unsigned int)
const
1431 std::vector<double> & values,
1432 const unsigned int)
const
1434 Assert(values.size() == points.size(),
1437 for (
unsigned int i = 0; i < points.size(); ++i)
1445 const unsigned int )
const
1456 const unsigned int )
const
1475 const unsigned int)
const
1477 const double x = p(0);
1478 const double y = p(1);
1480 const double phi = std::atan2(x, y) +
numbers::PI;
1481 const double r_squared = x * x + y * y;
1491 std::vector<double> & values,
1492 const unsigned int)
const
1494 Assert(values.size() == points.size(),
1497 for (
unsigned int i = 0; i < points.size(); ++i)
1499 const double x = points[i](0);
1500 const double y = points[i](1);
1502 const double phi = std::atan2(x, y) +
numbers::PI;
1503 const double r_squared = x * x + y * y;
1516 Assert(values.size() == points.size(),
1519 for (
unsigned int i = 0; i < points.size(); ++i)
1521 Assert(values[i].size() == 1,
1524 const double x = points[i](0);
1525 const double y = points[i](1);
1527 const double phi = std::atan2(x, y) +
numbers::PI;
1528 const double r_squared = x * x + y * y;
1538 const unsigned int)
const
1548 std::vector<double> & values,
1549 const unsigned int)
const
1551 Assert(values.size() == points.size(),
1554 for (
unsigned int i = 0; i < points.size(); ++i)
1562 const unsigned int)
const
1564 const double x = p(0);
1565 const double y = p(1);
1566 const double phi = std::atan2(x, y) +
numbers::PI;
1567 const double r64 =
std::pow(x * x + y * y, 3. / 4.);
1570 result[0] = 1. / 2. *
1573 result[1] = 1. / 2. *
1585 const unsigned int)
const
1587 Assert(gradients.size() == points.size(),
1590 for (
unsigned int i = 0; i < points.size(); ++i)
1593 const double x = p(0);
1594 const double y = p(1);
1595 const double phi = std::atan2(x, y) +
numbers::PI;
1596 const double r64 =
std::pow(x * x + y * y, 3. / 4.);
1604 for (
unsigned int d = 2; d < dim; ++d)
1605 gradients[i][d] = 0.;
1615 Assert(gradients.size() == points.size(),
1618 for (
unsigned int i = 0; i < points.size(); ++i)
1620 Assert(gradients[i].size() == 1,
1624 const double x = p(0);
1625 const double y = p(1);
1626 const double phi = std::atan2(x, y) +
numbers::PI;
1627 const double r64 =
std::pow(x * x + y * y, 3. / 4.);
1629 gradients[i][0][0] =
1632 gradients[i][0][1] =
1635 for (
unsigned int d = 2; d < dim; ++d)
1636 gradients[i][0][d] = 0.;
1645 const unsigned int)
const
1647 const double x = p(0);
1648 const double y = p(1);
1650 const double phi = std::atan2(x, y) +
numbers::PI;
1651 const double r_squared = x * x + y * y;
1659 std::vector<double> & values,
1660 const unsigned int)
const
1662 Assert(values.size() == points.size(),
1665 for (
unsigned int i = 0; i < points.size(); ++i)
1667 const double x = points[i](0);
1668 const double y = points[i](1);
1670 const double phi = std::atan2(x, y) +
numbers::PI;
1671 const double r_squared = x * x + y * y;
1680 const std::vector<
Point<2>> &points,
1683 Assert(values.size() == points.size(),
1686 for (
unsigned int i = 0; i < points.size(); ++i)
1688 Assert(values[i].size() == 1,
1691 const double x = points[i](0);
1692 const double y = points[i](1);
1694 const double phi = std::atan2(x, y) +
numbers::PI;
1695 const double r_squared = x * x + y * y;
1704 const unsigned int)
const
1712 const std::vector<
Point<2>> &points,
1713 std::vector<double> & values,
1714 const unsigned int)
const
1716 Assert(values.size() == points.size(),
1719 for (
unsigned int i = 0; i < points.size(); ++i)
1726 const unsigned int)
const
1728 const double x = p(0);
1729 const double y = p(1);
1730 const double phi = std::atan2(x, y) +
numbers::PI;
1731 const double r78 =
std::pow(x * x + y * y, 7. / 8.);
1735 result[0] = 1. / 4. *
1738 result[1] = 1. / 4. *
1747 const std::vector<
Point<2>> &points,
1749 const unsigned int)
const
1751 Assert(gradients.size() == points.size(),
1754 for (
unsigned int i = 0; i < points.size(); ++i)
1757 const double x = p(0);
1758 const double y = p(1);
1759 const double phi = std::atan2(x, y) +
numbers::PI;
1760 const double r78 =
std::pow(x * x + y * y, 7. / 8.);
1774 const std::vector<
Point<2>> & points,
1775 std::vector<std::vector<
Tensor<1, 2>>> &gradients)
const
1777 Assert(gradients.size() == points.size(),
1780 for (
unsigned int i = 0; i < points.size(); ++i)
1782 Assert(gradients[i].size() == 1,
1786 const double x = p(0);
1787 const double y = p(1);
1788 const double phi = std::atan2(x, y) +
numbers::PI;
1789 const double r78 =
std::pow(x * x + y * y, 7. / 8.);
1791 gradients[i][0][0] =
1794 gradients[i][0][1] =
1804 const double steepness)
1805 : direction(direction)
1806 , steepness(steepness)
1829 const double x = steepness * (-cosine * p(0) + sine * p(1));
1830 return -std::atan(x);
1838 std::vector<double> & values,
1839 const unsigned int)
const
1841 Assert(values.size() == p.size(),
1844 for (
unsigned int i = 0; i < p.size(); ++i)
1846 const double x = steepness * (-cosine * p[i](0) + sine * p[i](1));
1847 values[i] = -std::atan(x);
1856 const double x = steepness * (-cosine * p(0) + sine * p(1));
1857 const double r = 1 + x * x;
1858 return 2 * steepness * steepness * x / (r * r);
1865 std::vector<double> & values,
1866 const unsigned int)
const
1868 Assert(values.size() == p.size(),
1871 double f = 2 * steepness * steepness;
1873 for (
unsigned int i = 0; i < p.size(); ++i)
1875 const double x = steepness * (-cosine * p[i](0) + sine * p[i](1));
1876 const double r = 1 + x * x;
1877 values[i] = f * x / (r * r);
1887 const double x = steepness * (-cosine * p(0) + sine * p(1));
1888 const double r = -steepness * (1 + x * x);
1890 erg[0] = cosine * r;
1901 const unsigned int)
const
1903 Assert(gradients.size() == p.size(),
1906 for (
unsigned int i = 0; i < p.size(); ++i)
1908 const double x = steepness * (cosine * p[i](0) + sine * p[i](1));
1909 const double r = -steepness * (1 + x * x);
1910 gradients[i][0] = cosine * r;
1911 gradients[i][1] = sine * r;
1923 return sizeof(*this);
1935 , fourier_coefficients(fourier_coefficients)
1943 const unsigned int component)
const
1947 return std::cos(fourier_coefficients * p);
1955 const unsigned int component)
const
1959 return -fourier_coefficients *
std::sin(fourier_coefficients * p);
1967 const unsigned int component)
const
1971 return (fourier_coefficients * fourier_coefficients) *
1972 (-
std::cos(fourier_coefficients * p));
1985 , fourier_coefficients(fourier_coefficients)
1993 const unsigned int component)
const
1997 return std::sin(fourier_coefficients * p);
2005 const unsigned int component)
const
2009 return fourier_coefficients *
std::cos(fourier_coefficients * p);
2017 const unsigned int component)
const
2021 return (fourier_coefficients * fourier_coefficients) *
2022 (-
std::sin(fourier_coefficients * p));
2033 const std::vector<
Point<dim>> &fourier_coefficients,
2034 const std::vector<double> & weights)
2036 , fourier_coefficients(fourier_coefficients)
2049 const unsigned int component)
const
2054 const unsigned int n = weights.size();
2056 for (
unsigned int s = 0; s < n; ++s)
2057 sum += weights[s] *
std::sin(fourier_coefficients[s] * p);
2067 const unsigned int component)
const
2072 const unsigned int n = weights.size();
2074 for (
unsigned int s = 0; s < n; ++s)
2075 sum += fourier_coefficients[s] *
std::cos(fourier_coefficients[s] * p);
2085 const unsigned int component)
const
2090 const unsigned int n = weights.size();
2092 for (
unsigned int s = 0; s < n; ++s)
2093 sum -= (fourier_coefficients[s] * fourier_coefficients[s]) *
2094 std::sin(fourier_coefficients[s] * p);
2107 const std::vector<
Point<dim>> &fourier_coefficients,
2108 const std::vector<double> & weights)
2110 , fourier_coefficients(fourier_coefficients)
2123 const unsigned int component)
const
2128 const unsigned int n = weights.size();
2130 for (
unsigned int s = 0; s < n; ++s)
2131 sum += weights[s] *
std::cos(fourier_coefficients[s] * p);
2141 const unsigned int component)
const
2146 const unsigned int n = weights.size();
2148 for (
unsigned int s = 0; s < n; ++s)
2149 sum -= fourier_coefficients[s] *
std::sin(fourier_coefficients[s] * p);
2159 const unsigned int component)
const
2164 const unsigned int n = weights.size();
2166 for (
unsigned int s = 0; s < n; ++s)
2167 sum -= (fourier_coefficients[s] * fourier_coefficients[s]) *
2168 std::cos(fourier_coefficients[s] * p);
2179 template <
int dim,
typename Number>
2181 const unsigned int n_components)
2182 :
Function<dim, Number>(n_components)
2183 , exponents(exponents)
2188 template <
int dim,
typename Number>
2191 const unsigned int component)
const
2197 for (
unsigned int s = 0; s < dim; ++s)
2200 Assert(std::floor(exponents[s]) == exponents[s],
2201 ExcMessage(
"Exponentiation of a negative base number with "
2202 "a real exponent can't be performed."));
2203 prod *=
std::pow(p[s], exponents[s]);
2210 template <
int dim,
typename Number>
2215 Assert(values.size() == this->n_components,
2218 for (
unsigned int i = 0; i < values.size(); ++i)
2224 template <
int dim,
typename Number>
2227 const unsigned int component)
const
2233 for (
unsigned int d = 0; d < dim; ++d)
2236 for (
unsigned int s = 0; s < dim; ++s)
2238 if ((s == d) && (exponents[s] == 0) && (p[s] == 0))
2246 Assert(std::floor(exponents[s]) == exponents[s],
2248 "Exponentiation of a negative base number with "
2249 "a real exponent can't be performed."));
2251 (s == d ? exponents[s] *
std::pow(p[s], exponents[s] - 1) :
2263 template <
int dim,
typename Number>
2266 std::vector<Number> & values,
2267 const unsigned int component)
const
2269 Assert(values.size() == points.size(),
2272 for (
unsigned int i = 0; i < points.size(); ++i)
2279 const double wave_number,
2282 , wave_number(wave_number)
2294 return std_cxx17::cyl_bessel_j(order, r * wave_number);
2301 std::vector<double> & values,
2302 const unsigned int)
const
2306 for (
unsigned int k = 0; k < points.size(); ++k)
2308 const double r = points[k].distance(
center);
2309 values[k] = std_cxx17::cyl_bessel_j(order, r * wave_number);
2320 const double co = (r == 0.) ? 0. : (p(0) -
center(0)) / r;
2321 const double si = (r == 0.) ? 0. : (p(1) -
center(1)) / r;
2325 (-std_cxx17::cyl_bessel_j(1, r * wave_number)) :
2326 (.5 * (std_cxx17::cyl_bessel_j(order - 1, wave_number * r) -
2327 std_cxx17::cyl_bessel_j(order + 1, wave_number * r)));
2329 result[0] = wave_number * co * dJn;
2330 result[1] = wave_number * si * dJn;
2340 const unsigned int)
const
2344 for (
unsigned int k = 0; k < points.size(); ++k)
2348 const double co = (r == 0.) ? 0. : (p(0) -
center(0)) / r;
2349 const double si = (r == 0.) ? 0. : (p(1) -
center(1)) / r;
2353 (-std_cxx17::cyl_bessel_j(1, r * wave_number)) :
2354 (.5 * (std_cxx17::cyl_bessel_j(order - 1, wave_number * r) -
2355 std_cxx17::cyl_bessel_j(order + 1, wave_number * r)));
2357 result[0] = wave_number * co * dJn;
2358 result[1] = wave_number * si * dJn;
2374 return ((1 - xi[0]) * data_values[ix[0]] +
2375 xi[0] * data_values[ix[0] + 1]);
2383 return (((1 - p_unit[0]) * data_values[ix[0]][ix[1]] +
2384 p_unit[0] * data_values[ix[0] + 1][ix[1]]) *
2386 ((1 - p_unit[0]) * data_values[ix[0]][ix[1] + 1] +
2387 p_unit[0] * data_values[ix[0] + 1][ix[1] + 1]) *
2396 return ((((1 - p_unit[0]) * data_values[ix[0]][ix[1]][ix[2]] +
2397 p_unit[0] * data_values[ix[0] + 1][ix[1]][ix[2]]) *
2399 ((1 - p_unit[0]) * data_values[ix[0]][ix[1] + 1][ix[2]] +
2400 p_unit[0] * data_values[ix[0] + 1][ix[1] + 1][ix[2]]) *
2403 (((1 - p_unit[0]) * data_values[ix[0]][ix[1]][ix[2] + 1] +
2404 p_unit[0] * data_values[ix[0] + 1][ix[1]][ix[2] + 1]) *
2406 ((1 - p_unit[0]) * data_values[ix[0]][ix[1] + 1][ix[2] + 1] +
2407 p_unit[0] * data_values[ix[0] + 1][ix[1] + 1][ix[2] + 1]) *
2425 grad[0] = (data_values[ix[0] + 1] - data_values[ix[0]]) / dx[0];
2437 double u00 = data_values[ix[0]][ix[1]],
2438 u01 = data_values[ix[0] + 1][ix[1]],
2439 u10 = data_values[ix[0]][ix[1] + 1],
2440 u11 = data_values[ix[0] + 1][ix[1] + 1];
2443 ((1 - p_unit[1]) * (u01 - u00) + p_unit[1] * (u11 - u10)) /
dx[0];
2445 ((1 - p_unit[0]) * (u10 - u00) + p_unit[0] * (u11 - u01)) /
dx[1];
2457 double u000 = data_values[ix[0]][ix[1]][ix[2]],
2458 u001 = data_values[ix[0] + 1][ix[1]][ix[2]],
2459 u010 = data_values[ix[0]][ix[1] + 1][ix[2]],
2460 u100 = data_values[ix[0]][ix[1]][ix[2] + 1],
2461 u011 = data_values[ix[0] + 1][ix[1] + 1][ix[2]],
2462 u101 = data_values[ix[0] + 1][ix[1]][ix[2] + 1],
2463 u110 = data_values[ix[0]][ix[1] + 1][ix[2] + 1],
2464 u111 = data_values[ix[0] + 1][ix[1] + 1][ix[2] + 1];
2468 ((1 - p_unit[1]) * (u001 - u000) + p_unit[1] * (u011 - u010)) +
2470 ((1 - p_unit[1]) * (u101 - u100) + p_unit[1] * (u111 - u110))) /
2474 ((1 - p_unit[0]) * (u010 - u000) + p_unit[0] * (u011 - u001)) +
2476 ((1 - p_unit[0]) * (u110 - u100) + p_unit[0] * (u111 - u101))) /
2480 ((1 - p_unit[0]) * (u100 - u000) + p_unit[0] * (u101 - u001)) +
2482 ((1 - p_unit[0]) * (u110 - u010) + p_unit[0] * (u111 - u011))) /
2493 const std::array<std::vector<double>, dim> &coordinate_values,
2495 : coordinate_values(coordinate_values)
2496 , data_values(data_values)
2498 for (
unsigned int d = 0; d < dim; ++d)
2503 "Coordinate arrays must have at least two coordinate values!"));
2508 "Coordinate arrays must be sorted in strictly ascending order."));
2512 "Data and coordinate tables do not have the same size."));
2520 std::array<std::vector<double>, dim> &&coordinate_values,
2522 : coordinate_values(
std::move(coordinate_values))
2523 , data_values(
std::move(data_values))
2525 for (
unsigned int d = 0; d < dim; ++d)
2530 "Coordinate arrays must have at least two coordinate values!"));
2535 "Coordinate arrays must be sorted in strictly ascending order."));
2537 Assert(this->data_values.size()[d] == this->coordinate_values[d].size(),
2539 "Data and coordinate tables do not have the same size."));
2555 for (
unsigned int d = 0; d < dim; ++d)
2559 ix[d] = (std::lower_bound(coordinate_values[d].begin(),
2560 coordinate_values[d].end(),
2562 coordinate_values[d].begin());
2571 if (ix[d] == coordinate_values[d].size())
2572 ix[d] = coordinate_values[d].size() - 2;
2586 return sizeof(*this) +
2588 sizeof(coordinate_values) +
2590 sizeof(data_values);
2608 const unsigned int component)
const
2614 "This is a scalar function object, the component can only be zero."));
2623 for (
unsigned int d = 0; d < dim; ++d)
2625 (coordinate_values[d][ix[d] + 1] -
2626 coordinate_values[d][ix[d]]),
2630 return interpolate(data_values, ix, p_unit);
2639 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)
2660 return gradient_interpolate(data_values, ix, p_unit, dx);
2667 const std::array<std::pair<double, double>, dim> &interval_endpoints,
2668 const std::array<unsigned int, dim> & n_subintervals,
2670 : interval_endpoints(interval_endpoints)
2671 , n_subintervals(n_subintervals)
2672 , data_values(data_values)
2674 for (
unsigned int d = 0; d < dim; ++d)
2677 ExcMessage(
"There needs to be at least one subinterval in each "
2678 "coordinate direction."));
2680 ExcMessage(
"The interval in each coordinate direction needs "
2681 "to have positive size"));
2683 ExcMessage(
"The data table does not have the correct size."));
2691 std::array<std::pair<double, double>, dim> &&interval_endpoints,
2692 std::array<unsigned int, dim> && n_subintervals,
2694 : interval_endpoints(
std::move(interval_endpoints))
2695 , n_subintervals(
std::move(n_subintervals))
2696 , data_values(
std::move(data_values))
2698 for (
unsigned int d = 0; d < dim; ++d)
2701 ExcMessage(
"There needs to be at least one subinterval in each "
2702 "coordinate direction."));
2705 ExcMessage(
"The interval in each coordinate direction needs "
2706 "to have positive size"));
2707 Assert(this->data_values.size()[d] == this->n_subintervals[d] + 1,
2708 ExcMessage(
"The data table does not have the correct size."));
2717 const unsigned int component)
const
2723 "This is a scalar function object, the component can only be zero."));
2728 for (
unsigned int d = 0; d < dim; ++d)
2730 const double delta_x =
2731 ((interval_endpoints[d].second - interval_endpoints[d].first) /
2733 if (p[d] <= interval_endpoints[d].
first)
2735 else if (p[d] >= interval_endpoints[d].
second - delta_x)
2736 ix[d] = n_subintervals[d] - 1;
2738 ix[d] =
static_cast<unsigned int>(
2739 (p[d] - interval_endpoints[d].first) / delta_x);
2746 for (
unsigned int d = 0; d < dim; ++d)
2748 const double delta_x =
2749 ((interval_endpoints[d].second - interval_endpoints[d].first) /
2758 return interpolate(data_values, ix, p_unit);
2766 const unsigned int component)
const
2772 "This is a scalar function object, the component can only be zero."));
2777 for (
unsigned int d = 0; d < dim; ++d)
2779 const double delta_x = ((this->interval_endpoints[d].second -
2780 this->interval_endpoints[d].first) /
2781 this->n_subintervals[d]);
2782 if (p[d] <= this->interval_endpoints[d].
first)
2784 else if (p[d] >= this->interval_endpoints[d].
second - delta_x)
2785 ix[d] = this->n_subintervals[d] - 1;
2787 ix[d] =
static_cast<unsigned int>(
2788 (p[d] - this->interval_endpoints[d].first) / delta_x);
2796 for (
unsigned int d = 0; d < dim; ++d)
2798 delta_x[d] = ((this->interval_endpoints[d].second -
2799 this->interval_endpoints[d].first) /
2800 this->n_subintervals[d]);
2803 ix[d] * delta_x[d]) /
2809 return gradient_interpolate(this->data_values, ix, p_unit, delta_x);
2818 return sizeof(*this) + data_values.memory_consumption() -
2819 sizeof(data_values);
2839 const std::vector<double> &coefficients)
2841 , exponents(exponents)
2842 , coefficients(coefficients)
2855 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
2904 for (
unsigned int d = 0; d < dim; ++d)
2908 for (
unsigned int monom = 0; monom < exponents.n_rows(); ++monom)
2911 for (
unsigned int s = 0; s < dim; ++s)
2913 if ((s == d) && (exponents[monom][s] == 0) && (p[s] == 0))
2921 Assert(std::floor(exponents[monom][s]) ==
2922 exponents[monom][s],
2924 "Exponentiation of a negative base number with "
2925 "a real exponent can't be performed."));
2927 (s == d ? exponents[monom][s] *
2928 std::pow(p[s], exponents[monom][s] - 1) :
2929 std::pow(p[s], exponents[monom][s]));
2932 sum += coefficients[monom] * prod;
2945 return sizeof(*this) + exponents.memory_consumption() -
sizeof(exponents) +
2947 sizeof(coefficients);
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
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
numbers::NumberTraits< Number >::real_type square() const
#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)
std::enable_if_t< std::is_fundamental< T >::value, std::size_t > memory_consumption(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)