dune-istl  2.8.0
smoother.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_AMGSMOOTHER_HH
4 #define DUNE_AMGSMOOTHER_HH
5 
9 #include <dune/istl/schwarz.hh>
11 #include <dune/common/propertymap.hh>
12 
13 namespace Dune
14 {
15  namespace Amg
16  {
17 
33  template<class T>
35  {
39  typedef T RelaxationFactor;
40 
49 
54  : iterations(1), relaxationFactor(1.0)
55  {}
56  };
57 
61  template<class T>
63  {
65 
66  };
67 
68  template<class X, class Y>
70  {
72 
73  };
74 
75  template<class X, class Y, class C, class T>
77  : public SmootherTraits<T>
78  {};
79 
80  template<class C, class T>
82  : public SmootherTraits<T>
83  {};
84 
88  template<class T>
90  {
91  typedef typename T::matrix_type Matrix;
92 
94 
96 
97  public:
99  {}
100 
101  void setMatrix(const Matrix& matrix)
102  {
103  matrix_=&matrix;
104  }
105  virtual void setMatrix(const Matrix& matrix, [[maybe_unused]] const AggregatesMap& amap)
106  {
107  setMatrix(matrix);
108  }
109 
110 
111  const Matrix& getMatrix() const
112  {
113  return *matrix_;
114  }
115 
116  void setArgs(const SmootherArgs& args)
117  {
118  args_=&args;
119  }
120 
121  template<class T1>
122  void setComm([[maybe_unused]] T1& comm)
123  {}
124 
126  {
127  return comm_;
128  }
129 
130  const SmootherArgs getArgs() const
131  {
132  return *args_;
133  }
134 
135  protected:
136  const Matrix* matrix_;
137  private:
138  const SmootherArgs* args_;
139  SequentialInformation comm_;
140  };
141 
142  template<class T>
144  : public DefaultConstructionArgs<T>
145  {};
146 
147  template<class T, class C=SequentialInformation>
149  : public ConstructionArgs<T>
150  {
151  public:
153  {}
154 
155  void setComm(const C& comm)
156  {
157  comm_ = &comm;
158  }
159 
160  const C& getComm() const
161  {
162  return *comm_;
163  }
164  private:
165  const C* comm_;
166  };
167 
168 
169  template<class X, class Y>
171  {
172  typedef Richardson<X,Y> T;
173 
175 
176  public:
178  {}
179 
180  template <class... Args>
181  void setMatrix(const Args&...)
182  {}
183 
184  void setArgs(const SmootherArgs& args)
185  {
186  args_=&args;
187  }
188 
189  template<class T1>
190  void setComm([[maybe_unused]] T1& comm)
191  {}
192 
194  {
195  return comm_;
196  }
197 
198  const SmootherArgs getArgs() const
199  {
200  return *args_;
201  }
202 
203  private:
204  const SmootherArgs* args_;
205  SequentialInformation comm_;
206  };
207 
208 
209 
210  template<class T>
211  struct ConstructionTraits;
212 
216  template<class M, class X, class Y, int l>
217  struct ConstructionTraits<SeqSSOR<M,X,Y,l> >
218  {
220 
221  static inline std::shared_ptr<SeqSSOR<M,X,Y,l>> construct(Arguments& args)
222  {
223  return std::make_shared<SeqSSOR<M,X,Y,l>>
224  (args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor);
225  }
226  };
227 
228 
232  template<class M, class X, class Y, int l>
233  struct ConstructionTraits<SeqSOR<M,X,Y,l> >
234  {
236 
237  static inline std::shared_ptr<SeqSOR<M,X,Y,l>> construct(Arguments& args)
238  {
239  return std::make_shared<SeqSOR<M,X,Y,l>>
240  (args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor);
241  }
242  };
243 
244 
248  template<class M, class X, class Y, int l>
249  struct ConstructionTraits<SeqJac<M,X,Y,l> >
250  {
252 
253  static inline std::shared_ptr<SeqJac<M,X,Y,l>> construct(Arguments& args)
254  {
255  return std::make_shared<SeqJac<M,X,Y,l>>
256  (args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor);
257  }
258  };
259 
263  template<class X, class Y>
265  {
267 
268  static inline std::shared_ptr<Richardson<X,Y>> construct(Arguments& args)
269  {
270  return std::make_shared<Richardson<X,Y>>
271  (args.getArgs().relaxationFactor);
272  }
273  };
274 
275 
276  template<class M, class X, class Y>
277  class ConstructionArgs<SeqILU<M,X,Y> >
278  : public DefaultConstructionArgs<SeqILU<M,X,Y> >
279  {
280  public:
282  : n_(n)
283  {}
284 
285  void setN(int n)
286  {
287  n_ = n;
288  }
289 
290  int getN()
291  {
292  return n_;
293  }
294 
295  private:
296  int n_;
297  };
298 
299 
303  template<class M, class X, class Y>
304  struct ConstructionTraits<SeqILU<M,X,Y> >
305  {
307 
308  static inline std::shared_ptr<SeqILU<M,X,Y>> construct(Arguments& args)
309  {
310  return std::make_shared<SeqILU<M,X,Y>>
311  (args.getMatrix(), args.getN(), args.getArgs().relaxationFactor);
312  }
313  };
314 
318  template<class M, class X, class Y, class C>
319  struct ConstructionTraits<ParSSOR<M,X,Y,C> >
320  {
322 
323  static inline std::shared_ptr<ParSSOR<M,X,Y,C>> construct(Arguments& args)
324  {
325  return std::make_shared<ParSSOR<M,X,Y,C>>
326  (args.getMatrix(), args.getArgs().iterations,
327  args.getArgs().relaxationFactor, args.getComm());
328  }
329  };
330 
331  template<class X, class Y, class C, class T>
333  {
336  static inline std::shared_ptr<BlockPreconditioner<X,Y,C,T>> construct(Arguments& args)
337  {
338  auto seqPrec = SeqConstructionTraits::construct(args);
339  return std::make_shared<BlockPreconditioner<X,Y,C,T>> (seqPrec, args.getComm());
340  }
341  };
342 
343  template<class C, class T>
345  {
348  static inline std::shared_ptr<NonoverlappingBlockPreconditioner<C,T>> construct(Arguments& args)
349  {
350  auto seqPrec = SeqConstructionTraits::construct(args);
351  return std::make_shared<NonoverlappingBlockPreconditioner<C,T>> (seqPrec, args.getComm());
352  }
353  };
354 
365  template<class T>
367  {
368  typedef T Smoother;
369  typedef typename Smoother::range_type Range;
370  typedef typename Smoother::domain_type Domain;
371 
379  static void preSmooth(Smoother& smoother, Domain& v, const Range& d)
380  {
381  smoother.apply(v,d);
382  }
383 
391  static void postSmooth(Smoother& smoother, Domain& v, const Range& d)
392  {
393  smoother.apply(v,d);
394  }
395  };
396 
402  template<typename LevelContext>
403  void presmooth(LevelContext& levelContext, size_t steps)
404  {
405  for(std::size_t i=0; i < steps; ++i) {
406  *levelContext.lhs=0;
408  ::preSmooth(*levelContext.smoother, *levelContext.lhs,
409  *levelContext.rhs);
410  // Accumulate update
411  *levelContext.update += *levelContext.lhs;
412 
413  // update defect
414  levelContext.matrix->applyscaleadd(-1, *levelContext.lhs, *levelContext.rhs);
415  levelContext.pinfo->project(*levelContext.rhs);
416  }
417  }
418 
424  template<typename LevelContext>
425  void postsmooth(LevelContext& levelContext, size_t steps)
426  {
427  for(std::size_t i=0; i < steps; ++i) {
428  // update defect
429  levelContext.matrix->applyscaleadd(-1, *levelContext.lhs,
430  *levelContext.rhs);
431  *levelContext.lhs=0;
432  levelContext.pinfo->project(*levelContext.rhs);
434  ::postSmooth(*levelContext.smoother, *levelContext.lhs, *levelContext.rhs);
435  // Accumulate update
436  *levelContext.update += *levelContext.lhs;
437  }
438  }
439 
440  template<class M, class X, class Y, int l>
441  struct SmootherApplier<SeqSOR<M,X,Y,l> >
442  {
444  typedef typename Smoother::range_type Range;
445  typedef typename Smoother::domain_type Domain;
446 
447  static void preSmooth(Smoother& smoother, Domain& v, Range& d)
448  {
449  smoother.template apply<true>(v,d);
450  }
451 
452 
453  static void postSmooth(Smoother& smoother, Domain& v, Range& d)
454  {
455  smoother.template apply<false>(v,d);
456  }
457  };
458 
459  template<class M, class X, class Y, class C, int l>
460  struct SmootherApplier<BlockPreconditioner<X,Y,C,SeqSOR<M,X,Y,l> > >
461  {
463  typedef typename Smoother::range_type Range;
464  typedef typename Smoother::domain_type Domain;
465 
466  static void preSmooth(Smoother& smoother, Domain& v, Range& d)
467  {
468  smoother.template apply<true>(v,d);
469  }
470 
471 
472  static void postSmooth(Smoother& smoother, Domain& v, Range& d)
473  {
474  smoother.template apply<false>(v,d);
475  }
476  };
477 
478  template<class M, class X, class Y, class C, int l>
480  {
482  typedef typename Smoother::range_type Range;
483  typedef typename Smoother::domain_type Domain;
484 
485  static void preSmooth(Smoother& smoother, Domain& v, Range& d)
486  {
487  smoother.template apply<true>(v,d);
488  }
489 
490 
491  static void postSmooth(Smoother& smoother, Domain& v, Range& d)
492  {
493  smoother.template apply<false>(v,d);
494  }
495  };
496 
497  } // end namespace Amg
498 
499  // forward declarations
500  template<class M, class X, class MO, class MS, class A>
501  class SeqOverlappingSchwarz;
502 
503  struct MultiplicativeSchwarzMode;
504 
505  namespace Amg
506  {
507  template<class M, class X, class MS, class TA>
509  MS,TA> >
510  {
512  typedef typename Smoother::range_type Range;
513  typedef typename Smoother::domain_type Domain;
514 
515  static void preSmooth(Smoother& smoother, Domain& v, const Range& d)
516  {
517  smoother.template apply<true>(v,d);
518  }
519 
520 
521  static void postSmooth(Smoother& smoother, Domain& v, const Range& d)
522  {
523  smoother.template apply<false>(v,d);
524 
525  }
526  };
527 
528  // template<class M, class X, class TM, class TA>
529  // class SeqOverlappingSchwarz;
530 
531  template<class T>
533  : public DefaultSmootherArgs<T>
534  {
536 
538  bool onthefly;
539 
541  bool onthefly_=false)
542  : overlap(overlap_), onthefly(onthefly_)
543  {}
544  };
545 
546  template<class M, class X, class TM, class TS, class TA>
547  struct SmootherTraits<SeqOverlappingSchwarz<M,X,TM,TS,TA> >
548  {
550  };
551 
552  template<class M, class X, class TM, class TS, class TA>
554  : public DefaultConstructionArgs<SeqOverlappingSchwarz<M,X,TM,TS,TA> >
555  {
557 
558  public:
563  typedef typename Vector::value_type Subdomain;
564 
565  virtual void setMatrix(const M& matrix, const AggregatesMap& amap)
566  {
567  Father::setMatrix(matrix);
568 
569  std::vector<bool> visited(amap.noVertices(), false);
570  typedef IteratorPropertyMap<std::vector<bool>::iterator,IdentityMap> VisitedMapType;
571  VisitedMapType visitedMap(visited.begin());
572 
573  MatrixGraph<const M> graph(matrix);
574 
576 
577  switch(Father::getArgs().overlap) {
578  case SmootherArgs::vertex :
579  {
580  VertexAdder visitor(subdomains, amap);
581  createSubdomains(matrix, graph, amap, visitor, visitedMap);
582  }
583  break;
584  case SmootherArgs::pairwise :
585  {
586  createPairDomains(graph);
587  }
588  break;
589  case SmootherArgs::aggregate :
590  {
591  AggregateAdder<VisitedMapType> visitor(subdomains, amap, graph, visitedMap);
592  createSubdomains(matrix, graph, amap, visitor, visitedMap);
593  }
594  break;
595  case SmootherArgs::none :
596  NoneAdder visitor;
597  createSubdomains(matrix, graph, amap, visitor, visitedMap);
598  break;
599  default :
600  DUNE_THROW(NotImplemented, "This overlapping scheme is not supported!");
601  }
602  }
603  void setMatrix(const M& matrix)
604  {
605  Father::setMatrix(matrix);
606 
607  /* Create aggregates map where each aggregate is just one vertex. */
608  AggregatesMap amap(matrix.N());
609  VertexDescriptor v=0;
610  for(typename AggregatesMap::iterator iter=amap.begin();
611  iter!=amap.end(); ++iter)
612  *iter=v++;
613 
614  std::vector<bool> visited(amap.noVertices(), false);
615  typedef IteratorPropertyMap<std::vector<bool>::iterator,IdentityMap> VisitedMapType;
616  VisitedMapType visitedMap(visited.begin());
617 
618  MatrixGraph<const M> graph(matrix);
619 
621 
622  switch(Father::getArgs().overlap) {
623  case SmootherArgs::vertex :
624  {
625  VertexAdder visitor(subdomains, amap);
626  createSubdomains(matrix, graph, amap, visitor, visitedMap);
627  }
628  break;
629  case SmootherArgs::aggregate :
630  {
631  DUNE_THROW(NotImplemented, "Aggregate overlap is not supported yet");
632  /*
633  AggregateAdder<VisitedMapType> visitor(subdomains, amap, graph, visitedMap);
634  createSubdomains(matrix, graph, amap, visitor, visitedMap);
635  */
636  }
637  break;
638  case SmootherArgs::pairwise :
639  {
640  createPairDomains(graph);
641  }
642  break;
643  case SmootherArgs::none :
644  NoneAdder visitor;
645  createSubdomains(matrix, graph, amap, visitor, visitedMap);
646 
647  }
648  }
649 
651  {
652  return subdomains;
653  }
654 
655  private:
656  struct VertexAdder
657  {
658  VertexAdder(Vector& subdomains_, const AggregatesMap& aggregates_)
659  : subdomains(subdomains_), max(-1), subdomain(-1), aggregates(aggregates_)
660  {}
661  template<class T>
662  void operator()(const T& edge)
663  {
664  if(aggregates[edge.target()]!=AggregatesMap::ISOLATED)
665  subdomains[subdomain].insert(edge.target());
666  }
667  int setAggregate(const AggregateDescriptor& aggregate_)
668  {
669  subdomain=aggregate_;
670  max = std::max(subdomain, aggregate_);
671  return subdomain;
672  }
673  int noSubdomains() const
674  {
675  return max+1;
676  }
677  private:
678  Vector& subdomains;
680  AggregateDescriptor subdomain;
681  const AggregatesMap& aggregates;
682  };
683  struct NoneAdder
684  {
685  template<class T>
686  void operator()(const T& edge)
687  {}
688  int setAggregate(const AggregateDescriptor& aggregate_)
689  {
690  return -1;
691  }
692  int noSubdomains() const
693  {
694  return -1;
695  }
696  };
697 
698  template<class VM>
699  struct AggregateAdder
700  {
701  AggregateAdder(Vector& subdomains_, const AggregatesMap& aggregates_,
702  const MatrixGraph<const M>& graph_, VM& visitedMap_)
703  : subdomains(subdomains_), subdomain(-1), aggregates(aggregates_),
704  adder(subdomains_, aggregates_), graph(graph_), visitedMap(visitedMap_)
705  {}
706  template<class T>
707  void operator()(const T& edge)
708  {
709  subdomains[subdomain].insert(edge.target());
710  // If we (the neighbouring vertex of the aggregate)
711  // are not isolated, add the aggregate we belong to
712  // to the same subdomain using the OneOverlapAdder
713  if(aggregates[edge.target()]!=AggregatesMap::ISOLATED) {
714  assert(aggregates[edge.target()]!=aggregate);
715  typename AggregatesMap::VertexList vlist;
716  aggregates.template breadthFirstSearch<true,false>(edge.target(), aggregate,
717  graph, vlist, adder, adder,
718  visitedMap);
719  }
720  }
721 
722  int setAggregate(const AggregateDescriptor& aggregate_)
723  {
724  adder.setAggregate(aggregate_);
725  aggregate=aggregate_;
726  return ++subdomain;
727  }
728  int noSubdomains() const
729  {
730  return subdomain+1;
731  }
732 
733  private:
734  AggregateDescriptor aggregate;
735  Vector& subdomains;
736  int subdomain;
737  const AggregatesMap& aggregates;
738  VertexAdder adder;
739  const MatrixGraph<const M>& graph;
740  VM& visitedMap;
741  };
742 
743  void createPairDomains(const MatrixGraph<const M>& graph)
744  {
745  typedef typename MatrixGraph<const M>::ConstVertexIterator VIter;
746  typedef typename MatrixGraph<const M>::ConstEdgeIterator EIter;
747  typedef typename M::size_type size_type;
748 
749  std::set<std::pair<size_type,size_type> > pairs;
750  int total=0;
751  for(VIter v=graph.begin(), ve=graph.end(); ve != v; ++v)
752  for(EIter e = v.begin(), ee=v.end(); ee!=e; ++e)
753  {
754  ++total;
755  if(e.source()<e.target())
756  pairs.insert(std::make_pair(e.source(),e.target()));
757  else
758  pairs.insert(std::make_pair(e.target(),e.source()));
759  }
760 
761 
762  subdomains.resize(pairs.size());
763  Dune::dinfo <<std::endl<< "Created "<<pairs.size()<<" ("<<total<<") pair domains"<<std::endl<<std::endl;
764  typedef typename std::set<std::pair<size_type,size_type> >::const_iterator SIter;
765  typename Vector::iterator subdomain=subdomains.begin();
766 
767  for(SIter s=pairs.begin(), se =pairs.end(); se!=s; ++s)
768  {
769  subdomain->insert(s->first);
770  subdomain->insert(s->second);
771  ++subdomain;
772  }
773  std::size_t minsize=10000;
774  std::size_t maxsize=0;
775  int sum=0;
776  for(typename Vector::size_type i=0; i < subdomains.size(); ++i) {
777  sum+=subdomains[i].size();
778  minsize=std::min(minsize, subdomains[i].size());
779  maxsize=std::max(maxsize, subdomains[i].size());
780  }
781  Dune::dinfo<<"Subdomain size: min="<<minsize<<" max="<<maxsize<<" avg="<<(sum/subdomains.size())
782  <<" no="<<subdomains.size()<<std::endl;
783  }
784 
785  template<class Visitor>
786  void createSubdomains(const M& matrix, const MatrixGraph<const M>& graph,
787  const AggregatesMap& amap, Visitor& overlapVisitor,
788  IteratorPropertyMap<std::vector<bool>::iterator,IdentityMap>& visitedMap )
789  {
790  // count number ag aggregates. We assume that the
791  // aggregates are numbered consecutively from 0 except
792  // for the isolated ones. All isolated vertices form
793  // one aggregate, here.
794  int isolated=0;
795  AggregateDescriptor maxAggregate=0;
796 
797  for(std::size_t i=0; i < amap.noVertices(); ++i)
798  if(amap[i]==AggregatesMap::ISOLATED)
799  isolated++;
800  else
801  maxAggregate = std::max(maxAggregate, amap[i]);
802 
803  subdomains.resize(maxAggregate+1+isolated);
804 
805  // reset the subdomains
806  for(typename Vector::size_type i=0; i < subdomains.size(); ++i)
807  subdomains[i].clear();
808 
809  // Create the subdomains from the aggregates mapping.
810  // For each aggregate we mark all entries and the
811  // neighbouring vertices as belonging to the same subdomain
812  VertexAdder aggregateVisitor(subdomains, amap);
813 
814  for(VertexDescriptor i=0; i < amap.noVertices(); ++i)
815  if(!get(visitedMap, i)) {
816  AggregateDescriptor aggregate=amap[i];
817 
818  if(amap[i]==AggregatesMap::ISOLATED) {
819  // isolated vertex gets its own aggregate
820  subdomains.push_back(Subdomain());
821  aggregate=subdomains.size()-1;
822  }
823  overlapVisitor.setAggregate(aggregate);
824  aggregateVisitor.setAggregate(aggregate);
825  subdomains[aggregate].insert(i);
826  typename AggregatesMap::VertexList vlist;
827  amap.template breadthFirstSearch<false,false>(i, aggregate, graph, vlist, aggregateVisitor,
828  overlapVisitor, visitedMap);
829  }
830 
831  std::size_t minsize=10000;
832  std::size_t maxsize=0;
833  int sum=0;
834  for(typename Vector::size_type i=0; i < subdomains.size(); ++i) {
835  sum+=subdomains[i].size();
836  minsize=std::min(minsize, subdomains[i].size());
837  maxsize=std::max(maxsize, subdomains[i].size());
838  }
839  Dune::dinfo<<"Subdomain size: min="<<minsize<<" max="<<maxsize<<" avg="<<(sum/subdomains.size())
840  <<" no="<<subdomains.size()<<" isolated="<<isolated<<std::endl;
841 
842 
843 
844  }
845  Vector subdomains;
846  };
847 
848 
849  template<class M, class X, class TM, class TS, class TA>
851  {
853 
854  static inline std::shared_ptr<SeqOverlappingSchwarz<M,X,TM,TS,TA>> construct(Arguments& args)
855  {
856  return std::make_shared<SeqOverlappingSchwarz<M,X,TM,TS,TA>>
857  (args.getMatrix(),
858  args.getSubDomains(),
859  args.getArgs().relaxationFactor,
860  args.getArgs().onthefly);
861  }
862  };
863 
864 
865  } // namespace Amg
866 } // namespace Dune
867 
868 
869 
870 #endif
Provides classes for the Coloring process of AMG.
Helper classes for the construction of classes without empty constructor.
Define general preconditioner interface.
const Matrix & getMatrix() const
Definition: smoother.hh:111
DefaultSmootherArgs< typename X::field_type > Arguments
Definition: smoother.hh:71
static std::shared_ptr< SeqILU< M, X, Y > > construct(Arguments &args)
Definition: smoother.hh:308
static void postSmooth(Smoother &smoother, Domain &v, Range &d)
Definition: smoother.hh:491
const SequentialInformation & getComm()
Definition: smoother.hh:193
static void preSmooth(Smoother &smoother, Domain &v, const Range &d)
Definition: smoother.hh:515
ConstructionArgs< SeqILU< M, X, Y > > Arguments
Definition: smoother.hh:306
int setAggregate(const AggregateDescriptor &aggregate_)
Definition: smoother.hh:688
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition: smoother.hh:64
int setAggregate(const AggregateDescriptor &aggregate_)
Definition: smoother.hh:667
ConstructionTraits< T > SeqConstructionTraits
Definition: smoother.hh:347
void setArgs(const SmootherArgs &args)
Definition: smoother.hh:116
ConstructionArgs< SeqOverlappingSchwarz< M, X, TM, TS, TA > > Arguments
Definition: smoother.hh:852
NonoverlappingBlockPreconditioner< C, SeqSOR< M, X, Y, l > > Smoother
Definition: smoother.hh:481
static void postSmooth(Smoother &smoother, Domain &v, Range &d)
Definition: smoother.hh:453
AggregateAdder(Vector &subdomains_, const AggregatesMap &aggregates_, const MatrixGraph< const M > &graph_, VM &visitedMap_)
Definition: smoother.hh:701
void setComm(const C &comm)
Definition: smoother.hh:155
DefaultConstructionArgs< Richardson< X, Y > > Arguments
Definition: smoother.hh:266
virtual ~DefaultConstructionArgs()
Definition: smoother.hh:177
SeqOverlappingSchwarzSmootherArgs< typename M::field_type > Arguments
Definition: smoother.hh:549
static void preSmooth(Smoother &smoother, Domain &v, Range &d)
Definition: smoother.hh:485
int getN()
Definition: smoother.hh:290
SeqSOR< M, X, Y, l > Smoother
Definition: smoother.hh:443
static std::shared_ptr< SeqSSOR< M, X, Y, l > > construct(Arguments &args)
Definition: smoother.hh:221
AggregatesMap::AggregateDescriptor AggregateDescriptor
Definition: smoother.hh:561
static std::shared_ptr< Richardson< X, Y > > construct(Arguments &args)
Definition: smoother.hh:268
bool onthefly
Definition: smoother.hh:538
DefaultConstructionArgs< SeqSOR< M, X, Y, l > > Arguments
Definition: smoother.hh:235
virtual void setMatrix(const M &matrix, const AggregatesMap &amap)
Definition: smoother.hh:565
void setMatrix(const Args &...)
Definition: smoother.hh:181
static std::shared_ptr< SeqJac< M, X, Y, l > > construct(Arguments &args)
Definition: smoother.hh:253
DefaultConstructionArgs< SeqJac< M, X, Y, l > > Arguments
Definition: smoother.hh:251
DefaultConstructionArgs< SeqSSOR< M, X, Y, l > > Arguments
Definition: smoother.hh:219
static std::shared_ptr< NonoverlappingBlockPreconditioner< C, T > > construct(Arguments &args)
Definition: smoother.hh:348
const SmootherArgs getArgs() const
Definition: smoother.hh:130
VertexAdder(Vector &subdomains_, const AggregatesMap &aggregates_)
Definition: smoother.hh:658
static std::shared_ptr< SeqSOR< M, X, Y, l > > construct(Arguments &args)
Definition: smoother.hh:237
SeqOverlappingSchwarz< M, X, TM, TS, TA >::subdomain_vector Vector
Definition: smoother.hh:562
static void preSmooth(Smoother &smoother, Domain &v, Range &d)
Definition: smoother.hh:466
const_iterator begin() const
Definition: aggregates.hh:723
void setMatrix(const Matrix &matrix)
Definition: smoother.hh:101
T Smoother
Definition: smoother.hh:368
static void preSmooth(Smoother &smoother, Domain &v, Range &d)
Definition: smoother.hh:447
BlockPreconditioner< X, Y, C, SeqSOR< M, X, Y, l > > Smoother
Definition: smoother.hh:462
static std::shared_ptr< BlockPreconditioner< X, Y, C, T > > construct(Arguments &args)
Definition: smoother.hh:336
AggregateDescriptor * iterator
Definition: aggregates.hh:733
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition: smoother.hh:403
SeqOverlappingSchwarzSmootherArgs(Overlap overlap_=vertex, bool onthefly_=false)
Definition: smoother.hh:540
DefaultParallelConstructionArgs< T, C > Arguments
Definition: smoother.hh:334
DefaultParallelConstructionArgs< T, C > Arguments
Definition: smoother.hh:346
const Matrix * matrix_
Definition: smoother.hh:136
const_iterator end() const
Definition: aggregates.hh:728
V AggregateDescriptor
The aggregate descriptor type.
Definition: aggregates.hh:578
static const V ISOLATED
Identifier of isolated vertices.
Definition: aggregates.hh:569
const SequentialInformation & getComm()
Definition: smoother.hh:125
DefaultSmootherArgs()
Default constructor.
Definition: smoother.hh:53
void setMatrix(const M &matrix)
Definition: smoother.hh:603
void setComm([[maybe_unused]] T1 &comm)
Definition: smoother.hh:190
std::size_t noVertices() const
Get the number of vertices.
static void postSmooth(Smoother &smoother, Domain &v, const Range &d)
apply post smoothing in forward direction
Definition: smoother.hh:391
static std::shared_ptr< ParSSOR< M, X, Y, C > > construct(Arguments &args)
Definition: smoother.hh:323
virtual void setMatrix(const Matrix &matrix, [[maybe_unused]] const AggregatesMap &amap)
Definition: smoother.hh:105
Smoother::domain_type Domain
Definition: smoother.hh:370
void setN(int n)
Definition: smoother.hh:285
SLList< VertexDescriptor, Allocator > VertexList
The type of a single linked list of vertex descriptors.
Definition: aggregates.hh:590
SeqOverlappingSchwarz< M, X, MultiplicativeSchwarzMode, MS, TA > Smoother
Definition: smoother.hh:511
MatrixGraph< M >::VertexDescriptor VertexDescriptor
Definition: smoother.hh:559
const C & getComm() const
Definition: smoother.hh:160
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition: smoother.hh:425
Dune::Amg::AggregatesMap< VertexDescriptor > AggregatesMap
Definition: smoother.hh:560
const SmootherArgs getArgs() const
Definition: smoother.hh:198
static void postSmooth(Smoother &smoother, Domain &v, const Range &d)
Definition: smoother.hh:521
DefaultParallelConstructionArgs< M, C > Arguments
Definition: smoother.hh:321
RelaxationFactor relaxationFactor
The relaxation factor to use.
Definition: smoother.hh:48
virtual ~DefaultParallelConstructionArgs()
Definition: smoother.hh:152
static std::shared_ptr< SeqOverlappingSchwarz< M, X, TM, TS, TA > > construct(Arguments &args)
Definition: smoother.hh:854
Smoother::domain_type Domain
Definition: smoother.hh:445
int setAggregate(const AggregateDescriptor &aggregate_)
Definition: smoother.hh:722
Smoother::range_type Range
Definition: smoother.hh:444
virtual ~DefaultConstructionArgs()
Definition: smoother.hh:98
static void preSmooth(Smoother &smoother, Domain &v, const Range &d)
apply pre smoothing in forward direction
Definition: smoother.hh:379
static void postSmooth(Smoother &smoother, Domain &v, Range &d)
Definition: smoother.hh:472
ConstructionTraits< T > SeqConstructionTraits
Definition: smoother.hh:335
ConstructionArgs(int n=0)
Definition: smoother.hh:281
void setComm([[maybe_unused]] T1 &comm)
Definition: smoother.hh:122
void setArgs(const SmootherArgs &args)
Definition: smoother.hh:184
int iterations
The numbe of iterations to perform.
Definition: smoother.hh:44
T RelaxationFactor
The type of the relaxation factor.
Definition: smoother.hh:39
Smoother::range_type Range
Definition: smoother.hh:369
Overlap overlap
Definition: smoother.hh:537
@ aggregate
Definition: smoother.hh:535
@ pairwise
Definition: smoother.hh:535
@ vertex
Definition: smoother.hh:535
Definition: allocator.hh:9
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get([[maybe_unused]] const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition: dependency.hh:291
Sequential overlapping Schwarz preconditioner.
Definition: overlappingschwarz.hh:753
X range_type
The range type of the preconditioner.
Definition: overlappingschwarz.hh:768
X domain_type
The domain type of the preconditioner.
Definition: overlappingschwarz.hh:763
Traits class for generically constructing non default constructable types.
Definition: construction.hh:37
Nonoverlapping parallel preconditioner.
Definition: novlpschwarz.hh:277
P::range_type range_type
The range type of the preconditioner.
Definition: novlpschwarz.hh:285
P::domain_type domain_type
The domain type of the preconditioner.
Definition: novlpschwarz.hh:283
Tag that tells the Schwarz method to be multiplicative.
Definition: overlappingschwarz.hh:124
Class providing information about the mapping of the vertices onto aggregates.
Definition: aggregates.hh:558
VertexIterator end()
Get an iterator over the vertices.
M::size_type VertexDescriptor
The vertex descriptor.
Definition: graph.hh:71
VertexIterator begin()
Get an iterator over the vertices.
Definition: pinfo.hh:26
The default class for the smoother arguments.
Definition: smoother.hh:35
Traits class for getting the attribute class of a smoother.
Definition: smoother.hh:63
Construction Arguments for the default smoothers.
Definition: smoother.hh:90
Definition: smoother.hh:145
Helper class for applying the smoothers.
Definition: smoother.hh:367
Sequential SSOR preconditioner.
Definition: preconditioners.hh:137
Sequential SOR preconditioner.
Definition: preconditioners.hh:255
X domain_type
The domain type of the preconditioner.
Definition: preconditioners.hh:260
Y range_type
The range type of the preconditioner.
Definition: preconditioners.hh:262
The sequential jacobian preconditioner.
Definition: preconditioners.hh:404
Sequential ILU preconditioner.
Definition: preconditioners.hh:522
Richardson preconditioner.
Definition: preconditioners.hh:701
A parallel SSOR preconditioner.
Definition: schwarz.hh:176
Block parallel preconditioner.
Definition: schwarz.hh:279
X domain_type
The domain type of the preconditioner.
Definition: schwarz.hh:286
Y range_type
The range type of the preconditioner.
Definition: schwarz.hh:291