Skip to content
Snippets Groups Projects
Commit f7000d03 authored by Bernd Flemisch's avatar Bernd Flemisch Committed by Timo Koch
Browse files

[linear] add norm to base class

parent f13c1791
No related branches found
No related tags found
1 merge request!3386New istl linear solvers
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
#ifndef DUMUX_LINEAR_SOLVER_HH #ifndef DUMUX_LINEAR_SOLVER_HH
#define DUMUX_LINEAR_SOLVER_HH #define DUMUX_LINEAR_SOLVER_HH
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/exceptions.hh> #include <dune/common/exceptions.hh>
#include <dune/istl/scalarproducts.hh>
#include <dumux/common/parameters.hh> #include <dumux/common/parameters.hh>
namespace Dumux { namespace Dumux {
...@@ -71,6 +73,15 @@ public: ...@@ -71,6 +73,15 @@ public:
DUNE_THROW(Dune::NotImplemented, "Linear solver doesn't implement a solve method!"); DUNE_THROW(Dune::NotImplemented, "Linear solver doesn't implement a solve method!");
} }
template<class Vector>
auto norm(const Vector& x) const
{
if (Dune::MPIHelper::getCommunication().size() > 1)
DUNE_THROW(Dune::NotImplemented, "norm in parallel");
return Dune::SeqScalarProduct<Vector>().norm(x);
}
//! the name of the linear solver //! the name of the linear solver
std::string name() const std::string name() const
{ return "unknown solver"; } { return "unknown solver"; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment