From: Luca Heltai Date: Fri, 6 Apr 2018 13:01:51 +0000 (+0200) Subject: Add clone method for Manifold and FlatManifold X-Git-Tag: v9.0.0-rc1~196^2~10 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dde5a95e892172936b9962accb6746dfb2eb4a28;p=dealii.git Add clone method for Manifold and FlatManifold --- 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::