412 Assert(dim == 2, ExcImpossibleInDim(dim));
415 constexpr int dim_1 = dim == 2 ? 1 : 0;
418 for (
unsigned int k2 = 0; k2 < qy.
size(); ++k2)
419 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
421 this->quadrature_points[k][0] = qx.
point(k1)[0];
422 this->quadrature_points[k][dim_1] = qy.
point(k2)[0];
425 Assert(k == this->size(), ExcInternalError());
427 this->is_tensor_product_flag =
true;
428 this->tensor_basis = std::make_unique<std::array<Quadrature<1>, dim>>();
429 (*this->tensor_basis)[0] = qx;
430 (*this->tensor_basis)[dim_1] = qy;
439 :
Quadrature<dim>(qx.size() * qy.size() * qz.size())
441 Assert(dim == 3, ExcImpossibleInDim(dim));
444 constexpr int dim_1 = dim == 3 ? 1 : 0;
445 constexpr int dim_2 = dim == 3 ? 2 : 0;
448 for (
unsigned int k3 = 0; k3 < qz.
size(); ++k3)
449 for (
unsigned int k2 = 0; k2 < qy.
size(); ++k2)
450 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
452 this->quadrature_points[k][0] = qx.
point(k1)[0];
453 this->quadrature_points[k][dim_1] = qy.
point(k2)[0];
454 this->quadrature_points[k][dim_2] = qz.
point(k3)[0];
457 Assert(k == this->size(), ExcInternalError());
459 this->is_tensor_product_flag =
true;
460 this->tensor_basis = std::make_unique<std::array<Quadrature<1>, dim>>();
461 (*this->tensor_basis)[0] = qx;
462 (*this->tensor_basis)[dim_1] = qy;
463 (*this->tensor_basis)[dim_2] = qz;
480 std::any_of(base_quadrature.
get_points().cbegin(),
482 [](
const Point<1> &p) { return p == Point<1>{0.}; });
483 const bool at_right =
484 std::any_of(base_quadrature.
get_points().cbegin(),
486 [](
const Point<1> &p) { return p == Point<1>{1.}; });
487 return (at_left && at_right);
490 std::vector<Point<1>>
491 create_equidistant_interval_points(
const unsigned int n_copies)
493 std::vector<Point<1>> support_points(n_copies + 1);
495 for (
unsigned int copy = 0; copy < n_copies; ++copy)
496 support_points[copy][0] =
497 static_cast<double>(copy) /
static_cast<double>(n_copies);
499 support_points[n_copies][0] = 1.0;
501 return support_points;
529 const std::vector<
Point<1>> &intervals)
531 internal::QIteratedImplementation::uses_both_endpoints(base_quadrature) ?
532 (base_quadrature.size() - 1) * (intervals.size() - 1) + 1 :
533 base_quadrature.size() * (intervals.size() - 1))
535 Assert(base_quadrature.
size() > 0, ExcNotInitialized());
536 Assert(intervals.size() > 1, ExcZero());
538 const unsigned int n_copies = intervals.size() - 1;
540 if (!internal::QIteratedImplementation::uses_both_endpoints(base_quadrature))
544 unsigned int next_point = 0;
545 for (
unsigned int copy = 0; copy < n_copies; ++copy)
546 for (
unsigned int q_point = 0; q_point < base_quadrature.
size();
549 this->quadrature_points[next_point] =
551 (intervals[copy + 1][0] - intervals[copy][0]) +
553 this->weights[next_point] =
554 base_quadrature.
weight(q_point) *
555 (intervals[copy + 1][0] - intervals[copy][0]);
563 const unsigned int left_index =
564 std::distance(base_quadrature.
get_points().begin(),
565 std::find_if(base_quadrature.
get_points().cbegin(),
568 return p == Point<1>{0.};
571 const unsigned int right_index =
572 std::distance(base_quadrature.
get_points().begin(),
573 std::find_if(base_quadrature.
get_points().cbegin(),
576 return p == Point<1>{1.};
579 const unsigned double_point_offset =
580 left_index + (base_quadrature.size() - right_index);
582 for (
unsigned int copy = 0, next_point = 0; copy < n_copies; ++copy)
583 for (
unsigned int q_point = 0; q_point < base_quadrature.size();
588 if ((copy > 0) && (base_quadrature.point(q_point) ==
Point<1>(0.0)))
590 Assert(this->quadrature_points[next_point - double_point_offset]
592 base_quadrature.point(q_point)[0] *
593 (intervals[copy + 1][0] - intervals[copy][0]) +
594 intervals[copy][0])) < 1e-10 ,
597 this->weights[next_point - double_point_offset] +=
598 base_quadrature.weight(q_point) *
599 (intervals[copy + 1][0] - intervals[copy][0]);
605 Point<1>(base_quadrature.point(q_point)[0] *
606 (intervals[copy + 1][0] - intervals[copy][0]) +
611 this->weights[next_point] =
612 base_quadrature.weight(q_point) *
613 (intervals[
copy + 1][0] - intervals[
copy][0]);
622 for (
auto &i : this->quadrature_points)
625 else if (
std::abs(i[0] - 1.0) < 1e-12)
630 double sum_of_weights = 0;
631 for (
unsigned int i = 0; i < this->size(); ++i)
632 sum_of_weights += this->weight(i);
633 Assert(std::fabs(sum_of_weights - 1) < 1e-13, ExcInternalError());