Loading...
Searching...
No Matches
fastamg.hh
Go to the documentation of this file.
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_ISTL_FASTAMG_HH
#define DUNE_ISTL_FASTAMG_HH
#include <memory>
#include <dune/common/exceptions.hh>
#include <dune/common/typetraits.hh>
#include <dune/istl/paamg/smoother.hh>
#include <dune/istl/paamg/transfer.hh>
#include <dune/istl/paamg/matrixhierarchy.hh>
#include <dune/istl/solvers.hh>
#include <dune/istl/scalarproducts.hh>
#include <dune/istl/superlu.hh>
#include <dune/istl/umfpack.hh>
#include <dune/istl/solvertype.hh>
#include <dune/istl/io.hh>
#include <dune/istl/preconditioners.hh>
#include "fastamgsmoother.hh"
namespace Dune
{
namespace Amg
{
template<class M, class X, class PI=SequentialInformation, class A=std::allocator<X> >
class FastAMG : public Preconditioner<X,X>
{
public:
typedef M Operator;
typedef PI ParallelInformation;
typedef MatrixHierarchy<M, ParallelInformation, A> OperatorHierarchy;
typedef typename OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy;
typedef X Domain;
typedef X Range;
typedef InverseOperator<X,X> CoarseSolver;
FastAMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
const Parameters& parms,
bool symmetric=true);
template<class C>
FastAMG(std::shared_ptr<const Operator> fineOperator,
const C& criterion,
const Parameters& parms=Parameters(),
bool symmetric=true,
const ParallelInformation& pinfo=ParallelInformation());
template<class C>
FastAMG(const Operator& fineOperator,
const C& criterion,
const Parameters& parms=Parameters(),
bool symmetric=true,
const ParallelInformation& pinfo=ParallelInformation())
: FastAMG(stackobject_to_shared_ptr(fineOperator),
criterion, parms, symmetric, pinfo)
{}
FastAMG(const FastAMG& amg);
void pre(Domain& x, Range& b);
void apply(Domain& v, const Range& d);
virtual SolverCategory::Category category() const
{
return SolverCategory::sequential;
}
void post(Domain& x);
template<class A1>
void getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont);
std::size_t levels();
std::size_t maxlevels();
void recalculateHierarchy()
{
matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
}
bool usesDirectCoarseLevelSolver() const;
private:
template<class C>
void createHierarchies(C& criterion,
std::shared_ptr<const Operator> fineOperator,
const PI& pinfo);
struct LevelContext
{
typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix;
typename ParallelInformationHierarchy::Iterator pinfo;
typename OperatorHierarchy::RedistributeInfoList::const_iterator redist;
typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates;
typename Hierarchy<Domain,A>::Iterator lhs;
typename Hierarchy<Domain,A>::Iterator residual;
typename Hierarchy<Range,A>::Iterator rhs;
std::size_t level;
};
void mgc(LevelContext& levelContext, Domain& x, const Range& b);
void presmooth(LevelContext& levelContext, Domain& x, const Range& b);
void postsmooth(LevelContext& levelContext, Domain& x, const Range& b);
void moveToFineLevel(LevelContext& levelContext, bool processedFineLevel,
Domain& fineX);
bool moveToCoarseLevel(LevelContext& levelContext);
void initIteratorsWithFineLevel(LevelContext& levelContext);
std::shared_ptr<OperatorHierarchy> matrices_;
std::shared_ptr<CoarseSolver> solver_;
std::shared_ptr<Hierarchy<Range,A>> rhs_;
std::shared_ptr<Hierarchy<Domain,A>> lhs_;
std::shared_ptr<Hierarchy<Domain,A>> residual_;
using ScalarProduct = Dune::ScalarProduct<X>;
std::shared_ptr<ScalarProduct> scalarProduct_;
std::size_t gamma_;
std::size_t preSteps_;
std::size_t postSteps_;
std::size_t level;
bool buildHierarchy_;
bool symmetric;
bool coarsesolverconverged;
typedef SeqSSOR<typename M::matrix_type,X,X> Smoother;
typedef std::shared_ptr<Smoother> SmootherPointer;
SmootherPointer coarseSmoother_;
std::size_t verbosity_;
};
template<class M, class X, class PI, class A>
FastAMG<M,X,PI,A>::FastAMG(const FastAMG& amg)
: matrices_(amg.matrices_), solver_(amg.solver_),
rhs_(), lhs_(), residual_(), scalarProduct_(amg.scalarProduct_),
gamma_(amg.gamma_), preSteps_(amg.preSteps_), postSteps_(amg.postSteps_),
symmetric(amg.symmetric), coarsesolverconverged(amg.coarsesolverconverged),
coarseSmoother_(amg.coarseSmoother_), verbosity_(amg.verbosity_)
{}
template<class M, class X, class PI, class A>
FastAMG<M,X,PI,A>::FastAMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
const Parameters& parms, bool symmetric_)
: matrices_(stackobject_to_shared_ptr(matrices)), solver_(&coarseSolver),
rhs_(), lhs_(), residual_(), scalarProduct_(),
gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()),
postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
symmetric(symmetric_), coarsesolverconverged(true),
coarseSmoother_(), verbosity_(parms.debugLevel())
{
if(preSteps_>1||postSteps_>1)
{
std::cerr<<"WARNING only one step of smoothing is supported!"<<std::endl;
preSteps_=postSteps_=0;
}
assert(matrices_->isBuilt());
static_assert(std::is_same<PI,SequentialInformation>::value,
"Currently only sequential runs are supported");
}
template<class M, class X, class PI, class A>
template<class C>
FastAMG<M,X,PI,A>::FastAMG(std::shared_ptr<const Operator> fineOperator,
const C& criterion,
const Parameters& parms,
bool symmetric_,
const PI& pinfo)
: solver_(), rhs_(), lhs_(), residual_(), scalarProduct_(), gamma_(parms.getGamma()),
preSteps_(parms.getNoPreSmoothSteps()), postSteps_(parms.getNoPostSmoothSteps()),
buildHierarchy_(true),
symmetric(symmetric_), coarsesolverconverged(true),
coarseSmoother_(), verbosity_(criterion.debugLevel())
{
if(preSteps_>1||postSteps_>1)
{
std::cerr<<"WARNING only one step of smoothing is supported!"<<std::endl;
preSteps_=postSteps_=1;
}
static_assert(std::is_same<PI,SequentialInformation>::value,
"Currently only sequential runs are supported");
// TODO: reestablish compile time checks.
//static_assert(static_cast<int>(PI::category)==static_cast<int>(S::category),
// "Matrix and Solver must match in terms of category!");
createHierarchies(criterion, std::move(fineOperator), pinfo);
}
template<class M, class X, class PI, class A>
template<class C>
void FastAMG<M,X,PI,A>::createHierarchies(C& criterion,
std::shared_ptr<const Operator> fineOperator,
const PI& pinfo)
{
Timer watch;
matrices_ = std::make_shared<OperatorHierarchy>(
std::const_pointer_cast<Operator>(std::move(fineOperator)),
stackobject_to_shared_ptr(const_cast<PI&>(pinfo)));
matrices_->template build<NegateSet<typename PI::OwnerSet> >(criterion);
if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()) {
// We have the carsest level. Create the coarse Solver
typedef typename SmootherTraits<Smoother>::Arguments SmootherArgs;
SmootherArgs sargs;
sargs.iterations = 1;
typename ConstructionTraits<Smoother>::Arguments cargs;
cargs.setArgs(sargs);
if(matrices_->redistributeInformation().back().isSetup()) {
// Solve on the redistributed partitioning
cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat());
cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed());
}else{
cargs.setMatrix(matrices_->matrices().coarsest()->getmat());
cargs.setComm(*matrices_->parallelInformation().coarsest());
}
coarseSmoother_ = ConstructionTraits<Smoother>::construct(cargs);
scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
#if HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK
#if HAVE_SUITESPARSE_UMFPACK
#define DIRECTSOLVER UMFPack
#else
#define DIRECTSOLVER SuperLU
#endif
// Use superlu if we are purely sequential or with only one processor on the coarsest level.
if(std::is_same<ParallelInformation,SequentialInformation>::value // sequential mode
|| matrices_->parallelInformation().coarsest()->communicator().size()==1 //parallel mode and only one processor
|| (matrices_->parallelInformation().coarsest().isRedistributed()
&& matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
&& matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0)) { // redistribute and 1 proc
if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
std::cout<<"Using superlu"<<std::endl;
if(matrices_->parallelInformation().coarsest().isRedistributed())
{
if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
// We are still participating on this level
solver_.reset(new DIRECTSOLVER<typename M::matrix_type>(matrices_->matrices().coarsest().getRedistributed().getmat(), false, false));
else
solver_.reset();
}else
solver_.reset(new DIRECTSOLVER<typename M::matrix_type>(matrices_->matrices().coarsest()->getmat(), false, false));
}else
#undef DIRECTSOLVER
#endif // HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK
{
if(matrices_->parallelInformation().coarsest().isRedistributed())
{
if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
// We are still participating on this level
solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()),
*scalarProduct_,
*coarseSmoother_, 1E-2, 1000, 0));
else
solver_.reset();
}else
solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()),
*scalarProduct_,
*coarseSmoother_, 1E-2, 1000, 0));
}
}
if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
}
template<class M, class X, class PI, class A>
void FastAMG<M,X,PI,A>::pre(Domain& x, Range& b)
{
Timer watch, watch1;
// Detect Matrix rows where all offdiagonal entries are
// zero and set x such that A_dd*x_d=b_d
// Thus users can be more careless when setting up their linear
// systems.
typedef typename M::matrix_type Matrix;
typedef typename Matrix::ConstRowIterator RowIter;
typedef typename Matrix::ConstColIterator ColIter;
typedef typename Matrix::block_type Block;
Block zero;
zero=typename Matrix::field_type();
const Matrix& mat=matrices_->matrices().finest()->getmat();
for(RowIter row=mat.begin(); row!=mat.end(); ++row) {
bool isDirichlet = true;
bool hasDiagonal = false;
ColIter diag;
for(ColIter col=row->begin(); col!=row->end(); ++col) {
if(row.index()==col.index()) {
diag = col;
hasDiagonal = (*col != zero);
}else{
if(*col!=zero)
isDirichlet = false;
}
}
if(isDirichlet && hasDiagonal)
{
if constexpr (Dune::IsNumber<Block>::value)
x[row.index()] = b[row.index()]/(*diag);
else
diag->solve(x[row.index()], b[row.index()]);
}
}
if (verbosity_>0)
std::cout<<" Preprocessing Dirichlet took "<<watch1.elapsed()<<std::endl;
watch1.reset();
// No smoother to make x consistent! Do it by hand
matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
residual_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
matrices_->coarsenVector(*rhs_);
matrices_->coarsenVector(*lhs_);
matrices_->coarsenVector(*residual_);
// The preconditioner might change x and b. So we have to
// copy the changes to the original vectors.
x = *lhs_->finest();
b = *rhs_->finest();
}
template<class M, class X, class PI, class A>
std::size_t FastAMG<M,X,PI,A>::levels()
{
return matrices_->levels();
}
template<class M, class X, class PI, class A>
std::size_t FastAMG<M,X,PI,A>::maxlevels()
{
return matrices_->maxlevels();
}
template<class M, class X, class PI, class A>
void FastAMG<M,X,PI,A>::apply(Domain& v, const Range& d)
{
LevelContext levelContext;
// Init all iterators for the current level
initIteratorsWithFineLevel(levelContext);
assert(v.two_norm()==0);
level=0;
if(matrices_->maxlevels()==1){
// The coarse solver might modify the d!
Range b(d);
mgc(levelContext, v, b);
}else
mgc(levelContext, v, d);
if(postSteps_==0||matrices_->maxlevels()==1)
levelContext.pinfo->copyOwnerToAll(v, v);
}
template<class M, class X, class PI, class A>
void FastAMG<M,X,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
{
levelContext.matrix = matrices_->matrices().finest();
levelContext.pinfo = matrices_->parallelInformation().finest();
levelContext.redist =
matrices_->redistributeInformation().begin();
levelContext.aggregates = matrices_->aggregatesMaps().begin();
levelContext.lhs = lhs_->finest();
levelContext.residual = residual_->finest();
levelContext.rhs = rhs_->finest();
levelContext.level=0;
}
template<class M, class X, class PI, class A>
bool FastAMG<M,X,PI,A>
::moveToCoarseLevel(LevelContext& levelContext)
{
bool processNextLevel=true;
if(levelContext.redist->isSetup()) {
throw "bla";
levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.residual),
levelContext.residual.getRedistributed());
processNextLevel = levelContext.residual.getRedistributed().size()>0;
if(processNextLevel) {
//restrict defect to coarse level right hand side.
++levelContext.pinfo;
Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
static_cast<const Range&>(levelContext.residual.getRedistributed()),
*levelContext.pinfo);
}
}else{
//restrict defect to coarse level right hand side.
++levelContext.rhs;
++levelContext.pinfo;
Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
static_cast<const Range&>(*levelContext.residual), *levelContext.pinfo);
}
if(processNextLevel) {
// prepare coarse system
++levelContext.residual;
++levelContext.lhs;
++levelContext.matrix;
++levelContext.level;
++levelContext.redist;
if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
// next level is not the globally coarsest one
++levelContext.aggregates;
}
// prepare the lhs on the next level
*levelContext.lhs=0;
*levelContext.residual=0;
}
return processNextLevel;
}
template<class M, class X, class PI, class A>
void FastAMG<M,X,PI,A>
::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, Domain& x)
{
if(processNextLevel) {
if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
// previous level is not the globally coarsest one
--levelContext.aggregates;
}
--levelContext.redist;
--levelContext.level;
//prolongate and add the correction (update is in coarse left hand side)
--levelContext.matrix;
--levelContext.residual;
}
typename Hierarchy<Domain,A>::Iterator coarseLhs = levelContext.lhs--;
if(levelContext.redist->isSetup()) {
// Need to redistribute during prolongate
Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
levelContext.lhs.getRedistributed(),
matrices_->getProlongationDampingFactor(),
*levelContext.pinfo, *levelContext.redist);
}else{
Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
matrices_->getProlongationDampingFactor(), *levelContext.pinfo);
// printvector(std::cout, *lhs, "prolongated coarse grid correction", "lhs", 10, 10, 10);
}
if(processNextLevel) {
--levelContext.rhs;
}
}
template<class M, class X, class PI, class A>
void FastAMG<M,X,PI,A>
::presmooth(LevelContext& levelContext, Domain& x, const Range& b)
{
constexpr auto bl = blockLevel<typename M::matrix_type>();
GaussSeidelPresmoothDefect<bl>::apply(levelContext.matrix->getmat(),
x,
*levelContext.residual,
b);
}
template<class M, class X, class PI, class A>
void FastAMG<M,X,PI,A>
::postsmooth(LevelContext& levelContext, Domain& x, const Range& b)
{
constexpr auto bl = blockLevel<typename M::matrix_type>();
GaussSeidelPostsmoothDefect<bl>
::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b);
}
template<class M, class X, class PI, class A>
bool FastAMG<M,X,PI,A>::usesDirectCoarseLevelSolver() const
{
return IsDirectSolver< CoarseSolver>::value;
}
template<class M, class X, class PI, class A>
void FastAMG<M,X,PI,A>::mgc(LevelContext& levelContext, Domain& v, const Range& b){
if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
// Solve directly
InverseOperatorResult res;
res.converged=true; // If we do not compute this flag will not get updated
if(levelContext.redist->isSetup()) {
levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed());
if(levelContext.rhs.getRedistributed().size()>0) {
// We are still participating in the computation
levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
levelContext.rhs.getRedistributed());
solver_->apply(levelContext.lhs.getRedistributed(), levelContext.rhs.getRedistributed(), res);
}
levelContext.redist->redistributeBackward(v, levelContext.lhs.getRedistributed());
levelContext.pinfo->copyOwnerToAll(v, v);
}else{
levelContext.pinfo->copyOwnerToAll(b, b);
solver_->apply(v, const_cast<Range&>(b), res);
}
// printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10);
// printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10);
if (!res.converged)
coarsesolverconverged = false;
}else{
// presmoothing
presmooth(levelContext, v, b);
// printvector(std::cout, *lhs, "update", "u", 10, 10, 10);
// printvector(std::cout, *residual, "post presmooth residual", "r", 10);
#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
bool processNextLevel = moveToCoarseLevel(levelContext);
if(processNextLevel) {
// next level
for(std::size_t i=0; i<gamma_; i++)
mgc(levelContext, *levelContext.lhs, *levelContext.rhs);
}
moveToFineLevel(levelContext, processNextLevel, v);
#else
*lhs=0;
#endif
if(levelContext.matrix == matrices_->matrices().finest()) {
coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
if(!coarsesolverconverged)
DUNE_THROW(MathError, "Coarse solver did not converge");
}
postsmooth(levelContext, v, b);
}
}
template<class M, class X, class PI, class A>
void FastAMG<M,X,PI,A>::post([[maybe_unused]] Domain& x)
{
lhs_=nullptr;
rhs_=nullptr;
residual_=nullptr;
}
template<class M, class X, class PI, class A>
template<class A1>
void FastAMG<M,X,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
{
matrices_->getCoarsestAggregatesOnFinest(cont);
}
} // end namespace Amg
} // end namespace Dune
#endif
preconditioners.hh
Define general preconditioner interface.
solvers.hh
Implementations of the inverse operator interface.
io.hh
Some generic functions for pretty printing vectors and matrices.
fastamgsmoother.hh
matrixhierarchy.hh
Provides a classes representing the hierarchies in AMG.
DIRECTSOLVER
#define DIRECTSOLVER
transfer.hh
Prolongation and restriction for amg.
smoother.hh
Classes for the generic construction and application of the smoothers.
superlu.hh
Classes for using SuperLU with ISTL matrices.
solvertype.hh
Templates characterizing the type of a solver.
scalarproducts.hh
Define base class for scalar product and norm.
umfpack.hh
Classes for using UMFPack with ISTL matrices.
Dune::Amg::SmootherTraits::Arguments
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition smoother.hh:67
Dune::Amg::ConstructionTraits::construct
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
Dune::Amg::presmooth
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
Dune::Amg::ConstructionTraits::Arguments
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
Dune::Amg::postsmooth
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
Dune::Amg::FastAMG::LevelContext::matrix
OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix
The iterator over the matrices.
Definition fastamg.hh:207
Dune::Amg::FastAMG::getCoarsestAggregateNumbers
void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont)
Get the aggregate number of each unknown on the coarsest level.
Definition fastamg.hh:731
Dune::Amg::FastAMG::LevelContext::pinfo
ParallelInformationHierarchy::Iterator pinfo
The iterator over the parallel information.
Definition fastamg.hh:211
Dune::Amg::FastAMG::recalculateHierarchy
void recalculateHierarchy()
Recalculate the matrix hierarchy.
Definition fastamg.hh:173
Dune::Amg::FastAMG::post
void post(Domain &x)
Clean up.
Definition fastamg.hh:722
Dune::Amg::FastAMG::maxlevels
std::size_t maxlevels()
Definition fastamg.hh:508
Dune::Amg::FastAMG::Domain
X Domain
The domain type.
Definition fastamg.hh:77
Dune::Amg::FastAMG::LevelContext::residual
Hierarchy< Domain, A >::Iterator residual
The iterator over the residuals.
Definition fastamg.hh:227
Dune::Amg::FastAMG::category
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category).
Definition fastamg.hh:146
Dune::Amg::FastAMG::OperatorHierarchy
MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy
The operator hierarchy type.
Definition fastamg.hh:72
Dune::Amg::FastAMG::LevelContext::redist
OperatorHierarchy::RedistributeInfoList::const_iterator redist
The iterator over the redistribution information.
Definition fastamg.hh:215
Dune::Amg::FastAMG::Range
X Range
The range type.
Definition fastamg.hh:79
Dune::Amg::FastAMG::ParallelInformation
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition fastamg.hh:70
Dune::Amg::FastAMG::Operator
M Operator
The matrix operator type.
Definition fastamg.hh:63
Dune::Amg::FastAMG::levels
std::size_t levels()
Definition fastamg.hh:503
Dune::Amg::FastAMG::FastAMG
FastAMG(const Operator &fineOperator, const C &criterion, const Parameters &parms=Parameters(), bool symmetric=true, const ParallelInformation &pinfo=ParallelInformation())
Construct an AMG with an inexact coarse solver based on the smoother.
Definition fastamg.hh:125
Dune::Amg::FastAMG::CoarseSolver
InverseOperator< X, X > CoarseSolver
the type of the coarse solver.
Definition fastamg.hh:81
Dune::Amg::FastAMG::usesDirectCoarseLevelSolver
bool usesDirectCoarseLevelSolver() const
Check whether the coarse solver used is a direct solver.
Definition fastamg.hh:659
Dune::Amg::FastAMG::LevelContext::lhs
Hierarchy< Domain, A >::Iterator lhs
The iterator over the left hand side.
Definition fastamg.hh:223
Dune::Amg::FastAMG::LevelContext::rhs
Hierarchy< Range, A >::Iterator rhs
The iterator over the right hand sided.
Definition fastamg.hh:231
Dune::Amg::FastAMG::LevelContext::level
std::size_t level
The level index.
Definition fastamg.hh:235
Dune::Amg::FastAMG::apply
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition fastamg.hh:515
Dune::Amg::FastAMG::ParallelInformationHierarchy
OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy
The parallal data distribution hierarchy type.
Definition fastamg.hh:74
Dune::Amg::FastAMG::pre
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition fastamg.hh:449
Dune::Amg::FastAMG::FastAMG
FastAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const Parameters &parms, bool symmetric=true)
Construct a new amg with a specific coarse solver.
Definition fastamg.hh:320
Dune::Amg::FastAMG::LevelContext::aggregates
OperatorHierarchy::AggregatesMapList::const_iterator aggregates
The iterator over the aggregates maps.
Definition fastamg.hh:219
Dune
Definition allocator.hh:11
Dune::createScalarProduct
std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, SolverCategory::Category category)
Definition scalarproducts.hh:242
Dune::col
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
Dune::blockLevel
constexpr std::size_t blockLevel()
Determine the block level of a possibly nested vector/matrix type.
Definition blocklevel.hh:176
Dune::Amg
Definition novlpschwarz.hh:256
Dune::Matrix
A generic dynamic dense matrix.
Definition matrix.hh:561
Dune::Matrix::ConstRowIterator
MatrixImp::DenseMatrixBase< T, A >::ConstIterator ConstRowIterator
Const iterator over the matrix rows.
Definition matrix.hh:586
Dune::Matrix::end
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:616
Dune::Matrix::begin
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:610
Dune::Matrix::field_type
typename Imp::BlockTraits< T >::field_type field_type
Export the type representing the underlying field.
Definition matrix.hh:565
Dune::Matrix::ConstColIterator
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
Dune::Matrix::block_type
T block_type
Export the type representing the components.
Definition matrix.hh:568
Dune::Amg::FastAMG
A fast (sequential) algebraic multigrid based on agglomeration that saves memory bandwidth.
Definition fastamg.hh:60
Dune::Amg::GaussSeidelPresmoothDefect::apply
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:20
Dune::Amg::GaussSeidelPostsmoothDefect
Definition fastamgsmoother.hh:67
Dune::Amg::Hierarchy< ParallelInformation, Allocator >::Iterator
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Definition hierarchy.hh:220
Dune::Amg::MatrixHierarchy
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
Dune::Amg::MatrixHierarchy< M, ParallelInformation, A >::ParallelInformationHierarchy
Dune::Amg::Hierarchy< ParallelInformation, Allocator > ParallelInformationHierarchy
Definition matrixhierarchy.hh:82
Dune::Amg::Parameters
All parameters for AMG.
Definition parameters.hh:416
Dune::Amg::Transfer
Definition transfer.hh:32
Dune::Preconditioner
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
Dune::SeqSSOR
Sequential SSOR preconditioner.
Definition preconditioners.hh:142
Dune::ScalarProduct
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
Dune::InverseOperatorResult
Statistics about the application of an inverse operator.
Definition solver.hh:50
Dune::InverseOperatorResult::converged
bool converged
True if convergence criterion has been met.
Definition solver.hh:75
Dune::InverseOperator
Abstract base class for all solvers.
Definition solver.hh:101
Dune::SolverCategory::Category
Category
Definition solvercategory.hh:23
Dune::SolverCategory::sequential
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
Dune::IsDirectSolver::value
@ value
Whether this is a direct solver.
Definition solvertype.hh:24