diff --git a/dune/solvers/norms/fullnorm.hh b/dune/solvers/norms/fullnorm.hh index 006fae90e6a78e74654547ab0aa9258018b6d003..0dc3d48af6b795051275e97b560fa0c84ed12830 100644 --- a/dune/solvers/norms/fullnorm.hh +++ b/dune/solvers/norms/fullnorm.hh @@ -18,7 +18,7 @@ template <class LowRankFactor, class VectorType> class FullNorm: public Norm<VectorType> { public: - FullNorm(double alpha, const LowRankFactor &lowRankFactor) : + FullNorm(const double alpha, const LowRankFactor &lowRankFactor) : lowRankFactor_(lowRankFactor), alpha(alpha) {} @@ -60,43 +60,43 @@ class FullNorm: public Norm<VectorType> }; - +template<> class FullNorm<Dune::BlockVector<Dune::FieldVector<double,1> >, Dune::BlockVector<Dune::FieldVector<double,1> > >: public Norm<Dune::BlockVector<Dune::FieldVector<double,1> > > { - typedef <Dune::BlockVector<Dune::FieldVector<double,1> > VectorType; - public: - FullNorm(double alpha, const VectorType &m) : - m(m), - alpha(alpha) - {} - - //! Compute the norm of the given vector - double operator()(const VectorType &v) const - { - double r = 0.0; - - for(int row = 0; row < v.size(); ++row) - r += m[row] * v[row]; - - return sqrt(fabs(alpha*r*r)); - } + typedef Dune::BlockVector<Dune::FieldVector<double,1> > VectorType; + public: + FullNorm(const double alpha, const VectorType &m) : + m(m), + alpha(alpha) + {} + + //! Compute the norm of the given vector + double operator()(const VectorType &v) const + { + double r = 0.0; + + for(int row = 0; row < v.size(); ++row) + r += m[row] * v[row]; + + return sqrt(fabs(alpha*r*r)); + } + + //! Compute the norm of the difference of two vectors + double diff(const VectorType &v1, const VectorType &v2) const + { + double r = 0.0; + + for(int row = 0; row < v1.size(); ++row) + r += (double)m[row] * (v1[row] - v2[row]); + + return sqrt(fabs(alpha*r*r)); + } + + private: + const VectorType &m; + + const double alpha; - //! Compute the norm of the difference of two vectors - double diff(const VectorType &v1, const VectorType &v2) const - { - double r = 0.0; - - for(int row = 0; row < v1.size(); ++row) - r += (double)m[row] * (v1[row] - v2[row]); - - return sqrt(fabs(alpha*r*r)); - } - - private: - const VectorType &m; - - const double alpha; - }; -#endif +#endif