dune-istl  2.9.0
owneroverlapcopy.hh
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 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_ISTL_OWNEROVERLAPCOPY_HH
6 #define DUNE_ISTL_OWNEROVERLAPCOPY_HH
7 
8 #include <new>
9 #include <iostream>
10 #include <vector>
11 #include <list>
12 #include <map>
13 #include <set>
14 #include <tuple>
15 
16 #include "cmath"
17 
18 // MPI header
19 #if HAVE_MPI
20 #include <mpi.h>
21 #endif
22 
23 #include <dune/common/enumset.hh>
24 
25 #if HAVE_MPI
26 #include <dune/common/parallel/indexset.hh>
27 #include <dune/common/parallel/communicator.hh>
28 #include <dune/common/parallel/remoteindices.hh>
29 #include <dune/common/parallel/mpicommunication.hh>
30 #endif
31 
32 #include "solvercategory.hh"
33 #include "istlexception.hh"
34 #include <dune/common/parallel/communication.hh>
36 
37 template<int dim, template<class,class> class Comm>
38 void testRedistributed(int s);
39 
40 
41 namespace Dune {
42 
59  {
60  enum AttributeSet {
61  owner=1, overlap=2, copy=3
62  };
63  };
64 
76  template <class G, class L>
78  {
79  public:
81  typedef G GlobalIdType;
82 
84  typedef L LocalIdType;
85 
92  typedef std::tuple<GlobalIdType,LocalIdType,int> IndexTripel;
99  typedef std::tuple<int,GlobalIdType,int> RemoteIndexTripel;
100 
106  void addLocalIndex (const IndexTripel& x)
107  {
108  if (std::get<2>(x)!=OwnerOverlapCopyAttributeSet::owner &&
109  std::get<2>(x)!=OwnerOverlapCopyAttributeSet::overlap &&
110  std::get<2>(x)!=OwnerOverlapCopyAttributeSet::copy)
111  DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set");
112  localindices.insert(x);
113  }
114 
121  {
122  if (std::get<2>(x)!=OwnerOverlapCopyAttributeSet::owner &&
123  std::get<2>(x)!=OwnerOverlapCopyAttributeSet::overlap &&
124  std::get<2>(x)!=OwnerOverlapCopyAttributeSet::copy)
125  DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set");
126  remoteindices.insert(x);
127  }
128 
133  const std::set<IndexTripel>& localIndices () const
134  {
135  return localindices;
136  }
137 
142  const std::set<RemoteIndexTripel>& remoteIndices () const
143  {
144  return remoteindices;
145  }
146 
150  void clear ()
151  {
152  localindices.clear();
153  remoteindices.clear();
154  }
155 
156  private:
158  std::set<IndexTripel> localindices;
160  std::set<RemoteIndexTripel> remoteindices;
161  };
162 
163 
164 #if HAVE_MPI
165 
172  template <class GlobalIdType, class LocalIdType=int>
174  {
175  template<typename M, typename G, typename L>
176  friend void loadMatrixMarket(M&,
177  const std::string&,
179  bool);
180  // used types
182  typedef typename IndexInfoFromGrid<GlobalIdType,LocalIdType>::RemoteIndexTripel RemoteIndexTripel;
183  typedef typename std::set<IndexTripel>::const_iterator localindex_iterator;
184  typedef typename std::set<RemoteIndexTripel>::const_iterator remoteindex_iterator;
186  typedef Dune::ParallelLocalIndex<AttributeSet> LI;
187  public:
188  typedef Dune::ParallelIndexSet<GlobalIdType,LI,512> PIS;
189  typedef Dune::RemoteIndices<PIS> RI;
190  typedef Dune::RemoteIndexListModifier<PIS,typename RI::Allocator,false> RILM;
191  typedef typename RI::RemoteIndex RX;
192  typedef Dune::BufferedCommunicator BC;
193  typedef Dune::Interface IF;
194  typedef EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner> OwnerSet;
195  typedef EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> CopySet;
196  typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::overlap>,AttributeSet> OwnerOverlapSet;
197  typedef Dune::AllSet<AttributeSet> AllSet;
198  protected:
199 
200 
202  template<typename T>
204  {
205  typedef typename CommPolicy<T>::IndexedType V;
206 
207  static V gather(const T& a, std::size_t i)
208  {
209  return a[i];
210  }
211 
212  static void scatter(T& a, V v, std::size_t i)
213  {
214  a[i] = v;
215  }
216  };
217  template<typename T>
219  {
220  typedef typename CommPolicy<T>::IndexedType V;
221 
222  static V gather(const T& a, std::size_t i)
223  {
224  return a[i];
225  }
226 
227  static void scatter(T& a, V v, std::size_t i)
228  {
229  a[i] += v;
230  }
231  };
232 
234  {
235  if (OwnerOverlapToAllInterfaceBuilt)
236  OwnerOverlapToAllInterface.free();
237  OwnerOverlapSet sourceFlags;
238  Combine<OwnerOverlapSet,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy>,AttributeSet>
239  destFlags;
240  OwnerOverlapToAllInterface.build(ri,sourceFlags,destFlags);
241  OwnerOverlapToAllInterfaceBuilt = true;
242  }
243 
245  {
246  if (OwnerToAllInterfaceBuilt)
247  OwnerToAllInterface.free();
248  OwnerSet sourceFlags;
249  AllSet destFlags;
250  OwnerToAllInterface.build(ri,sourceFlags,destFlags);
251  OwnerToAllInterfaceBuilt = true;
252  }
253 
255  {
256  if (OwnerCopyToAllInterfaceBuilt)
257  OwnerCopyToAllInterface.free();
258 
259  typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy>,AttributeSet> OwnerCopySet;
260  OwnerCopySet sourceFlags;
261  Combine<OwnerCopySet,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::overlap>,AttributeSet> destFlags;
262  OwnerCopyToAllInterface.build(ri,sourceFlags,destFlags);
263  OwnerCopyToAllInterfaceBuilt = true;
264  }
265 
267  {
268  if (OwnerCopyToOwnerCopyInterfaceBuilt)
269  OwnerCopyToOwnerCopyInterface.free();
270 
271 
272  typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy>,AttributeSet> OwnerCopySet;
273  OwnerCopySet sourceFlags;
274  OwnerCopySet destFlags;
275  OwnerCopyToOwnerCopyInterface.build(ri,sourceFlags,destFlags);
276  OwnerCopyToOwnerCopyInterfaceBuilt = true;
277  }
278 
280  {
281  if (CopyToAllInterfaceBuilt)
282  CopyToAllInterface.free();
283  CopySet sourceFlags;
284  AllSet destFlags;
285  CopyToAllInterface.build(ri,sourceFlags,destFlags);
286  CopyToAllInterfaceBuilt = true;
287  }
288 
289  public:
290 
296  return category_;
297  }
298 
299  const Communication<MPI_Comm>& communicator() const
300  {
301  return cc;
302  }
303 
310  template<class T>
311  void copyOwnerToAll (const T& source, T& dest) const
312  {
313  if (!OwnerToAllInterfaceBuilt)
316  communicator.template build<T>(OwnerToAllInterface);
317  communicator.template forward<CopyGatherScatter<T> >(source,dest);
318  communicator.free();
319  }
320 
327  template<class T>
328  void copyCopyToAll (const T& source, T& dest) const
329  {
330  if (!CopyToAllInterfaceBuilt)
333  communicator.template build<T>(CopyToAllInterface);
334  communicator.template forward<CopyGatherScatter<T> >(source,dest);
335  communicator.free();
336  }
337 
344  template<class T>
345  void addOwnerOverlapToAll (const T& source, T& dest) const
346  {
347  if (!OwnerOverlapToAllInterfaceBuilt)
350  communicator.template build<T>(OwnerOverlapToAllInterface);
351  communicator.template forward<AddGatherScatter<T> >(source,dest);
352  communicator.free();
353  }
354 
361  template<class T>
362  void addOwnerCopyToAll (const T& source, T& dest) const
363  {
364  if (!OwnerCopyToAllInterfaceBuilt)
367  communicator.template build<T>(OwnerCopyToAllInterface);
368  communicator.template forward<AddGatherScatter<T> >(source,dest);
369  communicator.free();
370  }
371 
378  template<class T>
379  void addOwnerCopyToOwnerCopy (const T& source, T& dest) const
380  {
381  if (!OwnerCopyToOwnerCopyInterfaceBuilt)
384  communicator.template build<T>(OwnerCopyToOwnerCopyInterface);
385  communicator.template forward<AddGatherScatter<T> >(source,dest);
386  communicator.free();
387  }
388 
389 
397  template<class T1, class T2>
398  void dot (const T1& x, const T1& y, T2& result) const
399  {
400  using real_type = typename FieldTraits<typename T1::field_type>::real_type;
401  // set up mask vector
402  if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size()))
403  {
404  mask.resize(x.size());
405  for (typename std::vector<double>::size_type i=0; i<mask.size(); i++)
406  mask[i] = 1;
407  for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
408  if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
409  mask[i->local().local()] = 0;
410  }
411  result = T2(0.0);
412 
413  for (typename T1::size_type i=0; i<x.size(); i++)
414  result += (x[i]*(y[i]))*static_cast<real_type>(mask[i]);
415  result = cc.sum(result);
416  }
417 
424  template<class T1>
425  typename FieldTraits<typename T1::field_type>::real_type norm (const T1& x) const
426  {
427  using real_type = typename FieldTraits<typename T1::field_type>::real_type;
428 
429  // set up mask vector
430  if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size()))
431  {
432  mask.resize(x.size());
433  for (typename std::vector<double>::size_type i=0; i<mask.size(); i++)
434  mask[i] = 1;
435  for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
436  if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
437  mask[i->local().local()] = 0;
438  }
439  auto result = real_type(0.0);
440  for (typename T1::size_type i=0; i<x.size(); i++)
441  result += Impl::asVector(x[i]).two_norm2()*mask[i];
442  using std::sqrt;
443  return sqrt(cc.sum(result));
444  }
445 
446  typedef Dune::EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> CopyFlags;
447 
449  typedef Dune::ParallelIndexSet<GlobalIdType,LI,512> ParallelIndexSet;
450 
452  typedef Dune::RemoteIndices<PIS> RemoteIndices;
453 
456  typedef Dune::GlobalLookupIndexSet<ParallelIndexSet> GlobalLookupIndexSet;
457 
462  const ParallelIndexSet& indexSet() const
463  {
464  return pis;
465  }
466 
472  {
473  return ri;
474  }
475 
481  {
482  return pis;
483  }
484 
485 
491  {
492  return ri;
493  }
494 
496  {
497  if(globalLookup_) {
498  if(pis.seqNo()==oldseqNo)
499  // Nothing changed!
500  return;
501  delete globalLookup_;
502  }
503 
504  globalLookup_ = new GlobalLookupIndexSet(pis);
505  oldseqNo = pis.seqNo();
506  }
507 
508  void buildGlobalLookup(std::size_t size)
509  {
510  if(globalLookup_) {
511  if(pis.seqNo()==oldseqNo)
512  // Nothing changed!
513  return;
514  delete globalLookup_;
515  }
516  globalLookup_ = new GlobalLookupIndexSet(pis, size);
517  oldseqNo = pis.seqNo();
518  }
519 
521  {
522  delete globalLookup_;
523  globalLookup_=0;
524  }
525 
527  {
528  assert(globalLookup_ != 0);
529  return *globalLookup_;
530  }
531 
537  template<class T1>
538  void project (T1& x) const
539  {
540  for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
541  if (i->local().attribute()==OwnerOverlapCopyAttributeSet::copy)
542  x[i->local().local()] = 0;
543  }
544 
556  bool freecomm_ = false)
557  : comm(comm_), cc(comm_), pis(), ri(pis,pis,comm_),
558  OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false),
559  OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt(false),
560  CopyToAllInterfaceBuilt(false), globalLookup_(0), category_(cat_),
561  freecomm(freecomm_)
562  {}
563 
573  : comm(MPI_COMM_WORLD), cc(MPI_COMM_WORLD), pis(), ri(pis,pis,MPI_COMM_WORLD),
574  OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false),
575  OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt(false),
576  CopyToAllInterfaceBuilt(false), globalLookup_(0), category_(cat_), freecomm(false)
577  {}
578 
587  MPI_Comm comm_,
589  bool freecomm_ = false)
590  : comm(comm_), cc(comm_), OwnerToAllInterfaceBuilt(false),
591  OwnerOverlapToAllInterfaceBuilt(false), OwnerCopyToAllInterfaceBuilt(false),
592  OwnerCopyToOwnerCopyInterfaceBuilt(false), CopyToAllInterfaceBuilt(false),
593  globalLookup_(0), category_(cat_), freecomm(freecomm_)
594  {
595  // set up an ISTL index set
596  pis.beginResize();
597  for (localindex_iterator i=indexinfo.localIndices().begin(); i!=indexinfo.localIndices().end(); ++i)
598  {
599  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::owner)
600  pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::owner,true));
601  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap)
602  pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::overlap,true));
603  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::copy)
604  pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::copy,true));
605  // std::cout << cc.rank() << ": adding index " << std::get<0>(*i) << " " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl;
606  }
607  pis.endResize();
608 
609  // build remote indices WITHOUT communication
610  // std::cout << cc.rank() << ": build remote indices" << std::endl;
611  ri.setIndexSets(pis,pis,cc);
612  if (indexinfo.remoteIndices().size()>0)
613  {
614  remoteindex_iterator i=indexinfo.remoteIndices().begin();
615  int p = std::get<0>(*i);
616  RILM modifier = ri.template getModifier<false,true>(p);
617  typename PIS::const_iterator pi=pis.begin();
618  for ( ; i!=indexinfo.remoteIndices().end(); ++i)
619  {
620  // handle processor change
621  if (p!=std::get<0>(*i))
622  {
623  p = std::get<0>(*i);
624  modifier = ri.template getModifier<false,true>(p);
625  pi=pis.begin();
626  }
627 
628  // position to correct entry in parallel index set
629  while (pi->global()!=std::get<1>(*i) && pi!=pis.end())
630  ++pi;
631  if (pi==pis.end())
632  DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set");
633 
634  // insert entry
635  // std::cout << cc.rank() << ": adding remote index " << std::get<0>(*i) << " " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl;
636  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::owner)
637  modifier.insert(RX(OwnerOverlapCopyAttributeSet::owner,&(*pi)));
638  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap)
639  modifier.insert(RX(OwnerOverlapCopyAttributeSet::overlap,&(*pi)));
640  if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::copy)
641  modifier.insert(RX(OwnerOverlapCopyAttributeSet::copy,&(*pi)));
642  }
643  }else{
644  // Force remote indices to be synced!
645  ri.template getModifier<false,true>(0);
646  }
647  }
648 
649  // destructor: free memory in some objects
651  {
652  ri.free();
653  if (OwnerToAllInterfaceBuilt) OwnerToAllInterface.free();
654  if (OwnerOverlapToAllInterfaceBuilt) OwnerOverlapToAllInterface.free();
655  if (OwnerCopyToAllInterfaceBuilt) OwnerCopyToAllInterface.free();
656  if (OwnerCopyToOwnerCopyInterfaceBuilt) OwnerCopyToOwnerCopyInterface.free();
657  if (CopyToAllInterfaceBuilt) CopyToAllInterface.free();
658  if (globalLookup_) delete globalLookup_;
659  if (freecomm==true)
660  if(comm!=MPI_COMM_NULL)
661  {
662 #ifdef MPI_2
663  // If it is possible to query whether MPI_Finalize
664  // was called, only free the communicator before
665  // calling MPI_Finalize.
666  int wasFinalized = 0;
667  MPI_Finalized( &wasFinalized );
668  if(!wasFinalized)
669 #endif
670  MPI_Comm_free(&comm);
671  }
672  }
673 
674  private:
676  {}
677  MPI_Comm comm;
678  Communication<MPI_Comm> cc;
679  PIS pis;
680  RI ri;
681  mutable IF OwnerToAllInterface;
682  mutable bool OwnerToAllInterfaceBuilt;
683  mutable IF OwnerOverlapToAllInterface;
684  mutable bool OwnerOverlapToAllInterfaceBuilt;
685  mutable IF OwnerCopyToAllInterface;
686  mutable bool OwnerCopyToAllInterfaceBuilt;
687  mutable IF OwnerCopyToOwnerCopyInterface;
688  mutable bool OwnerCopyToOwnerCopyInterfaceBuilt;
689  mutable IF CopyToAllInterface;
690  mutable bool CopyToAllInterfaceBuilt;
691  mutable std::vector<double> mask;
692  int oldseqNo;
693  GlobalLookupIndexSet* globalLookup_;
694  const SolverCategory::Category category_;
695  bool freecomm;
696  };
697 
698 #endif
699 
700 
703 } // end namespace
704 
705 #endif
Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices.
void testRedistributed(int s)
Definition: allocator.hh:11
derive error class from the base class in common
Definition: istlexception.hh:19
Attribute set for overlapping Schwarz.
Definition: owneroverlapcopy.hh:59
AttributeSet
Definition: owneroverlapcopy.hh:60
@ owner
Definition: owneroverlapcopy.hh:61
@ copy
Definition: owneroverlapcopy.hh:61
@ overlap
Definition: owneroverlapcopy.hh:61
Information about the index distribution.
Definition: owneroverlapcopy.hh:78
std::tuple< GlobalIdType, LocalIdType, int > IndexTripel
A triple describing a local index.
Definition: owneroverlapcopy.hh:92
void addRemoteIndex(const RemoteIndexTripel &x)
Add a new remote index triple to the set of remote indices.
Definition: owneroverlapcopy.hh:120
G GlobalIdType
The type of the global index.
Definition: owneroverlapcopy.hh:81
L LocalIdType
The type of the local index.
Definition: owneroverlapcopy.hh:84
const std::set< IndexTripel > & localIndices() const
Get the set of indices local to the process.
Definition: owneroverlapcopy.hh:133
void clear()
Remove all indices from the sets.
Definition: owneroverlapcopy.hh:150
void addLocalIndex(const IndexTripel &x)
Add a new index triple to the set of local indices.
Definition: owneroverlapcopy.hh:106
const std::set< RemoteIndexTripel > & remoteIndices() const
Get the set of remote indices.
Definition: owneroverlapcopy.hh:142
std::tuple< int, GlobalIdType, int > RemoteIndexTripel
A triple describing a remote index.
Definition: owneroverlapcopy.hh:99
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition: owneroverlapcopy.hh:174
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopySet
Definition: owneroverlapcopy.hh:195
const ParallelIndexSet & indexSet() const
Get the underlying parallel index set.
Definition: owneroverlapcopy.hh:462
void buildOwnerOverlapToAllInterface() const
Definition: owneroverlapcopy.hh:233
RemoteIndices & remoteIndices()
Get the underlying remote indices.
Definition: owneroverlapcopy.hh:490
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > PIS
Definition: owneroverlapcopy.hh:188
void buildOwnerCopyToAllInterface() const
Definition: owneroverlapcopy.hh:254
ParallelIndexSet & indexSet()
Get the underlying parallel index set.
Definition: owneroverlapcopy.hh:480
void buildOwnerCopyToOwnerCopyInterface() const
Definition: owneroverlapcopy.hh:266
OwnerOverlapCopyCommunication(const IndexInfoFromGrid< GlobalIdType, LocalIdType > &indexinfo, MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Constructor.
Definition: owneroverlapcopy.hh:586
SolverCategory::Category category() const
Get Solver Category.
Definition: owneroverlapcopy.hh:295
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:379
void buildCopyToAllInterface() const
Definition: owneroverlapcopy.hh:279
FieldTraits< typename T1::field_type >::real_type norm(const T1 &x) const
Compute the global Euclidean norm of a vector.
Definition: owneroverlapcopy.hh:425
Dune::EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopyFlags
Definition: owneroverlapcopy.hh:446
Dune::RemoteIndices< PIS > RI
Definition: owneroverlapcopy.hh:189
void buildGlobalLookup(std::size_t size)
Definition: owneroverlapcopy.hh:508
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:345
Dune::RemoteIndices< PIS > RemoteIndices
The type of the remote indices.
Definition: owneroverlapcopy.hh:452
void project(T1 &x) const
Set vector to zero at copy dofs.
Definition: owneroverlapcopy.hh:538
Dune::AllSet< AttributeSet > AllSet
Definition: owneroverlapcopy.hh:197
Combine< EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner >, EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::overlap >, AttributeSet > OwnerOverlapSet
Definition: owneroverlapcopy.hh:196
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition: owneroverlapcopy.hh:328
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition: owneroverlapcopy.hh:456
Dune::Interface IF
Definition: owneroverlapcopy.hh:193
~OwnerOverlapCopyCommunication()
Definition: owneroverlapcopy.hh:650
void buildGlobalLookup()
Definition: owneroverlapcopy.hh:495
Dune::BufferedCommunicator BC
Definition: owneroverlapcopy.hh:192
OwnerOverlapCopyCommunication(MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Construct the communication without any indices.
Definition: owneroverlapcopy.hh:554
void dot(const T1 &x, const T1 &y, T2 &result) const
Compute a global dot product of two vectors.
Definition: owneroverlapcopy.hh:398
const Communication< MPI_Comm > & communicator() const
Definition: owneroverlapcopy.hh:299
OwnerOverlapCopyCommunication(SolverCategory::Category cat_=SolverCategory::overlapping)
Construct the communication without any indices using MPI_COMM_WORLD.
Definition: owneroverlapcopy.hh:572
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet
Definition: owneroverlapcopy.hh:194
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition: owneroverlapcopy.hh:471
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition: owneroverlapcopy.hh:311
friend void loadMatrixMarket(M &, const std::string &, OwnerOverlapCopyCommunication< G, L > &, bool)
Load a parallel matrix/vector stored in matrix market format.
Definition: matrixmarket.hh:1269
RI::RemoteIndex RX
Definition: owneroverlapcopy.hh:191
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:362
void freeGlobalLookup()
Definition: owneroverlapcopy.hh:520
Dune::RemoteIndexListModifier< PIS, typename RI::Allocator, false > RILM
Definition: owneroverlapcopy.hh:190
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition: owneroverlapcopy.hh:449
void buildOwnerToAllInterface() const
Definition: owneroverlapcopy.hh:244
const GlobalLookupIndexSet & globalLookup() const
Definition: owneroverlapcopy.hh:526
gather/scatter callback for communcation
Definition: owneroverlapcopy.hh:204
static V gather(const T &a, std::size_t i)
Definition: owneroverlapcopy.hh:207
static void scatter(T &a, V v, std::size_t i)
Definition: owneroverlapcopy.hh:212
CommPolicy< T >::IndexedType V
Definition: owneroverlapcopy.hh:205
CommPolicy< T >::IndexedType V
Definition: owneroverlapcopy.hh:220
static V gather(const T &a, std::size_t i)
Definition: owneroverlapcopy.hh:222
static void scatter(T &a, V v, std::size_t i)
Definition: owneroverlapcopy.hh:227
Category
Definition: solvercategory.hh:23
@ overlapping
Category for overlapping solvers.
Definition: solvercategory.hh:29