diff --git a/TODO b/TODO index f7b4e6b3119e61721a394b8a35829644a0289686..7379bb910e194a3edb3041287ae319e6182d5697 100644 --- a/TODO +++ b/TODO @@ -65,8 +65,6 @@ and maintain. ## Naming of classes and members * ignoreNodes_ should be called ignore_/ignoreIndices_/ignoreComponents_ -* In some classes the type of the matrix is called 'OperatorType'. - This is old 'dune-fem speak', and should be replaced by 'MatrixType'. diff --git a/dune/solvers/common/arithmetic.hh b/dune/solvers/common/arithmetic.hh index 716c32708ad0c116b3d42e75e7b70611b2615cf8..524e4611430131db5dfdd07e0816d6ea2645e7bf 100644 --- a/dune/solvers/common/arithmetic.hh +++ b/dune/solvers/common/arithmetic.hh @@ -490,12 +490,12 @@ namespace Arithmetic /** \brief Internal helper class for Matrix operations * */ - template<class OperatorType, bool isMatrix> + template<class MatrixType, bool isMatrix> struct OperatorHelper { template <class VectorType> static typename VectorType::field_type - Axy(const OperatorType &A, + Axy(const MatrixType &A, const VectorType &x, const VectorType &y) { @@ -507,7 +507,7 @@ namespace Arithmetic template <class VectorType> static typename VectorType::field_type - bmAxy(const OperatorType &A, const VectorType &b, + bmAxy(const MatrixType &A, const VectorType &b, const VectorType &x, const VectorType &y) { VectorType tmp = b; @@ -569,26 +569,26 @@ namespace Arithmetic }; //! Compute \f$(Ax,y)\f$ - template <class OperatorType, class VectorType> + template <class MatrixType, class VectorType> typename VectorType::field_type - Axy(const OperatorType &A, + Axy(const MatrixType &A, const VectorType &x, const VectorType &y) { - return OperatorHelper<OperatorType, - MatrixTraits<OperatorType>::isMatrix>::Axy(A, x, y); + return OperatorHelper<MatrixType, + MatrixTraits<MatrixType>::isMatrix>::Axy(A, x, y); } //! Compute \f$(b-Ax,y)\f$ - template <class OperatorType, class VectorType> + template <class MatrixType, class VectorType> typename VectorType::field_type - bmAxy(const OperatorType &A, + bmAxy(const MatrixType &A, const VectorType &b, const VectorType &x, const VectorType &y) { - return OperatorHelper<OperatorType, - MatrixTraits<OperatorType>::isMatrix>::bmAxy(A, b, x, y); + return OperatorHelper<MatrixType, + MatrixTraits<MatrixType>::isMatrix>::bmAxy(A, b, x, y); } } diff --git a/dune/solvers/iterationsteps/blockgsstep.cc b/dune/solvers/iterationsteps/blockgsstep.cc index 2822176aa7eef5f738e96bb3613ccc870b4569a5..704a6b3e806bd40aaa839f3e4e42cf2ba90c1f67 100644 --- a/dune/solvers/iterationsteps/blockgsstep.cc +++ b/dune/solvers/iterationsteps/blockgsstep.cc @@ -3,21 +3,21 @@ #include <cassert> -template<class OperatorType, class DiscFuncType, class BitVectorType> +template<class MatrixType, class DiscFuncType, class BitVectorType> inline -DiscFuncType BlockGSStep<OperatorType, DiscFuncType, BitVectorType>::getSol() +DiscFuncType BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::getSol() { return *(this->x_); } -template<class OperatorType, class DiscFuncType, class BitVectorType> +template<class MatrixType, class DiscFuncType, class BitVectorType> inline -void BlockGSStep<OperatorType, DiscFuncType, BitVectorType>:: +void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>:: residual(int index, VectorBlock& r) const { - const OperatorType& mat = *this->mat_; + const MatrixType& mat = *this->mat_; - typedef typename OperatorType::row_type RowType; + typedef typename MatrixType::row_type RowType; const RowType& row = mat[index]; typedef typename RowType::ConstIterator ColumnIterator; @@ -37,11 +37,11 @@ residual(int index, VectorBlock& r) const } -template<class OperatorType, class DiscFuncType, class BitVectorType> +template<class MatrixType, class DiscFuncType, class BitVectorType> inline -void BlockGSStep<OperatorType, DiscFuncType, BitVectorType>::iterate() +void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::iterate() { - const OperatorType& mat = *this->mat_; + const MatrixType& mat = *this->mat_; assert(this->ignoreNodes_ != NULL); for (size_t i=0; i<this->x_->size(); i++) { @@ -62,7 +62,7 @@ void BlockGSStep<OperatorType, DiscFuncType, BitVectorType>::iterate() } else { // Copy the matrix and adjust rhs and matrix so that dofs given in ignoreNodes[i] // are not touched - typename OperatorType::block_type matRes; + typename MatrixType::block_type matRes; for (int j = 0; j < BlockSize; ++j) { if ((*this->ignoreNodes_)[i][j]) { r[j] = 0; diff --git a/dune/solvers/iterationsteps/blockgsstep.hh b/dune/solvers/iterationsteps/blockgsstep.hh index 141432e277d6ffea042dc625f020393845875134..956038441cb841d40a1bf88f0c7d6709ab38ee18 100644 --- a/dune/solvers/iterationsteps/blockgsstep.hh +++ b/dune/solvers/iterationsteps/blockgsstep.hh @@ -9,15 +9,15 @@ /** \brief A linear Gauß-Seidel iteration step for convex problems which have a block-structure. * - * \tparam OperatorType The linear operator type + * \tparam MatrixType The linear operator type * \tparam DiscFuncType The block vector type of the right hand side and the iterates * \tparam BitVectorType The type of the bit-vector specifying degrees of freedom that shall be ignored. * */ -template<class OperatorType, +template<class MatrixType, class DiscFuncType, class BitVectorType = Dune::BitSetVector<DiscFuncType::block_type::dimension> > - class BlockGSStep : public LinearIterationStep<OperatorType, DiscFuncType, BitVectorType> + class BlockGSStep : public LinearIterationStep<MatrixType, DiscFuncType, BitVectorType> { typedef typename DiscFuncType::block_type VectorBlock; @@ -30,8 +30,8 @@ template<class OperatorType, BlockGSStep() {} //! Constructor with a linear problem - BlockGSStep(const OperatorType& mat, DiscFuncType& x, const DiscFuncType& rhs) - : LinearIterationStep<OperatorType,DiscFuncType>(mat, x, rhs) + BlockGSStep(const MatrixType& mat, DiscFuncType& x, const DiscFuncType& rhs) + : LinearIterationStep<MatrixType,DiscFuncType>(mat, x, rhs) {} //! Perform one iteration diff --git a/dune/solvers/iterationsteps/linegsstep.cc b/dune/solvers/iterationsteps/linegsstep.cc index a8f06b23ad7c401852e81b9263ee25554fb52ca8..44951158e0322c4f370bcc5f5dfdf381140bba44 100755 --- a/dune/solvers/iterationsteps/linegsstep.cc +++ b/dune/solvers/iterationsteps/linegsstep.cc @@ -3,9 +3,9 @@ #include <dune/istl/btdmatrix.hh> #include <dune/istl/scaledidmatrix.hh> -template<class OperatorType, class DiscFuncType, class BitVectorType> +template<class MatrixType, class DiscFuncType, class BitVectorType> inline -DiscFuncType LineGSStep<OperatorType, DiscFuncType, BitVectorType>::getSol() +DiscFuncType LineGSStep<MatrixType, DiscFuncType, BitVectorType>::getSol() { return *(this->x_); @@ -13,13 +13,13 @@ DiscFuncType LineGSStep<OperatorType, DiscFuncType, BitVectorType>::getSol() } -template<class OperatorType, class DiscFuncType, class BitVectorType> -void LineGSStep<OperatorType, DiscFuncType, BitVectorType >::iterate() +template<class MatrixType, class DiscFuncType, class BitVectorType> +void LineGSStep<MatrixType, DiscFuncType, BitVectorType >::iterate() { // input of this method: x^(k) (not the permuted version of x^(k)!) - const OperatorType& mat = *this->mat_; + const MatrixType& mat = *this->mat_; int number_of_blocks = blockStructure_.size(); @@ -53,7 +53,7 @@ void LineGSStep<OperatorType, DiscFuncType, BitVectorType >::iterate() // Copy the linear system for the current line/block into a tridiagonal matrix // ////////////////////////////////////////////////////////////////////////////////////////////////// - Dune::BTDMatrix<typename OperatorType::block_type> tridiagonalMatrix(current_block_size); + Dune::BTDMatrix<typename MatrixType::block_type> tridiagonalMatrix(current_block_size); for (int j=0; j<current_block_size; j++) { diff --git a/dune/solvers/iterationsteps/linegsstep.hh b/dune/solvers/iterationsteps/linegsstep.hh index 674e52057a13b4c8c7748bc54714c88695bab877..7a3059ca1c6657062c5beaa3782938b433653ced 100755 --- a/dune/solvers/iterationsteps/linegsstep.hh +++ b/dune/solvers/iterationsteps/linegsstep.hh @@ -7,10 +7,10 @@ #include <dune/solvers/iterationsteps/blockgsstep.hh> -template<class OperatorType, +template<class MatrixType, class DiscFuncType, class BitVectorType = Dune::BitSetVector<DiscFuncType::block_type::dimension> > - class LineGSStep : public BlockGSStep<OperatorType, DiscFuncType, BitVectorType> + class LineGSStep : public BlockGSStep<MatrixType, DiscFuncType, BitVectorType> { typedef typename DiscFuncType::block_type VectorBlock; @@ -33,8 +33,8 @@ template<class OperatorType, {} //! Constructor with a linear problem - LineGSStep(const OperatorType& mat, DiscFuncType& x, DiscFuncType& rhs) - : BlockGSStep<OperatorType,DiscFuncType>(mat, x, rhs) + LineGSStep(const MatrixType& mat, DiscFuncType& x, DiscFuncType& rhs) + : BlockGSStep<MatrixType,DiscFuncType>(mat, x, rhs) {} //! Perform one iteration diff --git a/dune/solvers/iterationsteps/projectedblockgsstep.cc b/dune/solvers/iterationsteps/projectedblockgsstep.cc index 652ef54f42b358a48487967b4c0b1f33d2dbb99f..402143bc01512e68f6f11c4d1d90c67a0f5634df 100644 --- a/dune/solvers/iterationsteps/projectedblockgsstep.cc +++ b/dune/solvers/iterationsteps/projectedblockgsstep.cc @@ -1,22 +1,22 @@ // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=8 sw=4 sts=4: -template<class OperatorType, class DiscFuncType> +template<class MatrixType, class DiscFuncType> inline -DiscFuncType ProjectedBlockGSStep<OperatorType, DiscFuncType>::getSol() +DiscFuncType ProjectedBlockGSStep<MatrixType, DiscFuncType>::getSol() { return *(this->x_); } -template<class OperatorType, class DiscFuncType> +template<class MatrixType, class DiscFuncType> inline -void ProjectedBlockGSStep<OperatorType, DiscFuncType>::iterate() +void ProjectedBlockGSStep<MatrixType, DiscFuncType>::iterate() { if (hasObstacle_->size()!= (unsigned int)this->x_->size()) DUNE_THROW(SolverError, "Size of hasObstacle (" << hasObstacle_->size() << ") doesn't match solution vector (" << this->x_->size() << ")"); - const OperatorType& mat = *this->mat_; + const MatrixType& mat = *this->mat_; for (size_t i=0; i<this->x_->size(); i++) { diff --git a/dune/solvers/iterationsteps/projectedblockgsstep.hh b/dune/solvers/iterationsteps/projectedblockgsstep.hh index 62b89652b27527c41ab69a86349388e6266ccc8a..4d6a2e4acef643e469203a45389241ee2630b136 100644 --- a/dune/solvers/iterationsteps/projectedblockgsstep.hh +++ b/dune/solvers/iterationsteps/projectedblockgsstep.hh @@ -8,8 +8,8 @@ #include "blockgsstep.hh" #include <dune/solvers/common/boxconstraint.hh> -template<class OperatorType, class DiscFuncType> -class ProjectedBlockGSStep : public BlockGSStep<OperatorType, DiscFuncType> +template<class MatrixType, class DiscFuncType> +class ProjectedBlockGSStep : public BlockGSStep<MatrixType, DiscFuncType> { typedef typename DiscFuncType::block_type VectorBlock; @@ -24,8 +24,8 @@ public: ProjectedBlockGSStep() {} //! Constructor with a linear problem - ProjectedBlockGSStep(const OperatorType& mat, DiscFuncType& x, const DiscFuncType& rhs) - : BlockGSStep<OperatorType,DiscFuncType>(mat, x, rhs) + ProjectedBlockGSStep(const MatrixType& mat, DiscFuncType& x, const DiscFuncType& rhs) + : BlockGSStep<MatrixType,DiscFuncType>(mat, x, rhs) {} //! Perform one iteration diff --git a/dune/solvers/norms/energynorm.hh b/dune/solvers/norms/energynorm.hh index 0a225f2e1b4723c1632d98bc333457e5a69548a4..d66fe90ef5ee223e554dc04ab55017117911ea78 100644 --- a/dune/solvers/norms/energynorm.hh +++ b/dune/solvers/norms/energynorm.hh @@ -25,7 +25,7 @@ * * \todo Elaborate documentation. */ - template<class OperatorType, class V> + template<class MatrixType, class V> class EnergyNorm : public Norm<V> { public: @@ -36,19 +36,19 @@ EnergyNorm(const double tol=1e-10 ) : iterationStep_(NULL), matrix_(NULL), tol_(tol) {} - EnergyNorm(LinearIterationStep<OperatorType, VectorType>& it, const double tol=1e-10) + EnergyNorm(LinearIterationStep<MatrixType, VectorType>& it, const double tol=1e-10) : iterationStep_(&it), matrix_(NULL), tol_(tol) {} - EnergyNorm(const OperatorType& matrix, const double tol=1e-10) + EnergyNorm(const MatrixType& matrix, const double tol=1e-10) : iterationStep_(NULL), matrix_(&matrix), tol_(tol) {} - void setMatrix(const OperatorType* matrix) { + void setMatrix(const MatrixType* matrix) { matrix_ = matrix; } - void setIterationStep(LinearIterationStep<OperatorType, VectorType>* iterationStep) { + void setIterationStep(LinearIterationStep<MatrixType, VectorType>* iterationStep) { iterationStep_ = iterationStep; } @@ -74,7 +74,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 MatrixType& A = (iterationStep_) ? *(iterationStep_->getMatrix()) : *matrix_; @@ -92,7 +92,7 @@ // \brief Compute the squared norm for a given vector and matrix DUNE_DEPRECATED static field_type normSquared(const VectorType& u, - const OperatorType& A, + const MatrixType& A, const double tol=1e-10) { const field_type ret = Arithmetic::Axy(A, u, u); @@ -110,9 +110,9 @@ protected: - LinearIterationStep<OperatorType, VectorType>* iterationStep_; + LinearIterationStep<MatrixType, VectorType>* iterationStep_; - const OperatorType* matrix_; + const MatrixType* matrix_; const double tol_; diff --git a/dune/solvers/norms/pnorm.hh b/dune/solvers/norms/pnorm.hh index 04f2354870efaf3f5c92a91c6fe2ed7874697d28..b4faa70f0b197f3ce32af8193b3fbae9dbc042d0 100644 --- a/dune/solvers/norms/pnorm.hh +++ b/dune/solvers/norms/pnorm.hh @@ -1,7 +1,7 @@ // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=8 sw=4 sts=4: -#ifndef __PNORM__HH__ -#define __PNORM__HH__ +#ifndef DUNE_SOLVERS_PNORM_HH +#define DUNE_SOLVERS_PNORM_HH #include <cmath>