8template<
class value_type>
9static inline MPI_Datatype getMPIDataType(){ assert(
false &&
"Type not supported!\n" );
return MPI_DOUBLE; }
11inline MPI_Datatype getMPIDataType<double>(){
return MPI_DOUBLE;}
13inline MPI_Datatype getMPIDataType<float>(){
return MPI_FLOAT;}
15inline MPI_Datatype getMPIDataType<int>(){
return MPI_INT;}
17inline MPI_Datatype getMPIDataType<bool>(){
return MPI_C_BOOL;}
19inline MPI_Datatype getMPIDataType<unsigned>(){
return MPI_UNSIGNED;}
96template<
class LocalContainer>
110 if( do_size() == 0 )
return LocalContainer();
111 return do_make_buffer();
126 do_global_gather( values, buffer);
142 LocalContainer tmp = do_make_buffer();
143 do_global_gather( values, tmp);
160 do_global_scatter_reduce(toScatter, values);
212 return do_isCommunicating();
237 m_source_size = src.m_source_size;
243 m_source_size = new_size;
246 unsigned m_source_size;
247 virtual MPI_Comm do_communicator()
const=0;
248 virtual unsigned do_size()
const=0;
249 virtual LocalContainer do_make_buffer( )
const=0;
250 virtual void do_global_gather(
const value_type* values, LocalContainer& gathered)
const=0;
251 virtual void do_global_scatter_reduce(
const LocalContainer& toScatter,
value_type* values)
const=0;
252 virtual bool do_isCommunicating( )
const {
typename TensorTraits< std::decay_t< Vector > >::value_type get_value_type
Definition: tensor_traits.h:38
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Struct that performs collective scatter and gather operations across processes on distributed vectors...
Definition: mpi_communicator.h:98
void global_gather(const value_type *values, LocalContainer &buffer) const
. Globally (across processes) gather data into a buffer
Definition: mpi_communicator.h:124
aCommunicator & operator=(const aCommunicator &src)
only derived classes can assign
Definition: mpi_communicator.h:236
unsigned local_size() const
The local size of the source vector v = local size of the dg::MPI_Vector
Definition: mpi_communicator.h:190
aCommunicator(const aCommunicator &src)
only derived classes can copy
Definition: mpi_communicator.h:232
void global_scatter_reduce(const LocalContainer &toScatter, value_type *values) const
. Globally (across processes) scatter data accross processes and reduce on multiple indices
Definition: mpi_communicator.h:159
LocalContainer container_type
reveal local container type
Definition: mpi_communicator.h:101
get_value_type< LocalContainer > value_type
reveal value type
Definition: mpi_communicator.h:99
unsigned buffer_size() const
The local size of the buffer vector w = local map size.
Definition: mpi_communicator.h:178
void set_local_size(unsigned new_size)
Set the local size of the source vector v.
Definition: mpi_communicator.h:242
virtual ~aCommunicator()
vritual destructor
Definition: mpi_communicator.h:225
LocalContainer global_gather(const value_type *values) const
. Globally (across processes) gather data into a buffer (memory allocating version)
Definition: mpi_communicator.h:140
LocalContainer allocate_buffer() const
Allocate a buffer object of size buffer_size()
Definition: mpi_communicator.h:109
bool isCommunicating() const
True if the gather/scatter operation involves actual MPI communication.
Definition: mpi_communicator.h:211
MPI_Comm communicator() const
The internal MPI communicator used.
Definition: mpi_communicator.h:220
virtual aCommunicator * clone() const =0
Generic copy method.
aCommunicator(unsigned local_size=0)
only derived classes can construct
Definition: mpi_communicator.h:229