Dune Core Modules (unstable)

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