|
Discontinuous Galerkin Library
#include "dg/algorithm.h"
|
A simple wrapper around a container object and an MPI_Comm. More...
Public Types | |
| using | container_type = container |
| typedef to acces underlying container | |
Public Member Functions | |
| MPI_Vector () | |
no data is allocated, communicator is MPI_COMM_NULL | |
| MPI_Vector (container data, MPI_Comm comm) | |
| construct a vector | |
| template<class OtherContainer > | |
| MPI_Vector (const MPI_Vector< OtherContainer > &src) | |
| Conversion operator. | |
| const container & | data () const |
| Get underlying data. | |
| container & | data () |
| Set underlying data. | |
| MPI_Comm | communicator () const |
| Get the communicator to which this vector belongs. | |
| void | set_communicator (MPI_Comm comm) |
| Set the communicator. | |
| unsigned | size () const |
| Return the size of the data object. | |
| void | swap (MPI_Vector &src) |
| Swap data and communicator. | |
Friends | |
| void | swap (MPI_Vector< container > &first, MPI_Vector< container > &second) |
A simple wrapper around a container object and an MPI_Comm.
This enables the tag dispatch system for e.g. blas1 and blas2 functions to choose the corresponding MPI implementation of a function over its shared memory analogon.
In the dg library MPI_Vectors are generated notably via the dg::evaluate function when called with a dg::RealMPIGrid
dg::blas1::dot in the same way as in shared memory code without an additional comm parameter.| container | local container type. Must have a size() and a swap() member function and a specialization of the TensorTraits class. |
| using dg::MPI_Vector< container >::container_type = container |
typedef to acces underlying container
|
inline |
no data is allocated, communicator is MPI_COMM_NULL
|
inline |
construct a vector
| data | internal data copy |
| comm | MPI communicator (may not be MPI_COMM_NULL) |
|
inline |
Conversion operator.
uses conversion between compatible containers
| OtherContainer | another container class (container must be copy constructible from OtherContainer) |
| src | the source |
|
inline |
Get the communicator to which this vector belongs.
|
inline |
Set underlying data.
|
inline |
Get underlying data.
|
inline |
Set the communicator.
| comm | new communicator to set |
|
inline |
Return the size of the data object.
data.size()
|
inline |
Swap data and communicator.
| src | communicator and data is swapped |
|
friend |
This follows the discussion in https://stackoverflow.com/questions/5695548/public-friend-swap-member-function
| first | first instance |
| second | second instance |