34 , is_tensor_product_flag(false)
43 , is_tensor_product_flag(dim == 1)
51 const std::vector<double> &
w)
62 const std::vector<double> & weights)
65 , is_tensor_product_flag(dim == 1)
76 , weights(points.size(), std::numeric_limits<
double>::infinity())
77 , is_tensor_product_flag(dim == 1)
88 , weights(std::vector<
double>(1, 1.))
89 , is_tensor_product_flag(true)
90 , tensor_basis(new std::array<
Quadrature<1>, dim>())
92 for (
unsigned int i = 0; i < dim; ++i)
94 const std::vector<Point<1>> quad_vec_1d(1,
Point<1>(
point[i]));
104 , weights(std::vector<
double>(1, 1.))
105 , is_tensor_product_flag(true)
122 , weights(q1.size() * q2.size())
123 , is_tensor_product_flag(q1.is_tensor_product())
125 unsigned int present_index = 0;
126 for (
unsigned int i2 = 0; i2 < q2.
size(); ++i2)
127 for (
unsigned int i1 = 0; i1 < q1.
size(); ++i1)
132 for (
unsigned int d = 0;
d < dim - 1; ++
d)
145 for (
unsigned int i = 0; i <
size(); ++i)
156 tensor_basis = std_cxx14::make_unique<std::array<Quadrature<1>, dim>>();
157 for (
unsigned int i = 0; i < dim - 1; ++i)
159 (*tensor_basis)[dim - 1] = q2;
169 , is_tensor_product_flag(true)
171 unsigned int present_index = 0;
172 for (
unsigned int i2 = 0; i2 < q2.
size(); ++i2)
188 for (
unsigned int i = 0; i <
size(); ++i)
206 , is_tensor_product_flag(false)
228 , is_tensor_product_flag(true)
232 const unsigned int n0 = q.
size();
233 const unsigned int n1 = (dim > 1) ? n0 : 1;
234 const unsigned int n2 = (dim > 2) ? n0 : 1;
237 for (
unsigned int i2 = 0; i2 < n2; ++i2)
238 for (
unsigned int i1 = 0; i1 < n1; ++i1)
239 for (
unsigned int i0 = 0; i0 < n0; ++i0)
254 tensor_basis = std_cxx14::make_unique<std::array<Quadrature<1>, dim>>();
255 for (
unsigned int i = 0; i < dim; ++i)
266 , is_tensor_product_flag(q.is_tensor_product_flag)
270 std_cxx14::make_unique<std::array<Quadrature<1>, dim>>(*q.
tensor_basis);
282 if (dim > 1 && is_tensor_product_flag)
284 if (tensor_basis ==
nullptr)
285 tensor_basis = std_cxx14::make_unique<std::array<Quadrature<1>, dim>>(
315 typename std::conditional<dim == 1,
316 std::array<Quadrature<1>, dim>,
317 const std::array<Quadrature<1>, dim> &>::type
320 Assert(this->is_tensor_product_flag ==
true,
321 ExcMessage(
"This function only makes sense if "
322 "this object represents a tensor product!"));
325 return *tensor_basis;
331 std::array<Quadrature<1>, 1>
335 ExcMessage(
"This function only makes sense if "
336 "this object represents a tensor product!"));
338 return std::array<Quadrature<1>, 1>{{*
this}};
351 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
377 for (
unsigned int k2 = 0; k2 < qy.
size(); ++k2)
378 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
386 const std::array<Quadrature<1>, 2> q_array{{qx, qy}};
388 std_cxx14::make_unique<std::array<Quadrature<1>, 2>>(q_array);
397 :
Quadrature<dim>(qx.size() * qy.size() * qz.size())
408 :
Quadrature<3>(qx.size() * qy.size() * qz.size())
411 for (
unsigned int k3 = 0; k3 < qz.
size(); ++k3)
412 for (
unsigned int k2 = 0; k2 < qy.
size(); ++k2)
413 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
422 const std::array<Quadrature<1>, 3> q_array{{qx, qy, qz}};
424 std_cxx14::make_unique<std::array<Quadrature<1>, 3>>(q_array);
437 std::vector<Point<2>> q_points(q.
size());
438 std::vector<double> weights(q.
size());
439 for (
unsigned int i = 0; i < q.
size(); ++i)
441 q_points[i][0] = q.
point(i)[1];
442 q_points[i][1] = q.
point(i)[0];
455 std::vector<Point<2>> q_points(q.
size());
456 std::vector<double> weights(q.
size());
457 for (
unsigned int i = 0; i < q.
size(); ++i)
463 q_points[i][0] = q.
point(i)[0];
464 q_points[i][1] = q.
point(i)[1];
468 q_points[i][0] = 1.0 - q.
point(i)[1];
469 q_points[i][1] = q.
point(i)[0];
473 q_points[i][0] = 1.0 - q.
point(i)[0];
474 q_points[i][1] = 1.0 - q.
point(i)[1];
478 q_points[i][0] = q.
point(i)[1];
479 q_points[i][1] = 1.0 - q.
point(i)[0];
493 const unsigned int face_no,
496 const unsigned int dim = 1;
500 q_points[0] =
Point<dim>(
static_cast<double>(face_no));
508 const unsigned int face_no,
511 const unsigned int dim = 2;
516 for (
unsigned int p = 0; p < quadrature.
size(); ++p)
541 const unsigned int face_no,
544 const unsigned int dim = 3;
549 for (
unsigned int p = 0; p < quadrature.
size(); ++p)
587 const unsigned int face_no,
592 const unsigned int dim = 1;
596 q_points[0] =
Point<dim>(
static_cast<double>(face_no));
604 const unsigned int face_no,
605 const unsigned int subface_no,
609 const unsigned int dim = 2;
616 for (
unsigned int p = 0; p < quadrature.
size(); ++p)
682 const unsigned int face_no,
683 const unsigned int subface_no,
687 const unsigned int dim = 3;
696 double const_value = face_no % 2;
705 const_index = face_no / 2;
711 double xi_scale = 1.0, eta_scale = 1.0, xi_translation = 0.0,
712 eta_translation = 0.0;
736 xi_translation = subface_no % 2 * 0.5;
740 eta_translation = subface_no % 2 * 0.5;
745 xi_translation =
int(subface_no % 2) * 0.5;
746 eta_translation =
int(subface_no / 2) * 0.5;
754 for (
unsigned int p = 0; p < quadrature.
size(); ++p)
756 q_points[p][xi_index] =
757 xi_scale * quadrature.
point(p)(0) + xi_translation;
758 q_points[p][eta_index] =
759 eta_scale * quadrature.
point(p)(1) + eta_translation;
760 q_points[p][const_index] = const_value;
769 const unsigned int dim = 1;
774 std::vector<Point<dim>> q_points;
775 q_points.reserve(n_points * n_faces);
776 std::vector<Point<dim>> help(n_points);
781 for (
unsigned int face = 0; face < n_faces; ++face)
783 project_to_face(quadrature, face, help);
784 std::copy(help.begin(), help.end(), std::back_inserter(q_points));
788 std::vector<double> weights;
789 weights.reserve(n_points * n_faces);
790 for (
unsigned int face = 0; face < n_faces; ++face)
793 std::back_inserter(weights));
807 const unsigned int dim = 2;
809 const unsigned int n_points = quadrature.
size(),
813 std::vector<Point<dim>> q_points;
814 q_points.reserve(n_points * n_faces);
815 std::vector<Point<dim>> help(n_points);
819 for (
unsigned int face = 0; face < n_faces; ++face)
821 project_to_face(quadrature, face, help);
822 std::copy(help.begin(), help.end(), std::back_inserter(q_points));
826 std::vector<double> weights;
827 weights.reserve(n_points * n_faces);
828 for (
unsigned int face = 0; face < n_faces; ++face)
831 std::back_inserter(weights));
845 const unsigned int dim = 3;
859 const unsigned int n_points = quadrature.
size(),
863 std::vector<Point<dim>> q_points;
864 q_points.reserve(n_points * n_faces * 8);
865 std::vector<Point<dim>> help(n_points);
867 std::vector<double> weights;
868 weights.reserve(n_points * n_faces * 8);
874 for (
const auto &mutation : q)
878 for (
unsigned int face = 0; face < n_faces; ++face)
880 project_to_face(mutation, face, help);
881 std::copy(help.begin(), help.end(), std::back_inserter(q_points));
885 for (
unsigned int face = 0; face < n_faces; ++face)
886 std::copy(mutation.get_weights().begin(),
887 mutation.get_weights().end(),
888 std::back_inserter(weights));
904 const unsigned int dim = 1;
911 std::vector<Point<dim>> q_points;
912 q_points.reserve(n_points * n_faces * subfaces_per_face);
913 std::vector<Point<dim>> help(n_points);
917 for (
unsigned int face = 0; face < n_faces; ++face)
918 for (
unsigned int subface = 0; subface < subfaces_per_face; ++subface)
920 project_to_subface(quadrature, face, subface, help);
921 std::copy(help.begin(), help.end(), std::back_inserter(q_points));
925 std::vector<double> weights;
926 weights.reserve(n_points * n_faces * subfaces_per_face);
927 for (
unsigned int face = 0; face < n_faces; ++face)
928 for (
unsigned int subface = 0; subface < subfaces_per_face; ++subface)
931 std::back_inserter(weights));
933 Assert(q_points.size() == n_points * n_faces * subfaces_per_face,
935 Assert(weights.size() == n_points * n_faces * subfaces_per_face,
947 const unsigned int dim = 2;
949 const unsigned int n_points = quadrature.
size(),
955 std::vector<Point<dim>> q_points;
956 q_points.reserve(n_points * n_faces * subfaces_per_face);
957 std::vector<Point<dim>> help(n_points);
961 for (
unsigned int face = 0; face < n_faces; ++face)
962 for (
unsigned int subface = 0; subface < subfaces_per_face; ++subface)
964 project_to_subface(quadrature, face, subface, help);
965 std::copy(help.begin(), help.end(), std::back_inserter(q_points));
969 std::vector<double> weights;
970 weights.reserve(n_points * n_faces * subfaces_per_face);
971 for (
unsigned int face = 0; face < n_faces; ++face)
972 for (
unsigned int subface = 0; subface < subfaces_per_face; ++subface)
975 std::back_inserter(weights));
977 Assert(q_points.size() == n_points * n_faces * subfaces_per_face,
979 Assert(weights.size() == n_points * n_faces * subfaces_per_face,
991 const unsigned int dim = 3;
1002 const unsigned int n_points = quadrature.
size(),
1004 total_subfaces_per_face = 2 + 2 + 4;
1007 std::vector<Point<dim>> q_points;
1008 q_points.reserve(n_points * n_faces * total_subfaces_per_face * 8);
1009 std::vector<Point<dim>> help(n_points);
1011 std::vector<double> weights;
1012 weights.reserve(n_points * n_faces * total_subfaces_per_face * 8);
1018 for (
const auto &mutation : q)
1022 for (
unsigned int face = 0; face < n_faces; ++face)
1026 for (
unsigned int subface = 0;
1031 project_to_subface(mutation,
1036 std::copy(help.begin(), help.end(), std::back_inserter(q_points));
1040 for (
unsigned int face = 0; face < n_faces; ++face)
1044 for (
unsigned int subface = 0;
1048 std::copy(mutation.get_weights().begin(),
1049 mutation.get_weights().end(),
1050 std::back_inserter(weights));
1053 Assert(q_points.size() == n_points * n_faces * total_subfaces_per_face * 8,
1055 Assert(weights.size() == n_points * n_faces * total_subfaces_per_face * 8,
1067 const unsigned int child_no)
1071 const unsigned int n_q_points = quadrature.
size();
1073 std::vector<Point<dim>> q_points(n_q_points);
1074 for (
unsigned int i = 0; i < n_q_points; ++i)
1082 std::vector<double> weights = quadrature.
get_weights();
1083 for (
unsigned int i = 0; i < n_q_points; ++i)
1094 const unsigned int n_points = quadrature.
size(),
1097 std::vector<Point<dim>> q_points(n_points * n_children);
1098 std::vector<double> weights(n_points * n_children);
1102 for (
unsigned int child = 0; child < n_children; ++child)
1105 for (
unsigned int i = 0; i < n_points; ++i)
1107 q_points[child * n_points + i] = help.
point(i);
1108 weights[child * n_points + i] = help.
weight(i);
1122 const unsigned int n = quadrature.
size();
1123 std::vector<Point<dim>> points(n);
1124 std::vector<double> weights(n);
1125 const double length = p1.
distance(p2);
1127 for (
unsigned int k = 0; k < n; ++k)
1129 const double alpha = quadrature.
point(k)(0);
1130 points[k] = alpha * p2;
1131 points[k] += (1. - alpha) * p1;
1132 weights[k] = length * quadrature.
weight(k);
1142 const bool face_orientation,
1143 const bool face_flip,
1144 const bool face_rotation,
1145 const unsigned int n_quadrature_points)
1153 return face_no * n_quadrature_points;
1178 static const unsigned int offset[2][2][2] = {
1197 (face_no + offset[face_orientation][face_flip][face_rotation]) *
1198 n_quadrature_points);
1212 const unsigned int face_no,
1213 const unsigned int subface_no,
1217 const unsigned int n_quadrature_points,
1225 n_quadrature_points);
1233 const unsigned int face_no,
1234 const unsigned int subface_no,
1238 const unsigned int n_quadrature_points,
1246 n_quadrature_points);
1253 const unsigned int face_no,
1254 const unsigned int subface_no,
1255 const bool face_orientation,
1256 const bool face_flip,
1257 const bool face_rotation,
1258 const unsigned int n_quadrature_points,
1261 const unsigned int dim = 3;
1291 const unsigned int total_subfaces_per_face = 8;
1308 static const unsigned int orientation_offset[2][2][2] = {
1337 static const unsigned int ref_case_offset[3] = {
1413 static const unsigned int
1449 equivalent_refine_case[ref_case][subface_no];
1450 const unsigned int equ_subface_no =
1451 equivalent_subface_number[ref_case][subface_no];
1458 (face_orientation == face_rotation ? ref_case_permutation[equ_ref_case] :
1487 const unsigned int final_subface_no =
1496 return (((face_no * total_subfaces_per_face +
1497 ref_case_offset[final_ref_case - 1] + final_subface_no) +
1498 orientation_offset[face_orientation][face_flip][face_rotation]) *
1499 n_quadrature_points);
1507 const unsigned int face_no)
1509 std::vector<Point<dim>> points(quadrature.
size());
1518 const unsigned int face_no,
1519 const unsigned int subface_no,
1522 std::vector<Point<dim>> points(quadrature.
size());
1532 namespace QIteratedImplementation
1539 const bool at_left =
1540 std::any_of(base_quadrature.
get_points().cbegin(),
1542 [](
const Point<1> &p) { return p == Point<1>{0.}; });
1543 const bool at_right =
1544 std::any_of(base_quadrature.
get_points().cbegin(),
1546 [](
const Point<1> &p) { return p == Point<1>{1.}; });
1547 return (at_left && at_right);
1668 const unsigned int n_copies)
1670 internal::QIteratedImplementation::uses_both_endpoints(base_quadrature) ?
1671 (base_quadrature.size() - 1) * n_copies + 1 :
1672 base_quadrature.size() * n_copies)
1678 if (!internal::QIteratedImplementation::uses_both_endpoints(base_quadrature))
1683 unsigned int next_point = 0;
1685 for (
unsigned int q_point = 0; q_point < base_quadrature.
size();
1690 (1.0 *
copy) / n_copies);
1692 base_quadrature.
weight(q_point) / n_copies;
1700 unsigned int next_point = 0;
1707 double double_point_weight = 0;
1708 unsigned int n_end_points = 0;
1709 for (
unsigned int i = 0; i < base_quadrature.
size(); ++i)
1715 double_point_weight += base_quadrature.
weight(i);
1719 double_point_weight /= n_copies;
1728 for (
unsigned int q_point = 0; q_point < base_quadrature.
size();
1740 (1.0 *
copy) / n_copies);
1747 if ((
copy != n_copies - 1) &&
1749 this->
weights[next_point] = double_point_weight;
1752 base_quadrature.
weight(q_point) / n_copies;
1759 double sum_of_weights = 0;
1760 for (
unsigned int i = 0; i < this->
size(); ++i)
1761 sum_of_weights += this->
weight(i);
1779 const unsigned int N)