32 : is_tensor_product_flag(false)
39 , is_tensor_product_flag(false)
47 : is_tensor_product_flag(dim == 1)
54 : quadrature_points(n_q,
Point<dim>())
56 , is_tensor_product_flag(dim == 1)
66 this->weights.clear();
67 if (weights.
size() > 0)
70 this->weights.insert(this->weights.
end(), weights.
begin(), weights.
end());
73 this->weights.resize(points.size(),
74 std::numeric_limits<double>::infinity());
76 quadrature_points.clear();
77 quadrature_points.insert(quadrature_points.end(),
81 is_tensor_product_flag = dim == 1;
88 const std::vector<double> &weights)
89 : quadrature_points(points)
91 , is_tensor_product_flag(dim == 1)
101 std::vector<double> &&weights)
102 : quadrature_points(
std::move(points))
103 , weights(
std::move(weights))
104 , is_tensor_product_flag(dim == 1)
114 : quadrature_points(points)
115 , weights(points.size(),
std::numeric_limits<double>::infinity())
116 , is_tensor_product_flag(dim == 1)
126 : quadrature_points(
std::vector<
Point<dim>>(1, point))
127 , weights(
std::vector<double>(1, 1.))
128 , is_tensor_product_flag(true)
131 for (
unsigned int i = 0; i < dim; ++i)
133 const std::vector<Point<1>> quad_vec_1d(1,
Point<1>(
point[i]));
144 , weights(
std::vector<double>(1, 1.))
145 , is_tensor_product_flag(true)
152 : is_tensor_product_flag(false)
170 : quadrature_points(q1.size() * q2.size())
171 , weights(q1.size() * q2.size())
172 , is_tensor_product_flag(q1.is_tensor_product())
174 unsigned int present_index = 0;
175 for (
unsigned int i2 = 0; i2 < q2.
size(); ++i2)
176 for (
unsigned int i1 = 0; i1 < q1.
size(); ++i1)
180 for (
unsigned int d = 0; d < dim - 1; ++d)
181 quadrature_points[present_index][d] = q1.
point(i1)[d];
182 quadrature_points[present_index][dim - 1] = q2.
point(i2)[0];
193 for (
unsigned int i = 0; i < size(); ++i)
201 if (is_tensor_product_flag)
203 tensor_basis = std::make_unique<std::array<Quadrature<1>, dim>>();
204 for (
unsigned int i = 0; i < dim - 1; ++i)
206 (*tensor_basis)[dim - 1] = q2;
216 , is_tensor_product_flag(true)
218 unsigned int present_index = 0;
219 for (
unsigned int i2 = 0; i2 < q2.
size(); ++i2)
234 for (
unsigned int i = 0; i <
size(); ++i)
248 , quadrature_points(1)
250 , is_tensor_product_flag(false)
269 , quadrature_points(
Utilities::fixed_power<dim>(q.size()))
270 , weights(
Utilities::fixed_power<dim>(q.size()))
271 , is_tensor_product_flag(true)
275 const unsigned int n0 = q.
size();
276 const unsigned int n1 = (dim > 1) ? n0 : 1;
277 const unsigned int n2 = (dim > 2) ? n0 : 1;
280 for (
unsigned int i2 = 0; i2 < n2; ++i2)
281 for (
unsigned int i1 = 0; i1 < n1; ++i1)
282 for (
unsigned int i0 = 0; i0 < n0; ++i0)
297 tensor_basis = std::make_unique<std::array<Quadrature<1>, dim>>();
298 for (
unsigned int i = 0; i < dim; ++i)
307 , quadrature_points(q.quadrature_points)
309 , is_tensor_product_flag(q.is_tensor_product_flag)
313 std::make_unique<std::array<Quadrature<1>, dim>>(*q.
tensor_basis);
325 if (dim > 1 && is_tensor_product_flag)
327 if (tensor_basis ==
nullptr)
329 std::make_unique<std::array<Quadrature<1>, dim>>(*q.
tensor_basis);
358typename std::conditional_t<dim == 1,
359 std::array<Quadrature<1>, dim>,
360 const std::array<Quadrature<1>, dim> &>
363 Assert(this->is_tensor_product_flag ==
true,
364 ExcMessage(
"This function only makes sense if "
365 "this object represents a tensor product!"));
368 return *tensor_basis;
374std::array<Quadrature<1>, 1>
377 Assert(this->is_tensor_product_flag ==
true,
378 ExcMessage(
"This function only makes sense if "
379 "this object represents a tensor product!"));
381 return std::array<Quadrature<1>, 1>{{*
this}};
394 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
396 this->quadrature_points[k][0] = qx.
point(k1)[0];
397 this->weights[k++] = qx.
weight(k1);
400 this->is_tensor_product_flag =
true;
413 constexpr int dim_1 = dim == 2 ? 1 : 0;
416 for (
unsigned int k2 = 0; k2 < qy.
size(); ++k2)
417 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
419 this->quadrature_points[k][0] = qx.
point(k1)[0];
420 this->quadrature_points[k][dim_1] = qy.
point(k2)[0];
425 this->is_tensor_product_flag =
true;
426 this->tensor_basis = std::make_unique<std::array<Quadrature<1>, dim>>();
427 (*this->tensor_basis)[0] = qx;
428 (*this->tensor_basis)[dim_1] = qy;
437 :
Quadrature<dim>(qx.size() * qy.size() * qz.size())
442 constexpr int dim_1 = dim == 3 ? 1 : 0;
443 constexpr int dim_2 = dim == 3 ? 2 : 0;
446 for (
unsigned int k3 = 0; k3 < qz.
size(); ++k3)
447 for (
unsigned int k2 = 0; k2 < qy.
size(); ++k2)
448 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
450 this->quadrature_points[k][0] = qx.
point(k1)[0];
451 this->quadrature_points[k][dim_1] = qy.
point(k2)[0];
452 this->quadrature_points[k][dim_2] = qz.
point(k3)[0];
457 this->is_tensor_product_flag =
true;
458 this->tensor_basis = std::make_unique<std::array<Quadrature<1>, dim>>();
459 (*this->tensor_basis)[0] = qx;
460 (*this->tensor_basis)[dim_1] = qy;
461 (*this->tensor_basis)[dim_2] = qz;
470 namespace QIteratedImplementation
478 std::any_of(base_quadrature.
get_points().cbegin(),
480 [](
const Point<1> &p) { return p == Point<1>{0.}; });
481 const bool at_right =
482 std::any_of(base_quadrature.
get_points().cbegin(),
484 [](
const Point<1> &p) { return p == Point<1>{1.}; });
485 return (at_left && at_right);
488 std::vector<Point<1>>
489 create_equidistant_interval_points(
const unsigned int n_copies)
491 std::vector<Point<1>> support_points(n_copies + 1);
493 for (
unsigned int copy = 0; copy < n_copies; ++copy)
494 support_points[copy][0] =
495 static_cast<double>(copy) /
static_cast<double>(n_copies);
497 support_points[n_copies][0] = 1.0;
499 return support_points;
527 const std::vector<
Point<1>> &intervals)
529 internal::QIteratedImplementation::uses_both_endpoints(base_quadrature) ?
530 (base_quadrature.size() - 1) * (intervals.size() - 1) + 1 :
531 base_quadrature.size() * (intervals.size() - 1))
536 const unsigned int n_copies = intervals.size() - 1;
538 if (!internal::QIteratedImplementation::uses_both_endpoints(base_quadrature))
542 unsigned int next_point = 0;
543 for (
unsigned int copy = 0; copy < n_copies; ++copy)
544 for (
unsigned int q_point = 0; q_point < base_quadrature.
size();
547 this->quadrature_points[next_point] =
549 (intervals[copy + 1][0] - intervals[copy][0]) +
551 this->weights[next_point] =
552 base_quadrature.
weight(q_point) *
553 (intervals[copy + 1][0] - intervals[copy][0]);
561 const unsigned int left_index =
562 std::distance(base_quadrature.
get_points().begin(),
563 std::find_if(base_quadrature.
get_points().cbegin(),
566 return p == Point<1>{0.};
569 const unsigned int right_index =
570 std::distance(base_quadrature.
get_points().begin(),
571 std::find_if(base_quadrature.
get_points().cbegin(),
574 return p == Point<1>{1.};
577 const unsigned double_point_offset =
578 left_index + (base_quadrature.size() - right_index);
580 for (
unsigned int copy = 0, next_point = 0; copy < n_copies; ++copy)
581 for (
unsigned int q_point = 0; q_point < base_quadrature.size();
586 if ((copy > 0) && (base_quadrature.point(q_point) ==
Point<1>(0.0)))
588 Assert(this->quadrature_points[next_point - double_point_offset]
590 base_quadrature.point(q_point)[0] *
591 (intervals[copy + 1][0] - intervals[copy][0]) +
592 intervals[copy][0])) < 1e-10 ,
595 this->weights[next_point - double_point_offset] +=
596 base_quadrature.weight(q_point) *
597 (intervals[copy + 1][0] - intervals[copy][0]);
603 Point<1>(base_quadrature.point(q_point)[0] *
604 (intervals[copy + 1][0] - intervals[copy][0]) +
609 this->weights[next_point] =
610 base_quadrature.weight(q_point) *
611 (intervals[
copy + 1][0] - intervals[
copy][0]);
621 if (
std::
abs(i[0] - 0.0) < 1
e-12)
623 else if (
std::abs(i[0] - 1.0) < 1e-12)
627 double sum_of_weights = 0;
628 for (
unsigned int i = 0; i < this->size(); ++i)
629 sum_of_weights += this->weight(i);
638 const unsigned int n_copies)
641 internal::QIteratedImplementation::create_equidistant_interval_points(
654 const std::vector<
Point<1>> &intervals)
656 QIterated<1>(base_quadrature, intervals))
663 const unsigned int n_copies)
QAnisotropic(const Quadrature< 1 > &qx)
QIterated(const Quadrature< 1 > &base_quadrature, const unsigned int n_copies)
std::vector< Point< dim > > quadrature_points
void initialize(const ArrayView< const Point< dim > > &points, const ArrayView< const double > &weights={})
std::unique_ptr< std::array< Quadrature< 1 >, dim > > tensor_basis
Quadrature & operator=(const Quadrature< dim > &)
std::size_t memory_consumption() const
const Point< dim > & point(const unsigned int i) const
bool is_tensor_product_flag
double weight(const unsigned int i) const
bool operator==(const Quadrature< dim > &p) const
const std::array< Quadrature< 1 >, dim > & get_tensor_basis() const
std::vector< double > weights
const std::vector< Point< dim > > & get_points() const
unsigned int size() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcZero()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcNotInitialized()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define DEAL_II_NOT_IMPLEMENTED()
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
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=(ReferenceCells::get_hypercube< dim >() .template get_default_linear_mapping< dim, spacedim >()), const std::vector< std::vector< double > > &properties={})
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
void copy(const T *begin, const T *end, U *dest)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)