Loading...
Searching...
No Matches
Dune::BufferedCommunicator Class Reference
Common » Parallel Communication » Parallel Computing based on Indexsets

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

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

## Public Member Functions

| BufferedCommunicator ()
| Constructor.
template<class Data, class Interface>
std::enable_if< std::is_same< SizeOne, typenameCommPolicy< 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 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.

## Constructor & Destructor Documentation

## BufferedCommunicator()

Dune::BufferedCommunicator::BufferedCommunicator | ( |  | ) |

Constructor.

## ~BufferedCommunicator()

Dune::BufferedCommunicator::~BufferedCommunicator | ( |  | ) |

Destructor.

## Member Function Documentation

## backward() [1/2]

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);
Dune::CommPolicy::IndexedType
V::value_type IndexedType
The type we get at each index with operator[].
Definition communicator.hh:147

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.

Parameters

  data | Source and target of the communication.

## backward() [2/2]

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 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

  dest | The values will be copied from here to the send buffers.
  source | The received values will be copied to here.

## build() [1/2]

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

  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.

## build() [2/2]

template<class Data, class Interface>

std::enable_if< std::is_same< SizeOne, typenameCommPolicy< Data >::IndexedTypeFlag >::value, void >::type Dune::BufferedCommunicator::build | ( | const Interface & | interface | ) |

Build the buffers and information for the communication process.

Parameters

  interface | The interface that defines what indices are to be communicated.

## forward() [1/2]

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

  source | The values will be copied from here to the send buffers.
  dest | The received values will be copied to here.

## forward() [2/2]

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 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.

Parameters

  data | Source and target of the communication.

## free()

void Dune::BufferedCommunicator::free | ( |  | ) |

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

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

- communicator.hh