Commit ba1f9b59 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Merge master to new_interface branch

Merge branch 'master' into new_interface
parents b4094424 6087f6d4
......@@ -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'.
......
......@@ -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);
}
}
......
......@@ -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;
......
......@@ -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
......
......@@ -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++) {
......
......@@ -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
......
// -*- 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++) {
......
......@@ -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
......
......@@ -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_;
......
// -*- 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>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment