Discontinuous Galerkin Library
#include "dg/algorithm.h"
Collaboration diagram for Scatter and Gather:

Typedefs

template<class MPIContainer >
using dg::get_mpi_view_type = std::conditional_t< std::is_const< MPIContainer >::value, MPI_Vector< View< const typename MPIContainer::container_type > >, MPI_Vector< View< typename MPIContainer::container_type > > >
 

Functions

template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::global2local (const thrust::host_vector< real_type > &global, const aRealMPITopology3d< real_type > &g)
 Take the relevant local part of a global vector. More...
 
template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::global2local (const thrust::host_vector< real_type > &global, const aRealMPITopology2d< real_type > &g)
 Take the relevant local part of a global vector. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backproject (const RealGrid1d< real_type > &g)
 Create a matrix \( PI\) that projects values to an equidistant grid. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backproject (const aRealTopology2d< real_type > &g)
 Create a matrix \( PI\) that projects values to an equidistant grid. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backproject (const aRealTopology3d< real_type > &g)
 Create a matrix \( PI\) that projects values to an equidistant grid. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backproject (const RealGrid1d< real_type > &g)
 Create a matrix \( (PI)^{-1}\) that transforms values from an equidistant grid back to a dg grid. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backproject (const aRealTopology2d< real_type > &g)
 Create a matrix \( (PI)^{-1}\) that transforms values from an equidistant grid back to a dg grid. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backproject (const aRealTopology3d< real_type > &g)
 Create a matrix \( (PI)^{-1}\) that transforms values from an equidistant grid back to a dg grid. More...
 
template<class SharedContainer , class real_type >
void dg::split (SharedContainer &in, std::vector< View< SharedContainer > > &out, const aRealTopology3d< real_type > &grid)
 Split a vector into planes along the last dimension (fast version) More...
 
template<class SharedContainer , class real_type >
std::vector< View< SharedContainer > > dg::split (SharedContainer &in, const aRealTopology3d< real_type > &grid)
 Split a vector into planes along the last dimension (construct version) More...
 
template<class Container , class real_type >
void dg::assign3dfrom2d (const thrust::host_vector< real_type > &in2d, Container &out, const aRealTopology3d< real_type > &grid)
 Construct a 3d vector given a 2d host vector. More...
 
template<class MPIContainer , class real_type >
void dg::split (MPIContainer &in, std::vector< get_mpi_view_type< MPIContainer > > &out, const aRealMPITopology3d< real_type > &grid)
 MPI Version of split (fast version) More...
 
template<class MPIContainer , class real_type >
std::vector< get_mpi_view_type< MPIContainer > > dg::split (MPIContainer &in, const aRealMPITopology3d< real_type > &grid)
 MPI Version of split (construct version) More...
 
template<class LocalContainer , class real_type >
void dg::assign3dfrom2d (const MPI_Vector< thrust::host_vector< real_type > > &in2d, MPI_Vector< LocalContainer > &out, const aRealMPITopology3d< real_type > &grid)
 MPI Version of assign3dfrom2d. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backscatter (const RealGrid1d< real_type > &g)
 Create a matrix \( B_{eq} F\) that interpolates values to an equidistant grid ready for visualisation. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backscatter (const aRealTopology2d< real_type > &g)
 Create a matrix \( B_{eq} F\) that interpolates values to an equidistant grid ready for visualisation. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backscatter (const aRealTopology3d< real_type > &g)
 Create a matrix \( B_{eq} F\) that interpolates values to an equidistant grid ready for visualisation. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backscatter (const RealGrid1d< real_type > &g)
 Create a matrix \( (B_{eq} F)^{-1}\) that transforms values from an equidistant grid back to a dg grid. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backscatter (const aRealTopology2d< real_type > &g)
 Create a matrix \( (B_{eq} F)^{-1}\) that transforms values from an equidistant grid back to a dg grid. More...
 
template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backscatter (const aRealTopology3d< real_type > &g)
 Create a matrix \( (B_{eq} F)^{-1}\) that transforms values from an equidistant grid back to a dg grid. More...
 

Detailed Description

Typedef Documentation

◆ get_mpi_view_type

template<class MPIContainer >
using dg::get_mpi_view_type = typedef std::conditional_t< std::is_const<MPIContainer>::value, MPI_Vector<View<const typename MPIContainer::container_type> >, MPI_Vector<View<typename MPIContainer::container_type> > >

