Skip to content
Snippets Groups Projects
Commit 5250ce18 authored by Uli Sack's avatar Uli Sack Committed by usack
Browse files

* deprecated static method normSquared(DiscFuncType&,OperatorType&)

* reimplemented virtual method normSquared(DiscFuncType&)
* removed double negative in error message of Exception
* added some minimal docu and requested more

[[Imported from SVN: r3498]]
parent 1c3fe9db
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,12 @@
#include "norm.hh"
#include <dune/solvers/iterationsteps/lineariterationstep.hh>
/** \brief Vector norm induced by linear operator
*
* \f$\Vert u \Vert_A = (u, Au)^{1/2}\f$
*
* \todo Elaborate documentation, esp. why does a norm have a member LinearIterationStep a.s.o.
*/
template<class OperatorType, class DiscFuncType>
class EnergyNorm : public Norm<DiscFuncType>
{
......@@ -33,7 +39,7 @@
//! Compute the norm of the difference of two vectors
double diff(const DiscFuncType& f1, const DiscFuncType& f2) const {
if (iterationStep_ == NULL && matrix_ == NULL)
DUNE_THROW(Dune::Exception, "You have not supplied neither a matrix nor an IterationStep to the EnergyNorm routine!");
DUNE_THROW(Dune::Exception, "You have supplied neither a matrix nor an IterationStep to the EnergyNorm!");
DiscFuncType tmp_f = f1;
tmp_f -= f2;
......@@ -42,9 +48,15 @@
//! Compute the norm of the given vector
double operator()(const DiscFuncType& f) const
{
return sqrt(this->EnergyNorm<OperatorType,DiscFuncType>::normSquared(f));
}
//! Compute the square of the norm of the given vector
virtual double normSquared(const DiscFuncType& f) const
{
if (iterationStep_ == NULL && matrix_ == NULL)
DUNE_THROW(Dune::Exception, "You have not supplied neither a matrix nor an IterationStep to the EnergyNorm routine!");
DUNE_THROW(Dune::Exception, "You have supplied neither a matrix nor an IterationStep to the EnergyNorm!");
const OperatorType& A = (iterationStep_)
? *(iterationStep_->getMatrix())
......@@ -54,7 +66,7 @@
tmp = 0;
A.umv(f, tmp);
return sqrt(f * tmp);
return f*tmp;
}
/** \brief Compute the squared norm for a given vector and matrix
......@@ -66,7 +78,7 @@
tmp = 0;
A.umv(u, tmp);
return u*tmp;
}
} DUNE_DEPRECATED;
protected:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment