Skip to content
Snippets Groups Projects
Commit b8d600cd authored by Robert K's avatar Robert K
Browse files

Merge branch 'feature/residualnorm-in-dghelmholtzinverse-output' into 'master'

Add residual norm to dghelmholtzinverse info dict

See merge request !45
parents 49e6e52a 7d37e87d
No related branches found
Tags s2022.09
1 merge request!45Add residual norm to dghelmholtzinverse info dict
Pipeline #53767 passed
......@@ -123,12 +123,13 @@ namespace Dune
struct SolverInfo
{
SolverInfo ( bool converged, int linearIterations, int nonlinearIterations )
: converged( converged ), linearIterations( linearIterations ), nonlinearIterations( nonlinearIterations )
SolverInfo ( bool converged, int linearIterations, int nonlinearIterations, double residualNorm )
: converged( converged ), linearIterations( linearIterations ), nonlinearIterations( nonlinearIterations ), residualNorm( residualNorm )
{}
bool converged;
int linearIterations, nonlinearIterations;
double residualNorm;
};
// class wrapping a Python function to look like a Fem::Operator
......@@ -207,7 +208,7 @@ namespace Dune
(*this)( rhs, u );
helmholtzOp_.unbind();
return SolverInfo( invOp_.converged(), invOp_.linearIterations(), invOp_.iterations() );
return SolverInfo( invOp_.converged(), invOp_.linearIterations(), invOp_.iterations(), invOp_.residual() );
}
/** \brief Preconditioned solve
......
......@@ -640,6 +640,7 @@ def dgHelmholtzInverseOperator( op, u = None, parameters = {} ):
ret["converged"] = pybind11::cast(info.converged);
ret["iterations"] = pybind11::cast(info.nonlinearIterations);
ret["linear_iterations"] = pybind11::cast(info.linearIterations);
ret["residual"] = pybind11::cast(info.residualNorm);
return ret;
}''' )
# add method solve, combining setLambda and __call__ for efficiency. Also,
......@@ -657,6 +658,7 @@ def dgHelmholtzInverseOperator( op, u = None, parameters = {} ):
ret["converged"] = pybind11::cast(info.converged);
ret["iterations"] = pybind11::cast(info.nonlinearIterations);
ret["linear_iterations"] = pybind11::cast(info.linearIterations);
ret["residual"] = pybind11::cast(info.residualNorm);
return ret;
}''' )
......
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