A communicator that uses buffers to gather and scatter the data to be send or received. More...
#include <dune/common/parallel/communicator.hh>
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 > | |
std::enable_if< std::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. |
A communicator that uses buffers to gather and scatter the data to be send or received.
Before the data is sent it is 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.
Dune::BufferedCommunicator::BufferedCommunicator | ( | ) |
Constructor.
Dune::BufferedCommunicator::~BufferedCommunicator | ( | ) |
Destructor.
void Dune::BufferedCommunicator::backward | ( | Data & | data | ) | [inline] |
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.
data | Source and target of the communication. |
void Dune::BufferedCommunicator::backward | ( | Data & | source, | |
const Data & | dest | |||
) | [inline] |
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.
dest | The values will be copied from here to the send buffers. | |
source | The received values will be copied to here. |
void Dune::BufferedCommunicator::build | ( | const Data & | source, | |
const Data & | target, | |||
const Interface & | interface | |||
) | [inline] |
Build the buffers and information for the communication process.
source | The source in a forward send. The values will be copied from here to the send buffers. | |
target | The target in a forward send. The received values will be copied to here. | |
interface | The interface that defines what indices are to be communicated. |
std::enable_if<std::is_same<SizeOne,typename CommPolicy<Data>::IndexedTypeFlag>::value, void>::type Dune::BufferedCommunicator::build | ( | const Interface & | interface | ) | [inline] |
Build the buffers and information for the communication process.
interface | The interface that defines what indices are to be communicated. |
void Dune::BufferedCommunicator::forward | ( | Data & | data | ) | [inline] |
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.
data | Source and target of the communication. |
void Dune::BufferedCommunicator::forward | ( | const Data & | source, | |
Data & | dest | |||
) | [inline] |
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.
source | The values will be copied from here to the send buffers. | |
dest | The received values will be copied to here. |
void Dune::BufferedCommunicator::free | ( | ) |
Free the allocated memory (i.e. buffers and message information.