diff --git a/src/state/dieterichstateupdater.hh b/src/state/dieterichstateupdater.hh index ee8480c473e4f1f32802a97e51a2d9b21ef8d839..5398a2338fa3b3c119fa6805d726332ae575eb61 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 083d97eedaeb2d86085a193f7b03b331ea8459a4..872856ebfe681678175ee176e908b86c4db715c4 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 8c5f412dada1512e8cf6958e845128c22bfa73e9..5ff9b8651cf166ec1814d054a953c22b87d34bd6 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