Function Documentation

◆ assign3dfrom2d() [1/2]

template<class LocalContainer , class real_type >
void dg::assign3dfrom2d ( const MPI_Vector< thrust::host_vector< real_type > > &  in2d,
MPI_Vector< LocalContainer > &  out,
const aRealMPITopology3d< real_type > &  grid 
)

MPI Version of assign3dfrom2d.

Conceptually the same as a split of the out vector followed by assigning the input to each plane

Parameters
in2dthe 2d input (communicator is ignored)
outoutput (memory will be allocated)
gridprovide dimensions in 3rd and first two dimensions

◆ assign3dfrom2d() [2/2]

template<class Container , class real_type >
void dg::assign3dfrom2d ( const thrust::host_vector< real_type > &  in2d,
Container &  out,
const aRealTopology3d< real_type > &  grid 
)

Construct a 3d vector given a 2d host vector.

Conceptually the same as a split of the out vector followed by assigning the input to each plane

Parameters
in2dthe 2d input
outoutput (memory will be allocated)
gridprovide dimensions in 3rd and first two dimensions

◆ backproject() [1/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backproject ( const aRealTopology2d< real_type > &  g)

Create a matrix \( PI\) that projects values to an equidistant grid.

Same as dg::create::transformation( g_equidist, g)

Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::backscatter, dg::create::transformation

◆ backproject() [2/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backproject ( const aRealTopology3d< real_type > &  g)

Create a matrix \( PI\) that projects values to an equidistant grid.

Same as dg::create::transformation( g_equidist, g)

Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::backscatter, dg::create::transformation

◆ backproject() [3/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backproject ( const RealGrid1d< real_type > &  g)

Create a matrix \( PI\) that projects values to an equidistant grid.

Same as dg::create::transformation( g_equidist, g)

Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::backscatter, dg::create::transformation

◆ backscatter() [1/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backscatter ( const aRealTopology2d< real_type > &  g)

Create a matrix \( B_{eq} F\) that interpolates values to an equidistant grid ready for visualisation.

Useful if you want to visualize a dg-formatted vector.

Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::backproject

◆ backscatter() [2/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backscatter ( const aRealTopology3d< real_type > &  g)

Create a matrix \( B_{eq} F\) that interpolates values to an equidistant grid ready for visualisation.

Useful if you want to visualize a dg-formatted vector.

Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::backproject

◆ backscatter() [3/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::backscatter ( const RealGrid1d< real_type > &  g)

Create a matrix \( B_{eq} F\) that interpolates values to an equidistant grid ready for visualisation.

Useful if you want to visualize a dg-formatted vector.

Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::backproject

◆ global2local() [1/2]

template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::global2local ( const thrust::host_vector< real_type > &  global,
const aRealMPITopology2d< real_type > &  g 
)

Take the relevant local part of a global vector.

Parameters
globala vector the size of the global grid
gthe assumed topology
Returns
an MPI_Vector that is the distributed version of the global vector

◆ global2local() [2/2]

template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::global2local ( const thrust::host_vector< real_type > &  global,
const aRealMPITopology3d< real_type > &  g 
)

Take the relevant local part of a global vector.

Parameters
globala vector the size of the global grid
gthe assumed topology
Returns
an MPI_Vector that is the distributed version of the global vector

◆ inv_backproject() [1/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backproject ( const aRealTopology2d< real_type > &  g)

Create a matrix \( (PI)^{-1}\) that transforms values from an equidistant grid back to a dg grid.

Same as dg::create::transformation( g, g_equidist)

Note
The inverse of the backproject matrix is not its adjoint!
Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::inv_backscatter dg::create::backproject

◆ inv_backproject() [2/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backproject ( const aRealTopology3d< real_type > &  g)

Create a matrix \( (PI)^{-1}\) that transforms values from an equidistant grid back to a dg grid.

Same as dg::create::transformation( g, g_equidist)

Note
The inverse of the backproject matrix is not its adjoint!
Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::inv_backscatter dg::create::backproject

◆ inv_backproject() [3/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backproject ( const RealGrid1d< real_type > &  g)

Create a matrix \( (PI)^{-1}\) that transforms values from an equidistant grid back to a dg grid.

Same as dg::create::transformation( g, g_equidist)

Note
The inverse of the backproject matrix is not its adjoint!
Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::inv_backscatter dg::create::backproject

◆ inv_backscatter() [1/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backscatter ( const aRealTopology2d< real_type > &  g)

Create a matrix \( (B_{eq} F)^{-1}\) that transforms values from an equidistant grid back to a dg grid.

The inverse of dg::create::backscatter

Note
The inverse of the backscatter matrix is not its adjoint! The adjoint \( (B_{eq}F)^\dagger\) is the matrix that computes the (inexact) projection integral on an equidistant grid.
Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::inv_backproject dg::create::backscatter

◆ inv_backscatter() [2/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backscatter ( const aRealTopology3d< real_type > &  g)

Create a matrix \( (B_{eq} F)^{-1}\) that transforms values from an equidistant grid back to a dg grid.

The inverse of dg::create::backscatter

Note
The inverse of the backscatter matrix is not its adjoint! The adjoint \( (B_{eq}F)^\dagger\) is the matrix that computes the (inexact) projection integral on an equidistant grid.
Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::inv_backproject dg::create::backscatter

◆ inv_backscatter() [3/3]

template<class real_type >
dg::IHMatrix_t< real_type > dg::create::inv_backscatter ( const RealGrid1d< real_type > &  g)

Create a matrix \( (B_{eq} F)^{-1}\) that transforms values from an equidistant grid back to a dg grid.

The inverse of dg::create::backscatter

Note
The inverse of the backscatter matrix is not its adjoint! The adjoint \( (B_{eq}F)^\dagger\) is the matrix that computes the (inexact) projection integral on an equidistant grid.
Parameters
gThe grid on which to operate
Returns
transformation matrix (block diagonal)
See also
dg::create::inv_backproject dg::create::backscatter

◆ split() [1/4]

template<class MPIContainer , class real_type >
std::vector< get_mpi_view_type< MPIContainer > > dg::split ( MPIContainer &  in,
const aRealMPITopology3d< real_type > &  grid 
)

MPI Version of split (construct version)

may take longer due to the many calls to MPI group creation functions

Parameters
incontiguous 3d vector (must be of size grid.size())
gridprovide dimensions in 3rd and first two dimensions
Returns
out contains grid.nz()*grid.Nz() 2d vector views of 2d size on output
Note
two seperately split vectors have congruent (not identical) MPI_Communicators Note here the MPI concept of congruent (same process group, different contexts) vs. identical (same process group, same context) communicators.
Template Parameters
MPIContainerAn MPI_Vector of a SharedContainer

◆ split() [2/4]

template<class MPIContainer , class real_type >
void dg::split ( MPIContainer &  in,
std::vector< get_mpi_view_type< MPIContainer > > &  out,
const aRealMPITopology3d< real_type > &  grid 
)

MPI Version of split (fast version)

Note
every plane in out must hold a 2d Cartesian MPI_Communicator congruent (same process group) or ident (same process group, same context) with the communicator in grid
Attention
This version will NOT adapt the communicators in out
out will NOT be resized
Parameters
incontiguous 3d vector (must be of size grid.size())
outcontains grid.nz()*grid.Nz() 2d vector views of 2d size on output
gridprovide dimensions in 3rd and first two dimensions
Template Parameters
MPIContainerAn MPI_Vector of a SharedContainer

◆ split() [3/4]

template<class SharedContainer , class real_type >
std::vector< View< SharedContainer > > dg::split ( SharedContainer &  in,
const aRealTopology3d< real_type > &  grid 
)

Split a vector into planes along the last dimension (construct version)

Parameters
incontiguous 3d vector (must be of size grid.size())
gridprovide dimensions in 3rd and first two dimensions
Returns
out contains grid.nz()*grid.Nz() 2d vector views of 2d size on output
Template Parameters
SharedContainerTensorTraits exists for this class and the tensor_category derives from SharedVectorTag

◆ split() [4/4]

template<class SharedContainer , class real_type >
void dg::split ( SharedContainer &  in,
std::vector< View< SharedContainer > > &  out,
const aRealTopology3d< real_type > &  grid 
)

Split a vector into planes along the last dimension (fast version)

Parameters
incontiguous 3d vector (must be of size grid.size())
outcontains grid.nz()*grid.Nz() 2d vector views of 2d size on output
gridprovide dimensions in 3rd and first two dimensions
Attention
out will NOT be resized
Template Parameters
SharedContainerTensorTraits exists for this class and the tensor_category derives from SharedVectorTag