dune-common  2.2.0
Classes | Public Member Functions
Dune::BufferedCommunicator Class Reference

A communicator that uses buffers to gather and scatter the data to be send or received. More...

#include <dune/common/parallel/communicator.hh>

List of all members.

Classes

struct  MessageGatherer
 Functors for message data gathering.
struct  MessageGatherer< Data, GatherScatter, send, SizeOne >
 Functor for message data gathering for datatypes where at each index is only one value.
struct  MessageGatherer< Data, GatherScatter, send, VariableSize >
 Functor for message data scattering for datatypes where at each index can be a variable size of values.
struct  MessageInformation
 Information about a message to send.
struct  MessageScatterer
 Functors for message data scattering.
struct  MessageScatterer< Data, GatherScatter, send, SizeOne >
 Functor for message data gathering for datatypes where at each index is only one value.
struct  MessageScatterer< Data, GatherScatter, send, VariableSize >
 Functor for message data scattering for datatypes where at each index can be a variable size of values.
struct  MessageSizeCalculator
 Functors for message size caculation.
struct  MessageSizeCalculator< Data, SizeOne >
 Functor for message size caculation for datatypes where at each index is only one value.
struct  MessageSizeCalculator< Data, VariableSize >
 Functor for message size caculation for datatypes where at each index can be a variable number of values.

Public Member Functions

 BufferedCommunicator ()
 Constructor.
template<class Data , class Interface >
enable_if< is_same< SizeOne,
typename CommPolicy< Data >
::IndexedTypeFlag >::value,
void >::type 
build (const Interface &interface)
 Build the buffers and information for the communication process.
template<class Data , class Interface >
void build (const Data &source, const Data &target, const Interface &interface)
 Build the buffers and information for the communication process.
template<class GatherScatter , class Data >
void forward (const Data &source, Data &dest)
 Send from source to target.
template<class GatherScatter , class Data >
void backward (Data &source, const Data &dest)
 Communicate in the reverse direction, i.e. send from target to source.
template<class GatherScatter , class Data >
void forward (Data &data)
 Forward send where target and source are the same.
template<class GatherScatter , class Data >
void backward (Data &data)
 Backward send where target and source are the same.
void free ()
 Free the allocated memory (i.e. buffers and message information.
 ~BufferedCommunicator ()
 Destructor.

Detailed Description

A communicator that uses buffers to gather and scatter the data to be send or received.

Before the data is sent it it copied to a consecutive buffer and then that buffer is sent. The data is received in another buffer and then copied to the actual position.


Constructor & Destructor Documentation

Constructor.

Destructor.


Member Function Documentation

template<class GatherScatter , class Data >
void Dune::BufferedCommunicator::backward ( Data &  source,
const Data &  dest 
)

Communicate in the reverse direction, i.e. send from target to source.

The template parameter GatherScatter (e.g. CopyGatherScatter) has to have a static method

 // Gather the data at index index of data
 static const typename CommPolicy<Data>::IndexedType>& gather(Data& data, int index);

 // Scatter the value at a index of data
 static void scatter(Data& data, typename CommPolicy<Data>::IndexedType> value,
                     int index);

in the case where CommPolicy<Data>::IndexedTypeFlag is SizeOne and

 static onst typename CommPolicy<Data>::IndexedType> gather(Data& data, int index, int subindex);

 static void scatter(Data& data, typename CommPolicy<Data>::IndexedType> value,
                     int index, int subindex);

in the case where CommPolicy<Data>::IndexedTypeFlag is VariableSize. Here subindex is the subindex of the block at index.

Warning:
The source and target data have to have the same layout as the ones given to the build function in case of variable size values at the indices.
Parameters:
destThe values will be copied from here to the send buffers.
sourceThe received values will be copied to here.
template<class GatherScatter , class Data >
void Dune::BufferedCommunicator::backward ( Data &  data)

Backward send where target and source are the same.

The template parameter GatherScatter has to have a static method

 // Gather the data at index index of data
 static const typename CommPolicy<Data>::IndexedType>& gather(Data& data, int index);

 // Scatter the value at a index of data
 static void scatter(Data& data, typename CommPolicy<Data>::IndexedType> value,
                     int index);

in the case where CommPolicy<Data>::IndexedTypeFlag is SizeOne and

 static onst typename CommPolicy<Data>::IndexedType> gather(Data& data, int index, int subindex);

 static void scatter(Data& data, typename CommPolicy<Data>::IndexedType> value,
                     int index, int subindex);

in the case where CommPolicy<Data>::IndexedTypeFlag is VariableSize. Here subindex is the subindex of the block at index.

Parameters:
dataSource and target of the communication.
template<class Data , class Interface >
enable_if<is_same<SizeOne,typename CommPolicy<Data>::IndexedTypeFlag>::value, void>::type Dune::BufferedCommunicator::build ( const Interface interface)

Build the buffers and information for the communication process.

Parameters:
interfaceThe interface that defines what indices are to be communicated.
template<class Data , class Interface >
void Dune::BufferedCommunicator::build ( const Data &  source,
const Data &  target,
const Interface interface 
)

Build the buffers and information for the communication process.

Parameters:
sourceThe source in a forward send. The values will be copied from here to the send buffers.
targetThe target in a forward send. The received values will be copied to here.
interfaceThe interface that defines what indices are to be communicated.
template<class GatherScatter , class Data >
void Dune::BufferedCommunicator::forward ( const Data &  source,
Data &  dest 
)

Send from source to target.

The template parameter GatherScatter (e.g. CopyGatherScatter) has to have a static method

 // Gather the data at index index of data
 static const typename CommPolicy<Data>::IndexedType>& gather(Data& data, int index);

 // Scatter the value at a index of data
 static void scatter(Data& data, typename CommPolicy<Data>::IndexedType> value,
                     int index);

in the case where CommPolicy<Data>::IndexedTypeFlag is SizeOne and

 static const typename CommPolicy<Data>::IndexedType> gather(Data& data, int index, int subindex);

 static void scatter(Data& data, typename CommPolicy<Data>::IndexedType> value,
                     int index, int subindex);

in the case where CommPolicy<Data>::IndexedTypeFlag is VariableSize. Here subindex is the subindex of the block at index.

Warning:
The source and target data have to have the same layout as the ones given to the build function in case of variable size values at the indices.
Parameters:
sourceThe values will be copied from here to the send buffers.
destThe received values will be copied to here.
template<class GatherScatter , class Data >
void Dune::BufferedCommunicator::forward ( Data &  data)

Forward send where target and source are the same.

The template parameter GatherScatter has to have a static method

 // Gather the data at index index of data
 static const typename CommPolicy<Data>::IndexedType>& gather(Data& data, int index);

 // Scatter the value at a index of data
 static void scatter(Data& data, typename CommPolicy<Data>::IndexedType> value,
                     int index);

in the case where CommPolicy<Data>::IndexedTypeFlag is SizeOne and

 static onst typename CommPolicy<Data>::IndexedType> gather(Data& data, int index, int subindex);

 static void scatter(Data& data, typename CommPolicy<Data>::IndexedType> value,
                     int index, int subindex);

in the case where CommPolicy<Data>::IndexedTypeFlag is VariableSize. Here subindex is the subindex of the block at index.

Parameters:
dataSource and target of the communication.

Free the allocated memory (i.e. buffers and message information.


The documentation for this class was generated from the following file: