]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add clone method for Manifold and FlatManifold
authorLuca Heltai <luca.heltai@sissa.it>
Fri, 6 Apr 2018 13:01:51 +0000 (15:01 +0200)
committerLuca Heltai <luca.heltai@sissa.it>
Mon, 9 Apr 2018 12:32:11 +0000 (14:32 +0200)
include/deal.II/grid/manifold.h
source/grid/manifold.cc

index 34fcc77462c0d02670906f33b5d885023766c2c7..fe0f8aa23792e767cadcd800d16fb4d26f40c3ee 100644 (file)
@@ -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<Manifold<dim,spacedim> > 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<Manifold<dim,spacedim> > clone() const override;
+
   /**
    * Let the new point be the average sum of surrounding vertices.
    *
index 9a74d866a374c3e27f630ba60338daeae934ef31..94b0f266e2f9290ea24dd2a552895212f40c997e 100644 (file)
@@ -512,6 +512,15 @@ FlatManifold<dim,spacedim>::FlatManifold (const Tensor<1,spacedim> &periodicity,
 
 
 
+template<int dim, int spacedim>
+std::unique_ptr<Manifold<dim, spacedim> >
+FlatManifold<dim,spacedim>::clone() const
+{
+  return std::unique_ptr<Manifold<dim,spacedim> >(new FlatManifold<dim,spacedim>(periodicity, tolerance));
+}
+
+
+
 template <int dim, int spacedim>
 Point<spacedim>
 FlatManifold<dim, spacedim>::

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.