DUNE-FEM (unstable)

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. More...
 
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. More...
 
template<class GatherScatter , class Data >
void forward (const Data &source, Data &dest)
 Send from source to target. More...
 
template<class GatherScatter , class Data >
void backward (Data &source, const Data &dest)
 Communicate in the reverse direction, i.e. send from target to source. More...
 
template<class GatherScatter , class Data >
void forward (Data &data)
 Forward send where target and source are the same. More...
 
template<class GatherScatter , class Data >
void backward (Data &data)
 Backward send where target and source are the same. More...
 
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.

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);
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
dataSource 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
destThe values will be copied from here to the send buffers.
sourceThe 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
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.

◆ 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
interfaceThe 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
sourceThe values will be copied from here to the send buffers.
destThe 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
dataSource and target of the communication.

The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 20, 23:30, 2024)