From: Martin Kronbichler Date: Sun, 9 Apr 2023 18:31:16 +0000 (+0200) Subject: Initialize Quadrature with move argument X-Git-Tag: v9.5.0-rc1~351^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15057%2Fhead;p=dealii.git Initialize Quadrature with move argument --- diff --git a/include/deal.II/base/quadrature.h b/include/deal.II/base/quadrature.h index 7388d36863..a08473b025 100644 --- a/include/deal.II/base/quadrature.h +++ b/include/deal.II/base/quadrature.h @@ -189,6 +189,13 @@ public: Quadrature(const std::vector> &points, const std::vector & weights); + /** + * Construct a quadrature formula from given vectors of quadrature points + * (which should really be in the unit cell) and the corresponding weights, + * moving the points and weights into the present object. + */ + Quadrature(std::vector> &&points, std::vector &&weights); + /** * Construct a dummy quadrature formula from a list of points, with weights * set to infinity. The resulting object is therefore not meant to actually diff --git a/source/base/quadrature.cc b/source/base/quadrature.cc index e02be902fa..e2b838234b 100644 --- a/source/base/quadrature.cc +++ b/source/base/quadrature.cc @@ -73,6 +73,19 @@ Quadrature::Quadrature(const std::vector> &points, +template +Quadrature::Quadrature(std::vector> &&points, + std::vector && weights) + : quadrature_points(std::move(points)) + , weights(std::move(weights)) + , is_tensor_product_flag(dim == 1) +{ + Assert(weights.size() == points.size(), + ExcDimensionMismatch(weights.size(), points.size())); +} + + + template Quadrature::Quadrature(const std::vector> &points) : quadrature_points(points)