From 4f88335b813a4fcfd4529d5b4266c018ba4860dd Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Fri, 8 Mar 2019 22:40:39 +0100 Subject: [PATCH] cleanup oldSolution in ProblemInstat, so that it can be used in expressions and allows interpolation during grid changes --- src/amdis/ProblemInstat.hpp | 14 +++++++++++--- src/amdis/ProblemInstat.inc.hpp | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/amdis/ProblemInstat.hpp b/src/amdis/ProblemInstat.hpp index 1525044c..17871714 100644 --- a/src/amdis/ProblemInstat.hpp +++ b/src/amdis/ProblemInstat.hpp @@ -53,10 +53,18 @@ namespace AMDiS ProblemType& problemStat() { return *problemStat_; } ProblemType const& problemStat() const { return *problemStat_; } - /// Returns \ref oldSolution. + /// Returns mutable-ref of \ref oldSolution. + SystemVector& oldSolutionVector() + { + test_exit_dbg(bool(oldSolution_), + "OldSolution need to be created. Call initialize with INIT_UH_OLD."); + return *oldSolution_; + } + + /// Returns const-ref of \ref oldSolution. SystemVector const& oldSolutionVector() const { - test_exit_dbg(oldSolution_, + test_exit_dbg(bool(oldSolution_), "OldSolution need to be created. Call initialize with INIT_UH_OLD."); return *oldSolution_; } @@ -74,7 +82,7 @@ namespace AMDiS auto oldSolution(TreePath path = {}) const { auto&& tp = makeTreePath(path); - return makeDOFVectorView(oldSolutionVector(), tp); + return makeDiscreteFunction(oldSolutionVector(), tp); } /// Implementation of \ref ProblemTimeInterface::transferInitialSolution(). diff --git a/src/amdis/ProblemInstat.inc.hpp b/src/amdis/ProblemInstat.inc.hpp index ee125d4d..1b3a29dd 100644 --- a/src/amdis/ProblemInstat.inc.hpp +++ b/src/amdis/ProblemInstat.inc.hpp @@ -45,7 +45,7 @@ void ProblemInstat<Traits>::createUhOld() if (oldSolution_) warning("oldSolution already created\n"); else // create oldSolution - oldSolution_.reset(new SystemVector(problemStat_->globalBasis())); + oldSolution_.reset(new SystemVector(problemStat_->globalBasis(), INTERPOLATE)); } -- GitLab