428 constexpr int dim_1 = dim == 2 ? 1 : 0;
431 for (
unsigned int k2 = 0; k2 < qy.
size(); ++k2)
432 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
434 this->quadrature_points[k][0] = qx.
point(k1)[0];
435 this->quadrature_points[k][dim_1] = qy.
point(k2)[0];
440 this->is_tensor_product_flag =
true;
441 this->tensor_basis = std::make_unique<std::array<Quadrature<1>, dim>>();
442 (*this->tensor_basis)[0] = qx;
443 (*this->tensor_basis)[dim_1] = qy;
452 :
Quadrature<dim>(qx.size() * qy.size() * qz.size())
457 constexpr int dim_1 = dim == 3 ? 1 : 0;
458 constexpr int dim_2 = dim == 3 ? 2 : 0;
461 for (
unsigned int k3 = 0; k3 < qz.
size(); ++k3)
462 for (
unsigned int k2 = 0; k2 < qy.
size(); ++k2)
463 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
465 this->quadrature_points[k][0] = qx.
point(k1)[0];
466 this->quadrature_points[k][dim_1] = qy.
point(k2)[0];
467 this->quadrature_points[k][dim_2] = qz.
point(k3)[0];
472 this->is_tensor_product_flag =
true;
473 this->tensor_basis = std::make_unique<std::array<Quadrature<1>, dim>>();
474 (*this->tensor_basis)[0] = qx;
475 (*this->tensor_basis)[dim_1] = qy;
476 (*this->tensor_basis)[dim_2] = qz;
493 std::any_of(base_quadrature.
get_points().cbegin(),
495 [](
const Point<1> &p) { return p == Point<1>{0.}; });
496 const bool at_right =
497 std::any_of(base_quadrature.
get_points().cbegin(),
499 [](
const Point<1> &p) { return p == Point<1>{1.}; });
500 return (at_left && at_right);
503 std::vector<Point<1>>
504 create_equidistant_interval_points(
const unsigned int n_copies)
506 std::vector<Point<1>> support_points(n_copies + 1);
508 for (
unsigned int copy = 0; copy < n_copies; ++copy)
509 support_points[copy][0] =
510 static_cast<double>(copy) /
static_cast<double>(n_copies);
512 support_points[n_copies][0] = 1.0;
514 return support_points;
542 const std::vector<
Point<1>> &intervals)
544 internal::QIteratedImplementation::uses_both_endpoints(base_quadrature) ?
545 (base_quadrature.size() - 1) * (intervals.size() - 1) + 1 :
546 base_quadrature.size() * (intervals.size() - 1))
551 const unsigned int n_copies = intervals.size() - 1;
553 if (!internal::QIteratedImplementation::uses_both_endpoints(base_quadrature))
557 unsigned int next_point = 0;
558 for (
unsigned int copy = 0; copy < n_copies; ++copy)
559 for (
unsigned int q_point = 0; q_point < base_quadrature.
size();
562 this->quadrature_points[next_point] =
564 (intervals[copy + 1][0] - intervals[copy][0]) +
566 this->weights[next_point] =
567 base_quadrature.
weight(q_point) *
568 (intervals[copy + 1][0] - intervals[copy][0]);
576 const unsigned int left_index =
577 std::distance(base_quadrature.
get_points().begin(),
578 std::find_if(base_quadrature.
get_points().cbegin(),
581 return p == Point<1>{0.};
584 const unsigned int right_index =
585 std::distance(base_quadrature.
get_points().begin(),
586 std::find_if(base_quadrature.
get_points().cbegin(),
589 return p == Point<1>{1.};
592 const unsigned double_point_offset =
593 left_index + (base_quadrature.size() - right_index);
595 for (
unsigned int copy = 0, next_point = 0; copy < n_copies; ++copy)
596 for (
unsigned int q_point = 0; q_point < base_quadrature.size();
601 if ((copy > 0) && (base_quadrature.point(q_point) ==
Point<1>(0.0)))
603 Assert(this->quadrature_points[next_point - double_point_offset]
605 base_quadrature.point(q_point)[0] *
606 (intervals[copy + 1][0] - intervals[copy][0]) +
607 intervals[copy][0])) < 1e-10 ,
610 this->weights[next_point - double_point_offset] +=
611 base_quadrature.weight(q_point) *
612 (intervals[copy + 1][0] - intervals[copy][0]);
618 Point<1>(base_quadrature.point(q_point)[0] *
619 (intervals[copy + 1][0] - intervals[copy][0]) +
624 this->weights[next_point] =
625 base_quadrature.weight(q_point) *
626 (intervals[
copy + 1][0] - intervals[
copy][0]);
635 for (
auto &i : this->quadrature_points)
638 else if (
std::abs(i[0] - 1.0) < 1e-12)
643 double sum_of_weights = 0;
644 for (
unsigned int i = 0; i < this->size(); ++i)
645 sum_of_weights += this->weight(i);