3#ifndef DUNE_AMG_MATRIXHIERARCHY_HH
4#define DUNE_AMG_MATRIXHIERARCHY_HH
15#include <dune/common/parallel/indexset.hh>
57 template<
class M,
class PI,
class A=std::allocator<M> >
65 typedef typename MatrixOperator::matrix_type
Matrix;
83 using AAllocator =
typename std::allocator_traits<Allocator>::template rebind_alloc<AggregatesMap*>;
92 using RILAllocator =
typename std::allocator_traits<Allocator>::template rebind_alloc<RedistributeInfoType>;
103 std::shared_ptr<ParallelInformation> pinfo = std::make_shared<ParallelInformation>());
112 template<
typename O,
typename T>
113 void build(
const T& criterion);
129 template<
class V,
class BA,
class TA>
137 template<
class S,
class TA>
145 std::size_t
levels()
const;
226 template<
class Matrix,
bool pr
int>
233 static void stats([[maybe_unused]]
const Matrix& matrix)
237 template<
class Matrix>
238 struct MatrixStats<
Matrix,true>
247 min=std::numeric_limits<size_type>::max();
254 min=std::min(min, row.size());
255 max=std::max(max, row.size());
266 static void stats(
const Matrix& matrix)
268 calc c= for_each(matrix.begin(), matrix.end(), calc());
269 dinfo<<
"Matrix row: min="<<c.min<<
" max="<<c.max
270 <<
" average="<<
static_cast<double>(c.sum)/matrix.N()
310 template<
typename M,
typename C1>
312 [[maybe_unused]] std::shared_ptr<M> newMatrix,
314 [[maybe_unused]] std::shared_ptr<SequentialInformation>& newComm,
316 [[maybe_unused]]
int nparts,
317 [[maybe_unused]] C1& criterion)
319 DUNE_THROW(NotImplemented,
"Redistribution does not make sense in sequential code!");
323 template<
typename M,
typename C,
typename C1>
325 std::shared_ptr<M> newMatrix,
327 std::shared_ptr<C>& newComm,
329 int nparts, C1& criterion)
332#ifdef AMG_REPART_ON_COMM_GRAPH
336 criterion.debugLevel()>1);
350 if(origComm.communicator().rank()==0)
351 std::cout<<
"Original matrix"<<std::endl;
352 origComm.communicator().barrier();
356 newComm, ri.getInterface(),
357 criterion.debugLevel()>1);
360 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1)
361 std::cout<<
"Repartitioning took "<<time.elapsed()<<
" seconds."<<std::endl;
366 ri.checkInterface(origComm.indexSet(), newComm->indexSet(), origComm.communicator());
372 if(origComm.communicator().rank()==0)
373 std::cout<<
"Original matrix"<<std::endl;
374 origComm.communicator().barrier();
375 if(newComm->communicator().size()>0)
377 origComm.communicator().barrier();
380 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1)
381 std::cout<<
"Redistributing matrix took "<<time.elapsed()<<
" seconds."<<std::endl;
382 return existentOnRedist;
386 template<
class M,
class IS,
class A>
388 std::shared_ptr<ParallelInformation> pinfo)
389 : matrices_(fineMatrix),
390 parallelInformation_(pinfo)
393 DUNE_THROW(
ISTLError,
"MatrixOperator and ParallelInformation must belong to the same category!");
396 template<
class M,
class IS,
class A>
397 template<
typename O,
typename T>
400 prolongDamp_ = criterion.getProlongationDampingFactor();
401 typedef O OverlapFlags;
407 typedef bigunsignedint<
sizeof(int)*8*noints> BIGINT;
409 MatIterator mlevel = matrices_.finest();
410 MatrixStats<typename M::matrix_type,MINIMAL_DEBUG_LEVEL<=INFO_DEBUG_LEVEL>::stats(mlevel->getmat());
412 PInfoIterator infoLevel = parallelInformation_.finest();
414 finenonzeros = infoLevel->communicator().sum(finenonzeros);
415 BIGINT allnonzeros = finenonzeros;
421 BIGINT unknowns = mlevel->getmat().N();
423 unknowns = infoLevel->communicator().sum(unknowns);
424 double dunknowns=unknowns.todouble();
425 infoLevel->buildGlobalLookup(mlevel->getmat().N());
428 for(; level < criterion.maxLevel(); ++level, ++mlevel) {
429 assert(matrices_.levels()==redistributes_.size());
430 rank = infoLevel->communicator().rank();
431 if(rank==0 && criterion.debugLevel()>1)
432 std::cout<<
"Level "<<level<<
" has "<<dunknowns<<
" unknowns, "<<dunknowns/infoLevel->communicator().size()
433 <<
" unknowns per proc (procs="<<infoLevel->communicator().size()<<
")"<<std::endl;
445 && dunknowns < 30*infoLevel->communicator().size()))
446 && infoLevel->communicator().size()>1 &&
447 dunknowns/infoLevel->communicator().size() <= criterion.coarsenTarget())
450 std::shared_ptr<Matrix> redistMat = std::make_shared<Matrix>();
451 std::shared_ptr<ParallelInformation> redistComm;
452 std::size_t nodomains = (std::size_t)std::ceil(dunknowns/(criterion.minAggregateSize()
453 *criterion.coarsenTarget()));
454 if( nodomains<=criterion.minAggregateSize()/2 ||
455 dunknowns <= criterion.coarsenTarget() )
458 bool existentOnNextLevel =
460 redistComm, redistributes_.back(), nodomains,
462 BIGINT unknownsRedist = redistMat->N();
463 unknownsRedist = infoLevel->communicator().sum(unknownsRedist);
464 dunknowns= unknownsRedist.todouble();
465 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1)
466 std::cout<<
"Level "<<level<<
" (redistributed) has "<<dunknowns<<
" unknowns, "<<dunknowns/redistComm->communicator().size()
467 <<
" unknowns per proc (procs="<<redistComm->communicator().size()<<
")"<<std::endl;
468 MatrixArgs args(redistMat, *redistComm);
470 assert(mlevel.isRedistributed());
471 infoLevel.addRedistributed(redistComm);
472 infoLevel->freeGlobalLookup();
474 if(!existentOnNextLevel)
479 matrix = &(mlevel.getRedistributed());
480 info = &(infoLevel.getRedistributed());
481 info->buildGlobalLookup(matrix->getmat().N());
484 rank = info->communicator().rank();
485 if(dunknowns <= criterion.coarsenTarget())
491 typedef typename GraphCreator::GraphTuple GraphTuple;
495 std::vector<bool> excluded(matrix->getmat().N(),
false);
497 GraphTuple graphs = GraphCreator::create(*matrix, excluded, *info, OverlapFlags());
501 aggregatesMaps_.push_back(aggregatesMap);
505 int noAggregates, isoAggregates, oneAggregates, skippedAggregates;
507 std::tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) =
508 aggregatesMap->
buildAggregates(matrix->getmat(), *(std::get<1>(graphs)), criterion, level==0);
510 if(rank==0 && criterion.debugLevel()>2)
511 std::cout<<
" Have built "<<noAggregates<<
" aggregates totally ("<<isoAggregates<<
" isolated aggregates, "<<
512 oneAggregates<<
" aggregates of one vertex, and skipped "<<
513 skippedAggregates<<
" aggregates)."<<std::endl;
517 int start, end, overlapStart, overlapEnd;
518 int procs=info->communicator().rank();
519 int n = UNKNOWNS/procs;
520 int bigger = UNKNOWNS%procs;
525 end = (rank+1)*(n+1);
527 start = bigger + rank * n;
528 end = bigger + (rank + 1) * n;
533 overlapStart = start - 1;
535 overlapStart = start;
538 overlapEnd = end + 1;
542 assert((UNKNOWNS)*(overlapEnd-overlapStart)==aggregatesMap->
noVertices());
543 for(
int j=0; j< UNKNOWNS; ++j)
544 for(
int i=0; i < UNKNOWNS; ++i)
546 if(i>=overlapStart && i<overlapEnd)
548 int no = (j/2)*((UNKNOWNS)/2)+i/2;
549 (*aggregatesMap)[j*(overlapEnd-overlapStart)+i-overlapStart]=no;
554 if(criterion.debugLevel()>1 && info->communicator().rank()==0)
555 std::cout<<
"aggregating finished."<<std::endl;
557 BIGINT gnoAggregates=noAggregates;
558 gnoAggregates = info->communicator().sum(gnoAggregates);
559 double dgnoAggregates = gnoAggregates.todouble();
561 BIGINT gnoAggregates=((UNKNOWNS)/2)*((UNKNOWNS)/2);
564 if(criterion.debugLevel()>2 && rank==0)
565 std::cout <<
"Building "<<dgnoAggregates<<
" aggregates took "<<watch.elapsed()<<
" seconds."<<std::endl;
567 if(dgnoAggregates==0 || dunknowns/dgnoAggregates<criterion.minCoarsenRate())
572 std::cerr <<
"Stopped coarsening because of rate breakdown "<<dunknowns<<
"/"<<dgnoAggregates
573 <<
"="<<dunknowns/dgnoAggregates<<
"<"
574 <<criterion.minCoarsenRate()<<std::endl;
576 std::cerr<<
"Could not build any aggregates. Probably no connected nodes."<<std::endl;
578 aggregatesMap->
free();
579 delete aggregatesMap;
580 aggregatesMaps_.pop_back();
582 if(criterion.accumulate() && mlevel.isRedistributed() && info->communicator().size()>1) {
586 delete &(mlevel.getRedistributed().getmat());
587 mlevel.deleteRedistributed();
588 delete &(infoLevel.getRedistributed());
589 infoLevel.deleteRedistributed();
590 redistributes_.back().resetSetup();
595 unknowns = noAggregates;
596 dunknowns = dgnoAggregates;
598 CommunicationArgs commargs(info->communicator(),info->category());
599 parallelInformation_.addCoarser(commargs);
603 typename PropertyMapTypeSelector<VertexVisitedTag,PropertiesGraph>::Type visitedMap =
609 *(std::get<1>(graphs)),
614 GraphCreator::free(graphs);
616 if(criterion.debugLevel()>2) {
618 std::cout<<
"Coarsening of index sets took "<<watch.elapsed()<<
" seconds."<<std::endl;
623 infoLevel->buildGlobalLookup(aggregates);
626 infoLevel->globalLookup());
629 if(criterion.debugLevel()>2) {
631 std::cout<<
"Communicating global aggregate numbers took "<<watch.elapsed()<<
" seconds."<<std::endl;
635 std::vector<bool>& visited=excluded;
637 typedef std::vector<bool>::iterator Iterator;
638 typedef IteratorPropertyMap<Iterator, IdentityMap> VisitedMap2;
639 Iterator end = visited.end();
640 for(Iterator iter= visited.begin(); iter != end; ++iter)
643 VisitedMap2 visitedMap2(visited.begin(), Dune::IdentityMap());
645 std::shared_ptr<typename MatrixOperator::matrix_type>
646 coarseMatrix(productBuilder.build(*(std::get<0>(graphs)), visitedMap2,
651 dverb<<
"Building of sparsity pattern took "<<watch.elapsed()<<std::endl;
653 info->freeGlobalLookup();
655 delete std::get<0>(graphs);
656 productBuilder.calculate(matrix->getmat(), *aggregatesMap, *coarseMatrix, *infoLevel, OverlapFlags());
658 if(criterion.debugLevel()>2) {
660 std::cout<<
"Calculation entries of Galerkin product took "<<watch.elapsed()<<
" seconds."<<std::endl;
664 allnonzeros = allnonzeros + infoLevel->communicator().sum(nonzeros);
665 MatrixArgs args(coarseMatrix, *infoLevel);
667 matrices_.addCoarser(args);
672 infoLevel->freeGlobalLookup();
676 aggregatesMaps_.push_back(aggregatesMap);
678 if(criterion.debugLevel()>0) {
679 if(level==criterion.maxLevel()) {
680 BIGINT unknownsLevel = mlevel->getmat().N();
681 unknownsLevel = infoLevel->communicator().sum(unknownsLevel);
682 double dunknownsLevel = unknownsLevel.todouble();
683 if(rank==0 && criterion.debugLevel()>1) {
684 std::cout<<
"Level "<<level<<
" has "<<dunknownsLevel<<
" unknowns, "<<dunknownsLevel/infoLevel->communicator().size()
685 <<
" unknowns per proc (procs="<<infoLevel->communicator().size()<<
")"<<std::endl;
690 if(criterion.accumulate() && !redistributes_.back().isSetup() &&
691 infoLevel->communicator().size()>1) {
692#if HAVE_MPI && !HAVE_PARMETIS
694 infoLevel->communicator().rank()==0)
695 std::cerr<<
"Successive accumulation of data on coarse levels only works with ParMETIS installed."
696 <<
" Fell back to accumulation to one domain on coarsest level"<<std::endl;
700 std::shared_ptr<Matrix> redistMat = std::make_shared<Matrix>();
701 std::shared_ptr<ParallelInformation> redistComm;
705 redistComm, redistributes_.back(), nodomains,criterion);
706 MatrixArgs args(redistMat, *redistComm);
707 BIGINT unknownsRedist = redistMat->N();
708 unknownsRedist = infoLevel->communicator().sum(unknownsRedist);
710 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) {
711 double dunknownsRedist = unknownsRedist.todouble();
712 std::cout<<
"Level "<<level<<
" redistributed has "<<dunknownsRedist<<
" unknowns, "<<dunknownsRedist/redistComm->communicator().size()
713 <<
" unknowns per proc (procs="<<redistComm->communicator().size()<<
")"<<std::endl;
716 infoLevel.addRedistributed(redistComm);
717 infoLevel->freeGlobalLookup();
720 int levels = matrices_.levels();
721 maxlevels_ = parallelInformation_.finest()->communicator().max(levels);
722 assert(matrices_.levels()==redistributes_.size());
723 if(hasCoarsest() && rank==0 && criterion.debugLevel()>1)
724 std::cout<<
"operator complexity: "<<allnonzeros.todouble()/finenonzeros.todouble()<<std::endl;
728 template<
class M,
class IS,
class A>
735 template<
class M,
class IS,
class A>
739 return parallelInformation_;
742 template<
class M,
class IS,
class A>
745 int levels=aggregatesMaps().size();
746 int maxlevels=parallelInformation_.finest()->communicator().max(levels);
747 std::size_t size=(*(aggregatesMaps().begin()))->noVertices();
749 std::vector<std::size_t> tmp;
750 std::vector<std::size_t> *coarse, *fine;
767 if(levels==maxlevels) {
768 const AggregatesMap& map = *(*(++aggregatesMaps().rbegin()));
777 srand((
unsigned)std::clock());
778 std::set<size_t> used;
779 for(
typename std::vector<std::size_t>::iterator iter=coarse->begin(); iter != coarse->end();
782 std::pair<std::set<std::size_t>::iterator,
bool> ibpair
783 = used.insert(
static_cast<std::size_t
>((((
double)rand())/(RAND_MAX+1.0)))*coarse->size());
785 while(!ibpair.second)
786 ibpair = used.insert(
static_cast<std::size_t
>((((
double)rand())/(RAND_MAX+1.0))*coarse->size()));
787 *iter=*(ibpair.first);
795 for(
typename AggregatesMapList::const_reverse_iterator aggregates=++aggregatesMaps().rbegin();
796 aggregates != aggregatesMaps().rend(); ++aggregates,--levels) {
798 fine->resize((*aggregates)->noVertices());
799 fine->assign(fine->size(), 0);
801 ::prolongateVector(*(*aggregates), *coarse, *fine,
static_cast<std::size_t
>(1), *pinfo);
803 std::swap(coarse, fine);
807 assert(coarse==&data);
810 template<
class M,
class IS,
class A>
814 return aggregatesMaps_;
816 template<
class M,
class IS,
class A>
820 return redistributes_;
823 template<
class M,
class IS,
class A>
826 typedef typename AggregatesMapList::reverse_iterator AggregatesMapIterator;
830 AggregatesMapIterator amap = aggregatesMaps_.rbegin();
831 InfoIterator info = parallelInformation_.coarsest();
832 for(Iterator level=matrices_.coarsest(), finest=matrices_.finest(); level != finest; --level, --info, ++amap) {
839 template<
class M,
class IS,
class A>
840 template<
class V,
class BA,
class TA>
843 assert(hierarchy.levels()==1);
845 typedef typename RedistributeInfoList::const_iterator RIter;
846 RIter redist = redistributes_.begin();
848 Iterator matrix = matrices_.finest(), coarsest = matrices_.coarsest();
850 if(redist->isSetup())
851 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N());
852 Dune::dvverb<<
"Level "<<level<<
" has "<<matrices_.finest()->getmat().N()<<
" unknowns!"<<std::endl;
854 while(matrix != coarsest) {
855 ++matrix; ++level; ++redist;
856 Dune::dvverb<<
"Level "<<level<<
" has "<<matrix->getmat().N()<<
" unknowns!"<<std::endl;
858 hierarchy.addCoarser(matrix->getmat().N());
859 if(redist->isSetup())
860 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N());
866 template<
class M,
class IS,
class A>
867 template<
class S,
class TA>
871 assert(smoothers.
levels()==0);
874 typedef typename AggregatesMapList::const_iterator AggregatesIterator;
877 cargs.setArgs(sargs);
878 PinfoIterator pinfo = parallelInformation_.finest();
879 AggregatesIterator aggregates = aggregatesMaps_.begin();
881 for(MatrixIterator matrix = matrices_.finest(), coarsest = matrices_.coarsest();
882 matrix != coarsest; ++matrix, ++pinfo, ++aggregates, ++level) {
883 cargs.setMatrix(matrix->getmat(), **aggregates);
884 cargs.setComm(*pinfo);
887 if(maxlevels()>levels()) {
889 cargs.setMatrix(matrices_.coarsest()->getmat(), **aggregates);
890 cargs.setComm(*pinfo);
896 template<
class M,
class IS,
class A>
900 typedef typename AggregatesMapList::iterator AggregatesMapIterator;
904 AggregatesMapIterator amap = aggregatesMaps_.begin();
906 InfoIterator info = parallelInformation_.finest();
907 typename RedistributeInfoList::iterator riIter = redistributes_.begin();
908 Iterator level = matrices_.finest(), coarsest=matrices_.coarsest();
909 if(level.isRedistributed()) {
910 info->buildGlobalLookup(level->getmat().N());
912 const_cast<Matrix&
>(level.getRedistributed().getmat()),
913 *info,info.getRedistributed(), *riIter);
914 info->freeGlobalLookup();
917 for(; level!=coarsest; ++amap) {
918 const Matrix& fine = (level.isRedistributed() ? level.getRedistributed() : *level).getmat();
922 productBuilder.
calculate(fine, *(*amap),
const_cast<Matrix&
>(level->getmat()), *info, copyFlags);
923 if(level.isRedistributed()) {
924 info->buildGlobalLookup(level->getmat().N());
926 const_cast<Matrix&
>(level.getRedistributed().getmat()), *info,
927 info.getRedistributed(), *riIter);
928 info->freeGlobalLookup();
933 template<
class M,
class IS,
class A>
936 return matrices_.levels();
939 template<
class M,
class IS,
class A>
945 template<
class M,
class IS,
class A>
948 return levels()==maxlevels() &&
949 (!matrices_.coarsest().isRedistributed() ||matrices_.coarsest()->getmat().N()>0);
952 template<
class M,
class IS,
class A>
This file implements a vector space as a tensor product of a given vector space. The number of compon...
Functionality for redistributing a sparse matrix.
Some handy generic functions for ISTL matrices.
Provides classes for the Coloring process of AMG.
Helper classes for the construction of classes without empty constructor.
Provides classes for initializing the link attributes of a matrix graph.
Provides a class for building the galerkin product based on a aggregation scheme.
Provdes class for identifying aggregates globally.
Provides classes for building the matrix graph.
Provides a classes representing the hierarchies in AMG.
Provides a class for building the index set and remote indices on the coarse level.
Classes for the generic construction and application of the smoothers.
Prolongation and restriction for amg.
auto countNonZeros(const M &, typename std::enable_if_t< Dune::IsNumber< M >::value > *sfinae=nullptr)
Get the number of nonzero fields in the matrix.
Definition: matrixutils.hh:117
const AggregatesMapList & aggregatesMaps() const
Get the hierarchy of the mappings of the nodes onto aggregates.
Definition: matrixhierarchy.hh:812
bool isBuilt() const
Whether the hierarchy was built.
Definition: matrixhierarchy.hh:953
bool hasCoarsest() const
Definition: matrixhierarchy.hh:946
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition: hierarchy.hh:320
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition: matrixhierarchy.hh:934
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition: hierarchy.hh:332
const RedistributeInfoList & redistributeInformation() const
Get the hierarchy of the information about redistributions,.
Definition: matrixhierarchy.hh:818
const ParallelInformationHierarchy & parallelInformation() const
Get the hierarchy of the parallel data distribution information.
Definition: matrixhierarchy.hh:737
bool repartitionAndDistributeMatrix(const M &origMatrix, std::shared_ptr< M > newMatrix, SequentialInformation &origComm, std::shared_ptr< SequentialInformation > &newComm, RedistributeInformation< SequentialInformation > &ri, int nparts, C1 &criterion)
Definition: matrixhierarchy.hh:311
const_iterator begin() const
Definition: aggregates.hh:723
const ParallelMatrixHierarchy & matrices() const
Get the matrix hierarchy.
Definition: matrixhierarchy.hh:730
std::size_t maxlevels() const
Get the max number of levels in the hierarchy of processors.
Definition: matrixhierarchy.hh:940
const_iterator end() const
Definition: aggregates.hh:728
static const V ISOLATED
Identifier of isolated vertices.
Definition: aggregates.hh:569
void recalculateGalerkin(const F ©Flags)
Recalculate the galerkin products.
Definition: matrixhierarchy.hh:898
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition: construction.hh:42
std::size_t noVertices() const
Get the number of vertices.
void coarsenVector(Hierarchy< BlockVector< V, BA >, TA > &hierarchy) const
Coarsen the vector hierarchy according to the matrix hierarchy.
Definition: matrixhierarchy.hh:841
const AggregateDescriptor * const_iterator
Definition: aggregates.hh:721
MatrixHierarchy(std::shared_ptr< MatrixOperator > fineMatrix, std::shared_ptr< ParallelInformation > pinfo=std::make_shared< ParallelInformation >())
Constructor.
Definition: matrixhierarchy.hh:387
AccumulationMode
Identifiers for the different accumulation modes.
Definition: parameters.hh:230
void build(const T &criterion)
Build the matrix hierarchy using aggregation.
Definition: matrixhierarchy.hh:398
void free()
Free the allocated memory.
void coarsenSmoother(Hierarchy< S, TA > &smoothers, const typename SmootherTraits< S >::Arguments &args) const
Coarsen the smoother hierarchy according to the matrix hierarchy.
Definition: matrixhierarchy.hh:868
void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, bool finestLevel)
Build the dependency of the matrix graph.
std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, const C &criterion, bool finestLevel)
Build the aggregates.
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O ©)
Calculate the galerkin product.
void getCoarsestAggregatesOnFinest(std::vector< std::size_t > &data) const
Get the mapping of fine level unknowns to coarse level aggregates.
Definition: matrixhierarchy.hh:743
~MatrixHierarchy()
Definition: matrixhierarchy.hh:824
@ MAX_PROCESSES
Hard limit for the number of processes allowed.
Definition: matrixhierarchy.hh:48
@ atOnceAccu
Accumulate data to one process at once.
Definition: parameters.hh:242
@ successiveAccu
Successively accumulate to fewer processes.
Definition: parameters.hh:246
Definition: allocator.hh:9
void printGlobalSparseMatrix(const M &mat, C &ooc, std::ostream &os)
Definition: matrixutils.hh:152
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition: dependency.hh:291
void redistributeMatrixEntries(M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
Definition: matrixredistribute.hh:755
bool commGraphRepartition(const M &mat, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
Definition: repartition.hh:827
void redistributeMatrix(M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
Redistribute a matrix according to given domain decompositions.
Definition: matrixredistribute.hh:818
bool graphRepartition(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
execute a graph repartition for a giving graph and indexset.
Definition: repartition.hh:1233
A vector of blocks with memory management.
Definition: bvector.hh:393
derive error class from the base class in common
Definition: istlexception.hh:17
A generic dynamic dense matrix.
Definition: matrix.hh:559
A::size_type size_type
Type for indices and sizes.
Definition: matrix.hh:575
MatrixImp::DenseMatrixBase< T, A >::window_type row_type
The type implementing a matrix row.
Definition: matrix.hh:572
Definition: matrixredistribute.hh:20
Traits class for generically constructing non default constructable types.
Definition: construction.hh:37
Class providing information about the mapping of the vertices onto aggregates.
Definition: aggregates.hh:558
Class representing the properties of an ede in the matrix graph.
Definition: dependency.hh:37
Class representing a node in the matrix graph.
Definition: dependency.hh:124
Definition: galerkin.hh:97
Definition: galerkin.hh:116
Definition: globalaggregates.hh:129
Attaches properties to the edges and vertices of a graph.
Definition: graph.hh:976
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition: graph.hh:986
Definition: graphcreator.hh:20
LevelIterator< Hierarchy< MatrixOperator, Allocator >, MatrixOperator > Iterator
Type of the mutable iterator.
Definition: hierarchy.hh:214
LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const MatrixOperator > ConstIterator
Type of the const iterator.
Definition: hierarchy.hh:217
Definition: indicescoarsener.hh:34
The hierarchies build by the coarsening process.
Definition: matrixhierarchy.hh:59
typename std::allocator_traits< Allocator >::template rebind_alloc< AggregatesMap * > AAllocator
Allocator for pointers.
Definition: matrixhierarchy.hh:83
Dune::Amg::Hierarchy< ParallelInformation, Allocator > ParallelInformationHierarchy
The type of the parallel informarion hierarchy.
Definition: matrixhierarchy.hh:80
std::list< AggregatesMap *, AAllocator > AggregatesMapList
The type of the aggregates maps list.
Definition: matrixhierarchy.hh:86
PI ParallelInformation
The type of the index set.
Definition: matrixhierarchy.hh:68
Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy
The type of the parallel matrix hierarchy.
Definition: matrixhierarchy.hh:77
A Allocator
The allocator to use.
Definition: matrixhierarchy.hh:71
RedistributeInformation< ParallelInformation > RedistributeInfoType
The type of the redistribute information.
Definition: matrixhierarchy.hh:89
double getProlongationDampingFactor() const
Definition: matrixhierarchy.hh:186
typename std::allocator_traits< Allocator >::template rebind_alloc< RedistributeInfoType > RILAllocator
Allocator for RedistributeInfoType.
Definition: matrixhierarchy.hh:92
std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList
The type of the list of redistribute information.
Definition: matrixhierarchy.hh:95
Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > AggregatesMap
The type of the aggregates map we use.
Definition: matrixhierarchy.hh:74
MatrixOperator::matrix_type Matrix
The type of the matrix.
Definition: matrixhierarchy.hh:65
M MatrixOperator
The type of the matrix operator.
Definition: matrixhierarchy.hh:62
void operator()(const matrix_row &row)
Definition: matrixhierarchy.hh:252
Matrix::row_type matrix_row
Definition: matrixhierarchy.hh:243
size_type min
Definition: matrixhierarchy.hh:259
calc()
Definition: matrixhierarchy.hh:245
size_type max
Definition: matrixhierarchy.hh:260
size_type sum
Definition: matrixhierarchy.hh:261
Matrix::size_type size_type
Definition: matrixhierarchy.hh:242
The criterion describing the stop criteria for the coarsening process.
Definition: matrixhierarchy.hh:281
CoarsenCriterion(const Dune::Amg::Parameters &parms)
Definition: matrixhierarchy.hh:304
T AggregationCriterion
The criterion for tagging connections as strong and nodes as isolated. This might be e....
Definition: matrixhierarchy.hh:287
CoarsenCriterion(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
Constructor.
Definition: matrixhierarchy.hh:299
All parameters for AMG.
Definition: parameters.hh:391
Tag idnetifying the visited property of a vertex.
Definition: properties.hh:27
Traits class for getting the attribute class of a smoother.
Definition: smoother.hh:64
Definition: transfer.hh:30
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition: solvercategory.hh:32