13#ifndef DUNE_COMMON_MPIGUARD_HH
14#define DUNE_COMMON_MPIGUARD_HH
29 struct GuardCommunicator
34 virtual int rank() = 0;
35 virtual int size() = 0;
36 virtual int sum(
int i) = 0;
52 struct GenericGuardCommunicator
53 :
public GuardCommunicator
57 struct GenericGuardCommunicator< Communication<T> >
58 :
public GuardCommunicator
63 int rank()
override {
return comm.rank(); };
64 int size()
override {
return comm.size(); };
65 int sum(
int i)
override {
return comm.sum(
i); }
71 struct GenericGuardCommunicator<MPI_Comm>
72 :
public GenericGuardCommunicator< Communication<MPI_Comm> >
82 GuardCommunicator * GuardCommunicator::create(
const Communication<C> & comm)
88 GuardCommunicator * GuardCommunicator::create(
const MPI_Comm & comm)
159 m.getCommunication())),
227 << comm_->rank() <<
" due to "
228 <<
result <<
" remote error(s)");
A few common exception classes.
Implements an utility class that provides collective communication methods for sequential programs.
Helpers for dealing with MPI.
Implements an utility class that provides MPI's collective communication methods.
size_type size() const
Get the number of elements in the list.
Definition arraylist.hh:472
ArrayList()
Constructs an Array list with one chunk.
Definition arraylist.hh:457
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
Dune namespace.
Definition alignedallocator.hh:13
A dynamically growing random access list.
Definition arraylist.hh:62
Default exception if an error in the parallel communication of the program occurred.
Definition exceptions.hh:287
This exception is thrown if the MPIGuard detects an error on a remote process.
Definition mpiguard.hh:99
detects a thrown exception and communicates to all other processes
Definition mpiguard.hh:134
void reactivate()
reactivate the guard.
Definition mpiguard.hh:202
void finalize(bool success=true)
stop the guard.
Definition mpiguard.hh:218
~MPIGuard()
destroy the guard and check for undetected exceptions
Definition mpiguard.hh:188
MPIGuard(const C &comm, bool active=true)
create an MPIGuard operating on an arbitrary communicator.
Definition mpiguard.hh:174
MPIGuard(const MPI_Comm &comm, bool active=true)
Definition mpiguard.hh:180
MPIGuard(bool active=true)
create an MPIGuard operating on the Communicator of the global Dune::MPIHelper
Definition mpiguard.hh:146
MPIGuard(MPIHelper &m, bool active=true)
create an MPIGuard operating on the Communicator of a special Dune::MPIHelper m
Definition mpiguard.hh:157
A real mpi helper.
Definition mpihelper.hh:179