Loading...
Searching...
No Matches
Public Member Functions | List of all members
bitpit::DataCommInterface< Impl > Class Template Reference

Base class for data communications. More...

#include <DataCommInterface.hpp>

Public Member Functions

size_t fixedSize () const
 
template<class Buffer >
void gather (Buffer &buff, const uint32_t e)
 
template<class Buffer >
void scatter (Buffer &buff, const uint32_t e)
 
size_t size (const uint32_t e) const
 

Detailed Description

template<class Impl>
class bitpit::DataCommInterface< Impl >

Base class for data communications.

Date
09/sep/2015
Authors
Edoardo Lombardi
Marco Cisternino

This class is the base class used to implement the user interface to data communications.

The Curiously Recurrent Template Pattern is exploited to achieve the interface. By this way the interface is based on static polymorphism with no extra cost at runtime.

The user has to implement his communication classes by deriving them from this class. The mechanism implies that the derived class derives from a template base class and that the template parameter is the derived class itself, as follow

class Derived : public Base<Derived>{...}

The user has to implement all the methods of the base class in his derived class. These user's methods will really do the job.

Easily speaking, only the user knows his data and through the interface specialization he states the size of element data, how to write/read them in a communication buffer. Any MPI compatible POD datum can be written and read in the communication buffer.

Examples
PABLO_example_00006.cpp.

Definition at line 62 of file DataCommInterface.hpp.

Constructor & Destructor Documentation

◆ DataCommInterface()

template<class Impl >
bitpit::DataCommInterface< Impl >::DataCommInterface ( )
protected

Definition at line 28 of file DataCommInterface.tpp.

Member Function Documentation

◆ fixedSize()

template<class Impl >
size_t bitpit::DataCommInterface< Impl >::fixedSize ( ) const

Its user specification computes the same data size for every element in the grid.

Returns
the size of the data for every element

Definition at line 43 of file DataCommInterface.tpp.

◆ gather()

template<class Impl >
template<class Buffer >
void bitpit::DataCommInterface< Impl >::gather ( Buffer & buff,
const uint32_t e )

Its user specification writes the e element data to be communicated during the load balance in the buffer.

The user has to use the buffer buff as an output binary stream. A stream operator (<<) is provided to allocate any single element datum in the communication buffer, as follow

buff << userdatum

where userdatum can be any MPI compatible POD variable associated to the e element. In case of a vector of double, called userdata, to store data,

buff << userdata[e]
Parameters
[in]buffOutput communication buffer
[in]eThe element local index

Definition at line 66 of file DataCommInterface.tpp.

◆ scatter()

template<class Impl >
template<class Buffer >
void bitpit::DataCommInterface< Impl >::scatter ( Buffer & buff,
const uint32_t e )

Its user specification reads the e element data from the communication buffer and store them in the user data container.

The user has to use the buffer buff as an input binary stream. A stream operator (>>) is provided to read any single element datum from the communication buffer, as follow

buff >> userdatum

where userdatum can be any MPI compatible POD variable associated to the e element. In case of a vector of double, called userdata, to store data,

buff >> userdata[e]
Parameters
[in]buffInput communication buffer
[in]eThe element local index

Definition at line 89 of file DataCommInterface.tpp.

◆ size()

template<class Impl >
size_t bitpit::DataCommInterface< Impl >::size ( const uint32_t e) const

Its user specification computes the specific size of data for an element.

Parameters
[in]eElement local index.
Returns
the size of the data for the e element

Definition at line 35 of file DataCommInterface.tpp.


The documentation for this class was generated from the following files:
--- layout: doxygen_footer ---