From dde5a95e892172936b9962accb6746dfb2eb4a28 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Fri, 6 Apr 2018 15:01:51 +0200 Subject: [PATCH] Add clone method for Manifold and FlatManifold --- include/deal.II/grid/manifold.h | 12 ++++++++++++ source/grid/manifold.cc | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/include/deal.II/grid/manifold.h b/include/deal.II/grid/manifold.h index 34fcc77462..fe0f8aa237 100644 --- a/include/deal.II/grid/manifold.h +++ b/include/deal.II/grid/manifold.h @@ -350,6 +350,13 @@ public: */ virtual ~Manifold () = default; + /** + * Return a copy of this manifold. + * + * Every derived class should implement this operation in a sensible manner. + */ + virtual std::unique_ptr > clone() const = 0; + /** * @name Computing the location of points. */ @@ -692,6 +699,11 @@ public: FlatManifold (const Tensor<1,spacedim> &periodicity = Tensor<1,spacedim>(), const double tolerance=1e-10); + /** + * Return a copy of this manifold. + */ + virtual std::unique_ptr > clone() const override; + /** * Let the new point be the average sum of surrounding vertices. * diff --git a/source/grid/manifold.cc b/source/grid/manifold.cc index 9a74d866a3..94b0f266e2 100644 --- a/source/grid/manifold.cc +++ b/source/grid/manifold.cc @@ -512,6 +512,15 @@ FlatManifold::FlatManifold (const Tensor<1,spacedim> &periodicity, +template +std::unique_ptr > +FlatManifold::clone() const +{ + return std::unique_ptr >(new FlatManifold(periodicity, tolerance)); +} + + + template Point FlatManifold:: -- 2.39.5