25#ifndef DUMUX_AMGPARALLELHELPERS_HH
26#define DUMUX_AMGPARALLELHELPERS_HH
28#include <dune/common/version.hh>
29#include <dune/geometry/dimension.hh>
30#include <dune/grid/common/datahandleif.hh>
31#include <dune/grid/common/partitionset.hh>
32#include <dune/istl/owneroverlapcopy.hh>
33#include <dune/istl/paamg/pinfo.hh>
43template<
class Gr
idView,
class AmgTraits>
46 using DofMapper =
typename AmgTraits::DofMapper;
47 enum { dofCodim = AmgTraits::dofCodim };
49 class BaseGatherScatter
52 BaseGatherScatter(
const DofMapper& mapper)
55 template<
class EntityType>
56 int index(
const EntityType& e)
const
57 {
return mapper_.index(e); }
60 const DofMapper& mapper_;
67 class ConsistencyBoxGatherScatter
68 :
public BaseGatherScatter,
69 public Dune::CommDataHandleIF<ConsistencyBoxGatherScatter<V>,typename V::block_type>
72 using DataType =
typename V::block_type;
74 ConsistencyBoxGatherScatter(V& container,
const DofMapper& mapper)
75 : BaseGatherScatter(mapper), container_(container)
78 bool contains(
int dim,
int codim)
const
80 return dofCodim==codim;
83 bool fixedsize(
int dim,
int codim)
const
88 template<
class EntityType>
89 size_t size (EntityType& e)
const
94 template<
class MessageBuffer,
class EntityType>
95 void gather (MessageBuffer& buff,
const EntityType& e)
const
97 buff.write(container_[this->index(e)]);
100 template<
class MessageBuffer,
class EntityType>
101 void scatter (MessageBuffer& buff,
const EntityType& e,
size_t n)
103 typename V::block_type block;
105 container_[this->index(e)]+=block;
118 class GhostGatherScatter
119 :
public BaseGatherScatter,
120 public Dune::CommDataHandleIF<GhostGatherScatter,std::size_t>
123 using DataType = std::size_t;
125 GhostGatherScatter(std::vector<std::size_t>& ranks,
const DofMapper& mapper)
126 : BaseGatherScatter(mapper), ranks_(ranks)
130 bool contains(
int dim,
int codim)
const
132 return dofCodim==codim;
135 bool fixedsize(
int dim,
int codim)
const
140 template<
class EntityType>
141 size_t size (EntityType& e)
const
146 template<
class MessageBuffer,
class EntityType>
147 void gather (MessageBuffer& buff,
const EntityType& e)
const
149 std::size_t& data= ranks_[this->index(e)];
150 if (e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity)
155 template<
class MessageBuffer,
class EntityType>
156 void scatter (MessageBuffer& buff,
const EntityType& e,
size_t n)
159 std::size_t& data = ranks_[this->index(e)];
161 if (e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity)
165 std::vector<std::size_t>& ranks_;
174 class InteriorBorderGatherScatter
175 :
public BaseGatherScatter,
176 public Dune::CommDataHandleIF<InteriorBorderGatherScatter,std::size_t>
179 using DataType = std::size_t;
181 InteriorBorderGatherScatter(std::vector<std::size_t>& ranks,
const DofMapper& mapper)
182 : BaseGatherScatter(mapper), ranks_(ranks)
186 bool contains(
int dim,
int codim)
const
188 return dofCodim==codim;
191 bool fixedsize(
int dim,
int codim)
const
197 template<
class EntityType>
198 size_t size (EntityType& e)
const
203 template<
class MessageBuffer,
class EntityType>
204 void gather (MessageBuffer& buff,
const EntityType& e)
const
207 std::size_t& data = ranks_[this->index(e)];
208 if (e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity)
213 template<
class MessageBuffer,
class EntityType>
214 void scatter (MessageBuffer& buff,
const EntityType& e,
size_t n)
218 std::size_t& data = ranks_[this->index(e)];
220 if (e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity)
226 std::vector<std::size_t>& ranks_;
233 struct NeighbourGatherScatter
234 :
public BaseGatherScatter,
235 public Dune::CommDataHandleIF<NeighbourGatherScatter,int>
237 using DataType = int;
239 NeighbourGatherScatter(
const DofMapper& mapper,
int rank_, std::set<int>& neighbours_)
240 : BaseGatherScatter(mapper), myrank(rank_), neighbours(neighbours_)
244 bool contains(
int dim,
int codim)
const
246 return dofCodim==codim;
249 bool fixedsize(
int dim,
int codim)
const
254 template<
class EntityType>
255 size_t size (EntityType& e)
const
260 template<
class MessageBuffer,
class EntityType>
261 void gather (MessageBuffer& buff,
const EntityType &e)
const
266 template<
class MessageBuffer,
class EntityType>
267 void scatter (MessageBuffer& buff,
const EntityType &e,
size_t n)
271 neighbours.insert(x);
274 std::set<int>& neighbours;
282 struct SharedGatherScatter
283 :
public BaseGatherScatter,
284 public Dune::CommDataHandleIF<SharedGatherScatter,int>
286 using DataType = int;
288 SharedGatherScatter(std::vector<int>& shared,
const DofMapper& mapper)
289 : BaseGatherScatter(mapper), shared_(shared)
292 bool contains(
int dim,
int codim)
const
294 return dofCodim==codim;
297 bool fixedsize(
int dim,
int codim)
const
303 template<
class EntityType>
304 size_t size (EntityType& e)
const
309 template<
class MessageBuffer,
class EntityType>
310 void gather (MessageBuffer& buff, EntityType& e)
const
316 template<
class MessageBuffer,
class EntityType>
317 void scatter (MessageBuffer& buff,
const EntityType &e,
size_t n)
321 int& data= shared_[this->index(e)];
325 std::vector<int>& shared_;
332 template<
typename GI>
333 struct GlobalIndexGatherScatter
334 :
public BaseGatherScatter,
335 public Dune::CommDataHandleIF<GlobalIndexGatherScatter<GI>, GI>
338 GlobalIndexGatherScatter(std::vector<GI>& gindices,
const DofMapper& mapper)
339 : BaseGatherScatter(mapper), gindices_(gindices)
342 bool contains(
int dim,
int codim)
const
344 return dofCodim==codim;
347 bool fixedsize(
int dim,
int codim)
const
352 template<
class EntityType>
353 size_t size (EntityType& e)
const
358 template<
class MessageBuffer,
class EntityType>
359 void gather (MessageBuffer& buff,
const EntityType& e)
const
361 buff.write(gindices_[this->index(e)]);
364 template<
class MessageBuffer,
class EntityType>
365 void scatter (MessageBuffer& buff,
const EntityType& e,
size_t n)
370 gindices_[this->index(e)] = min(gindices_[this->index(e)], x);
373 std::vector<GI>& gindices_;
379 : gridView_(
gridView), mapper_(mapper), verbose_(verbose), initialized_(false)
386 owner_.resize(mapper_.size(),
387 gridView_.comm().rank());
388 isGhost_.resize(mapper_.size(),0.0);
390 GhostGatherScatter ggs(owner_, mapper_);
392 if (gridView_.comm().size()>1)
393 gridView_.communicate(ggs, Dune::InteriorBorder_All_Interface, Dune::ForwardCommunication);
398 InteriorBorderGatherScatter dh(owner_, mapper_);
400 if (gridView_.comm().size()>1)
401 gridView_.communicate(dh, Dune::InteriorBorder_InteriorBorder_Interface, Dune::ForwardCommunication);
404 for (
auto& v : owner_)
405 v = (v == gridView_.comm().rank()) ? 1.0 : 0.0;
416 for(
auto v2=owner_.begin(), vend=owner_.end(); v2!=vend; ++v1, ++v2)
421 double mask (std::size_t i)
const
427 std::size_t
ghost (std::size_t i)
const
433 template<
typename B,
typename A>
437 ConsistencyBoxGatherScatter<Dune::BlockVector<B,A> > gs(v, mapper_);
438 if (gridView_.comm().size() > 1)
439 gridView_.communicate(gs, Dune::InteriorBorder_InteriorBorder_Interface,
440 Dune::ForwardCommunication);
456 template<
typename MatrixType,
typename Comm>
466 {
return gridView_; }
469 const GridView gridView_;
470 const DofMapper& mapper_;
471 std::vector<std::size_t> owner_;
472 std::vector<std::size_t> isGhost_;
484template<
class Gr
idView,
class AmgTraits>
487 using Matrix =
typename AmgTraits::MType;
488 enum { dim = GridView::dimension };
489 enum { dofCodim = AmgTraits::dofCodim };
490 using Grid =
typename GridView::Traits::Grid;
491 using BlockType =
typename Matrix::block_type;
492 using IDS =
typename Grid::Traits::GlobalIdSet;
493 using IdType =
typename IDS::IdType;
494 using RowIterator =
typename Matrix::RowIterator;
495 using ColIterator =
typename Matrix::ColIterator;
496 using DofMapper =
typename AmgTraits::DofMapper;
504 : gridView_(gridView), mapper_(mapper)
509 for (
const auto& entity : entities(gridView_, Dune::Codim<dofCodim>()))
511 if (entity.partitionType() == Dune::BorderEntity)
513 int localIdx = mapper_.index(entity);
514 IdType dofIdxGlobal = gridView_.grid().globalIdSet().id(entity);
516 std::pair<IdType, int> g2iPair(dofIdxGlobal, localIdx);
517 gid2Index_.insert(g2iPair);
519 std::pair<int, IdType> i2gPair(localIdx, dofIdxGlobal);
520 index2GID_.insert(i2gPair);
547 :
public Dune::CommDataHandleIF<MatPatternExchange, IdType>
549 using RowIterator =
typename Matrix::RowIterator;
550 using ColIterator =
typename Matrix::ColIterator;
563 const std::map<IdType,int>& g2i,
564 const std::map<int,IdType>& i2g, Matrix& A,
566 : mapper_(mapper), gid2Index_(g2i), index2GID_(i2g),
567 sparsity_(A.N()), A_(A), helper_(helper)
575 return (codim==dofCodim);
589 template<
class EntityType>
590 size_t size (EntityType& e)
const
592 int i = mapper_.index(e);
594 for (ColIterator j = A_[i].begin(); j != A_[i].end(); ++j)
596 typename std::map<int,IdType>::const_iterator it = index2GID_.find(j.index());
597 if (it != index2GID_.end())
607 template<
class MessageBuffer,
class EntityType>
608 void gather (MessageBuffer& buff,
const EntityType& e)
const
610 int i = mapper_.index(e);
611 for (ColIterator j = A_[i].begin(); j != A_[i].end(); ++j)
613 typename std::map<int,IdType>::const_iterator it=index2GID_.find(j.index());
614 if (it != index2GID_.end())
615 buff.write(it->second);
623 template<
class MessageBuffer,
class EntityType>
624 void scatter (MessageBuffer& buff,
const EntityType& e,
size_t n)
626 int i = mapper_.index(e);
627 for (
size_t k = 0; k < n; k++)
632 typename std::map<IdType,int>::const_iterator it = gid2Index_.find(
id);
633 if (it != gid2Index_.end()
634 && sparsity_[i].find(it->second) == sparsity_[i].end()
635 && helper_.ghost(it->second) != 1<<24)
636 sparsity_[i].insert(it->second);
650 const DofMapper& mapper_;
651 const std::map<IdType,int>& gid2Index_;
652 const std::map<int,IdType>& index2GID_;
653 std::vector<std::set<int> > sparsity_;
670 :
public Dune::CommDataHandleIF<MatEntryExchange,MatEntry>
672 using RowIterator =
typename Matrix::RowIterator;
673 using ColIterator =
typename Matrix::ColIterator;
686 const std::map<int,IdType>& i2g,
688 : mapper_(mapper), gid2Index_(g2i), index2GID_(i2g), A_(A)
696 return (codim==dofCodim);
710 template<
class EntityType>
711 size_t size (EntityType& e)
const
713 int i = mapper_.index(e);
715 for (ColIterator j = A_[i].begin(); j != A_[i].end(); ++j)
717 typename std::map<int,IdType>::const_iterator it = index2GID_.find(j.index());
718 if (it != index2GID_.end())
728 template<
class MessageBuffer,
class EntityType>
729 void gather (MessageBuffer& buff,
const EntityType& e)
const
731 int i = mapper_.index(e);
732 for (ColIterator j = A_[i].begin(); j != A_[i].end(); ++j)
734 typename std::map<int,IdType>::const_iterator it=index2GID_.find(j.index());
735 if (it != index2GID_.end())
736 buff.write(
MatEntry(it->second,*j));
744 template<
class MessageBuffer,
class EntityType>
745 void scatter (MessageBuffer& buff,
const EntityType& e,
size_t n)
747 int i = mapper_.index(e);
748 for (
size_t k = 0; k < n; k++)
753 typename std::map<IdType,int>::const_iterator it = gid2Index_.find(m.
first);
754 if (it != gid2Index_.end())
755 if (A_[i].find(it->second) != A_[i].end())
756 A_[i][it->second] += m.
second;
761 const DofMapper& mapper_;
762 const std::map<IdType,int>& gid2Index_;
763 const std::map<int,IdType>& index2GID_;
775 if (gridView_.comm().size() > 1)
781 gridView_.communicate(datahandle, Dune::InteriorBorder_InteriorBorder_Interface,
782 Dune::ForwardCommunication);
783 std::vector<std::set<int> >& sparsity = datahandle.
sparsity();
785 for (RowIterator i = A.begin(); i != A.end(); ++i)
787 for (ColIterator j = A[i.index()].begin(); j != A[i.index()].end(); ++j)
789 if (sparsity[i.index()].find(j.index()) == sparsity[i.index()].end())
791 sparsity[i.index()].insert(j.index());
794 nnz += sparsity[i.index()].size();
797 A.setSize(tmp.N(), tmp.N(), nnz);
798 A.setBuildMode(Matrix::row_wise);
799 typename Matrix::CreateIterator citer = A.createbegin();
800 using Iter =
typename std::vector<std::set<int> >::const_iterator;
801 for (Iter i = sparsity.begin(), end = sparsity.end(); i!=end; ++i, ++citer)
803 using SIter =
typename std::set<int>::const_iterator;
804 for (SIter si = i->begin(), send = i->end(); si!=send; ++si)
810 for (RowIterator i = tmp.begin(); i != tmp.end(); ++i)
811 for (ColIterator j = tmp[i.index()].begin(); j != tmp[i.index()].end(); ++j)
812 A[i.index()][j.index()] = tmp[i.index()][j.index()];
822 if (gridView_.comm().size() > 1)
825 gridView_.communicate(datahandle, Dune::InteriorBorder_InteriorBorder_Interface,
826 Dune::ForwardCommunication);
839 const GridView gridView_;
840 const DofMapper& mapper_;
841 std::map<IdType, int> gid2Index_;
842 std::map<int, IdType> index2GID_;
848template<
class Gr
idView,
class AmgTraits>
851 if (gridView_.comm().size() > 1)
857 gridView_.communicate(datahandle, Dune::InteriorBorder_InteriorBorder_Interface,
858 Dune::ForwardCommunication);
859 std::vector<std::set<int> >& sparsity = datahandle.
sparsity();
862 for (RowIterator i = A.begin(); i != A.end(); ++i)
864 for (ColIterator j = A[i.index()].begin(); j != A[i.index()].end(); ++j)
866 if (sparsity[i.index()].find(j.index()) == sparsity[i.index()].end())
867 sparsity[i.index()].insert(j.index());
869 nnz += sparsity[i.index()].size();
872 A.setSize(tmp.N(), tmp.N(), nnz);
873 A.setBuildMode(Matrix::row_wise);
874 typename Matrix::CreateIterator citer = A.createbegin();
875 using Iter =
typename std::vector<std::set<int> >::const_iterator;
876 for (Iter i = sparsity.begin(), end = sparsity.end(); i!=end; ++i, ++citer){
877 using SIter =
typename std::set<int>::const_iterator;
878 for (SIter si = i->begin(), send = i->end(); si!=send; ++si)
884 for (RowIterator i = tmp.begin(); i != tmp.end(); ++i)
885 for (ColIterator j = tmp[i.index()].begin(); j != tmp[i.index()].end(); ++j)
886 A[i.index()][j.index()] = tmp[i.index()][j.index()];
893template<
class Gr
idView,
class AmgTraits>
894template<
typename MatrixType,
typename Comm>
902 initGhostsAndOwners();
906 std::vector<int> sharedDofs(mapper_.size(),
false);
908 SharedGatherScatter sgs(sharedDofs, mapper_);
910 if (gridView_.comm().size() > 1)
911 gridView_.communicate(sgs, Dune::All_All_Interface,
912 Dune::ForwardCommunication);
915 using GlobalIndex =
typename Comm::ParallelIndexSet::GlobalIndex;
916 GlobalIndex count = 0;
917 auto owned = owner_.begin();
919 for (
auto v=sharedDofs.begin(), vend=sharedDofs.end(); v != vend; ++v, ++owned)
923 Dune::dverb << gridView_.comm().rank() <<
": shared count is " << count.touint()
926 std::vector<GlobalIndex> counts(gridView_.comm().size());
927 gridView_.comm().allgather(&count, 1, &(counts[0]));
930 GlobalIndex
start = 0;
931 for (
int i = 0; i < gridView_.comm().rank(); ++i)
934 std::vector<GlobalIndex> scalarIndices(mapper_.size(),
935 std::numeric_limits<GlobalIndex>::max());
937 auto shared = sharedDofs.begin();
938 auto index = scalarIndices.begin();
940 for (
auto i=owner_.begin(), iend=owner_.end(); i!=iend; ++i, ++shared, ++index)
950 GlobalIndexGatherScatter<GlobalIndex> gigs(scalarIndices, mapper_);
951 if (gridView_.comm().size()>1)
952 gridView_.communicate(gigs, Dune::All_All_Interface,
953 Dune::ForwardCommunication);
957 comm.indexSet().beginResize();
958 index = scalarIndices.begin();
959 auto ghost = isGhost_.begin();
961 for (
auto i=owner_.begin(), iend=owner_.end(); i!=iend; ++i, ++ghost, ++index)
963 Dune::OwnerOverlapCopyAttributeSet::AttributeSet attr;
964 if (*index!=std::numeric_limits<GlobalIndex>::max())
970 attr = Dune::OwnerOverlapCopyAttributeSet::owner;
972#if DUNE_VERSION_GTE(DUNE_ISTL, 2, 7)
973 else if ( *ghost==(1<<24) && ( comm.category() ==
974 static_cast<int>(Dune::SolverCategory::nonoverlapping)) )
976 else if ( *ghost==(1<<24) && ( comm.getSolverCategory() ==
977 static_cast<int>(Dune::SolverCategory::nonoverlapping)) )
981 attr = Dune::OwnerOverlapCopyAttributeSet::overlap;
985 attr = Dune::OwnerOverlapCopyAttributeSet::copy;
987 comm.indexSet().add(*index,
typename Comm::ParallelIndexSet::LocalIndex(i-owner_.begin(), attr));
990 comm.indexSet().endResize();
993 std::set<int> neighbours;
994 NeighbourGatherScatter ngs(mapper_, gridView_.comm().rank(),
997 if (gridView_.comm().size() > 1)
998 gridView_.communicate(ngs, Dune::All_All_Interface,
999 Dune::ForwardCommunication);
1001 comm.remoteIndices().setNeighbours(neighbours);
1002 comm.remoteIndices().template rebuild<false>();
1022template<
class Gr
idView,
class AmgTraits,
bool isParallel>
1027 using Comm =
typename AmgTraits::Comm;
1031 template<
class Matrix,
class Vector>
1034 std::shared_ptr<Comm>& comm,
1035 std::shared_ptr<LinearOperator>& fop,
1036 std::shared_ptr<ScalarProduct>& sp,
1038 const bool firstCall)
1040 comm = std::make_shared<Comm>();
1041 fop = std::make_shared<LinearOperator>(A);
1042 sp = std::make_shared<ScalarProduct>();
1050template<
class Gr
idView,
class AmgTraits>
1055 using Comm =
typename AmgTraits::Comm;
1059 template<
class Matrix,
class Vector>
1062 std::shared_ptr<Comm>& comm,
1063 std::shared_ptr<LinearOperator>& fop,
1064 std::shared_ptr<ScalarProduct>& sp,
1066 const bool firstCall)
1068 Dune::SolverCategory::Category category = AmgTraits::isNonOverlapping ?
1069 Dune::SolverCategory::nonoverlapping : Dune::SolverCategory::overlapping;
1071 if(AmgTraits::isNonOverlapping && firstCall)
1076 comm = std::make_shared<Comm>(pHelper.
gridView().comm(), category);
1078 if(AmgTraits::isNonOverlapping)
1087 fop = std::make_shared<LinearOperator>(A, *comm);
1088 sp = std::make_shared<ScalarProduct>(*comm);
1089 rank = comm->communicator().rank();
1092 if(AmgTraits::isNonOverlapping)
int start(int argc, char **argv, void(*usage)(const char *, const std::string &))
Provides a main function with error handling.
Definition: start.hh:127
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
A parallel helper class providing a nonoverlapping decomposition of all degrees of freedom.
Definition: amgparallelhelpers.hh:45
const GridView & gridView() const
Return the gridView.
Definition: amgparallelhelpers.hh:465
void createIndexSetAndProjectForAMG(MatrixType &m, Comm &c)
Creates a matrix suitable for parallel AMG and the parallel information.
Definition: amgparallelhelpers.hh:895
const DofMapper & dofMapper() const
Return the dofMapper.
Definition: amgparallelhelpers.hh:461
std::size_t ghost(std::size_t i) const
Definition: amgparallelhelpers.hh:427
ParallelISTLHelper(const GridView &gridView, const DofMapper &mapper, int verbose=1)
Definition: amgparallelhelpers.hh:378
double mask(std::size_t i) const
Definition: amgparallelhelpers.hh:421
void initGhostsAndOwners()
Definition: amgparallelhelpers.hh:384
void makeNonOverlappingConsistent(Dune::BlockVector< B, A > &v)
Definition: amgparallelhelpers.hh:434
void mask(W &w) const
Definition: amgparallelhelpers.hh:412
Helper class for adding up matrix entries on border.
Definition: amgparallelhelpers.hh:486
void sumEntries(Matrix &A)
Sums up the entries corresponding to border vertices.
Definition: amgparallelhelpers.hh:820
void getExtendedMatrix(Matrix &A, const ParallelISTLHelper< GridView, AmgTraits > &helper)
communicates values for the sparsity pattern of the new matrix.
Definition: amgparallelhelpers.hh:773
EntityExchanger(const GridView &gridView, const DofMapper &mapper)
Constructor. Sets up the local to global relations.
Definition: amgparallelhelpers.hh:503
A DataHandle class to exchange matrix sparsity patterns.
Definition: amgparallelhelpers.hh:548
bool contains(int dim, int codim) const
Returns true if data for given valid codim should be communicated.
Definition: amgparallelhelpers.hh:573
MatPatternExchange(const DofMapper &mapper, const std::map< IdType, int > &g2i, const std::map< int, IdType > &i2g, Matrix &A, const ParallelISTLHelper< GridView, AmgTraits > &helper)
Constructor.
Definition: amgparallelhelpers.hh:562
bool fixedsize(int dim, int codim) const
Returns true if size of data per entity of given dim and codim is a constant.
Definition: amgparallelhelpers.hh:581
std::vector< std::set< int > > & sparsity()
Get the communicated sparsity pattern.
Definition: amgparallelhelpers.hh:644
void gather(MessageBuffer &buff, const EntityType &e) const
Pack data from user to message buffer.
Definition: amgparallelhelpers.hh:608
void scatter(MessageBuffer &buff, const EntityType &e, size_t n)
Unpack data from message buffer to user.
Definition: amgparallelhelpers.hh:624
size_t size(EntityType &e) const
How many objects of type DataType have to be sent for a given entity.
Definition: amgparallelhelpers.hh:590
IdType DataType
Export type of data for message buffer.
Definition: amgparallelhelpers.hh:553
Local matrix blocks associated with the global id set.
Definition: amgparallelhelpers.hh:661
MatEntry(const IdType &f, const BlockType &s)
Definition: amgparallelhelpers.hh:664
MatEntry()
Definition: amgparallelhelpers.hh:665
IdType first
Definition: amgparallelhelpers.hh:662
BlockType second
Definition: amgparallelhelpers.hh:663
A DataHandle class to exchange matrix entries.
Definition: amgparallelhelpers.hh:671
void scatter(MessageBuffer &buff, const EntityType &e, size_t n)
Unpack data from message buffer to user.
Definition: amgparallelhelpers.hh:745
bool contains(int dim, int codim) const
Returns true if data for given valid codim should be communicated.
Definition: amgparallelhelpers.hh:694
size_t size(EntityType &e) const
How many objects of type DataType have to be sent for a given entity.
Definition: amgparallelhelpers.hh:711
bool fixedsize(int dim, int codim) const
Returns true if size of data per entity of given dim and codim is a constant.
Definition: amgparallelhelpers.hh:702
MatEntryExchange(const DofMapper &mapper, const std::map< IdType, int > &g2i, const std::map< int, IdType > &i2g, Matrix &A)
Constructor.
Definition: amgparallelhelpers.hh:685
void gather(MessageBuffer &buff, const EntityType &e) const
Pack data from user to message buffer.
Definition: amgparallelhelpers.hh:729
Prepare the linear algebra member variables.
Definition: amgparallelhelpers.hh:1024
static void prepareLinearAlgebra(Matrix &A, Vector &b, int &rank, std::shared_ptr< Comm > &comm, std::shared_ptr< LinearOperator > &fop, std::shared_ptr< ScalarProduct > &sp, ParallelHelper &pHelper, const bool firstCall)
Definition: amgparallelhelpers.hh:1032
typename AmgTraits::Comm Comm
Definition: amgparallelhelpers.hh:1027
typename AmgTraits::DofMapper DofMapper
Definition: amgparallelhelpers.hh:1025
typename AmgTraits::ScalarProduct ScalarProduct
Definition: amgparallelhelpers.hh:1029
typename AmgTraits::LinearOperator LinearOperator
Definition: amgparallelhelpers.hh:1028
static void prepareLinearAlgebra(Matrix &A, Vector &b, int &rank, std::shared_ptr< Comm > &comm, std::shared_ptr< LinearOperator > &fop, std::shared_ptr< ScalarProduct > &sp, ParallelHelper &pHelper, const bool firstCall)
Definition: amgparallelhelpers.hh:1060
typename AmgTraits::DofMapper DofMapper
Definition: amgparallelhelpers.hh:1053
typename AmgTraits::Comm Comm
Definition: amgparallelhelpers.hh:1055
typename AmgTraits::ScalarProduct ScalarProduct
Definition: amgparallelhelpers.hh:1057
typename AmgTraits::LinearOperator LinearOperator
Definition: amgparallelhelpers.hh:1056
The implementation is specialized for the different discretizations.
Definition: amgtraits.hh:71