Using the CriticalException in PreconditionerFactory and ISTLSolver

This commit is contained in:
Kjetil Olsen Lye 2025-02-08 12:50:56 +01:00
parent 5181a06219
commit 8b84bc6b4b
2 changed files with 9 additions and 6 deletions

View File

@ -25,6 +25,7 @@
#include <dune/istl/owneroverlapcopy.hh>
#include <dune/istl/solver.hh>
#include <opm/common/CriticalError.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/common/TimingMacros.hpp>
@ -377,10 +378,11 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
void prepare(const Matrix& M, Vector& b)
{
OPM_TIMEBLOCK(istlSolverPrepare);
OPM_BEGIN_TRY_CATCH_RETHROW_AS_CRITICAL_ERROR();
initPrepare(M,b);
initPrepare(M,b);
prepareFlexibleSolver();
prepareFlexibleSolver();
OPM_END_TRY_CATCH_RETHROW_AS_CRITICAL_ERROR();
}

View File

@ -20,6 +20,7 @@
#include <config.h>
#include <opm/common/CriticalError.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/TimingMacros.hpp>
@ -776,7 +777,7 @@ PreconditionerFactory<Operator, Comm>::create(const Operator& op,
const std::function<Vector()>& weightsCalculator,
std::size_t pressureIndex)
{
return instance().doCreate(op, prm, weightsCalculator, pressureIndex);
OPM_TRY_THROW_AS_CRITICAL_ERROR(return instance().doCreate(op, prm, weightsCalculator, pressureIndex));
}
template <class Operator, class Comm>
@ -787,7 +788,7 @@ PreconditionerFactory<Operator, Comm>::create(const Operator& op,
const Comm& comm,
std::size_t pressureIndex)
{
return instance().doCreate(op, prm, weightsCalculator, pressureIndex, comm);
OPM_TRY_THROW_AS_CRITICAL_ERROR(return instance().doCreate(op, prm, weightsCalculator, pressureIndex, comm));
}
@ -798,7 +799,7 @@ PreconditionerFactory<Operator, Comm>::create(const Operator& op,
const Comm& comm,
std::size_t pressureIndex)
{
return instance().doCreate(op, prm, std::function<Vector()>(), pressureIndex, comm);
OPM_TRY_THROW_AS_CRITICAL_ERROR(return instance().doCreate(op, prm, std::function<Vector()>(), pressureIndex, comm));
}
template <class Operator, class Comm>