From 90e1bf096c6ac29a4b396a5461f474665faab2e3 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Sun, 9 Apr 2023 20:31:16 +0200 Subject: [PATCH] Initialize Quadrature with move argument --- include/deal.II/base/quadrature.h | 7 +++++++ source/base/quadrature.cc | 13 +++++++++++++ 2 files changed, 20 insertions(+) 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) -- 2.39.5