From 82675edbae12f787c0963e277ff6f79b527432c7 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Tue, 30 Oct 2012 20:59:43 +0100 Subject: [PATCH] Make stateUpdaters cloneable --- src/state/dieterichstateupdater.hh | 8 ++++++++ src/state/ruinastateupdater.hh | 8 ++++++++ src/state/stateupdater.hh | 2 ++ 3 files changed, 18 insertions(+) diff --git a/src/state/dieterichstateupdater.hh b/src/state/dieterichstateupdater.hh index ee8480c4..5398a233 100644 --- a/src/state/dieterichstateupdater.hh +++ b/src/state/dieterichstateupdater.hh @@ -16,6 +16,8 @@ class DieterichStateUpdater virtual void solve(VectorType const &velocity_field); virtual void extractState(SingletonVectorType &state); + virtual StateUpdater<SingletonVectorType, VectorType> *clone(); + private: SingletonVectorType alpha_old; SingletonVectorType alpha; @@ -57,4 +59,10 @@ void DieterichStateUpdater<SingletonVectorType, VectorType>::extractState( state = alpha; } +template <class SingletonVectorType, class VectorType> +StateUpdater<SingletonVectorType, VectorType> * +DieterichStateUpdater<SingletonVectorType, VectorType>::clone() { + return new DieterichStateUpdater<SingletonVectorType, VectorType>(*this); +} + #endif diff --git a/src/state/ruinastateupdater.hh b/src/state/ruinastateupdater.hh index 083d97ee..872856eb 100644 --- a/src/state/ruinastateupdater.hh +++ b/src/state/ruinastateupdater.hh @@ -15,6 +15,8 @@ class RuinaStateUpdater : public StateUpdater<SingletonVectorType, VectorType> { virtual void solve(VectorType const &velocity_field); virtual void extractState(SingletonVectorType &state); + virtual StateUpdater<SingletonVectorType, VectorType> *clone(); + private: SingletonVectorType alpha_old; SingletonVectorType alpha; @@ -55,4 +57,10 @@ void RuinaStateUpdater<SingletonVectorType, VectorType>::extractState( state = alpha; } +template <class SingletonVectorType, class VectorType> +StateUpdater<SingletonVectorType, VectorType> * +RuinaStateUpdater<SingletonVectorType, VectorType>::clone() { + return new RuinaStateUpdater<SingletonVectorType, VectorType>(*this); +} + #endif diff --git a/src/state/stateupdater.hh b/src/state/stateupdater.hh index 8c5f412d..5ff9b865 100644 --- a/src/state/stateupdater.hh +++ b/src/state/stateupdater.hh @@ -7,6 +7,8 @@ template <class SingletonVectorType, class VectorType> class StateUpdater { virtual void setup(double _tau) = 0; virtual void solve(VectorType const &velocity_field) = 0; virtual void extractState(SingletonVectorType &state) = 0; + + virtual StateUpdater<SingletonVectorType, VectorType> *clone() = 0; }; #endif -- GitLab