From db209f0cf4ac06f9a145de017c079aa802f9964d Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Sun, 19 Feb 2023 13:20:27 +0100 Subject: [PATCH] [assembler] Deprecate residualNorm and introduce temporary interface --- dumux/assembly/fvassembler.hh | 17 ++++++++++++----- dumux/multidomain/fvassembler.hh | 21 ++++++++++++++------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/dumux/assembly/fvassembler.hh b/dumux/assembly/fvassembler.hh index 7ce65e6695..13b298370a 100644 --- a/dumux/assembly/fvassembler.hh +++ b/dumux/assembly/fvassembler.hh @@ -244,12 +244,10 @@ public: }); } - //! compute the residual and return it's vector norm - Scalar residualNorm(const SolutionVector& curSol) const + //! compute a residual's vector norm (this is a temporary interface introduced during the deprecation period) + [[deprecated("Use the linear solver's norm. Will be deleted after 3.7")]] + Scalar normOfResidual(ResidualType& residual) const { - ResidualType residual(numDofs()); - assembleResidual(residual, curSol); - // issue a warning if the calculation is used in parallel with overlap static bool warningIssued = false; @@ -284,6 +282,15 @@ public: return sqrt(result2); } + //! compute the residual and return it's vector norm + [[deprecated("Use assembleResidual and the linear solver's norm. Will be deleted after 3.7")]] + Scalar residualNorm(const SolutionVector& curSol) const + { + ResidualType residual(numDofs()); + assembleResidual(residual, curSol); + return normOfResidual(residual); + } + /*! * \brief Tells the assembler which jacobian and residual to use. * This also resizes the containers to the required sizes and sets the diff --git a/dumux/multidomain/fvassembler.hh b/dumux/multidomain/fvassembler.hh index 3c141c7736..fa476f638f 100644 --- a/dumux/multidomain/fvassembler.hh +++ b/dumux/multidomain/fvassembler.hh @@ -295,13 +295,10 @@ public: }); } - //! compute the residual and return it's vector norm - Scalar residualNorm(const SolutionVector& curSol) + //! compute a residual's vector norm (this is a temporary interface introduced during the deprecation period) + [[deprecated("Use the linear solver's norm. Will be deleted after 3.7")]] + Scalar normOfResidual(ResidualType& residual) const { - ResidualType residual; - setResidualSize_(residual); - assembleResidual(residual, curSol); - // calculate the squared norm of the residual Scalar resultSquared = 0.0; @@ -349,6 +346,16 @@ public: return sqrt(resultSquared); } + //! compute the residual and return it's vector norm + [[deprecated("Use norm(curSol) provided by the linear solver class instead. Will be deleted after 3.7")]] + Scalar residualNorm(const SolutionVector& curSol) + { + ResidualType residual; + setResidualSize_(residual); + assembleResidual(residual, curSol); + return normOfResidual(residual); + } + /*! * \brief Tells the assembler which jacobian and residual to use. * This also resizes the containers to the required sizes and sets the @@ -736,7 +743,7 @@ private: std::shared_ptr<ResidualType> residual_; //! Issue a warning if the calculation is used in parallel with overlap. This could be a static local variable if it wasn't for g++7 yielding a linker error. - bool warningIssued_; + mutable bool warningIssued_; //! if multithreaded assembly is enabled bool enableMultithreading_ = false; -- GitLab