68 std::vector<long double> points =
69 Polynomials::jacobi_polynomial_roots<long double>(n, 0, 0);
71 for (
unsigned int i = 0; i < (points.size() + 1) / 2; ++i)
77 const long double pp =
80 const long double x = -1. + 2. * points[i];
81 const double w = 1. / ((1. - x * x) * pp * pp);
98 long double result = n - 1;
99 for (
int i = n - 2; i > 1; --i)
113 std::vector<long double>
118 const unsigned int q = x.size();
119 std::vector<long double>
w(q);
121 const long double factor =
122 std::pow(2., alpha + beta + 1) *
gamma(alpha + q) *
gamma(beta + q) /
123 ((q - 1) *
gamma(q) *
gamma(alpha + beta + q + 1));
124 for (
unsigned int i = 0; i < q; ++i)
126 const long double s =
128 w[i] = factor / (s * s);
131 w[q - 1] *= (alpha + 1);
146 std::vector<long double> points =
147 Polynomials::jacobi_polynomial_roots<long double>(n - 2, 1, 1);
148 points.insert(points.begin(), 0);
149 points.push_back(1.);
150 std::vector<long double>
w =
154 for (
unsigned int i = 0; i < points.size(); ++i)
157 this->weights[i] = 0.5 *
w[i];
177 static const double xpts[] = {0.0, 1.0};
178 static const double wts[] = {0.5, 0.5};
180 for (
unsigned int i = 0; i < this->
size(); ++i)
193 static const double xpts[] = {0.0, 0.5, 1.0};
194 static const double wts[] = {1. / 6., 2. / 3., 1. / 6.};
196 for (
unsigned int i = 0; i < this->
size(); ++i)
209 static const double xpts[] = {0.0, .25, .5, .75, 1.0};
210 static const double wts[] = {
211 7. / 90., 32. / 90., 12. / 90., 32. / 90., 7. / 90.};
213 for (
unsigned int i = 0; i < this->
size(); ++i)
226 static const double xpts[] = {
227 0.0, 1. / 6., 1. / 3., .5, 2. / 3., 5. / 6., 1.0};
228 static const double wts[] = {41. / 840.,
236 for (
unsigned int i = 0; i < this->
size(); ++i)
251 for (
unsigned int i = 0; i < this->
size(); ++i)
258 this->
weights[i] = revert ?
w[n - 1 - i] :
w[i];
266 std::vector<double> q_points(n);
271 q_points[0] = 0.3333333333333333;
275 q_points[0] = 0.1120088061669761;
276 q_points[1] = 0.6022769081187381;
280 q_points[0] = 0.06389079308732544;
281 q_points[1] = 0.3689970637156184;
282 q_points[2] = 0.766880303938942;
286 q_points[0] = 0.04144848019938324;
287 q_points[1] = 0.2452749143206022;
288 q_points[2] = 0.5561654535602751;
289 q_points[3] = 0.848982394532986;
293 q_points[0] = 0.02913447215197205;
294 q_points[1] = 0.1739772133208974;
295 q_points[2] = 0.4117025202849029;
296 q_points[3] = 0.6773141745828183;
297 q_points[4] = 0.89477136103101;
301 q_points[0] = 0.02163400584411693;
302 q_points[1] = 0.1295833911549506;
303 q_points[2] = 0.3140204499147661;
304 q_points[3] = 0.5386572173517997;
305 q_points[4] = 0.7569153373774084;
306 q_points[5] = 0.922668851372116;
311 q_points[0] = 0.0167193554082585;
312 q_points[1] = 0.100185677915675;
313 q_points[2] = 0.2462942462079286;
314 q_points[3] = 0.4334634932570557;
315 q_points[4] = 0.6323509880476823;
316 q_points[5] = 0.81111862674023;
317 q_points[6] = 0.940848166743287;
321 q_points[0] = 0.01332024416089244;
322 q_points[1] = 0.07975042901389491;
323 q_points[2] = 0.1978710293261864;
324 q_points[3] = 0.354153994351925;
325 q_points[4] = 0.5294585752348643;
326 q_points[5] = 0.7018145299391673;
327 q_points[6] = 0.849379320441094;
328 q_points[7] = 0.953326450056343;
332 q_points[0] = 0.01086933608417545;
333 q_points[1] = 0.06498366633800794;
334 q_points[2] = 0.1622293980238825;
335 q_points[3] = 0.2937499039716641;
336 q_points[4] = 0.4466318819056009;
337 q_points[5] = 0.6054816627755208;
338 q_points[6] = 0.7541101371585467;
339 q_points[7] = 0.877265828834263;
340 q_points[8] = 0.96225055941096;
344 q_points[0] = 0.00904263096219963;
345 q_points[1] = 0.05397126622250072;
346 q_points[2] = 0.1353118246392511;
347 q_points[3] = 0.2470524162871565;
348 q_points[4] = 0.3802125396092744;
349 q_points[5] = 0.5237923179723384;
350 q_points[6] = 0.6657752055148032;
351 q_points[7] = 0.7941904160147613;
352 q_points[8] = 0.898161091216429;
353 q_points[9] = 0.9688479887196;
358 q_points[0] = 0.007643941174637681;
359 q_points[1] = 0.04554182825657903;
360 q_points[2] = 0.1145222974551244;
361 q_points[3] = 0.2103785812270227;
362 q_points[4] = 0.3266955532217897;
363 q_points[5] = 0.4554532469286375;
364 q_points[6] = 0.5876483563573721;
365 q_points[7] = 0.7139638500230458;
366 q_points[8] = 0.825453217777127;
367 q_points[9] = 0.914193921640008;
368 q_points[10] = 0.973860256264123;
372 q_points[0] = 0.006548722279080035;
373 q_points[1] = 0.03894680956045022;
374 q_points[2] = 0.0981502631060046;
375 q_points[3] = 0.1811385815906331;
376 q_points[4] = 0.2832200676673157;
377 q_points[5] = 0.398434435164983;
378 q_points[6] = 0.5199526267791299;
379 q_points[7] = 0.6405109167754819;
380 q_points[8] = 0.7528650118926111;
381 q_points[9] = 0.850240024421055;
382 q_points[10] = 0.926749682988251;
383 q_points[11] = 0.977756129778486;
399 std::vector<double> quadrature_weights(n);
404 quadrature_weights[0] = -1.0;
407 quadrature_weights[0] = -0.7185393190303845;
408 quadrature_weights[1] = -0.2814606809696154;
412 quadrature_weights[0] = -0.5134045522323634;
413 quadrature_weights[1] = -0.3919800412014877;
414 quadrature_weights[2] = -0.0946154065661483;
418 quadrature_weights[0] = -0.3834640681451353;
419 quadrature_weights[1] = -0.3868753177747627;
420 quadrature_weights[2] = -0.1904351269501432;
421 quadrature_weights[3] = -0.03922548712995894;
425 quadrature_weights[0] = -0.2978934717828955;
426 quadrature_weights[1] = -0.3497762265132236;
427 quadrature_weights[2] = -0.234488290044052;
428 quadrature_weights[3] = -0.0989304595166356;
429 quadrature_weights[4] = -0.01891155214319462;
433 quadrature_weights[0] = -0.2387636625785478;
434 quadrature_weights[1] = -0.3082865732739458;
435 quadrature_weights[2] = -0.2453174265632108;
436 quadrature_weights[3] = -0.1420087565664786;
437 quadrature_weights[4] = -0.05545462232488041;
438 quadrature_weights[5] = -0.01016895869293513;
443 quadrature_weights[0] = -0.1961693894252476;
444 quadrature_weights[1] = -0.2703026442472726;
445 quadrature_weights[2] = -0.239681873007687;
446 quadrature_weights[3] = -0.1657757748104267;
447 quadrature_weights[4] = -0.0889432271377365;
448 quadrature_weights[5] = -0.03319430435645653;
449 quadrature_weights[6] = -0.005932787015162054;
453 quadrature_weights[0] = -0.164416604728002;
454 quadrature_weights[1] = -0.2375256100233057;
455 quadrature_weights[2] = -0.2268419844319134;
456 quadrature_weights[3] = -0.1757540790060772;
457 quadrature_weights[4] = -0.1129240302467932;
458 quadrature_weights[5] = -0.05787221071771947;
459 quadrature_weights[6] = -0.02097907374214317;
460 quadrature_weights[7] = -0.003686407104036044;
464 quadrature_weights[0] = -0.1400684387481339;
465 quadrature_weights[1] = -0.2097722052010308;
466 quadrature_weights[2] = -0.211427149896601;
467 quadrature_weights[3] = -0.1771562339380667;
468 quadrature_weights[4] = -0.1277992280331758;
469 quadrature_weights[5] = -0.07847890261203835;
470 quadrature_weights[6] = -0.0390225049841783;
471 quadrature_weights[7] = -0.01386729555074604;
472 quadrature_weights[8] = -0.002408041036090773;
476 quadrature_weights[0] = -0.12095513195457;
477 quadrature_weights[1] = -0.1863635425640733;
478 quadrature_weights[2] = -0.1956608732777627;
479 quadrature_weights[3] = -0.1735771421828997;
480 quadrature_weights[4] = -0.135695672995467;
481 quadrature_weights[5] = -0.0936467585378491;
482 quadrature_weights[6] = -0.05578772735275126;
483 quadrature_weights[7] = -0.02715981089692378;
484 quadrature_weights[8] = -0.00951518260454442;
485 quadrature_weights[9] = -0.001638157633217673;
490 quadrature_weights[0] = -0.1056522560990997;
491 quadrature_weights[1] = -0.1665716806006314;
492 quadrature_weights[2] = -0.1805632182877528;
493 quadrature_weights[3] = -0.1672787367737502;
494 quadrature_weights[4] = -0.1386970574017174;
495 quadrature_weights[5] = -0.1038334333650771;
496 quadrature_weights[6] = -0.06953669788988512;
497 quadrature_weights[7] = -0.04054160079499477;
498 quadrature_weights[8] = -0.01943540249522013;
499 quadrature_weights[9] = -0.006737429326043388;
500 quadrature_weights[10] = -0.001152486965101561;
504 quadrature_weights[0] = -0.09319269144393;
505 quadrature_weights[1] = -0.1497518275763289;
506 quadrature_weights[2] = -0.166557454364573;
507 quadrature_weights[3] = -0.1596335594369941;
508 quadrature_weights[4] = -0.1384248318647479;
509 quadrature_weights[5] = -0.1100165706360573;
510 quadrature_weights[6] = -0.07996182177673273;
511 quadrature_weights[7] = -0.0524069547809709;
512 quadrature_weights[8] = -0.03007108900074863;
513 quadrature_weights[9] = -0.01424924540252916;
514 quadrature_weights[10] = -0.004899924710875609;
515 quadrature_weights[11] = -0.000834029009809656;
523 return quadrature_weights;
531 const bool factor_out_singularity)
533 ((origin[0] == 0) || (origin[0] == 1)) ? (alpha == 1 ? n : 2 * n) : 4 * n)
534 , fraction(((origin[0] == 0) || (origin[0] == 1.)) ? 1. : origin[0])
559 unsigned int ns_offset = (
fraction == 1) ? n : 2 * n;
561 for (
unsigned int i = 0, j = ns_offset; i < n; ++i, ++j)
569 if ((alpha != 1) || (
fraction != 1))
589 if (factor_out_singularity ==
true)
590 for (
unsigned int i = 0; i <
size(); ++i)
595 "The singularity cannot be on a Gauss point of the same order!"));
598 Assert(denominator != 0.0,
600 "The quadrature formula you are using does not allow to "
601 "factor out the singularity, which is zero at one point."));
602 this->
weights[i] /= denominator;
611 const double eps = 1
e-8;
615 [
eps](
double coord) {
616 return std::abs(coord) < eps || std::abs(coord - 1.) < eps;
618 const bool on_vertex =
620 std::abs((singularity -
Point<2>(.5, .5)).norm_square() - .5) <
eps;
632 const bool factor_out_singularity)
641 std::vector<QGaussOneOverR<2>> quads;
642 std::vector<Point<2>> origins;
645 quads.emplace_back(n, 3, factor_out_singularity);
646 quads.emplace_back(n, 2, factor_out_singularity);
647 quads.emplace_back(n, 1, factor_out_singularity);
648 quads.emplace_back(n, 0, factor_out_singularity);
650 origins.emplace_back(0., 0.);
651 origins.emplace_back(singularity[0], 0.);
652 origins.emplace_back(0., singularity[1]);
653 origins.push_back(singularity);
658 unsigned int q_id = 0;
661 for (
unsigned int box = 0; box < 4; ++box)
664 dist =
Point<2>(std::abs(dist[0]), std::abs(dist[1]));
665 double area = dist[0] * dist[1];
667 for (
unsigned int q = 0; q < quads[box].size(); ++q, ++q_id)
669 const Point<2> &qp = quads[box].point(q);
671 origins[box] +
Point<2>(dist[0] * qp[0], dist[1] * qp[1]);
672 this->
weights[q_id] = quads[box].weight(q) * area;
680 const unsigned int vertex_index,
681 const bool factor_out_singularity)
717 std::vector<double> & ws = this->
weights;
720 for (
unsigned int q = 0; q < gauss.
size(); ++q)
724 ps[q][1] = gp[0] * std::tan(pi4 * gp[1]);
725 ws[q] = gauss.
weight(q) * pi4 / std::cos(pi4 * gp[1]);
726 if (factor_out_singularity)
730 ws[gauss.
size() + q] = ws[q];
731 ps[gauss.
size() + q][0] = ps[q][1];
732 ps[gauss.
size() + q][1] = ps[q][0];
737 switch (vertex_index)
754 double R00 = std::cos(theta), R01 = -std::sin(theta);
755 double R10 = std::sin(theta), R11 = std::cos(theta);
757 if (vertex_index != 0)
758 for (
unsigned int q = 0; q <
size(); ++q)
760 double x = ps[q][0] - .5, y = ps[q][1] - .5;
762 ps[q][0] = R00 * x + R01 * y + .5;
763 ps[q][1] = R10 * x + R11 * y + .5;
772 std::vector<unsigned int> permutation(quad.
size());
773 for (
unsigned int i = 0; i < quad.
size(); ++i)
776 std::sort(permutation.begin(),
778 [
this](
const unsigned int x,
const unsigned int y) {
779 return this->compare_weights(x, y);
789 for (
unsigned int i = 0; i < quad.
size(); ++i)
793 if (permutation[i] != i)
803 return (this->weights[a] < this->weights[
b]);
889 const double eta_bar = singularity[0] * 2. - 1.;
890 const double eta_star = eta_bar * eta_bar - 1.;
894 std::vector<double> weights_dummy(
weights.size());
895 unsigned int cont = 0;
896 const double tol = 1
e-10;
914 weights.resize(weights_dummy.size() - 1);
922 if (std::abs(eta_star) <= tol)
925 std::pow((eta_bar * eta_star + std::abs(eta_star)), 1.0 / 3.0) +
926 std::pow((eta_bar * eta_star - std::abs(eta_star)), 1.0 / 3.0) +
931 gamma_bar = (eta_bar * eta_star + std::abs(eta_star)) /
932 std::abs(eta_bar * eta_star + std::abs(eta_star)) *
933 std::pow(std::abs(eta_bar * eta_star + std::abs(eta_star)),
935 (eta_bar * eta_star - std::abs(eta_star)) /
936 std::abs(eta_bar * eta_star - std::abs(eta_star)) *
937 std::pow(std::abs(eta_bar * eta_star - std::abs(eta_star)),
944 double eta = (std::pow(
gamma - gamma_bar, 3.0) +
945 gamma_bar * (gamma_bar * gamma_bar + 3)) /
946 (1 + 3 * gamma_bar * gamma_bar);
948 double J = 3 * ((
gamma - gamma_bar) * (
gamma - gamma_bar)) /
949 (1 + 3 * gamma_bar * gamma_bar);
966 std::vector<double> points(n);
968 for (
unsigned short i = 0; i < n; ++i)
975 (1. +
double(2 * i + 1) /
double(2 * (n - 1) + 2))));
988 std::vector<double> weights(n);
990 for (
unsigned short i = 0; i < n; ++i)
1006 Assert(n > 0,
ExcMessage(
"Need at least one point for the quadrature rule"));
1010 for (
unsigned int i = 0; i < this->
size(); ++i)
1033 std::vector<double> points(n);
1035 for (
unsigned short i = 0; i < n; ++i)
1041 case ::QGaussRadauChebyshev<1>::left:
1047 (1 + 2 *
double(i) / (2 *
double(n - 1) + 1.))));
1051 case ::QGaussRadauChebyshev<1>::right:
1055 (1. - std::cos(
numbers::PI * (2 *
double(n - 1 - i) /
1056 (2 *
double(n - 1) + 1.))));
1064 "This constructor can only be called with either "
1065 "QGaussRadauChebyshev::left or QGaussRadauChebyshev::right as "
1066 "second argument."));
1079 std::vector<double> weights(n);
1081 for (
unsigned short i = 0; i < n; ++i)
1104 std::vector<double> p =
1106 std::vector<double>
w =
1109 for (
unsigned int i = 0; i < this->
size(); ++i)
1136 std::vector<double> points(n);
1138 for (
unsigned short i = 0; i < n; ++i)
1144 (1. + std::cos(
numbers::PI * (1 +
double(i) /
double(n - 1))));
1153 std::vector<double> weights(n);
1155 for (
unsigned short i = 0; i < n; ++i)
1159 if (i == 0 || i == (n - 1))
1176 "Need at least two points for Gauss-Lobatto quadrature rule"));
1177 std::vector<double> p =
1179 std::vector<double>
w =
1182 for (
unsigned int i = 0; i < this->
size(); ++i)
1200 std::vector<Point<dim>> qpoints;
1201 std::vector<double> weights;
1203 for (
unsigned int i = 0; i < quad.
size(); ++i)
1206 for (
unsigned int d = 0;
d < dim; ++
d)
1211 this->weights.push_back(quad.
weight(i));
1224 for (
unsigned int d = 0;
d < dim; ++
d)
1234 std::vector<Point<dim>> qp(this->size());
1235 std::vector<double>
w(this->size());
1237 for (
unsigned int i = 0; i < this->size(); ++i)
1240 w[i] = J * this->weight(i);
1255 for (
unsigned int i = 0; i < base.
size(); ++i)
1257 const auto q = base.
point(i);
1258 const auto w = base.
weight(i);
1260 const auto xhat = q[0];
1261 const auto yhat = q[1];
1265 const double st = std::sin(t);
1266 const double ct = std::cos(t);
1267 const double r = xhat / (st + ct);
1269 const double J = pi * xhat / (2 * (std::sin(pi * yhat) + 1));
1292 for (
unsigned int i = 0; i < base.
size(); ++i)
1294 const auto q = base.
point(i);
1295 const auto w = base.
weight(i);
1297 const auto xhat = q[0];
1298 const auto yhat = q[1];
1300 const double x = std::pow(xhat, beta) * (1 - yhat);
1301 const double y = std::pow(xhat, beta) * yhat;
1303 const double J = beta * std::pow(xhat, 2. * beta - 1.);
1323 "The split point should be inside the unit reference cell."));
1325 std::array<Point<dim>, dim + 1>
vertices;
1333 for (
unsigned int start = 0; start < (dim > 2 ? 2 : 1); ++start)
1335 for (
unsigned int i = 0; i < dim; ++i)
1342 quad.get_points().begin(),
1343 quad.get_points().end());
1344 this->weights.insert(this->weights.end(),
1345 quad.get_weights().begin(),
1346 quad.get_weights().end());