35 , is_tensor_product_flag(false)
43 : quadrature_points(n_q,
Point<dim>())
45 , is_tensor_product_flag(dim == 1)
53 const std::vector<double> & w)
56 quadrature_points = p;
58 is_tensor_product_flag = dim == 1;
65 const std::vector<double> & weights)
66 : quadrature_points(points)
68 , is_tensor_product_flag(dim == 1)
78 : quadrature_points(points)
79 , weights(points.size(),
std::numeric_limits<double>::infinity())
80 , is_tensor_product_flag(dim == 1)
90 : quadrature_points(
std::vector<
Point<dim>>(1, point))
91 , weights(
std::vector<double>(1, 1.))
92 , is_tensor_product_flag(true)
95 for (
unsigned int i = 0; i < dim; ++i)
97 const std::vector<Point<1>> quad_vec_1d(1,
Point<1>(
point[i]));
107 : quadrature_points(
std::vector<
Point<1>>(1, point))
108 , weights(
std::vector<double>(1, 1.))
109 , is_tensor_product_flag(true)
116 : is_tensor_product_flag(false)
134 : quadrature_points(q1.size() * q2.size())
135 , weights(q1.size() * q2.size())
136 , is_tensor_product_flag(q1.is_tensor_product())
138 unsigned int present_index = 0;
139 for (
unsigned int i2 = 0; i2 < q2.
size(); ++i2)
140 for (
unsigned int i1 = 0; i1 < q1.
size(); ++i1)
144 for (
unsigned int d = 0; d < dim - 1; ++d)
145 quadrature_points[present_index](d) = q1.
point(i1)(d);
146 quadrature_points[present_index](dim - 1) = q2.
point(i2)(0);
157 for (
unsigned int i = 0; i < size(); ++i)
165 if (is_tensor_product_flag)
167 tensor_basis = std::make_unique<std::array<Quadrature<1>, dim>>();
168 for (
unsigned int i = 0; i < dim - 1; ++i)
170 (*tensor_basis)[dim - 1] = q2;
180 , is_tensor_product_flag(true)
182 unsigned int present_index = 0;
183 for (
unsigned int i2 = 0; i2 < q2.
size(); ++i2)
187 quadrature_points[present_index](0) = q2.
point(i2)(0);
189 weights[present_index] = q2.
weight(i2);
198 for (
unsigned int i = 0; i < size(); ++i)
214 , is_tensor_product_flag(false)
233 , quadrature_points(
Utilities::fixed_power<dim>(q.size()))
234 , weights(
Utilities::fixed_power<dim>(q.size()))
235 , is_tensor_product_flag(true)
239 const unsigned int n0 = q.
size();
240 const unsigned int n1 = (dim > 1) ? n0 : 1;
241 const unsigned int n2 = (dim > 2) ? n0 : 1;
244 for (
unsigned int i2 = 0; i2 < n2; ++i2)
245 for (
unsigned int i1 = 0; i1 < n1; ++i1)
246 for (
unsigned int i0 = 0; i0 < n0; ++i0)
261 tensor_basis = std::make_unique<std::array<Quadrature<1>, dim>>();
262 for (
unsigned int i = 0; i < dim; ++i)
271 , quadrature_points(q.quadrature_points)
273 , is_tensor_product_flag(q.is_tensor_product_flag)
277 std::make_unique<std::array<Quadrature<1>, dim>>(*q.
tensor_basis);
289 if (dim > 1 && is_tensor_product_flag)
291 if (tensor_basis ==
nullptr)
293 std::make_unique<std::array<Quadrature<1>, dim>>(*q.
tensor_basis);
322typename std::conditional<dim == 1,
323 std::array<Quadrature<1>, dim>,
324 const std::array<Quadrature<1>, dim> &>::type
327 Assert(this->is_tensor_product_flag ==
true,
328 ExcMessage(
"This function only makes sense if "
329 "this object represents a tensor product!"));
332 return *tensor_basis;
338std::array<Quadrature<1>, 1>
341 Assert(this->is_tensor_product_flag ==
true,
342 ExcMessage(
"This function only makes sense if "
343 "this object represents a tensor product!"));
345 return std::array<Quadrature<1>, 1>{{*
this}};
358 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
384 for (
unsigned int k2 = 0; k2 < qy.
size(); ++k2)
385 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
393 const std::array<Quadrature<1>, 2> q_array{{qx, qy}};
394 this->
tensor_basis = std::make_unique<std::array<Quadrature<1>, 2>>(q_array);
403 :
Quadrature<dim>(qx.size() * qy.size() * qz.size())
414 :
Quadrature<3>(qx.size() * qy.size() * qz.size())
417 for (
unsigned int k3 = 0; k3 < qz.
size(); ++k3)
418 for (
unsigned int k2 = 0; k2 < qy.
size(); ++k2)
419 for (
unsigned int k1 = 0; k1 < qx.
size(); ++k1)
428 const std::array<Quadrature<1>, 3> q_array{{qx, qy, qz}};
429 this->
tensor_basis = std::make_unique<std::array<Quadrature<1>, 3>>(q_array);
438 namespace QIteratedImplementation
446 std::any_of(base_quadrature.
get_points().cbegin(),
448 [](
const Point<1> &p) { return p == Point<1>{0.}; });
449 const bool at_right =
450 std::any_of(base_quadrature.
get_points().cbegin(),
452 [](
const Point<1> &p) { return p == Point<1>{1.}; });
453 return (at_left && at_right);
456 std::vector<Point<1>>
457 create_equidistant_interval_points(
const unsigned int n_copies)
459 std::vector<Point<1>> support_points(n_copies + 1);
461 for (
unsigned int copy = 0; copy < n_copies; ++copy)
462 support_points[copy][0] =
463 static_cast<double>(copy) /
static_cast<double>(n_copies);
465 support_points[n_copies][0] = 1.0;
467 return support_points;
495 const std::vector<
Point<1>> &intervals)
497 internal::QIteratedImplementation::uses_both_endpoints(base_quadrature) ?
498 (base_quadrature.size() - 1) * (intervals.size() - 1) + 1 :
499 base_quadrature.size() * (intervals.size() - 1))
504 const unsigned int n_copies = intervals.size() - 1;
506 if (!internal::QIteratedImplementation::uses_both_endpoints(base_quadrature))
510 unsigned int next_point = 0;
511 for (
unsigned int copy = 0; copy < n_copies; ++copy)
512 for (
unsigned int q_point = 0; q_point < base_quadrature.
size();
517 (intervals[copy + 1][0] - intervals[copy][0]) +
520 base_quadrature.
weight(q_point) *
521 (intervals[copy + 1][0] - intervals[copy][0]);
529 const unsigned int left_index =
530 std::distance(base_quadrature.
get_points().begin(),
531 std::find_if(base_quadrature.
get_points().cbegin(),
534 return p == Point<1>{0.};
537 const unsigned int right_index =
538 std::distance(base_quadrature.
get_points().begin(),
539 std::find_if(base_quadrature.
get_points().cbegin(),
542 return p == Point<1>{1.};
545 const unsigned double_point_offset =
546 left_index + (base_quadrature.size() - right_index);
548 for (
unsigned int copy = 0, next_point = 0; copy < n_copies; ++copy)
549 for (
unsigned int q_point = 0; q_point < base_quadrature.size();
554 if ((copy > 0) && (base_quadrature.point(q_point) ==
Point<1>(0.0)))
556 Assert(this->quadrature_points[next_point - double_point_offset]
558 base_quadrature.point(q_point)(0) *
559 (intervals[copy + 1][0] - intervals[copy][0]) +
560 intervals[copy][0])) < 1e-10 ,
563 this->weights[next_point - double_point_offset] +=
564 base_quadrature.weight(q_point) *
565 (intervals[copy + 1][0] - intervals[copy][0]);
571 Point<1>(base_quadrature.point(q_point)(0) *
572 (intervals[copy + 1][0] - intervals[copy][0]) +
577 this->weights[next_point] =
578 base_quadrature.weight(q_point) *
579 (intervals[
copy + 1][0] - intervals[
copy][0]);
588 for (
auto &i : this->quadrature_points)
595 double sum_of_weights = 0;
596 for (
unsigned int i = 0; i < this->size(); ++i)
597 sum_of_weights += this->weight(i);
606 const unsigned int n_copies)
609 internal::QIteratedImplementation::create_equidistant_interval_points(
622 const std::vector<
Point<1>> &intervals)
624 QIterated<1>(base_quadrature, intervals))
631 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
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
Quadrature(const unsigned int n_quadrature_points=0)
const std::array< Quadrature< 1 >, dim > & get_tensor_basis() const
double weight(const unsigned int i) const
bool operator==(const Quadrature< dim > &p) const
void initialize(const std::vector< Point< dim > > &points, const std::vector< double > &weights)
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)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
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 > &)