From 4527ce8ffd61d79167c4498f184cdb76a92743ac Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 29 Jan 2015 11:30:03 +0100 Subject: [PATCH] Add access to the underlying information about the parallelization. We need it serveral places and all of them seem to have access to NewtonIterationBlackoilInterface. This makes it natural to give access to it and prevent users from having to forward it manually at several places in the simulator driver. --- opm/autodiff/NewtonIterationBlackoilCPR.cpp | 4 ++++ opm/autodiff/NewtonIterationBlackoilCPR.hpp | 6 +++++- opm/autodiff/NewtonIterationBlackoilInterface.hpp | 5 +++++ opm/autodiff/NewtonIterationBlackoilSimple.cpp | 4 ++++ opm/autodiff/NewtonIterationBlackoilSimple.hpp | 3 +++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/opm/autodiff/NewtonIterationBlackoilCPR.cpp b/opm/autodiff/NewtonIterationBlackoilCPR.cpp index 80933b2b7..de76309a0 100644 --- a/opm/autodiff/NewtonIterationBlackoilCPR.cpp +++ b/opm/autodiff/NewtonIterationBlackoilCPR.cpp @@ -234,6 +234,10 @@ namespace Opm return dx; } + const boost::any& NewtonIterationBlackoilCPR::parallelInformation() const + { + return parallelInformation_; + } diff --git a/opm/autodiff/NewtonIterationBlackoilCPR.hpp b/opm/autodiff/NewtonIterationBlackoilCPR.hpp index 58a19989d..e97a56408 100644 --- a/opm/autodiff/NewtonIterationBlackoilCPR.hpp +++ b/opm/autodiff/NewtonIterationBlackoilCPR.hpp @@ -71,6 +71,11 @@ namespace Opm /// \copydoc NewtonIterationBlackoilInterface::iterations virtual int iterations () const { return iterations_; } + /// \copydoc NewtonIterationBlackoilInterface::parallelInformation + virtual const boost::any& parallelInformation() const; + + private: + /// \brief construct the CPR preconditioner and the solver. /// \tparam P The type of the parallel information. /// \param parallelInformation the information about the parallelization. @@ -99,7 +104,6 @@ namespace Opm linsolve.apply(x, istlb, result); } - private: mutable int iterations_; double cpr_relax_; unsigned int cpr_ilu_n_; diff --git a/opm/autodiff/NewtonIterationBlackoilInterface.hpp b/opm/autodiff/NewtonIterationBlackoilInterface.hpp index 2e26db07e..ffe886153 100644 --- a/opm/autodiff/NewtonIterationBlackoilInterface.hpp +++ b/opm/autodiff/NewtonIterationBlackoilInterface.hpp @@ -23,6 +23,7 @@ #include +#include namespace Opm { @@ -42,6 +43,10 @@ namespace Opm /// \return number of linear iterations used during last call of computeNewtonIncrement virtual int iterations () const = 0; + + + /// \brief Get the information about the parallelization of the grid. + virtual const boost::any& parallelInformation() const = 0; }; } // namespace Opm diff --git a/opm/autodiff/NewtonIterationBlackoilSimple.cpp b/opm/autodiff/NewtonIterationBlackoilSimple.cpp index b976680b4..3817d94b9 100644 --- a/opm/autodiff/NewtonIterationBlackoilSimple.cpp +++ b/opm/autodiff/NewtonIterationBlackoilSimple.cpp @@ -74,5 +74,9 @@ namespace Opm return dx; } + const boost::any& NewtonIterationBlackoilSimple::parallelInformation() const + { + return parallelInformation_; + } } // namespace Opm diff --git a/opm/autodiff/NewtonIterationBlackoilSimple.hpp b/opm/autodiff/NewtonIterationBlackoilSimple.hpp index 20cd484c4..5f530f10c 100644 --- a/opm/autodiff/NewtonIterationBlackoilSimple.hpp +++ b/opm/autodiff/NewtonIterationBlackoilSimple.hpp @@ -55,6 +55,9 @@ namespace Opm /// \copydoc NewtonIterationBlackoilInterface::iterations virtual int iterations () const { return iterations_; } + /// \copydoc NewtonIterationBlackoilInterface::parallelInformation + virtual const boost::any& parallelInformation() const; + private: std::unique_ptr linsolver_; mutable int iterations_;