1#ifndef TWO_LEVEL_SCHWARZ_HH
2#define TWO_LEVEL_SCHWARZ_HH
4#if HAVE_SUITESPARSE_UMFPACK
8#include "coarsespace.hh"
17 template<
class GFS,
class M,
class X,
class Y>
18 class TwoLevelOverlappingAdditiveSchwarz
22 typedef Dune::PDELab::Backend::Native<M> ISTLM;
40 TwoLevelOverlappingAdditiveSchwarz (
const GFS& gfs,
const M& AF, std::shared_ptr<
CoarseSpace<X> > coarse_space,
bool coarse_space_active =
true,
int verbosity = 0)
41 : verbosity_(verbosity),
42 coarse_space_active_(coarse_space_active),
44 solverf_(
Dune::PDELab::Backend::native(AF),false),
45 coarse_space_(coarse_space),
46 coarse_solver_ (*coarse_space_->get_coarse_system()),
47 coarse_defect_(coarse_space_->basis_size(), coarse_space_->basis_size()),
48 prolongated_(gfs_, 0.0)
56 virtual void pre (X& x, Y& b)
64 virtual void apply (X& v,
const Y& d)
69 solverf_.apply(v,b,result);
71 if (!coarse_space_active_) {
73 Dune::PDELab::AddDataHandle<GFS,X> adddh(gfs_,v);
79 gfs_.gridView().comm().barrier();
82 coarse_space_->restrict (d, coarse_defect_);
86 COARSE_V v0(coarse_space_->basis_size(),coarse_space_->basis_size());
87 coarse_solver_.apply(v0, coarse_defect_, result);
90 coarse_space_->prolongate(v0, prolongated_);
93 coarse_time_ += timer_coarse_solve.
elapsed();
96 Dune::PDELab::AddDataHandle<GFS,X> result_addh(gfs_,v);
106 virtual void post (X& x) {
107 if (verbosity_ > 0) std::cout <<
"Coarse time CT=" << coarse_time_ << std::endl;
108 if (verbosity_ > 0) std::cout <<
"Coarse time per apply CTA=" << coarse_time_ / apply_calls_ << std::endl;
113 bool coarse_space_active_;
115 double coarse_time_ = 0.0;
116 int apply_calls_ = 0;
120 std::shared_ptr<CoarseSpace<X> > coarse_space_;
Representation of a coarse space intended for two-level Schwarz preconditioners.
Definition: coarsespace.hh:8
A sparse block matrix with compressed row storage.
Definition: bcrsmatrix.hh:466
A vector of blocks with memory management.
Definition: bvector.hh:395
Base class for matrix free definition of preconditioners.
Definition: preconditioner.hh:32
A simple stop watch.
Definition: timer.hh:43
double elapsed() const noexcept
Get elapsed user-time from last reset until now/last stop in seconds.
Definition: timer.hh:77
Dune namespace.
Definition: alignedallocator.hh:13
Statistics about the application of an inverse operator.
Definition: solver.hh:48
Category
Definition: solvercategory.hh:23
@ overlapping
Category for overlapping solvers.
Definition: solvercategory.hh:29