]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Initialize Quadrature with move argument 15057/head
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Sun, 9 Apr 2023 18:31:16 +0000 (20:31 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Sun, 9 Apr 2023 18:31:16 +0000 (20:31 +0200)
include/deal.II/base/quadrature.h
source/base/quadrature.cc

index 7388d3686352cf8669b165e342572e1c7bc0e528..a08473b02560aa30d260595f710e110e038f8516 100644 (file)
@@ -189,6 +189,13 @@ public:
   Quadrature(const std::vector<Point<dim>> &points,
              const std::vector<double> &    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<Point<dim>> &&points, std::vector<double> &&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
index e02be902fab0dbd276682637529c081e878113b1..e2b838234b94a5526af27df46bf8e635b67b41e1 100644 (file)
@@ -73,6 +73,19 @@ Quadrature<dim>::Quadrature(const std::vector<Point<dim>> &points,
 
 
 
+template <int dim>
+Quadrature<dim>::Quadrature(std::vector<Point<dim>> &&points,
+                            std::vector<double> &&    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 <int dim>
 Quadrature<dim>::Quadrature(const std::vector<Point<dim>> &points)
   : quadrature_points(points)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.