dune-istl  2.8.0
owneroverlapcopy.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_ISTL_OWNEROVERLAPCOPY_HH
4 #define DUNE_ISTL_OWNEROVERLAPCOPY_HH
5 
6 #include <new>
7 #include <iostream>
8 #include <vector>
9 #include <list>
10 #include <map>
11 #include <set>
12 #include <tuple>
13 
14 #include "cmath"
15 
16 // MPI header
17 #if HAVE_MPI
18 #include <mpi.h>
19 #endif
20 
21 #include <dune/common/enumset.hh>
22 
23 #if HAVE_MPI
24 #include <dune/common/parallel/indexset.hh>
25 #include <dune/common/parallel/communicator.hh>
26 #include <dune/common/parallel/remoteindices.hh>
27 #include <dune/common/parallel/mpicommunication.hh>
28 #endif
29 
30 #include "solvercategory.hh"
31 #include "istlexception.hh"
32 #include <dune/common/parallel/communication.hh>
34 
35 template<int dim, template<class,class> class Comm>
36 void testRedistributed(int s);
37 
38 
39 namespace Dune {
40 
57  {
58  enum AttributeSet {
59  owner=1, overlap=2, copy=3
60  };
61  };
62 
74  template <class G, class L>
76  {
77  public:
79  typedef G GlobalIdType;
80 
82  typedef L LocalIdType;
83 
90  typedef std::tuple<GlobalIdType,LocalIdType,int> IndexTripel;
97  typedef std::tuple<int,GlobalIdType,int> RemoteIndexTripel;
98 
104  void addLocalIndex (const IndexTripel& x)
105  {
106  if (std::get<2>(x)!=OwnerOverlapCopyAttributeSet::owner &&
107  std::get<2>(x)!=OwnerOverlapCopyAttributeSet::overlap &&
108  std::get<2>(x)!=OwnerOverlapCopyAttributeSet::copy)
109  DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set");
110  localindices.insert(x);
111  }
112 
119  {
120  if (std::get<2>(x)!=OwnerOverlapCopyAttributeSet::owner &&
121  std::get<2>(x)!=OwnerOverlapCopyAttributeSet::overlap &&
122  std::get<2>(x)!=OwnerOverlapCopyAttributeSet::copy)
123  DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set");
124  remoteindices.insert(x);
125  }
126 
131  const std::set<IndexTripel>& localIndices () const
132  {
133  return localindices;
134  }
135 
140  const std::set<RemoteIndexTripel>& remoteIndices () const
141  {
142  return remoteindices;
143  }
144 
148  void clear ()
149  {
150  localindices.clear();
151  remoteindices.clear();
152  }
153 
154  private:
156  std::set<IndexTripel> localindices;
158  std::set<RemoteIndexTripel> remoteindices;
159  };
160 
161 
162 #if HAVE_MPI
163 
170  template <class GlobalIdType, class LocalIdType=int>
172  {
173  template<typename M, typename G, typename L>
174  friend void loadMatrixMarket(M&,
175  const std::string&,
177  bool);
178  // used types
180  typedef typename IndexInfoFromGrid<GlobalIdType,LocalIdType>::RemoteIndexTripel RemoteIndexTripel;
181  typedef typename std::set<IndexTripel>::const_iterator localindex_iterator;
182  typedef typename std::set<RemoteIndexTripel>::const_iterator remoteindex_iterator;
184  typedef Dune::ParallelLocalIndex<AttributeSet> LI;
185  public:
186  typedef Dune::ParallelIndexSet<GlobalIdType,LI,512> PIS;
187  typedef Dune::RemoteIndices<PIS> RI;
188  typedef Dune::RemoteIndexListModifier<PIS,typename RI::Allocator,false> RILM;
189  typedef typename RI::RemoteIndex RX;
190  typedef Dune::BufferedCommunicator BC;
191  typedef Dune::Interface IF;
192  typedef EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner> OwnerSet;
193  typedef EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> CopySet;
194  typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::overlap>,AttributeSet> OwnerOverlapSet;
195  typedef Dune::AllSet<AttributeSet> AllSet;
196  protected:
197 
198 
200  template<typename T>
202  {
203  typedef typename CommPolicy<T>::IndexedType V;
204 
205  static V gather(const T& a, std::size_t i)
206  {
207  return a[i];
208  }
209 
210  static void scatter(T& a, V v, std::size_t i)
211  {
212  a[i] = v;
213  }
214  };
215  template<typename T>
217  {
218  typedef typename CommPolicy<T>::IndexedType V;
219 
220  static V gather(const T& a, std::size_t i)
221  {
222  return a[i];
223  }
224 
225  static void scatter(T& a, V v, std::size_t i)
226  {
227  a[i] += v;
228  }
229  };
230 
232  {
233  if (OwnerOverlapToAllInterfaceBuilt)
234  OwnerOverlapToAllInterface.free();
235  typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::overlap>,AttributeSet> OwnerOverlapSet;
236  typedef Combine<OwnerOverlapSet,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy>,AttributeSet> AllSet;
237  OwnerOverlapSet sourceFlags;
238  AllSet destFlags;
239  OwnerOverlapToAllInterface.build(ri,sourceFlags,destFlags);
240  OwnerOverlapToAllInterfaceBuilt = true;
241  }
242 
244  {
245  if (OwnerToAllInterfaceBuilt)
246  OwnerToAllInterface.free();
247  OwnerSet sourceFlags;
248  AllSet destFlags;
249  OwnerToAllInterface.build(ri,sourceFlags,destFlags);
250  OwnerToAllInterfaceBuilt = true;
251  }
252 
254  {
255  if (OwnerCopyToAllInterfaceBuilt)
256  OwnerCopyToAllInterface.free();
257  typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy>,AttributeSet> OwnerCopySet;
258  typedef Combine<OwnerCopySet,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::overlap>,AttributeSet> AllSet;
259  OwnerCopySet sourceFlags;
260  AllSet destFlags;
261  OwnerCopyToAllInterface.build(ri,sourceFlags,destFlags);
262  OwnerCopyToAllInterfaceBuilt = true;
263  }
264 
266  {
267  if (OwnerCopyToOwnerCopyInterfaceBuilt)
268  OwnerCopyToOwnerCopyInterface.free();
269  typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy>,AttributeSet> OwnerCopySet;
270  OwnerCopySet sourceFlags;
271  OwnerCopySet destFlags;
272  OwnerCopyToOwnerCopyInterface.build(ri,sourceFlags,destFlags);
273  OwnerCopyToOwnerCopyInterfaceBuilt = true;
274  }
275 
277  {
278  if (CopyToAllInterfaceBuilt)
279  CopyToAllInterface.free();
280  CopySet sourceFlags;
281  AllSet destFlags;
282  CopyToAllInterface.build(ri,sourceFlags,destFlags);
283  CopyToAllInterfaceBuilt = true;
284  }
285 
286  public:
287 
293  return category_;
294  }
295 
296  const CollectiveCommunication<MPI_Comm>& communicator() const
297  {
298  return cc;
299  }
300 
307  template<class T>
308  void copyOwnerToAll (const T& source, T& dest) const
309  {
310  if (!OwnerToAllInterfaceBuilt)
313  communicator.template build<T>(OwnerToAllInterface);
314  communicator.template forward<CopyGatherScatter<T> >(source,dest);
315  communicator.free();
316  }
317 
324  template<class T>
325  void copyCopyToAll (const T& source, T& dest) const
326  {
327  if (!CopyToAllInterfaceBuilt)
330  communicator.template build<T>(CopyToAllInterface);
331  communicator.template forward<CopyGatherScatter<T> >(source,dest);
332  communicator.free();
333  }
334 
341  template<class T>
342  void addOwnerOverlapToAll (const T& source, T& dest) const
343  {
344  if (!OwnerOverlapToAllInterfaceBuilt)
347  communicator.template build<T>(OwnerOverlapToAllInterface);
348  communicator.template forward<AddGatherScatter<T> >(source,dest);
349  communicator.free();
350  }
351 
358  template<class T>
359  void addOwnerCopyToAll (const T& source, T& dest) const
360  {
361  if (!OwnerCopyToAllInterfaceBuilt)
364  communicator.template build<T>(OwnerCopyToAllInterface);
365  communicator.template forward<AddGatherScatter<T> >(source,dest);
366  communicator.free();
367  }
368 
375  template<class T>
376  void addOwnerCopyToOwnerCopy (const T& source, T& dest) const
377  {
378  if (!OwnerCopyToOwnerCopyInterfaceBuilt)
381  communicator.template build<T>(OwnerCopyToOwnerCopyInterface);
382  communicator.template forward<AddGatherScatter<T> >(source,dest);
383  communicator.free();
384  }
385 
386 
394  template<class T1, class T2>
395  void dot (const T1& x, const T1& y, T2& result) const
396  {
397  using real_type = typename FieldTraits<typename T1::field_type>::real_type;
398  // set up mask vector
399  if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size()))
400  {
401  mask.resize(x.size());
402  for (typename std::vector<double>::size_type i=0; i<mask.size(); i++)
403  mask[i] = 1;
404  for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
405  if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
406  mask[i->local().local()] = 0;
407  }
408  result = T2(0.0);
409 
410  for (typename T1::size_type i=0; i<x.size(); i++)
411  result += (x[i]*(y[i]))*static_cast<real_type>(mask[i]);
412  result = cc.sum(result);
413  }
414 
421  template<class T1>
422  typename FieldTraits<typename T1::field_type>::real_type norm (const T1& x) const
423  {
424  using real_type = typename FieldTraits<typename T1::field_type>::real_type;
425 
426  // set up mask vector
427  if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size()))
428  {
429  mask.resize(x.size());
430  for (typename std::vector<double>::size_type i=0; i<mask.size(); i++)
431  mask[i] = 1;
432  for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
433  if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
434  mask[i->local().local()] = 0;
435  }
436  auto result = real_type(0.0);
437  for (typename T1::size_type i=0; i<x.size(); i++)
438  result += Impl::asVector(x[i]).two_norm2()*mask[i];
439  using std::sqrt;
440  return sqrt(cc.sum(result));
441  }
442 
443  typedef Dune::EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> CopyFlags;
444 
446  typedef Dune::ParallelIndexSet<GlobalIdType,LI,512> ParallelIndexSet;
447 
449  typedef Dune::RemoteIndices<PIS> RemoteIndices;
450 
453  typedef Dune::GlobalLookupIndexSet<ParallelIndexSet> GlobalLookupIndexSet;
454 
459  const ParallelIndexSet& indexSet() const
460  {
461  return pis;
462  }
463 
469  {
470  return ri;
471  }
472 
478  {
479  return pis;
480  }
481 
482 
488  {
489  return ri;
490  }
491 
493  {
494  if(globalLookup_) {
495  if(pis.seqNo()==oldseqNo)
496  // Nothing changed!
497  return;
498  delete globalLookup_;
499  }
500 
501  globalLookup_ = new GlobalLookupIndexSet(pis);
502  oldseqNo = pis.seqNo();
503  }
504 
505  void buildGlobalLookup(std::size_t size)
506  {
507  if(globalLookup_) {
508  if(pis.seqNo()==oldseqNo)
509  // Nothing changed!
510  return;
511  delete globalLookup_;
512  }
513  globalLookup_ = new GlobalLookupIndexSet(pis, size);
514  oldseqNo = pis.seqNo();
515  }
516 
518  {
519  delete globalLookup_;
520  globalLookup_=0;
521  }
522 
524  {
525  assert(globalLookup_ != 0);
526  return *globalLookup_;
527  }
528 
534  template<class T1>
535  void project (T1& x) const
536  {
537  for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
538  if (i->local().attribute()==OwnerOverlapCopyAttributeSet::copy)
539  x[i->local().local()] = 0;
540  }
541 
553  bool freecomm_ = false)
554  : comm(comm_), cc(comm_), pis(), ri(pis,pis,comm_),
555  OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false),
556  OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt(false),
557  CopyToAllInterfaceBuilt(false), globalLookup_(0), category_(cat_),
558  freecomm(freecomm_)
559  {}
560 
570  : comm(MPI_COMM_WORLD), cc(MPI_COMM_WORLD), pis(), ri(pis,pis,MPI_COMM_WORLD),
571  OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false),
572  OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt(false),
573  CopyToAllInterfaceBuilt(false), globalLookup_(0), category_(cat_), freecomm(false)
574  {}
575 
584  MPI_Comm comm_,
586  bool freecomm_ = false)
587  : comm(comm_), cc(comm_), OwnerToAllInterfaceBuilt(false),
588  OwnerOverlapToAllInterfaceBuilt(false), OwnerCopyToAllInterfaceBuilt(false),
589  OwnerCopyToOwnerCopyInterfaceBuilt(false), CopyToAllInterfaceBuilt(false),
590  globalLookup_(0), category_(cat_), freecomm(freecomm_)
591  {
592  // set up an ISTL index set
593  pis.beginResize();
594  for (localindex_iterator i=indexinfo.localIndices().begin(); i!=indexinfo.localIndices().end(); ++i)
595  {
596  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::owner)
597  pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::owner,true));
598  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap)
599  pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::overlap,true));
600  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::copy)
601  pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::copy,true));
602  // std::cout << cc.rank() << ": adding index " << std::get<0>(*i) << " " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl;
603  }
604  pis.endResize();
605 
606  // build remote indices WITHOUT communication
607  // std::cout << cc.rank() << ": build remote indices" << std::endl;
608  ri.setIndexSets(pis,pis,cc);
609  if (indexinfo.remoteIndices().size()>0)
610  {
611  remoteindex_iterator i=indexinfo.remoteIndices().begin();
612  int p = std::get<0>(*i);
613  RILM modifier = ri.template getModifier<false,true>(p);
614  typename PIS::const_iterator pi=pis.begin();
615  for ( ; i!=indexinfo.remoteIndices().end(); ++i)
616  {
617  // handle processor change
618  if (p!=std::get<0>(*i))
619  {
620  p = std::get<0>(*i);
621  modifier = ri.template getModifier<false,true>(p);
622  pi=pis.begin();
623  }
624 
625  // position to correct entry in parallel index set
626  while (pi->global()!=std::get<1>(*i) && pi!=pis.end())
627  ++pi;
628  if (pi==pis.end())
629  DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set");
630 
631  // insert entry
632  // std::cout << cc.rank() << ": adding remote index " << std::get<0>(*i) << " " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl;
633  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::owner)
634  modifier.insert(RX(OwnerOverlapCopyAttributeSet::owner,&(*pi)));
635  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap)
636  modifier.insert(RX(OwnerOverlapCopyAttributeSet::overlap,&(*pi)));
637  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::copy)
638  modifier.insert(RX(OwnerOverlapCopyAttributeSet::copy,&(*pi)));
639  }
640  }else{
641  // Force remote indices to be synced!
642  ri.template getModifier<false,true>(0);
643  }
644  }
645 
646  // destructor: free memory in some objects
648  {
649  ri.free();
650  if (OwnerToAllInterfaceBuilt) OwnerToAllInterface.free();
651  if (OwnerOverlapToAllInterfaceBuilt) OwnerOverlapToAllInterface.free();
652  if (OwnerCopyToAllInterfaceBuilt) OwnerCopyToAllInterface.free();
653  if (OwnerCopyToOwnerCopyInterfaceBuilt) OwnerCopyToOwnerCopyInterface.free();
654  if (CopyToAllInterfaceBuilt) CopyToAllInterface.free();
655  if (globalLookup_) delete globalLookup_;
656  if (freecomm==true)
657  if(comm!=MPI_COMM_NULL)
658  {
659 #ifdef MPI_2
660  // If it is possible to query whether MPI_Finalize
661  // was called, only free the communicator before
662  // calling MPI_Finalize.
663  int wasFinalized = 0;
664  MPI_Finalized( &wasFinalized );
665  if(!wasFinalized)
666 #endif
667  MPI_Comm_free(&comm);
668  }
669  }
670 
671  private:
673  {}
674  MPI_Comm comm;
675  CollectiveCommunication<MPI_Comm> cc;
676  PIS pis;
677  RI ri;
678  mutable IF OwnerToAllInterface;
679  mutable bool OwnerToAllInterfaceBuilt;
680  mutable IF OwnerOverlapToAllInterface;
681  mutable bool OwnerOverlapToAllInterfaceBuilt;
682  mutable IF OwnerCopyToAllInterface;
683  mutable bool OwnerCopyToAllInterfaceBuilt;
684  mutable IF OwnerCopyToOwnerCopyInterface;
685  mutable bool OwnerCopyToOwnerCopyInterfaceBuilt;
686  mutable IF CopyToAllInterface;
687  mutable bool CopyToAllInterfaceBuilt;
688  mutable std::vector<double> mask;
689  int oldseqNo;
690  GlobalLookupIndexSet* globalLookup_;
691  const SolverCategory::Category category_;
692  bool freecomm;
693  };
694 
695 #endif
696 
697 
700 } // end namespace
701 
702 #endif
Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices.
void testRedistributed(int s)
Definition: allocator.hh:9
derive error class from the base class in common
Definition: istlexception.hh:17
Attribute set for overlapping Schwarz.
Definition: owneroverlapcopy.hh:57
AttributeSet
Definition: owneroverlapcopy.hh:58
@ owner
Definition: owneroverlapcopy.hh:59
@ copy
Definition: owneroverlapcopy.hh:59
@ overlap
Definition: owneroverlapcopy.hh:59
Information about the index distribution.
Definition: owneroverlapcopy.hh:76
std::tuple< GlobalIdType, LocalIdType, int > IndexTripel
A triple describing a local index.
Definition: owneroverlapcopy.hh:90
void addRemoteIndex(const RemoteIndexTripel &x)
Add a new remote index triple to the set of remote indices.
Definition: owneroverlapcopy.hh:118
G GlobalIdType
The type of the global index.
Definition: owneroverlapcopy.hh:79
L LocalIdType
The type of the local index.
Definition: owneroverlapcopy.hh:82
const std::set< IndexTripel > & localIndices() const
Get the set of indices local to the process.
Definition: owneroverlapcopy.hh:131
void clear()
Remove all indices from the sets.
Definition: owneroverlapcopy.hh:148
void addLocalIndex(const IndexTripel &x)
Add a new index triple to the set of local indices.
Definition: owneroverlapcopy.hh:104
const std::set< RemoteIndexTripel > & remoteIndices() const
Get the set of remote indices.
Definition: owneroverlapcopy.hh:140
std::tuple< int, GlobalIdType, int > RemoteIndexTripel
A triple describing a remote index.
Definition: owneroverlapcopy.hh:97
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition: owneroverlapcopy.hh:172
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopySet
Definition: owneroverlapcopy.hh:193
const CollectiveCommunication< MPI_Comm > & communicator() const
Definition: owneroverlapcopy.hh:296
const ParallelIndexSet & indexSet() const
Get the underlying parallel index set.
Definition: owneroverlapcopy.hh:459
void buildOwnerOverlapToAllInterface() const
Definition: owneroverlapcopy.hh:231
RemoteIndices & remoteIndices()
Get the underlying remote indices.
Definition: owneroverlapcopy.hh:487
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > PIS
Definition: owneroverlapcopy.hh:186
void buildOwnerCopyToAllInterface() const
Definition: owneroverlapcopy.hh:253
ParallelIndexSet & indexSet()
Get the underlying parallel index set.
Definition: owneroverlapcopy.hh:477
void buildOwnerCopyToOwnerCopyInterface() const
Definition: owneroverlapcopy.hh:265
OwnerOverlapCopyCommunication(const IndexInfoFromGrid< GlobalIdType, LocalIdType > &indexinfo, MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Constructor.
Definition: owneroverlapcopy.hh:583
SolverCategory::Category category() const
Get Solver Category.
Definition: owneroverlapcopy.hh:292
void addOwnerCopyToOwnerCopy(const T &source, T &dest) const
Communicate values from owner and copy data points to owner and copy data points and add them to thos...
Definition: owneroverlapcopy.hh:376
void buildCopyToAllInterface() const
Definition: owneroverlapcopy.hh:276
FieldTraits< typename T1::field_type >::real_type norm(const T1 &x) const
Compute the global Euclidean norm of a vector.
Definition: owneroverlapcopy.hh:422
Dune::EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopyFlags
Definition: owneroverlapcopy.hh:443
Dune::RemoteIndices< PIS > RI
Definition: owneroverlapcopy.hh:187
void buildGlobalLookup(std::size_t size)
Definition: owneroverlapcopy.hh:505
void addOwnerOverlapToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points and add them to those values.
Definition: owneroverlapcopy.hh:342
Dune::RemoteIndices< PIS > RemoteIndices
The type of the remote indices.
Definition: owneroverlapcopy.hh:449
void project(T1 &x) const
Set vector to zero at copy dofs.
Definition: owneroverlapcopy.hh:535
Dune::AllSet< AttributeSet > AllSet
Definition: owneroverlapcopy.hh:195
Combine< EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner >, EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::overlap >, AttributeSet > OwnerOverlapSet
Definition: owneroverlapcopy.hh:194
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition: owneroverlapcopy.hh:325
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition: owneroverlapcopy.hh:453
Dune::Interface IF
Definition: owneroverlapcopy.hh:191
~OwnerOverlapCopyCommunication()
Definition: owneroverlapcopy.hh:647
void buildGlobalLookup()
Definition: owneroverlapcopy.hh:492
Dune::BufferedCommunicator BC
Definition: owneroverlapcopy.hh:190
OwnerOverlapCopyCommunication(MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Construct the communication without any indices.
Definition: owneroverlapcopy.hh:551
void dot(const T1 &x, const T1 &y, T2 &result) const
Compute a global dot product of two vectors.
Definition: owneroverlapcopy.hh:395
OwnerOverlapCopyCommunication(SolverCategory::Category cat_=SolverCategory::overlapping)
Construct the communication without any indices using MPI_COMM_WORLD.
Definition: owneroverlapcopy.hh:569
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet
Definition: owneroverlapcopy.hh:192
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition: owneroverlapcopy.hh:468
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition: owneroverlapcopy.hh:308
friend void loadMatrixMarket(M &, const std::string &, OwnerOverlapCopyCommunication< G, L > &, bool)
Load a parallel matrix/vector stored in matrix market format.
Definition: matrixmarket.hh:1222
RI::RemoteIndex RX
Definition: owneroverlapcopy.hh:189
void addOwnerCopyToAll(const T &source, T &dest) const
Communicate values from owner and copy data points to all other data points and add them to those val...
Definition: owneroverlapcopy.hh:359
void freeGlobalLookup()
Definition: owneroverlapcopy.hh:517
Dune::RemoteIndexListModifier< PIS, typename RI::Allocator, false > RILM
Definition: owneroverlapcopy.hh:188
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition: owneroverlapcopy.hh:446
void buildOwnerToAllInterface() const
Definition: owneroverlapcopy.hh:243
const GlobalLookupIndexSet & globalLookup() const
Definition: owneroverlapcopy.hh:523
gather/scatter callback for communcation
Definition: owneroverlapcopy.hh:202
static V gather(const T &a, std::size_t i)
Definition: owneroverlapcopy.hh:205
static void scatter(T &a, V v, std::size_t i)
Definition: owneroverlapcopy.hh:210
CommPolicy< T >::IndexedType V
Definition: owneroverlapcopy.hh:203
CommPolicy< T >::IndexedType V
Definition: owneroverlapcopy.hh:218
static V gather(const T &a, std::size_t i)
Definition: owneroverlapcopy.hh:220
static void scatter(T &a, V v, std::size_t i)
Definition: owneroverlapcopy.hh:225
Category
Definition: solvercategory.hh:21
@ overlapping
Category for overlapping solvers.
Definition: solvercategory.hh:27