34 , is_tensor_product_flag(false)
51 const std::vector<double> &
w)
62 const std::vector<double> &
weights)
67 Assert(weights.size() == points.size(),
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.))
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;
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)
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)
270 std_cxx14::make_unique<std::array<Quadrature<1>, dim>>(*q.
tensor_basis);
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
321 ExcMessage(
"This function only makes sense if " 322 "this object represents a tensor product!"));
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);
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());
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());
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));
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));
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);
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));
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));
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);
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)
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());
1510 project_to_face(quadrature, face_no, points);
1518 const unsigned int face_no,
1519 const unsigned int subface_no,
1522 std::vector<Point<dim>> points(quadrature.
size());
1523 project_to_subface(quadrature, face_no, subface_no, points, ref_case);
1532 namespace QIteratedImplementation
1539 const bool at_left =
1540 std::any_of(base_quadrature.
get_points().cbegin(),
1543 const bool at_right =
1544 std::any_of(base_quadrature.
get_points().cbegin(),
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)
static const unsigned int invalid_unsigned_int
static Quadrature< dim > project_to_child(const Quadrature< dim > &quadrature, const unsigned int child_no)
#define AssertDimension(dim1, dim2)
std::vector< double > weights
const std::vector< Point< dim > > & get_points() const
static void project_to_subface(const SubQuadrature &quadrature, const unsigned int face_no, const unsigned int subface_no, std::vector< Point< dim >> &q_points, const RefinementCase< dim - 1 > &ref_case=RefinementCase< dim - 1 >::isotropic_refinement)
const std::vector< double > & get_weights() const
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
Quadrature(const unsigned int n_quadrature_points=0)
static Quadrature< 2 > rotate(const Quadrature< 2 > &q, const unsigned int n_times)
#define AssertIndexRange(index, range)
void quadrature_points(const Triangulation< dim, spacedim > &triangulation, const Quadrature< dim > &quadrature, const std::vector< std::vector< BoundingBox< spacedim >>> &global_bounding_boxes, ParticleHandler< dim, spacedim > &particle_handler, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim, spacedim >::mapping)
const Point< dim > & point(const unsigned int i) const
const std::array< Quadrature< 1 >, dim > & get_tensor_basis() const
static ::ExceptionBase & ExcNotInitialized()
Quadrature & operator=(const Quadrature< dim > &)
static Quadrature< dim > project_to_all_subfaces(const SubQuadrature &quadrature)
static Quadrature< dim > project_to_line(const Quadrature< 1 > &quadrature, const Point< dim > &p1, const Point< dim > &p2)
QAnisotropic(const Quadrature< 1 > &qx)
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
T sum(const T &t, const MPI_Comm &mpi_communicator)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
#define DEAL_II_NAMESPACE_CLOSE
std::size_t memory_consumption() const
static ::ExceptionBase & ExcInvalidQuadratureFormula()
Expression fabs(const Expression &x)
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
bool is_tensor_product_flag
std::vector< Point< dim > > quadrature_points
unsigned int size() const
static Quadrature< 2 > reflect(const Quadrature< 2 > &q)
static unsigned int n_children(const RefinementCase< dim > &refinement_case)
Tensor< 2, dim, Number > w(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static Quadrature< dim > project_to_all_faces(const SubQuadrature &quadrature)
static void project_to_face(const SubQuadrature &quadrature, const unsigned int face_no, std::vector< Point< dim >> &q_points)
bool operator==(const Quadrature< dim > &p) const
static unsigned int child_cell_on_face(const RefinementCase< dim > &ref_case, const unsigned int face, const unsigned int subface, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false, const RefinementCase< dim - 1 > &face_refinement_case=RefinementCase< dim - 1 >::isotropic_refinement)
#define DEAL_II_NAMESPACE_OPEN
QIterated(const Quadrature< 1 > &base_quadrature, const unsigned int n_copies)
std::unique_ptr< std::array< Quadrature< 1 >, dim > > tensor_basis
static DataSetDescriptor subface(const unsigned int face_no, const unsigned int subface_no, const bool face_orientation, const bool face_flip, const bool face_rotation, const unsigned int n_quadrature_points, const internal::SubfaceCase< dim > ref_case=internal::SubfaceCase< dim >::case_isotropic)
static ::ExceptionBase & ExcNotImplemented()
void initialize(const std::vector< Point< dim >> &points, const std::vector< double > &weights)
static ::ExceptionBase & ExcZero()
void copy(const T *begin, const T *end, U *dest)
bool is_tensor_product() const
static Quadrature< dim > project_to_all_children(const Quadrature< dim > &quadrature)
double weight(const unsigned int i) const
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
static ::ExceptionBase & ExcInternalError()
static DataSetDescriptor face(const unsigned int face_no, const bool face_orientation, const bool face_flip, const bool face_rotation, const unsigned int n_quadrature_points)