diff --git a/dune/solvers/norms/energynorm.hh b/dune/solvers/norms/energynorm.hh index 686e60d4dda7407622687641d34bf12044719ab5..c8e819eb0fc985f69e9e1d94a8f15039f6f0e9be 100644 --- a/dune/solvers/norms/energynorm.hh +++ b/dune/solvers/norms/energynorm.hh @@ -32,11 +32,11 @@ EnergyNorm(const double tol=1e-10 ) : iterationStep_(NULL), matrix_(NULL), tol_(tol) {} - EnergyNorm(LinearIterationStep<OperatorType, DiscFuncType>& it, const double tol=1e-10) + EnergyNorm(LinearIterationStep<OperatorType, DiscFuncType>& it, const double tol=1e-10) : iterationStep_(&it), matrix_(NULL), tol_(tol) {} - EnergyNorm(const OperatorType& matrix, const double tol=1e-10) + EnergyNorm(const OperatorType& matrix, const double tol=1e-10) : iterationStep_(NULL), matrix_(&matrix), tol_(tol) {} @@ -59,7 +59,7 @@ } //! Compute the norm of the given vector - double operator()(const DiscFuncType& f) const + double operator()(const DiscFuncType& f) const { return std::sqrt(this->EnergyNorm<OperatorType,DiscFuncType>::normSquared(f)); } @@ -71,7 +71,7 @@ if (iterationStep_ == NULL && matrix_ == NULL) DUNE_THROW(Dune::Exception, "You have supplied neither a matrix nor an IterationStep to the EnergyNorm!"); - const OperatorType& A = (iterationStep_) + const OperatorType& A = (iterationStep_) ? *(iterationStep_->getMatrix()) : *matrix_; @@ -92,7 +92,7 @@ /** \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, + static field_type normSquared(const DiscFuncType& u, const OperatorType& A, const double tol=1e-10) {