Discontinuous Galerkin Library
#include "dg/algorithm.h"
dg::MPIDistMat< LocalMatrix, Collective > Struct Template Reference

Distributed memory matrix class. More...

Public Types

using value_type = get_value_type< LocalMatrix >
 

Public Member Functions

 MPIDistMat ()
 no memory allocation More...
 
 MPIDistMat (const LocalMatrix &m, const Collective &c, enum dist_type dist=row_dist)
 Constructor. More...
 
template<class OtherMatrix , class OtherCollective >
 MPIDistMat (const MPIDistMat< OtherMatrix, OtherCollective > &src)
 Copy Constructor. More...
 
const LocalMatrix & matrix () const
 Access to the local matrix. More...
 
const Collective & collective () const
 Access to the communication object. More...
 
enum dist_type get_dist () const
 
void set_dist (enum dist_type dist)
 
template<class ContainerType1 , class ContainerType2 >
void symv (value_type alpha, const ContainerType1 &x, value_type beta, ContainerType2 &y) const
 
template<class ContainerType1 , class ContainerType2 >
void symv (const ContainerType1 &x, ContainerType2 &y) const
 
template<class Functor , class ContainerType1 , class ContainerType2 >
void stencil (const Functor f, const ContainerType1 &x, ContainerType2 &y) const
 

Detailed Description

template<class LocalMatrix, class Collective>
struct dg::MPIDistMat< LocalMatrix, Collective >

Distributed memory matrix class.

The idea of this mpi matrix is to separate communication and computation in order to reuse existing optimized matrix formats for the computation. It can be expected that this works particularly well for cases in which the communication to computation ratio is low. In this class the matrix elements can be distributed rowwise or columnwise among mpi processes.

Template Parameters
LocalMatrixThe class of the matrix for local computations. symv needs to be callable on the container class of the MPI_Vector
Collectivemodels aCommunicator The Communication class needs to scatter and gather values across processes. Gather all points (including the ones that the process already has) necessary for the local matrix-vector product into one vector, such that the local matrix can be applied. If !isCommunicating() the global_gather and global_scatter_reduce functions won't be called and only the local matrix is applied.

Member Typedef Documentation

◆ value_type

template<class LocalMatrix , class Collective >
using dg::MPIDistMat< LocalMatrix, Collective >::value_type = get_value_type<LocalMatrix>

Constructor & Destructor Documentation

◆ MPIDistMat() [1/3]

template<class LocalMatrix , class Collective >
dg::MPIDistMat< LocalMatrix, Collective >::MPIDistMat ( )
inline

no memory allocation

◆ MPIDistMat() [2/3]

template<class LocalMatrix , class Collective >
dg::MPIDistMat< LocalMatrix, Collective >::MPIDistMat ( const LocalMatrix &  m,
const Collective &  c,
enum dist_type  dist = row_dist 
)
inline

Constructor.

Parameters
mThe local matrix
cThe communication object
disteither row or column distributed

◆ MPIDistMat() [3/3]

template<class LocalMatrix , class Collective >
template<class OtherMatrix , class OtherCollective >
dg::MPIDistMat< LocalMatrix, Collective >::MPIDistMat ( const MPIDistMat< OtherMatrix, OtherCollective > &  src)
inline

Copy Constructor.

Template Parameters
OtherMatrixLocalMatrix must be copy-constructible from OtherMatrix
OtherCollectiveCollective must be copy-constructible from OtherCollective
Parameters
srcThe other matrix

Member Function Documentation

◆ collective()

template<class LocalMatrix , class Collective >
const Collective & dg::MPIDistMat< LocalMatrix, Collective >::collective ( ) const
inline

Access to the communication object.

Returns
Reference to the collective object

◆ get_dist()

template<class LocalMatrix , class Collective >
enum dist_type dg::MPIDistMat< LocalMatrix, Collective >::get_dist ( ) const
inline

◆ matrix()

template<class LocalMatrix , class Collective >
const LocalMatrix & dg::MPIDistMat< LocalMatrix, Collective >::matrix ( ) const
inline

Access to the local matrix.

Returns
Reference to the local matrix

◆ set_dist()

template<class LocalMatrix , class Collective >
void dg::MPIDistMat< LocalMatrix, Collective >::set_dist ( enum dist_type  dist)
inline

◆ stencil()

template<class LocalMatrix , class Collective >
template<class Functor , class ContainerType1 , class ContainerType2 >
void dg::MPIDistMat< LocalMatrix, Collective >::stencil ( const Functor  f,
const ContainerType1 &  x,
ContainerType2 &  y 
) const
inline

◆ symv() [1/2]

template<class LocalMatrix , class Collective >
template<class ContainerType1 , class ContainerType2 >
void dg::MPIDistMat< LocalMatrix, Collective >::symv ( const ContainerType1 &  x,
ContainerType2 &  y 
) const
inline

◆ symv() [2/2]

template<class LocalMatrix , class Collective >
template<class ContainerType1 , class ContainerType2 >
void dg::MPIDistMat< LocalMatrix, Collective >::symv ( value_type  alpha,
const ContainerType1 &  x,
value_type  beta,
ContainerType2 &  y 
) const
inline

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