From 5764308bb59b300bdcec5374651ded2c3e79d6e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Milk?= <rene.milk@wwu.de>
Date: Wed, 21 Feb 2018 16:43:54 +0100
Subject: [PATCH] [functors] implement mandatory copy function

---
 dune/xt/grid/functors/boundary-detector.hh |  5 +++++
 dune/xt/grid/functors/bounding-box.hh      |  5 +++++
 dune/xt/grid/functors/lambda.hh            | 15 +++++++++++++++
 dune/xt/grid/functors/refinement.hh        |  5 +++++
 dune/xt/grid/information.hh                |  5 +++++
 dune/xt/grid/output/pgf.hh                 | 11 +++++++++++
 6 files changed, 46 insertions(+)

diff --git a/dune/xt/grid/functors/boundary-detector.hh b/dune/xt/grid/functors/boundary-detector.hh
index f240af733..728a26894 100644
--- a/dune/xt/grid/functors/boundary-detector.hh
+++ b/dune/xt/grid/functors/boundary-detector.hh
@@ -72,6 +72,11 @@ public:
     return found_;
   }
 
+  BaseType* copy() override
+  {
+    return new BoundaryDetectorFunctor<GL>(*this);
+  }
+
 private:
   const BoundaryInfo<IntersectionType>& boundary_info_;
   const std::shared_ptr<BoundaryType> boundary_type_;
diff --git a/dune/xt/grid/functors/bounding-box.hh b/dune/xt/grid/functors/bounding-box.hh
index 51331b721..de816faf7 100644
--- a/dune/xt/grid/functors/bounding-box.hh
+++ b/dune/xt/grid/functors/bounding-box.hh
@@ -48,6 +48,11 @@ struct MinMaxCoordinateFunctor : public ElementFunctor<GridViewType>
     }
   }
 
+  ElementFunctor<GridViewType>* copy() override
+  {
+    return new MinMaxCoordinateFunctor<GridViewType>(*this);
+  }
+
   VectorType minima_;
   VectorType maxima_;
 };
diff --git a/dune/xt/grid/functors/lambda.hh b/dune/xt/grid/functors/lambda.hh
index 4ea90a902..29254b32a 100644
--- a/dune/xt/grid/functors/lambda.hh
+++ b/dune/xt/grid/functors/lambda.hh
@@ -55,6 +55,11 @@ public:
     finalize_lambda_();
   }
 
+  BaseType* copy() override
+  {
+    return new ElementLambdaFunctor<GL>(*this);
+  }
+
 private:
   const ApplyLambdaType apply_lambda_;
   const PrepareLambdaType prepare_lambda_;
@@ -102,6 +107,11 @@ public:
     finalize_lambda_();
   }
 
+  BaseType* copy() override
+  {
+    return new IntersectionLambdaFunctor(*this);
+  }
+
 private:
   const ApplyLambdaType apply_lambda_;
   const PrepareLambdaType prepare_lambda_;
@@ -157,6 +167,11 @@ public:
     finalize_lambda_();
   }
 
+  BaseType* copy() override
+  {
+    return new ElementAndIntersectionLambdaFunctor<GL>(*this);
+  }
+
 private:
   const ElementApplyLambdaType element_apply_lambda_;
   const IntersectionApplyLambdaType intersection_apply_lambda_;
diff --git a/dune/xt/grid/functors/refinement.hh b/dune/xt/grid/functors/refinement.hh
index dea1be0f4..bea045612 100644
--- a/dune/xt/grid/functors/refinement.hh
+++ b/dune/xt/grid/functors/refinement.hh
@@ -41,6 +41,11 @@ struct MaximumEntityVolumeRefineFunctor : public ElementFunctor<GridViewType>
       grid_.mark(1, element);
   }
 
+  ElementFunctor<GridViewType>* copy() override
+  {
+    return new MaximumEntityVolumeRefineFunctor<GridViewType>(*this);
+  }
+
   const double threshold_volume_;
   GridType& grid_;
 };
diff --git a/dune/xt/grid/information.hh b/dune/xt/grid/information.hh
index 7b23445a5..6415173a3 100644
--- a/dune/xt/grid/information.hh
+++ b/dune/xt/grid/information.hh
@@ -139,6 +139,11 @@ struct Dimensions
           coord_limits_[k](corner[k]);
       }
     } // ()
+
+    ElementFunctor<GridLayerType>* copy() override
+    {
+      return new GridDimensionsFunctor(*this);
+    }
   };
 
   double volume_relation() const
diff --git a/dune/xt/grid/output/pgf.hh b/dune/xt/grid/output/pgf.hh
index 71cbc1507..5291a541c 100644
--- a/dune/xt/grid/output/pgf.hh
+++ b/dune/xt/grid/output/pgf.hh
@@ -137,6 +137,11 @@ public:
     file_.flush();
   }
 
+  BaseType* copy() override
+  {
+    return new PgfEntityFunctorIntersections<GridViewType>(*this);
+  }
+
   void maybePrintEntityIndex(const typename BaseType::ElementType& entity, const int idx)
   {
     if (!print_entityIndex_)
@@ -206,6 +211,12 @@ public:
     this->file_.flush();
   }
 
+  ElementAndIntersectionFunctor<GridViewType>* copy() override
+  {
+    return new PgfEntityFunctorIntersectionsWithShift<GridViewType>(*this);
+  }
+
+
 private:
   const int level_;
 };
-- 
GitLab