diff --git a/dune/solvers/norms/energynorm.hh b/dune/solvers/norms/energynorm.hh index 280e95f86f9605a9d86e43e23791ddd021b6c951..86e68a17e0ea3676834466e99f934eeb3fb9dd42 100644 --- a/dune/solvers/norms/energynorm.hh +++ b/dune/solvers/norms/energynorm.hh @@ -28,14 +28,14 @@ /** \brief The type used for the result */ typedef typename DiscFuncType::field_type field_type; - EnergyNorm() : iterationStep_(NULL), matrix_(NULL) {} + EnergyNorm(const double tol=1e-10 ) : iterationStep_(NULL), matrix_(NULL), tol_(tol) {} - EnergyNorm(LinearIterationStep<OperatorType, DiscFuncType>& it) - : iterationStep_(&it), matrix_(NULL) + EnergyNorm(LinearIterationStep<OperatorType, DiscFuncType>& it, const double tol=1e-10) + : iterationStep_(&it), matrix_(NULL), tol_(tol) {} - EnergyNorm(const OperatorType& matrix) - : iterationStep_(NULL), matrix_(&matrix) + EnergyNorm(const OperatorType& matrix, const double tol=1e-10) + : iterationStep_(NULL), matrix_(&matrix), tol_(tol) {} void setMatrix(const OperatorType* matrix) { @@ -81,7 +81,7 @@ if (ret < 0) { - if (ret < -1e-13) + if (ret < -tol_) { char msg[1024]; sprintf(msg, "Supplied linear operator is not positive (semi-)definite: (u,Au) = %e", ret); @@ -96,7 +96,8 @@ /** \brief Compute the squared norm for a given vector and matrix \todo This could be implemented without the temporary. */ static field_type normSquared(const DiscFuncType& u, - const OperatorType& A) + const OperatorType& A, + const double tol=1e-10) { DiscFuncType tmp(u.size()); tmp = 0; @@ -106,7 +107,7 @@ if (ret < 0) { - if (ret < -1e-13) + if (ret < -tol) { char msg[1024]; sprintf(msg, "Supplied linear operator is not positive (semi-)definite: (u,Au) = %e", ret); @@ -125,6 +126,8 @@ const OperatorType* matrix_; + const double tol_; + }; #endif