Skip to content
Snippets Groups Projects
Commit 0269ed9f authored by oliver.sander_at_tu-dresden.de's avatar oliver.sander_at_tu-dresden.de
Browse files

Remove the deprecated files blockgsstep.hh and blockgsstep.cc

parent 5272497a
No related branches found
No related tags found
1 merge request!46Remove deprecated stuff from tests
...@@ -4,4 +4,5 @@ ...@@ -4,4 +4,5 @@
## Deprecations and removals ## Deprecations and removals
- ... - The file `blockgsstep.hh` has been removed after four years of deprecation. Use the replacement
in `blockgssteps.hh` instead.
install(FILES install(FILES
amgstep.hh amgstep.hh
blockgsstep.cc
blockgsstep.hh
blockgssteps.hh blockgssteps.hh
cgstep.cc cgstep.cc
cgstep.hh cgstep.hh
......
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=8 sw=4 sts=4:
#include <cassert>
#include <dune/matrix-vector/axpy.hh>
template<class MatrixType, class DiscFuncType, class BitVectorType>
inline
void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::
residual(int index, VectorBlock& r) const
{
r = (*this->rhs_)[index];
const auto& row = (*this->mat_)[index];
for (auto cIt = row.begin(); cIt!=row.end(); ++cIt) {
// r_i -= A_ij x_j
Dune::MatrixVector::subtractProduct(r, *cIt, (*this->x_)[cIt.index()]);
}
}
template<class MatrixType, class DiscFuncType, class BitVectorType>
inline
void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::iterate()
{
assert(this->hasIgnore());
if (gs_type_ != Direction::BACKWARD)
for (std::size_t i=0; i<this->x_->size(); i++)
iterate_step(i);
if (gs_type_ != Direction::FORWARD)
for (std::size_t i=this->x_->size()-1; i>=0 && i<this->x_->size(); i--)
iterate_step(i);
}
template<class MatrixType, class DiscFuncType, class BitVectorType>
inline
void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::iterate_step(int i)
{
auto const &ignore_i = this->ignore()[i];
if (ignore_i.all())
return;
VectorBlock r;
residual(i, r);
const auto& mat_ii = (*this->mat_)[i][i];
// Compute correction v = A_{i,i}^{-1} r[i]
VectorBlock v;
if (ignore_i.none()) {
// No degree of freedom shall be ignored --> solve linear problem
mat_ii.solve(v, r);
} else {
// Copy the matrix and adjust rhs and matrix so that dofs given in ignoreNodes[i]
// are not touched
typename MatrixType::block_type matRes;
for (int j = 0; j < BlockSize; ++j) {
if (ignore_i[j]) {
r[j] = 0;
for (int k = 0; k < BlockSize; ++k)
matRes[j][k] = (k == j);
} else
matRes[j] = mat_ii[j];
}
matRes.solve(v, r);
}
// Add correction
VectorBlock& x = (*this->x_)[i];
x += v;
}
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=8 sw=4 sts=4:
#ifndef DUNE_BLOCK_GAUSS_SEIDEL_STEP_HH
#define DUNE_BLOCK_GAUSS_SEIDEL_STEP_HH
#warning This header is deprecated. Please use Dune::Solvers::BlockGSStep from blockgssteps.hh instead of ::BlockGSStep. See also gssteptest.cc for usage examples.
#include <dune/common/bitsetvector.hh>
#include "lineariterationstep.hh"
/** \brief A linear Gauß-Seidel iteration step for convex problems which have a block-structure.
*
* \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 MatrixType,
class DiscFuncType,
class BitVectorType = Dune::BitSetVector<DiscFuncType::block_type::dimension> >
class BlockGSStep : public LinearIterationStep<MatrixType, DiscFuncType, BitVectorType>
{
using VectorBlock = typename DiscFuncType::block_type;
enum {BlockSize = VectorBlock::dimension};
public:
enum Direction { FORWARD, BACKWARD, SYMMETRIC };
//! Default constructor.
BlockGSStep(Direction gs_type = FORWARD)
: gs_type_(gs_type)
{}
//! Constructor with a linear problem
BlockGSStep(const MatrixType& mat, DiscFuncType& x, const DiscFuncType& rhs, Direction gs_type = FORWARD)
: LinearIterationStep<MatrixType,DiscFuncType>(mat, x, rhs), gs_type_(gs_type)
{}
//! Perform one iteration
virtual void iterate();
/** \brief Compute the residual of the current iterate of a (block) degree of freedom
*
* \param index Global index of the (block) degree of freedom
* \param r Write residual in this vector
*/
virtual void residual(int index, VectorBlock& r) const;
protected:
const Direction gs_type_;
void iterate_step(int i);
};
#include "blockgsstep.cc"
#endif
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <dune/common/stringutility.hh> #include <dune/common/stringutility.hh>
#include <dune/solvers/solvers/loopsolver.hh> #include <dune/solvers/solvers/loopsolver.hh>
#include <dune/solvers/iterationsteps/blockgsstep.hh>
#include <dune/solvers/iterationsteps/projectedblockgsstep.hh> #include <dune/solvers/iterationsteps/projectedblockgsstep.hh>
#include <dune/solvers/iterationsteps/blockgssteps.hh> #include <dune/solvers/iterationsteps/blockgssteps.hh>
#include <dune/solvers/iterationsteps/truncatedblockgsstep.hh> #include <dune/solvers/iterationsteps/truncatedblockgsstep.hh>
...@@ -102,14 +101,9 @@ struct GSTestSuite { ...@@ -102,14 +101,9 @@ struct GSTestSuite {
}; };
{ {
BlockGSStep<Matrix, Vector> gsStep;
test(&gsStep, "BlockGS");
}
{
BlockGSStep<Matrix, Vector> gsStep1;
auto gsStep2 = Dune::Solvers::BlockGSStepFactory<Matrix, Vector>::create( auto gsStep2 = Dune::Solvers::BlockGSStepFactory<Matrix, Vector>::create(
Dune::Solvers::BlockGS::LocalSolvers::direct(0.0)); Dune::Solvers::BlockGS::LocalSolvers::direct(0.0));
diffTest(&gsStep1, "BlockGS", &gsStep2, "Dune::Solvers::BlockGS(Direct)"); test(&gsStep2, "Dune::Solvers::BlockGS(Direct)");
} }
{ {
TruncatedBlockGSStep<Matrix, Vector> gsStep1(1); TruncatedBlockGSStep<Matrix, Vector> gsStep1(1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment