16 #include <deal.II/base/numbers.h> 17 #include <deal.II/base/tensor.h> 18 #include <deal.II/base/point.h> 19 #include <deal.II/base/function_lib.h> 20 #include <deal.II/base/function_bessel.h> 21 #include <deal.II/lac/vector.h> 25 DEAL_II_NAMESPACE_OPEN
35 const unsigned int)
const 54 std::vector<double> &values,
55 const unsigned int)
const 57 Assert (values.size() == points.size(),
60 for (
unsigned int i=0; i<points.size(); ++i)
71 const unsigned int)
const 80 std::vector<double> &values,
81 const unsigned int)
const 83 Assert (values.size() == points.size(),
86 for (
unsigned int i=0; i<points.size(); ++i)
95 const unsigned int)
const 115 SquareFunction<dim>::gradient_list (
const std::vector<
Point<dim> > &points,
117 const unsigned int)
const 119 Assert (gradients.size() == points.size(),
122 for (
unsigned int i=0; i<points.size(); ++i)
133 const unsigned int)
const 144 std::vector<double> &values,
145 const unsigned int)
const 148 Assert (values.size() == points.size(),
151 for (
unsigned int i=0; i<points.size(); ++i)
154 values[i] = p(0)*p(1);
166 Assert (values.size() == points.size(),
170 for (
unsigned int i=0; i<points.size(); ++i)
173 values[i](0) = p(0)*p(1);
181 const unsigned int)
const 191 std::vector<double> &values,
192 const unsigned int)
const 195 Assert (values.size() == points.size(),
198 for (
unsigned int i=0; i<points.size(); ++i)
207 const unsigned int)
const 222 const unsigned int)
const 225 Assert (gradients.size() == points.size(),
228 for (
unsigned int i=0; i<points.size(); ++i)
230 gradients[i][0] = points[i](1);
231 gradients[i][1] = points[i](0);
238 Q1WedgeFunction<dim>::vector_gradient_list (
243 Assert (gradients.size() == points.size(),
245 Assert(gradients[0].size() == 1,
248 for (
unsigned int i=0; i<points.size(); ++i)
250 gradients[i][0][0] = points[i](1);
251 gradients[i][0][1] = points[i](0);
269 const unsigned int)
const 274 return 1.-p(0)*p(0)+offset;
276 return (1.-p(0)*p(0))*(1.-p(1)*p(1))+offset;
278 return (1.-p(0)*p(0))*(1.-p(1)*p(1))*(1.-p(2)*p(2))+offset;
288 std::vector<double> &values,
289 const unsigned int)
const 291 Assert (values.size() == points.size(),
294 for (
unsigned int i=0; i<points.size(); ++i)
300 values[i] = 1.-p(0)*p(0)+offset;
303 values[i] = (1.-p(0)*p(0))*(1.-p(1)*p(1))+offset;
306 values[i] = (1.-p(0)*p(0))*(1.-p(1)*p(1))*(1.-p(2)*p(2))+offset;
319 const unsigned int)
const 326 return -2.*((1.-p(0)*p(0))+(1.-p(1)*p(1)));
328 return -2.*((1.-p(0)*p(0))*(1.-p(1)*p(1))
329 +(1.-p(1)*p(1))*(1.-p(2)*p(2))
330 +(1.-p(2)*p(2))*(1.-p(0)*p(0)));
340 std::vector<double> &values,
341 const unsigned int)
const 343 Assert (values.size() == points.size(),
346 for (
unsigned int i=0; i<points.size(); ++i)
355 values[i] = -2.*((1.-p(0)*p(0))+(1.-p(1)*p(1)));
358 values[i] = -2.*((1.-p(0)*p(0))*(1.-p(1)*p(1))
359 +(1.-p(1)*p(1))*(1.-p(2)*p(2))
360 +(1.-p(2)*p(2))*(1.-p(0)*p(0)));
371 const unsigned int)
const 377 result[0] = -2.*p(0);
380 result[0] = -2.*p(0)*(1.-p(1)*p(1));
381 result[1] = -2.*p(1)*(1.-p(0)*p(0));
384 result[0] = -2.*p(0)*(1.-p(1)*p(1))*(1.-p(2)*p(2));
385 result[1] = -2.*p(1)*(1.-p(0)*p(0))*(1.-p(2)*p(2));
386 result[2] = -2.*p(2)*(1.-p(0)*p(0))*(1.-p(1)*p(1));
398 const unsigned int)
const 400 Assert (gradients.size() == points.size(),
403 for (
unsigned int i=0; i<points.size(); ++i)
409 gradients[i][0] = -2.*p(0);
412 gradients[i][0] = -2.*p(0)*(1.-p(1)*p(1));
413 gradients[i][1] = -2.*p(1)*(1.-p(0)*p(0));
416 gradients[i][0] = -2.*p(0)*(1.-p(1)*p(1))*(1.-p(2)*p(2));
417 gradients[i][1] = -2.*p(1)*(1.-p(0)*p(0))*(1.-p(2)*p(2));
418 gradients[i][2] = -2.*p(2)*(1.-p(0)*p(0))*(1.-p(1)*p(1));
439 const unsigned int)
const 458 std::vector<double> &values,
459 const unsigned int)
const 461 Assert (values.size() == points.size(),
464 for (
unsigned int i=0; i<points.size(); ++i)
465 values[i] = value(points[i]);
475 Assert (values.size() == points.size(),
478 for (
unsigned int i=0; i<points.size(); ++i)
480 const double v = value(points[i]);
481 for (
unsigned int k=0; k<values[i].size(); ++k)
490 const unsigned int)
const 509 std::vector<double> &values,
510 const unsigned int)
const 512 Assert (values.size() == points.size(),
515 for (
unsigned int i=0; i<points.size(); ++i)
516 values[i] = laplacian(points[i]);
522 const unsigned int)
const 549 const unsigned int)
const 551 Assert (gradients.size() == points.size(),
554 for (
unsigned int i=0; i<points.size(); ++i)
580 const unsigned int)
const 609 result[0][0] = cococo;
610 result[1][1] = cococo;
611 result[2][2] = cococo;
613 result[0][1] = sisico;
614 result[0][2] = sicosi;
615 result[1][2] = cosisi;
628 const unsigned int)
const 630 Assert (hessians.size() == points.size(),
635 for (
unsigned int i=0; i<points.size(); ++i)
648 hessians[i][0][0] = coco;
649 hessians[i][1][1] = coco;
651 hessians[i][0][1] = sisi;
662 hessians[i][0][0] = cococo;
663 hessians[i][1][1] = cococo;
664 hessians[i][2][2] = cococo;
666 hessians[i][0][1] = sisico;
667 hessians[i][0][2] = sicosi;
668 hessians[i][1][2] = cosisi;
690 const unsigned int d)
const 693 const unsigned int d1 = (d+1) % dim;
694 const unsigned int d2 = (d+2) % dim;
741 std::vector<double> &values,
742 const unsigned int d)
const 744 Assert (values.size() == points.size(),
747 const unsigned int d1 = (d+1) % dim;
748 const unsigned int d2 = (d+2) % dim;
750 for (
unsigned int i=0; i<points.size(); ++i)
777 Assert (values.size() == points.size(),
780 for (
unsigned int i=0; i<points.size(); ++i)
808 const unsigned int d)
const 818 const unsigned int d)
const 821 const unsigned int d1 = (d+1) % dim;
822 const unsigned int d2 = (d+2) % dim;
852 const unsigned int d)
const 855 const unsigned int d1 = (d+1) % dim;
856 const unsigned int d2 = (d+2) % dim;
859 Assert (gradients.size() == points.size(),
861 for (
unsigned int i=0; i<points.size(); ++i)
889 CosineGradFunction<dim>::vector_gradient_list (
896 for (
unsigned int i=0; i<points.size(); ++i)
909 gradients[i][0][0] = coco;
910 gradients[i][1][1] = coco;
911 gradients[i][0][1] = sisi;
912 gradients[i][1][0] = sisi;
923 gradients[i][0][0] = cococo;
924 gradients[i][1][1] = cococo;
925 gradients[i][2][2] = cococo;
926 gradients[i][0][1] = sisico;
927 gradients[i][1][0] = sisico;
928 gradients[i][0][2] = sicosi;
929 gradients[i][2][0] = sicosi;
930 gradients[i][1][2] = cosisi;
931 gradients[i][2][1] = cosisi;
946 const unsigned int)
const 951 return std::exp(p(0));
953 return std::exp(p(0)) * std::exp(p(1));
955 return std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2));
965 std::vector<double> &values,
966 const unsigned int)
const 968 Assert (values.size() == points.size(),
971 for (
unsigned int i=0; i<points.size(); ++i)
977 values[i] = std::exp(p(0));
980 values[i] = std::exp(p(0)) * std::exp(p(1));
983 values[i] = std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2));
994 const unsigned int)
const 999 return std::exp(p(0));
1001 return 2 * std::exp(p(0)) * std::exp(p(1));
1003 return 3 * std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2));
1013 std::vector<double> &values,
1014 const unsigned int)
const 1016 Assert (values.size() == points.size(),
1019 for (
unsigned int i=0; i<points.size(); ++i)
1025 values[i] = std::exp(p(0));
1028 values[i] = 2 * std::exp(p(0)) * std::exp(p(1));
1031 values[i] = 3 * std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2));
1042 const unsigned int)
const 1048 result[0] = std::exp(p(0));
1051 result[0] = std::exp(p(0)) * std::exp(p(1));
1052 result[1] = result[0];
1055 result[0] = std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2));
1056 result[1] = result[0];
1057 result[2] = result[0];
1069 const unsigned int)
const 1071 Assert (gradients.size() == points.size(),
1074 for (
unsigned int i=0; i<points.size(); ++i)
1080 gradients[i][0] = std::exp(p(0));
1083 gradients[i][0] = std::exp(p(0)) * std::exp(p(1));
1084 gradients[i][1] = gradients[i][0];
1087 gradients[i][0] = std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2));
1088 gradients[i][1] = gradients[i][0];
1089 gradients[i][2] = gradients[i][0];
1101 LSingularityFunction::value (
const Point<2> &p,
1102 const unsigned int)
const 1107 if ((x>=0) && (y>=0))
1111 double r2 = x*x+y*y;
1113 return std::pow(r2,1./3.) * std::sin(2./3.*phi);
1118 LSingularityFunction::value_list (
const std::vector<
Point<2> > &points,
1119 std::vector<double> &values,
1120 const unsigned int)
const 1122 Assert (values.size() == points.size(),
1125 for (
unsigned int i=0; i<points.size(); ++i)
1127 double x = points[i](0);
1128 double y = points[i](1);
1130 if ((x>=0) && (y>=0))
1135 double r2 = x*x+y*y;
1137 values[i] = std::pow(r2,1./3.) * std::sin(2./3.*phi);
1144 LSingularityFunction::vector_value_list (
1145 const std::vector<
Point<2> > &points,
1148 Assert (values.size() == points.size(),
1151 for (
unsigned int i=0; i<points.size(); ++i)
1153 Assert (values[i].size() == 1,
1155 double x = points[i](0);
1156 double y = points[i](1);
1158 if ((x>=0) && (y>=0))
1163 double r2 = x*x+y*y;
1165 values[i](0) = std::pow(r2,1./3.) * std::sin(2./3.*phi);
1172 LSingularityFunction::laplacian (
const Point<2> &,
1173 const unsigned int)
const 1180 LSingularityFunction::laplacian_list (
const std::vector<
Point<2> > &points,
1181 std::vector<double> &values,
1182 const unsigned int)
const 1184 Assert (values.size() == points.size(),
1187 for (
unsigned int i=0; i<points.size(); ++i)
1193 LSingularityFunction::gradient (
const Point<2> &p,
1194 const unsigned int)
const 1199 double r43 = std::pow(x*x+y*y,2./3.);
1202 result[0] = 2./3.*(std::sin(2./3.*phi)*x + std::cos(2./3.*phi)*y)/r43;
1203 result[1] = 2./3.*(std::sin(2./3.*phi)*y - std::cos(2./3.*phi)*x)/r43;
1209 LSingularityFunction::gradient_list (
const std::vector<
Point<2> > &points,
1211 const unsigned int)
const 1213 Assert (gradients.size() == points.size(),
1216 for (
unsigned int i=0; i<points.size(); ++i)
1222 double r43 = std::pow(x*x+y*y,2./3.);
1224 gradients[i][0] = 2./3.*(std::sin(2./3.*phi)*x + std::cos(2./3.*phi)*y)/r43;
1225 gradients[i][1] = 2./3.*(std::sin(2./3.*phi)*y - std::cos(2./3.*phi)*x)/r43;
1231 LSingularityFunction::vector_gradient_list (
1232 const std::vector<
Point<2> > &points,
1233 std::vector<std::vector<
Tensor<1,2> > > &gradients)
const 1235 Assert (gradients.size() == points.size(),
1238 for (
unsigned int i=0; i<points.size(); ++i)
1240 Assert(gradients[i].size() == 1,
1246 double r43 = std::pow(x*x+y*y,2./3.);
1248 gradients[i][0][0] = 2./3.*(std::sin(2./3.*phi)*x + std::cos(2./3.*phi)*y)/r43;
1249 gradients[i][0][1] = 2./3.*(std::sin(2./3.*phi)*y - std::cos(2./3.*phi)*x)/r43;
1262 LSingularityGradFunction::value (
const Point<2> &p,
1263 const unsigned int d)
const 1267 const double x = p(0);
1268 const double y = p(1);
1270 const double r43 = std::pow(x*x+y*y,2./3.);
1272 return 2./3.*(std::sin(2./3.*phi)*p(d) +
1274 ? (std::cos(2./3.*phi)*y)
1275 : (-std::cos(2./3.*phi)*x)))
1281 LSingularityGradFunction::value_list (
1282 const std::vector<
Point<2> > &points,
1283 std::vector<double> &values,
1284 const unsigned int d)
const 1289 for (
unsigned int i=0; i<points.size(); ++i)
1292 const double x = p(0);
1293 const double y = p(1);
1295 const double r43 = std::pow(x*x+y*y,2./3.);
1297 values[i] = 2./3.*(std::sin(2./3.*phi)*p(d) +
1299 ? (std::cos(2./3.*phi)*y)
1300 : (-std::cos(2./3.*phi)*x)))
1307 LSingularityGradFunction::vector_value_list (
1308 const std::vector<
Point<2> > &points,
1311 Assert (values.size() == points.size(),
1314 for (
unsigned int i=0; i<points.size(); ++i)
1318 const double x = p(0);
1319 const double y = p(1);
1321 const double r43 = std::pow(x*x+y*y,2./3.);
1323 values[i](0) = 2./3.*(std::sin(2./3.*phi)*x + std::cos(2./3.*phi)*y)/r43;
1324 values[i](1) = 2./3.*(std::sin(2./3.*phi)*y - std::cos(2./3.*phi)*x)/r43;
1330 LSingularityGradFunction::laplacian (
const Point<2> &,
1331 const unsigned int)
const 1338 LSingularityGradFunction::laplacian_list (
const std::vector<
Point<2> > &points,
1339 std::vector<double> &values,
1340 const unsigned int)
const 1342 Assert (values.size() == points.size(),
1345 for (
unsigned int i=0; i<points.size(); ++i)
1352 LSingularityGradFunction::gradient (
1354 const unsigned int )
const 1362 LSingularityGradFunction::gradient_list (
1365 const unsigned int )
const 1372 LSingularityGradFunction::vector_gradient_list (
1385 const unsigned int)
const 1391 double r2 = x*x+y*y;
1393 return std::pow(r2,.25) * std::sin(.5*phi);
1401 std::vector<double> &values,
1402 const unsigned int)
const 1404 Assert (values.size() == points.size(),
1407 for (
unsigned int i=0; i<points.size(); ++i)
1409 double x = points[i](0);
1410 double y = points[i](1);
1413 double r2 = x*x+y*y;
1415 values[i] = std::pow(r2,.25) * std::sin(.5*phi);
1426 Assert (values.size() == points.size(),
1429 for (
unsigned int i=0; i<points.size(); ++i)
1431 Assert (values[i].size() == 1,
1434 double x = points[i](0);
1435 double y = points[i](1);
1438 double r2 = x*x+y*y;
1440 values[i](0) = std::pow(r2,.25) * std::sin(.5*phi);
1448 const unsigned int)
const 1458 std::vector<double> &values,
1459 const unsigned int)
const 1461 Assert (values.size() == points.size(),
1464 for (
unsigned int i=0; i<points.size(); ++i)
1472 const unsigned int)
const 1477 double r64 = std::pow(x*x+y*y,3./4.);
1480 result[0] = 1./2.*(std::sin(1./2.*phi)*x + std::cos(1./2.*phi)*y)/r64;
1481 result[1] = 1./2.*(std::sin(1./2.*phi)*y - std::cos(1./2.*phi)*x)/r64;
1490 const unsigned int)
const 1492 Assert (gradients.size() == points.size(),
1495 for (
unsigned int i=0; i<points.size(); ++i)
1501 double r64 = std::pow(x*x+y*y,3./4.);
1503 gradients[i][0] = 1./2.*(std::sin(1./2.*phi)*x + std::cos(1./2.*phi)*y)/r64;
1504 gradients[i][1] = 1./2.*(std::sin(1./2.*phi)*y - std::cos(1./2.*phi)*x)/r64;
1505 for (
unsigned int d=2; d<dim; ++d)
1506 gradients[i][d] = 0.;
1512 SlitSingularityFunction<dim>::vector_gradient_list (
1516 Assert (gradients.size() == points.size(),
1519 for (
unsigned int i=0; i<points.size(); ++i)
1521 Assert(gradients[i].size() == 1,
1528 double r64 = std::pow(x*x+y*y,3./4.);
1530 gradients[i][0][0] = 1./2.*(std::sin(1./2.*phi)*x + std::cos(1./2.*phi)*y)/r64;
1531 gradients[i][0][1] = 1./2.*(std::sin(1./2.*phi)*y - std::cos(1./2.*phi)*x)/r64;
1532 for (
unsigned int d=2;
d<dim; ++
d)
1533 gradients[i][0][d] = 0.;
1541 SlitHyperSingularityFunction::value (
const Point<2> &p,
1542 const unsigned int)
const 1548 double r2 = x*x+y*y;
1550 return std::pow(r2,.125) * std::sin(.25*phi);
1555 SlitHyperSingularityFunction::value_list (
1556 const std::vector<
Point<2> > &points,
1557 std::vector<double> &values,
1558 const unsigned int)
const 1560 Assert (values.size() == points.size(),
1563 for (
unsigned int i=0; i<points.size(); ++i)
1565 double x = points[i](0);
1566 double y = points[i](1);
1569 double r2 = x*x+y*y;
1571 values[i] = std::pow(r2,.125) * std::sin(.25*phi);
1577 SlitHyperSingularityFunction::vector_value_list (
1578 const std::vector<
Point<2> > &points,
1581 Assert (values.size() == points.size(),
1584 for (
unsigned int i=0; i<points.size(); ++i)
1586 Assert(values[i].size() == 1,
1589 double x = points[i](0);
1590 double y = points[i](1);
1593 double r2 = x*x+y*y;
1595 values[i](0) = std::pow(r2,.125) * std::sin(.25*phi);
1601 SlitHyperSingularityFunction::laplacian (
1603 const unsigned int)
const 1610 SlitHyperSingularityFunction::laplacian_list (
1611 const std::vector<
Point<2> > &points,
1612 std::vector<double> &values,
1613 const unsigned int)
const 1615 Assert (values.size() == points.size(),
1618 for (
unsigned int i=0; i<points.size(); ++i)
1624 SlitHyperSingularityFunction::gradient (
1626 const unsigned int)
const 1631 double r78 = std::pow(x*x+y*y,7./8.);
1635 result[0] = 1./4.*(std::sin(1./4.*phi)*x + std::cos(1./4.*phi)*y)/r78;
1636 result[1] = 1./4.*(std::sin(1./4.*phi)*y - std::cos(1./4.*phi)*x)/r78;
1642 SlitHyperSingularityFunction::gradient_list (
1643 const std::vector<
Point<2> > &points,
1645 const unsigned int)
const 1647 Assert (gradients.size() == points.size(),
1650 for (
unsigned int i=0; i<points.size(); ++i)
1656 double r78 = std::pow(x*x+y*y,7./8.);
1658 gradients[i][0] = 1./4.*(std::sin(1./4.*phi)*x + std::cos(1./4.*phi)*y)/r78;
1659 gradients[i][1] = 1./4.*(std::sin(1./4.*phi)*y - std::cos(1./4.*phi)*x)/r78;
1665 SlitHyperSingularityFunction::vector_gradient_list (
1666 const std::vector<
Point<2> > &points,
1667 std::vector<std::vector<
Tensor<1,2> > > &gradients)
const 1669 Assert (gradients.size() == points.size(),
1672 for (
unsigned int i=0; i<points.size(); ++i)
1674 Assert(gradients[i].size() == 1,
1681 double r78 = std::pow(x*x+y*y,7./8.);
1683 gradients[i][0][0] = 1./4.*(std::sin(1./4.*phi)*x + std::cos(1./4.*phi)*y)/r78;
1684 gradients[i][0][1] = 1./4.*(std::sin(1./4.*phi)*y - std::cos(1./4.*phi)*x)/r78;
1692 const double steepness)
1694 direction(direction),
1695 steepness(steepness)
1717 const unsigned int)
const 1719 double x = steepness*(-cosine*p(0)+sine*p(1));
1720 return -std::atan(x);
1728 std::vector<double> &values,
1729 const unsigned int)
const 1731 Assert (values.size() == p.size(),
1734 for (
unsigned int i=0; i<p.size(); ++i)
1736 double x = steepness*(-cosine*p[i](0)+sine*p[i](1));
1737 values[i] = -std::atan(x);
1745 const unsigned int)
const 1747 double x = steepness*(-cosine*p(0)+sine*p(1));
1749 return 2*steepness*steepness*x/(r*r);
1756 std::vector<double> &values,
1757 const unsigned int)
const 1759 Assert (values.size() == p.size(),
1762 double f = 2*steepness*steepness;
1764 for (
unsigned int i=0; i<p.size(); ++i)
1766 double x = steepness*(-cosine*p[i](0)+sine*p[i](1));
1768 values[i] = f*x/(r*r);
1777 const unsigned int)
const 1779 double x = steepness*(-cosine*p(0)+sine*p(1));
1780 double r = -steepness*(1+x*x);
1793 const unsigned int)
const 1795 Assert (gradients.size() == p.size(),
1798 for (
unsigned int i=0; i<p.size(); ++i)
1800 double x = steepness*(cosine*p[i](0)+sine*p[i](1));
1801 double r = -steepness*(1+x*x);
1802 gradients[i][0] = cosine*r;
1803 gradients[i][1] = sine*r;
1815 return sizeof (*this);
1830 fourier_coefficients (fourier_coefficients)
1838 const unsigned int component)
const 1842 return std::cos(fourier_coefficients * p);
1850 const unsigned int component)
const 1854 return -fourier_coefficients * std::sin(fourier_coefficients * p);
1862 const unsigned int component)
const 1866 return (fourier_coefficients * fourier_coefficients) * (-std::cos(fourier_coefficients * p));
1881 fourier_coefficients (fourier_coefficients)
1889 const unsigned int component)
const 1893 return std::sin(fourier_coefficients * p);
1901 const unsigned int component)
const 1905 return fourier_coefficients * std::cos(fourier_coefficients * p);
1913 const unsigned int component)
const 1917 return (fourier_coefficients * fourier_coefficients) * (-std::sin(fourier_coefficients * p));
1930 const std::vector<double> &weights)
1933 fourier_coefficients (fourier_coefficients),
1947 const unsigned int component)
const 1952 const unsigned int n = weights.size();
1954 for (
unsigned int s=0; s<n; ++s)
1955 sum += weights[s] * std::sin(fourier_coefficients[s] * p);
1965 const unsigned int component)
const 1970 const unsigned int n = weights.size();
1972 for (
unsigned int s=0; s<n; ++s)
1973 sum += fourier_coefficients[s] * std::cos(fourier_coefficients[s] * p);
1983 const unsigned int component)
const 1988 const unsigned int n = weights.size();
1990 for (
unsigned int s=0; s<n; ++s)
1991 sum -= (fourier_coefficients[s] * fourier_coefficients[s]) * std::sin(fourier_coefficients[s] * p);
2005 const std::vector<double> &weights)
2008 fourier_coefficients (fourier_coefficients),
2022 const unsigned int component)
const 2027 const unsigned int n = weights.size();
2029 for (
unsigned int s=0; s<n; ++s)
2030 sum += weights[s] * std::cos(fourier_coefficients[s] * p);
2040 const unsigned int component)
const 2045 const unsigned int n = weights.size();
2047 for (
unsigned int s=0; s<n; ++s)
2048 sum -= fourier_coefficients[s] * std::sin(fourier_coefficients[s] * p);
2058 const unsigned int component)
const 2063 const unsigned int n = weights.size();
2065 for (
unsigned int s=0; s<n; ++s)
2066 sum -= (fourier_coefficients[s] * fourier_coefficients[s]) * std::cos(fourier_coefficients[s] * p);
2081 const unsigned int n_components)
2084 exponents (exponents)
2092 const unsigned int component)
const 2095 Assert (component<this->n_components,
2099 for (
unsigned int s=0; s<dim; ++s)
2102 Assert(std::floor(exponents[s]) == exponents[s],
2103 ExcMessage(
"Exponentiation of a negative base number with " 2104 "a real exponent can't be performed."));
2105 prod *= std::pow(p[s], exponents[s]);
2120 for (
unsigned int i=0; i<values.
size(); ++i)
2129 const unsigned int component)
const 2135 for (
unsigned int d=0; d<dim; ++d)
2138 for (
unsigned int s=0; s<dim; ++s)
2140 if ((s==d) && (exponents[s] == 0) && (p[s] == 0))
2148 Assert(std::floor(exponents[s]) == exponents[s],
2149 ExcMessage(
"Exponentiation of a negative base number with " 2150 "a real exponent can't be performed."));
2153 exponents[s] * std::pow(p[s], exponents[s]-1)
2155 std::pow(p[s], exponents[s]));
2169 std::vector<double> &values,
2170 const unsigned int component)
const 2172 Assert (values.size() == points.size(),
2175 for (
unsigned int i=0; i<points.size(); ++i)
2182 const unsigned int order,
2183 const double wave_number,
2187 wave_number(wave_number),
2196 const double r = p.
distance(center);
2197 #ifndef DEAL_II_HAVE_JN 2198 Assert(
false,
ExcMessage(
"The Bessel function jn was not found by CMake."));
2201 return jn(order, r*wave_number);
2210 std::vector<double> &values,
2211 const unsigned int)
const 2215 #ifndef DEAL_II_HAVE_JN 2218 Assert(
false,
ExcMessage(
"The Bessel function jn was not found by CMake."));
2220 for (
unsigned int k=0; k<points.size(); ++k)
2222 const double r = points[k].distance(center);
2223 values[k] = jn(order, r*wave_number);
2232 const unsigned int)
const 2235 #ifndef DEAL_II_HAVE_JN 2237 Assert(
false,
ExcMessage(
"The Bessel function jn was not found by CMake."));
2240 const double r = p.
distance(center);
2241 const double co = (r==0.) ? 0. : (p(0)-center(0))/r;
2242 const double si = (r==0.) ? 0. : (p(1)-center(1))/r;
2244 const double dJn = (order==0)
2245 ? (-jn(1, r*wave_number))
2246 : (.5*(jn(order-1, wave_number*r) -jn(order+1, wave_number*r)));
2248 result[0] = wave_number * co * dJn;
2249 result[1] = wave_number * si * dJn;
2261 const unsigned int)
const 2265 #ifndef DEAL_II_HAVE_JN 2266 Assert(
false,
ExcMessage(
"The Bessel function jn was not found by CMake."));
2268 for (
unsigned int k=0; k<points.size(); ++k)
2271 const double r = p.
distance(center);
2272 const double co = (r==0.) ? 0. : (p(0)-center(0))/r;
2273 const double si = (r==0.) ? 0. : (p(1)-center(1))/r;
2275 const double dJn = (order==0)
2276 ? (-jn(1, r*wave_number))
2277 : (.5*(jn(order-1, wave_number*r) -jn(order+1, wave_number*r)));
2279 result[0] = wave_number * co * dJn;
2280 result[1] = wave_number * si * dJn;
2296 return ((1-xi[0])*data_values[ix[0]]
2298 xi[0]*data_values[ix[0]+1]);
2305 return (((1-p_unit[0])*data_values[ix[0]][ix[1]]
2307 p_unit[0]*data_values[ix[0]+1][ix[1]])*(1-p_unit[1])
2309 ((1-p_unit[0])*data_values[ix[0]][ix[1]+1]
2311 p_unit[0]*data_values[ix[0]+1][ix[1]+1])*p_unit[1]);
2318 return ((((1-p_unit[0])*data_values[ix[0]][ix[1]][ix[2]]
2320 p_unit[0]*data_values[ix[0]+1][ix[1]][ix[2]])*(1-p_unit[1])
2322 ((1-p_unit[0])*data_values[ix[0]][ix[1]+1][ix[2]]
2324 p_unit[0]*data_values[ix[0]+1][ix[1]+1][ix[2]])*p_unit[1]) * (1-p_unit[2])
2326 (((1-p_unit[0])*data_values[ix[0]][ix[1]][ix[2]+1]
2328 p_unit[0]*data_values[ix[0]+1][ix[1]][ix[2]+1])*(1-p_unit[1])
2330 ((1-p_unit[0])*data_values[ix[0]][ix[1]+1][ix[2]+1]
2332 p_unit[0]*data_values[ix[0]+1][ix[1]+1][ix[2]+1])*p_unit[1]) * p_unit[2]);
2347 grad[0] = (data_values[ix[0]+1] - data_values[ix[0]]) / dx[0];
2359 u00 = data_values[ix[0]][ix[1]],
2360 u01 = data_values[ix[0]+1][ix[1]],
2361 u10 = data_values[ix[0]][ix[1]+1],
2362 u11 = data_values[ix[0]+1][ix[1]+1];
2364 grad[0] = ((1-p_unit[1])*(u01-u00) + p_unit[1]*(u11-u10))/
dx[0];
2365 grad[1] = ((1-p_unit[0])*(u10-u00) + p_unit[0]*(u11-u01))/
dx[1];
2377 u000 = data_values[ix[0]][ix[1]][ix[2]],
2378 u001 = data_values[ix[0]+1][ix[1]][ix[2]],
2379 u010 = data_values[ix[0]][ix[1]+1][ix[2]],
2380 u100 = data_values[ix[0]][ix[1]][ix[2]+1],
2381 u011 = data_values[ix[0]+1][ix[1]+1][ix[2]],
2382 u101 = data_values[ix[0]+1][ix[1]][ix[2]+1],
2383 u110 = data_values[ix[0]][ix[1]+1][ix[2]+1],
2384 u111 = data_values[ix[0]+1][ix[1]+1][ix[2]+1];
2386 grad[0] = ((1-p_unit[2])
2388 ((1-p_unit[1])*(u001-u000) + p_unit[1]*(u011-u010))
2392 ((1-p_unit[1])*(u101-u100) + p_unit[1]*(u111-u110))
2394 grad[1] = ((1-p_unit[2])
2396 ((1-p_unit[0])*(u010-u000) + p_unit[0]*(u011-u001))
2400 ((1-p_unit[0])*(u110-u100) + p_unit[0]*(u111-u101))
2402 grad[2] = ((1-p_unit[1])
2404 ((1-p_unit[0])*(u100-u000) + p_unit[0]*(u101-u001))
2408 ((1-p_unit[0])*(u110-u010) + p_unit[0]*(u111-u011))
2420 coordinate_values (coordinate_values),
2421 data_values (data_values)
2423 for (
unsigned int d=0; d<dim; ++d)
2426 ExcMessage (
"Coordinate arrays must have at least two coordinate values!"));
2429 ExcMessage (
"Coordinate arrays must be sorted in strictly ascending order."));
2432 ExcMessage (
"Data and coordinate tables do not have the same size."));
2447 for (
unsigned int d=0; d<dim; ++d)
2451 ix[d] = (std::lower_bound (coordinate_values[d].begin(),
2452 coordinate_values[d].end(),
2454 - coordinate_values[d].begin());
2463 if (ix[d] == coordinate_values[d].size())
2464 ix[d] = coordinate_values[d].size()-2;
2477 const unsigned int component)
const 2481 ExcMessage (
"This is a scalar function object, the component can only be zero."));
2490 for (
unsigned int d=0; d<dim; ++d)
2491 p_unit[d] = std::max(std::min((p[d]-coordinate_values[d][ix[d]]) /
2492 (coordinate_values[d][ix[d]+1]-coordinate_values[d][ix[d]]),
2496 return interpolate (data_values, ix, p_unit);
2504 const unsigned int component)
const 2508 ExcMessage (
"This is a scalar function object, the component can only be zero."));
2514 for (
unsigned int d=0; d<dim; ++d)
2515 dx[d] = coordinate_values[d][ix[d]+1]-coordinate_values[d][ix[d]];
2518 for (
unsigned int d=0; d<dim; ++d)
2519 p_unit[d] = std::max(std::min((p[d]-coordinate_values[d][ix[d]]) / dx[d],
2523 return gradient_interpolate(data_values, ix, p_unit, dx);
2531 const std::array<unsigned int,dim> &n_subintervals,
2534 interval_endpoints (interval_endpoints),
2535 n_subintervals (n_subintervals),
2536 data_values (data_values)
2538 for (
unsigned int d=0; d<dim; ++d)
2541 ExcMessage (
"There needs to be at least one subinterval in each " 2542 "coordinate direction."));
2544 ExcMessage (
"The interval in each coordinate direction needs " 2545 "to have positive size"));
2547 ExcMessage (
"The data table does not have the correct size."));
2555 const unsigned int component)
const 2559 ExcMessage (
"This is a scalar function object, the component can only be zero."));
2564 for (
unsigned int d=0; d<dim; ++d)
2566 const double delta_x = ((interval_endpoints[d].second - interval_endpoints[d].first) /
2568 if (p[d] <= interval_endpoints[d].first)
2570 else if (p[d] >= interval_endpoints[d].second-delta_x)
2571 ix[d] = n_subintervals[d]-1;
2573 ix[d] = (
unsigned int)((p[d]-interval_endpoints[d].first) / delta_x);
2580 for (
unsigned int d=0; d<dim; ++d)
2582 const double delta_x = ((interval_endpoints[d].second - interval_endpoints[d].first) /
2584 p_unit[d] = std::max(std::min((p[d]-interval_endpoints[d].first-ix[d]*delta_x)/delta_x,
2589 return interpolate (data_values, ix, p_unit);
2599 const std::vector<double> &coefficients)
2602 exponents (exponents),
2603 coefficients(coefficients)
2616 const unsigned int component)
const 2622 for (
unsigned int monom = 0; monom < exponents.n_rows(); ++monom)
2625 for (
unsigned int s=0; s< dim; ++s)
2628 Assert(std::floor(exponents[monom][s]) == exponents[monom][s],
2629 ExcMessage(
"Exponentiation of a negative base number with " 2630 "a real exponent can't be performed."));
2631 prod *= std::pow(p[s], exponents[monom][s]);
2633 sum += coefficients[monom]*prod;
2643 std::vector<double> &values,
2644 const unsigned int component)
const 2646 Assert (values.size() == points.size(),
2649 for (
unsigned int i=0; i<points.size(); ++i)
2658 const unsigned int component)
const 2665 for (
unsigned int d=0; d<dim; ++d)
2669 for (
unsigned int monom = 0; monom < exponents.n_rows(); ++monom)
2672 for (
unsigned int s=0; s < dim; ++s)
2674 if ((s==d)&&(exponents[monom][s] == 0)&&(p[s] == 0))
2682 Assert(std::floor(exponents[monom][s]) == exponents[monom][s],
2683 ExcMessage(
"Exponentiation of a negative base number with " 2684 "a real exponent can't be performed."));
2687 exponents[monom][s] * std::pow(p[s], exponents[monom][s]-1)
2689 std::pow(p[s], exponents[monom][s]));
2692 sum += coefficients[monom]*prod;
2752 DEAL_II_NAMESPACE_CLOSE
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual double value(const Point< dim > &p, const unsigned int component=0) const
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
virtual double value(const Point< dim > &p, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component) const
virtual double value(const Point< dim > &p, const unsigned int component) const
#define AssertDimension(dim1, dim2)
TableIndices< dim > table_index_of_point(const Point< dim > &p) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual double value(const Point< dim > &p, const unsigned int component=0) const
LSingularityGradFunction()
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual void vector_value(const Point< dim > &p, Vector< double > &values) const
Monomial(const Tensor< 1, dim > &exponents, const unsigned int n_components=1)
Polynomial(const Table< 2, double > &exponents, const std::vector< double > &coefficients)
virtual double value(const Point< dim > &p, const unsigned int component=0) const
virtual void vector_value_list(const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const
#define AssertIndexRange(index, range)
virtual double value(const Point< dim > &p, const unsigned int component=0) const
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
#define AssertVectorVectorDimension(vec, dim1, dim2)
virtual double laplacian(const Point< dim > &p, const unsigned int component) const
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
virtual void vector_value(const Point< dim > &p, Vector< double > &values) const
virtual void vector_value(const Point< dim > &p, Vector< double > &values) const
CosineFunction(const unsigned int n_components=1)
virtual void vector_value_list(const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
const std::array< std::vector< double >, dim > coordinate_values
virtual double value(const Point< dim > &p, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual double value(const Point< dim > &p, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual SymmetricTensor< 2, dim > hessian(const Point< dim > &p, const unsigned int component=0) const
static ::ExceptionBase & ExcMessage(std::string arg1)
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual double value(const Point< dim > &p, const unsigned int component=0) const
std::size_t memory_consumption() const
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
const Table< 2, double > exponents
const std::vector< Point< dim > > fourier_coefficients
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
virtual void vector_value_list(const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const
const Table< dim, double > data_values
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
numbers::NumberTraits< Number >::real_type distance(const Point< dim, Number > &p) const
virtual void hessian_list(const std::vector< Point< dim > > &points, std::vector< SymmetricTensor< 2, dim > > &hessians, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual double value(const Point< dim > &p, const unsigned int component=0) const
const std::vector< double > coefficients
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual double value(const Point< dim > &p, const unsigned int component=0) const
const Point< dim > direction
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
size_type size(const unsigned int i) const
const std::vector< Point< dim > > fourier_coefficients
virtual double value(const Point< dim > &points, const unsigned int component) const
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
PillowFunction(const double offset=0.)
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
InterpolatedTensorProductGridData(const std::array< std::vector< double >, dim > &coordinate_values, const Table< dim, double > &data_values)
virtual double value(const Point< dim > &p, const unsigned int component=0) const
numbers::NumberTraits< Number >::real_type square() const
FourierCosineFunction(const Tensor< 1, dim > &fourier_coefficients)
virtual double value(const Point< dim > &p, const unsigned int component=0) const
FourierCosineSum(const std::vector< Point< dim > > &fourier_coefficients, const std::vector< double > &weights)
static ::ExceptionBase & ExcNotImplemented()
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
FourierSineFunction(const Tensor< 1, dim > &fourier_coefficients)
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
virtual double value(const Point< dim > &p, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual double value(const Point< dim > &p, const unsigned int component=0) const
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual void laplacian_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component) const
static ::ExceptionBase & ExcZero()
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual double laplacian(const Point< dim > &p, const unsigned int component=0) const
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual void vector_value_list(const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const
static ::ExceptionBase & ExcInternalError()
JumpFunction(const Point< dim > &direction, const double steepness)
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
FourierSineSum(const std::vector< Point< dim > > &fourier_coefficients, const std::vector< double > &weights)