From: Martin Kronbichler Date: Fri, 5 Apr 2024 08:30:17 +0000 (+0200) Subject: Add Quadrature::initialize() function taking ArrayView X-Git-Tag: v9.6.0-rc1~402^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=398b4f56ebf93b92f2a170c1eb6fade0591429f0;p=dealii.git Add Quadrature::initialize() function taking ArrayView --- diff --git a/include/deal.II/base/quadrature.h b/include/deal.II/base/quadrature.h index 075ff4218c..8827c895fa 100644 --- a/include/deal.II/base/quadrature.h +++ b/include/deal.II/base/quadrature.h @@ -18,6 +18,7 @@ #include +#include #include #include @@ -243,6 +244,18 @@ public: initialize(const std::vector> &points, const std::vector &weights); + /** + * Set the quadrature points and weights to the values provided in the + * arguments. The weights array is allowed to be empty, in which case the + * weights are set to infinity. The resulting object is therefore not meant + * to actually perform integrations, but rather to be used with FEValues + * objects in order to find the position of some points (the quadrature + * points in this object) on the transformed cell in real space. + */ + void + initialize(const ArrayView> &points, + const ArrayView &weights = {}); + /** * Number of quadrature points. */ diff --git a/source/base/quadrature.cc b/source/base/quadrature.cc index c1f535198e..376d12c93a 100644 --- a/source/base/quadrature.cc +++ b/source/base/quadrature.cc @@ -59,6 +59,31 @@ Quadrature::initialize(const std::vector> &p, +template +void +Quadrature::initialize(const ArrayView> &points, + const ArrayView &weights) +{ + this->weights.clear(); + if (!weights.empty()) + { + AssertDimension(weights.size(), points.size()); + this->weights.insert(this->weights.end(), weights.begin(), weights.end()); + } + else + this->weights.resize(points.size(), + std::numeric_limits::infinity()); + + quadrature_points.clear(); + quadrature_points.insert(quadrature_points.end(), + points.begin(), + points.end()); + + is_tensor_product_flag = dim == 1; +} + + + template Quadrature::Quadrature(const std::vector> &points, const std::vector &weights)