From a63e642a23d00cd607c1f527f574dda90bc1f125 Mon Sep 17 00:00:00 2001
From: Felix Schindler <felix.schindler@wwu.de>
Date: Wed, 18 Mar 2020 14:48:03 +0100
Subject: [PATCH] [spaces.h1] allow to copy() flattop space

---
 dune/gdt/spaces/h1/continuous-flattop.hh | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/dune/gdt/spaces/h1/continuous-flattop.hh b/dune/gdt/spaces/h1/continuous-flattop.hh
index cbaa58096..c864be3a2 100644
--- a/dune/gdt/spaces/h1/continuous-flattop.hh
+++ b/dune/gdt/spaces/h1/continuous-flattop.hh
@@ -56,19 +56,35 @@ public:
   ContinuousFlatTopSpace(GridViewType grd_vw, const int fe_order, const D& overlap = 0.5)
     : grid_view_(grd_vw)
     , fe_order_(fe_order)
-    , local_finite_elements_(std::make_unique<LocalFlatTopFiniteElementFamily<D, d, R, r>>(overlap))
+    , overlap_(overlap)
+    , local_finite_elements_(std::make_unique<LocalFlatTopFiniteElementFamily<D, d, R, r>>(overlap_))
+    , mapper_(nullptr)
+    , basis_(nullptr)
+  {
+    this->update_after_adapt();
+  }
+
+  ContinuousFlatTopSpace(const ThisType& other)
+    : grid_view_(other.grid_view_)
+    , fe_order_(other.fe_order_)
+    , overlap_(other.overlap_)
+    , local_finite_elements_(std::make_unique<LocalFlatTopFiniteElementFamily<D, d, R, r>>(overlap_))
     , mapper_(nullptr)
     , basis_(nullptr)
   {
     this->update_after_adapt();
   }
 
-  ContinuousFlatTopSpace(const ThisType&) = default;
   ContinuousFlatTopSpace(ThisType&&) = default;
 
   ThisType& operator=(const ThisType&) = delete;
   ThisType& operator=(ThisType&&) = delete;
 
+  BaseType* copy() const override final
+  {
+    return new ThisType(*this);
+  }
+
   const GridViewType& grid_view() const override final
   {
     return grid_view_;
@@ -144,6 +160,7 @@ public:
 private:
   const GridViewType grid_view_;
   const int fe_order_;
+  const D overlap_;
   std::unique_ptr<const LocalFlatTopFiniteElementFamily<D, d, R, r>> local_finite_elements_;
   std::unique_ptr<MapperImplementation> mapper_;
   std::unique_ptr<GlobalBasisImplementation> basis_;
-- 
GitLab