Discontinuous Galerkin Library
#include "dg/algorithm.h"
Interpolation, Projection, Transformation

\( I \) and \( P = I^\dagger\) More...

Collaboration diagram for Interpolation, Projection, Transformation:

Namespaces

namespace  dg::create
 Contains functions used for matrix creation.
 

Functions

template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_interpolation (const RealGrid1d< real_type > &t, unsigned multiplyn, unsigned multiplyNx)
 Create interpolation matrix for integer multipliers. More...
 
template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_projection (const RealGrid1d< real_type > &t, unsigned dividen, unsigned divideNx)
 Create projecton matrix for integer dividers. More...
 
template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_transform (dg::Operator< real_type > opx, const RealGrid1d< real_type > &t)
 Create a block-diagonal matrix. More...
 
template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_interpolation (enum coo3d direction, const aRealTopology2d< real_type > &t, unsigned multiplyn, unsigned multiplyNx)
 Create interpolation matrix for integer multipliers. More...
 
template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_projection (enum coo3d direction, const aRealTopology2d< real_type > &t, unsigned dividen, unsigned divideNx)
 Create projecton matrix for integer dividers. More...
 
template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_transform (enum coo3d direction, dg::Operator< real_type > opx, const aRealTopology2d< real_type > &t)
 Create a block-diagonal matrix. More...
 
template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_interpolation (enum coo3d direction, const aRealTopology3d< real_type > &t, unsigned multiplyn, unsigned multiplyNx)
 Create interpolation matrix for integer multipliers. More...
 
template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_projection (enum coo3d direction, const aRealTopology3d< real_type > &t, unsigned dividen, unsigned divideNx)
 Create projecton matrix for integer dividers. More...
 
template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_transform (enum coo3d direction, dg::Operator< real_type > opx, const aRealTopology3d< real_type > &t)
 Create a block-diagonal matrix. More...
 
template<class real_type >
dg::MHMatrix_t< real_type > dg::create::fast_interpolation (enum coo3d direction, const aRealMPITopology2d< real_type > &t, unsigned multiplyn, unsigned multiplyNx)
 Create interpolation matrix for integer multipliers. More...
 
template<class real_type >
dg::MHMatrix_t< real_type > dg::create::fast_projection (enum coo3d direction, const aRealMPITopology2d< real_type > &t, unsigned dividen, unsigned divideNx)
 Create projecton matrix for integer dividers. More...
 
template<class real_type >
MHMatrix_t< real_type > dg::create::fast_transform (enum coo3d direction, dg::Operator< real_type > opx, const aRealMPITopology2d< real_type > &t)
 Create a block-diagonal matrix. More...
 
template<class real_type >
dg::MHMatrix_t< real_type > dg::create::fast_interpolation (enum coo3d direction, const aRealMPITopology3d< real_type > &t, unsigned multiplyn, unsigned multiplyNx)
 Create interpolation matrix for integer multipliers. More...
 
template<class real_type >
dg::MHMatrix_t< real_type > dg::create::fast_projection (enum coo3d direction, const aRealMPITopology3d< real_type > &t, unsigned dividen, unsigned divideNx)
 Create projecton matrix for integer dividers. More...
 
template<class real_type >
MHMatrix_t< real_type > dg::create::fast_transform (enum coo3d direction, dg::Operator< real_type > opx, const aRealMPITopology3d< real_type > &t)
 Create a block-diagonal matrix. More...
 
template<class Topology >
auto dg::create::fast_interpolation (const Topology &t, unsigned multiplyn, unsigned multiplyNx, unsigned multiplyNy)
 Create interpolation matrix for integer multipliers. More...
 
template<class Topology >
auto dg::create::fast_projection (const Topology &t, unsigned dividen, unsigned divideNx, unsigned divideNy)
 Create projecton matrix for integer dividers. More...
 
template<class Topology >
auto dg::create::fast_transform (dg::Operator< typename Topology::value_type > opx, dg::Operator< typename Topology::value_type > opy, const Topology &t)
 Create a block-diagonal matrix. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const thrust::host_vector< real_type > &x, const RealGrid1d< real_type > &g, dg::bc bcx=dg::NEU, std::string method="dg")
 Create interpolation matrix. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const thrust::host_vector< real_type > &x, const thrust::host_vector< real_type > &y, const aRealTopology2d< real_type > &g, dg::bc bcx=dg::NEU, dg::bc bcy=dg::NEU, std::string method="dg")
 Create interpolation matrix. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const thrust::host_vector< real_type > &x, const thrust::host_vector< real_type > &y, const thrust::host_vector< real_type > &z, const aRealTopology3d< real_type > &g, dg::bc bcx=dg::NEU, dg::bc bcy=dg::NEU, dg::bc bcz=dg::PER, std::string method="dg")
 Create interpolation matrix. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const RealGrid1d< real_type > &g_new, const RealGrid1d< real_type > &g_old, std::string method="dg")
 Create interpolation between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const aRealTopology2d< real_type > &g_new, const aRealTopology2d< real_type > &g_old, std::string method="dg")
 Create interpolation between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const aRealTopology3d< real_type > &g_new, const aRealTopology3d< real_type > &g_old, std::string method="dg")
 Create interpolation between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const aRealTopology3d< real_type > &g_new, const aRealTopology2d< real_type > &g_old, std::string method="dg")
 Create interpolation between two grids. More...
 
template<class real_type >
real_type dg::interpolate (dg::space sp, const thrust::host_vector< real_type > &v, real_type x, const RealGrid1d< real_type > &g, dg::bc bcx=dg::NEU)
 Interpolate a vector on a single point on a 1d Grid. More...
 
template<class real_type >
real_type dg::interpolate (dg::space sp, const thrust::host_vector< real_type > &v, real_type x, real_type y, const aRealTopology2d< real_type > &g, dg::bc bcx=dg::NEU, dg::bc bcy=dg::NEU)
 Interpolate a vector on a single point on a 2d Grid. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const thrust::host_vector< real_type > &x, const RealGridX1d< real_type > &g)
 Create interpolation matrix. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const thrust::host_vector< real_type > &x, const thrust::host_vector< real_type > &y, const aRealTopologyX2d< real_type > &g, dg::bc globalbcz=dg::NEU)
 Create interpolation matrix. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const thrust::host_vector< real_type > &x, const thrust::host_vector< real_type > &y, const thrust::host_vector< real_type > &z, const aRealTopologyX3d< real_type > &g, dg::bc globalbcz=dg::NEU)
 Create interpolation matrix. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const RealGridX1d< real_type > &g_new, const RealGridX1d< real_type > &g_old)
 Create interpolation between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const aRealTopologyX2d< real_type > &g_new, const aRealTopologyX2d< real_type > &g_old)
 Create interpolation between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation (const aRealTopologyX3d< real_type > &g_new, const aRealTopologyX3d< real_type > &g_old)
 Create interpolation between two grids. More...
 
template<class real_type >
real_type dg::interpolate (dg::space sp, const thrust::host_vector< real_type > &v, real_type x, real_type y, const aRealTopologyX2d< real_type > &g, dg::bc bcx=dg::NEU, dg::bc bcy=dg::NEU)
 Interpolate a vector on a single point on a 2d Grid. More...
 
template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::interpolation (const aRealMPITopology2d< real_type > &g_new, const aRealMPITopology2d< real_type > &g_old, std::string method="dg")
 Create interpolation between two grids. More...
 
template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::interpolation (const aRealMPITopology3d< real_type > &g_new, const aRealMPITopology3d< real_type > &g_old, std::string method="dg")
 Create interpolation between two grids. More...
 
template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::interpolation (const aRealMPITopology3d< real_type > &g_new, const aRealMPITopology2d< real_type > &g_old, std::string method="dg")
 Create interpolation between two grids. More...
 
template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::projection (const aRealMPITopology2d< real_type > &g_new, const aRealMPITopology2d< real_type > &g_old, std::string method="dg")
 Create a projection between two grids. More...
 
template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::projection (const aRealMPITopology3d< real_type > &g_new, const aRealMPITopology3d< real_type > &g_old, std::string method="dg")
 Create a projection between two grids. More...
 
template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::interpolation (const thrust::host_vector< real_type > &x, const thrust::host_vector< real_type > &y, const aRealMPITopology2d< real_type > &g, dg::bc bcx=dg::NEU, dg::bc bcy=dg::NEU, std::string method="dg")
 Create an MPI row distributed interpolation 2d matrix. More...
 
template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::interpolation (const thrust::host_vector< real_type > &x, const thrust::host_vector< real_type > &y, const thrust::host_vector< real_type > &z, const aRealMPITopology3d< real_type > &g, dg::bc bcx=dg::NEU, dg::bc bcy=dg::NEU, dg::bc bcz=dg::PER, std::string method="linear")
 Create an MPI row distributed interpolation 3d matrix. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::diagonal (const thrust::host_vector< real_type > &diagonal)
 Create a diagonal matrix. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection (const RealGrid1d< real_type > &g_new, const RealGrid1d< real_type > &g_old, std::string method="dg")
 Create a projection between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection (const aRealTopology2d< real_type > &g_new, const aRealTopology2d< real_type > &g_old, std::string method="dg")
 Create a projection between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection (const aRealTopology3d< real_type > &g_new, const aRealTopology3d< real_type > &g_old, std::string method="dg")
 Create a projection between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::transformation (const aRealTopology3d< real_type > &g_new, const aRealTopology3d< real_type > &g_old)
 Create a transformation matrix between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::transformation (const aRealTopology2d< real_type > &g_new, const aRealTopology2d< real_type > &g_old)
 Create a transformation matrix between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::transformation (const RealGrid1d< real_type > &g_new, const RealGrid1d< real_type > &g_old)
 Create a transformation matrix between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection (const RealGridX1d< real_type > &g_new, const RealGridX1d< real_type > &g_old, std::string method="dg")
 Create a projection between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection (const aRealTopologyX2d< real_type > &g_new, const aRealTopologyX2d< real_type > &g_old, std::string method="dg")
 Create a projection between two grids. More...
 
template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection (const aRealTopologyX3d< real_type > &g_new, const aRealTopologyX3d< real_type > &g_old, std::string method="dg")
 Create a projection between two grids. More...
 

Detailed Description

\( I \) and \( P = I^\dagger\)

Function Documentation

◆ diagonal()

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::diagonal ( const thrust::host_vector< real_type > &  diagonal)

Create a diagonal matrix.

This matrix is given by \( D_{ij} = d_i \delta_{ij}\)

Parameters
diagonalThe diagonal elements d_i
Returns
diagonal matrix

◆ fast_interpolation() [1/6]

template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_interpolation ( const RealGrid1d< real_type > &  t,
unsigned  multiplyn,
unsigned  multiplyNx 
)

Create interpolation matrix for integer multipliers.

When creating an interpolation from a given dg grid to one that has an integer multiple of cells and/or polynomial coefficients, the resulting interpolation matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose interpolation function, especially since it requires no communication from neighboring cells

See also
dg::create::interpolation
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/coarse) grid
multiplyninteger multiplier, the new grid has n*multiplyn polynomial coefficients
multiplyNxinteger multiplier, the new grid has Nx*multiplyNx points

◆ fast_interpolation() [2/6]

template<class Topology >
auto dg::create::fast_interpolation ( const Topology &  t,
unsigned  multiplyn,
unsigned  multiplyNx,
unsigned  multiplyNy 
)

Create interpolation matrix for integer multipliers.

When creating an interpolation from a given dg grid to one that has an integer multiple of cells and/or polynomial coefficients, the resulting interpolation matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose interpolation function, especially since it requires no communication from neighboring cells

See also
dg::create::interpolation
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/coarse) grid
multiplyninteger multiplier, the new grid has n*multiplyn polynomial coefficients
multiplyNxinteger multiplier, the new grid has Nx*multiplyNx points
multiplyNyinteger multiplier, the new grid has Ny*multiplyNy points

◆ fast_interpolation() [3/6]

template<class real_type >
dg::MHMatrix_t< real_type > dg::create::fast_interpolation ( enum coo3d  direction,
const aRealMPITopology2d< real_type > &  t,
unsigned  multiplyn,
unsigned  multiplyNx 
)

Create interpolation matrix for integer multipliers.

When creating an interpolation from a given dg grid to one that has an integer multiple of cells and/or polynomial coefficients, the resulting interpolation matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose interpolation function, especially since it requires no communication from neighboring cells

See also
dg::create::interpolation
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/coarse) grid
multiplyninteger multiplier, the new grid has n*multiplyn polynomial coefficients
multiplyNxinteger multiplier, the new grid has Nx*multiplyNx points
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_interpolation() [4/6]

template<class real_type >
dg::MHMatrix_t< real_type > dg::create::fast_interpolation ( enum coo3d  direction,
const aRealMPITopology3d< real_type > &  t,
unsigned  multiplyn,
unsigned  multiplyNx 
)

Create interpolation matrix for integer multipliers.

When creating an interpolation from a given dg grid to one that has an integer multiple of cells and/or polynomial coefficients, the resulting interpolation matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose interpolation function, especially since it requires no communication from neighboring cells

See also
dg::create::interpolation
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/coarse) grid
multiplyninteger multiplier, the new grid has n*multiplyn polynomial coefficients
multiplyNxinteger multiplier, the new grid has Nx*multiplyNx points
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_interpolation() [5/6]

template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_interpolation ( enum coo3d  direction,
const aRealTopology2d< real_type > &  t,
unsigned  multiplyn,
unsigned  multiplyNx 
)

Create interpolation matrix for integer multipliers.

When creating an interpolation from a given dg grid to one that has an integer multiple of cells and/or polynomial coefficients, the resulting interpolation matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose interpolation function, especially since it requires no communication from neighboring cells

See also
dg::create::interpolation
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/coarse) grid
multiplyninteger multiplier, the new grid has n*multiplyn polynomial coefficients
multiplyNxinteger multiplier, the new grid has Nx*multiplyNx points
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_interpolation() [6/6]

template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_interpolation ( enum coo3d  direction,
const aRealTopology3d< real_type > &  t,
unsigned  multiplyn,
unsigned  multiplyNx 
)

Create interpolation matrix for integer multipliers.

When creating an interpolation from a given dg grid to one that has an integer multiple of cells and/or polynomial coefficients, the resulting interpolation matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose interpolation function, especially since it requires no communication from neighboring cells

See also
dg::create::interpolation
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/coarse) grid
multiplyninteger multiplier, the new grid has n*multiplyn polynomial coefficients
multiplyNxinteger multiplier, the new grid has Nx*multiplyNx points
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_projection() [1/6]

template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_projection ( const RealGrid1d< real_type > &  t,
unsigned  dividen,
unsigned  divideNx 
)

Create projecton matrix for integer dividers.

When creating a projection from a given dg grid to one that has an integer division of cells and/or polynomial coefficients, the resulting projection matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose projection function, especially since it requires no communication from neighboring cells

See also
dg::create::projection
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/fine) grid
divideninteger divisor, the new grid has n/multiplyn polynomial coefficients
divideNxinteger divisor, the new grid has Nx/multiplyNx points

◆ fast_projection() [2/6]

template<class Topology >
auto dg::create::fast_projection ( const Topology &  t,
unsigned  dividen,
unsigned  divideNx,
unsigned  divideNy 
)

Create projecton matrix for integer dividers.

When creating a projection from a given dg grid to one that has an integer division of cells and/or polynomial coefficients, the resulting projection matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose projection function, especially since it requires no communication from neighboring cells

See also
dg::create::projection
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/fine) grid
divideninteger divisor, the new grid has n/multiplyn polynomial coefficients
divideNxinteger divisor, the new grid has Nx/multiplyNx points
divideNyinteger multiplier, the new grid has Ny/divideNy points

◆ fast_projection() [3/6]

template<class real_type >
dg::MHMatrix_t< real_type > dg::create::fast_projection ( enum coo3d  direction,
const aRealMPITopology2d< real_type > &  t,
unsigned  dividen,
unsigned  divideNx 
)

Create projecton matrix for integer dividers.

When creating a projection from a given dg grid to one that has an integer division of cells and/or polynomial coefficients, the resulting projection matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose projection function, especially since it requires no communication from neighboring cells

See also
dg::create::projection
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/fine) grid
divideninteger divisor, the new grid has n/multiplyn polynomial coefficients
divideNxinteger divisor, the new grid has Nx/multiplyNx points
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_projection() [4/6]

template<class real_type >
dg::MHMatrix_t< real_type > dg::create::fast_projection ( enum coo3d  direction,
const aRealMPITopology3d< real_type > &  t,
unsigned  dividen,
unsigned  divideNx 
)

Create projecton matrix for integer dividers.

When creating a projection from a given dg grid to one that has an integer division of cells and/or polynomial coefficients, the resulting projection matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose projection function, especially since it requires no communication from neighboring cells

See also
dg::create::projection
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/fine) grid
divideninteger divisor, the new grid has n/multiplyn polynomial coefficients
divideNxinteger divisor, the new grid has Nx/multiplyNx points
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_projection() [5/6]

template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_projection ( enum coo3d  direction,
const aRealTopology2d< real_type > &  t,
unsigned  dividen,
unsigned  divideNx 
)

Create projecton matrix for integer dividers.

When creating a projection from a given dg grid to one that has an integer division of cells and/or polynomial coefficients, the resulting projection matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose projection function, especially since it requires no communication from neighboring cells

See also
dg::create::projection
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/fine) grid
divideninteger divisor, the new grid has n/multiplyn polynomial coefficients
divideNxinteger divisor, the new grid has Nx/multiplyNx points
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_projection() [6/6]

template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_projection ( enum coo3d  direction,
const aRealTopology3d< real_type > &  t,
unsigned  dividen,
unsigned  divideNx 
)

Create projecton matrix for integer dividers.

When creating a projection from a given dg grid to one that has an integer division of cells and/or polynomial coefficients, the resulting projection matrix fits into our dg::EllSparseBlockMat format, which is much faster to apply than the full sparse matrix format from the general purpose projection function, especially since it requires no communication from neighboring cells

See also
dg::create::projection
For a derivation of the coefficients consult the dg manual Introduction to dg methods
Template Parameters
real_typea floating point type
Returns
a matrix that when applied to vectors on the old grid produces a vector on the new grid
Parameters
tThe existing (old/fine) grid
divideninteger divisor, the new grid has n/multiplyn polynomial coefficients
divideNxinteger divisor, the new grid has Nx/multiplyNx points
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_transform() [1/6]

template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_transform ( dg::Operator< real_type >  opx,
const RealGrid1d< real_type > &  t 
)

Create a block-diagonal matrix.

i.e. a matrix that has an \( n \times n \) block on its diagonal

\[ M = \begin{pmatrix} B & & & & & \\ & B & & & & \\ & & B & & & \\ & & & B & & \\ & & &...& & \end{pmatrix} \]

Block diagonal matrices fit into our dg::EllSparseBlockMat format, which is much faster to apply than a general sparse matrix, especially since it requires no communication from neighboring cells

Note
The idea is to use this function in combination with dg::DLT::forward() and dg::DLT::backward() to create a forward/backward transformation from configuration to Legendre space (or from nodal to modal values)
Template Parameters
real_typea floating point type
Returns
a block diagonal matrix
Parameters
opxthe block B
tThe grid determines the number of rows and columns
See also
dg::DLT

◆ fast_transform() [2/6]

template<class Topology >
auto dg::create::fast_transform ( dg::Operator< typename Topology::value_type >  opx,
dg::Operator< typename Topology::value_type >  opy,
const Topology &  t 
)

Create a block-diagonal matrix.

i.e. a matrix that has an \( n \times n \) block on its diagonal

\[ M = \begin{pmatrix} B & & & & & \\ & B & & & & \\ & & B & & & \\ & & & B & & \\ & & &...& & \end{pmatrix} \]

Block diagonal matrices fit into our dg::EllSparseBlockMat format, which is much faster to apply than a general sparse matrix, especially since it requires no communication from neighboring cells

Note
The idea is to use this function in combination with dg::DLT::forward() and dg::DLT::backward() to create a forward/backward transformation from configuration to Legendre space (or from nodal to modal values)
Template Parameters
real_typea floating point type
Returns
a block diagonal matrix
Parameters
opxthe block B
tThe grid determines the number of rows and columns
See also
dg::DLT
Parameters
opythe block B for the y transform

◆ fast_transform() [3/6]

template<class real_type >
MHMatrix_t< real_type > dg::create::fast_transform ( enum coo3d  direction,
dg::Operator< real_type >  opx,
const aRealMPITopology2d< real_type > &  t 
)

Create a block-diagonal matrix.

i.e. a matrix that has an \( n \times n \) block on its diagonal

\[ M = \begin{pmatrix} B & & & & & \\ & B & & & & \\ & & B & & & \\ & & & B & & \\ & & &...& & \end{pmatrix} \]

Block diagonal matrices fit into our dg::EllSparseBlockMat format, which is much faster to apply than a general sparse matrix, especially since it requires no communication from neighboring cells

Note
The idea is to use this function in combination with dg::DLT::forward() and dg::DLT::backward() to create a forward/backward transformation from configuration to Legendre space (or from nodal to modal values)
Template Parameters
real_typea floating point type
Returns
a block diagonal matrix
Parameters
opxthe block B
tThe grid determines the number of rows and columns
See also
dg::DLT
Parameters
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_transform() [4/6]

template<class real_type >
MHMatrix_t< real_type > dg::create::fast_transform ( enum coo3d  direction,
dg::Operator< real_type >  opx,
const aRealMPITopology3d< real_type > &  t 
)

Create a block-diagonal matrix.

i.e. a matrix that has an \( n \times n \) block on its diagonal

\[ M = \begin{pmatrix} B & & & & & \\ & B & & & & \\ & & B & & & \\ & & & B & & \\ & & &...& & \end{pmatrix} \]

Block diagonal matrices fit into our dg::EllSparseBlockMat format, which is much faster to apply than a general sparse matrix, especially since it requires no communication from neighboring cells

Note
The idea is to use this function in combination with dg::DLT::forward() and dg::DLT::backward() to create a forward/backward transformation from configuration to Legendre space (or from nodal to modal values)
Template Parameters
real_typea floating point type
Returns
a block diagonal matrix
Parameters
opxthe block B
tThe grid determines the number of rows and columns
See also
dg::DLT
Parameters
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_transform() [5/6]

template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_transform ( enum coo3d  direction,
dg::Operator< real_type >  opx,
const aRealTopology2d< real_type > &  t 
)

Create a block-diagonal matrix.

i.e. a matrix that has an \( n \times n \) block on its diagonal

\[ M = \begin{pmatrix} B & & & & & \\ & B & & & & \\ & & B & & & \\ & & & B & & \\ & & &...& & \end{pmatrix} \]

Block diagonal matrices fit into our dg::EllSparseBlockMat format, which is much faster to apply than a general sparse matrix, especially since it requires no communication from neighboring cells

Note
The idea is to use this function in combination with dg::DLT::forward() and dg::DLT::backward() to create a forward/backward transformation from configuration to Legendre space (or from nodal to modal values)
Template Parameters
real_typea floating point type
Returns
a block diagonal matrix
Parameters
opxthe block B
tThe grid determines the number of rows and columns
See also
dg::DLT
Parameters
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ fast_transform() [6/6]

template<class real_type >
dg::HMatrix_t< real_type > dg::create::fast_transform ( enum coo3d  direction,
dg::Operator< real_type >  opx,
const aRealTopology3d< real_type > &  t 
)

Create a block-diagonal matrix.

i.e. a matrix that has an \( n \times n \) block on its diagonal

\[ M = \begin{pmatrix} B & & & & & \\ & B & & & & \\ & & B & & & \\ & & & B & & \\ & & &...& & \end{pmatrix} \]

Block diagonal matrices fit into our dg::EllSparseBlockMat format, which is much faster to apply than a general sparse matrix, especially since it requires no communication from neighboring cells

Note
The idea is to use this function in combination with dg::DLT::forward() and dg::DLT::backward() to create a forward/backward transformation from configuration to Legendre space (or from nodal to modal values)
Template Parameters
real_typea floating point type
Returns
a block diagonal matrix
Parameters
opxthe block B
tThe grid determines the number of rows and columns
See also
dg::DLT
Parameters
directionThe direction inside the structured grid to which to apply the sparse block matrix.

◆ interpolate() [1/3]

template<class real_type >
real_type dg::interpolate ( dg::space  sp,
const thrust::host_vector< real_type > &  v,
real_type  x,
const RealGrid1d< real_type > &  g,
dg::bc  bcx = dg::NEU 
)

Interpolate a vector on a single point on a 1d Grid.

Parameters
spIndicate whether the elements of the vector v are in xspace (nodal values) or lspace (modal values) (choose dg::xspace if you don't know what is going on here, It is faster to interpolate in dg::lspace so consider transforming v using dg::forward_transform( ) if you do it very many times)
vThe vector to interpolate
xX-coordinate of interpolation point
gThe Grid on which to operate
bcxdetermines what to do when a point lies outside the boundary in x. If dg::PER, the point will be shifted topologically back onto the domain. Else the point will be mirrored at the boundary: dg::NEU will then simply interpolate at the resulting point, dg::DIR will take the negative of the interpolation. (dg::DIR_NEU and dg::NEU_DIR apply dg::NEU / dg::DIR to the respective left or right boundary ) This means the result of the interpolation is as if the interpolated function were Fourier transformed with the correct boundary condition and thus extended beyond the grid boundaries. Note that if a point lies directly on the boundary between two grid cells, the value of the polynomial to the right is taken.
Returns
interpolated point

◆ interpolate() [2/3]

template<class real_type >
real_type dg::interpolate ( dg::space  sp,
const thrust::host_vector< real_type > &  v,
real_type  x,
real_type  y,
const aRealTopology2d< real_type > &  g,
dg::bc  bcx = dg::NEU,
dg::bc  bcy = dg::NEU 
)

Interpolate a vector on a single point on a 2d Grid.

Parameters
spIndicate whether the elements of the vector v are in xspace (nodal values) or lspace (modal values) (choose dg::xspace if you don't know what is going on here, It is faster to interpolate in dg::lspace so consider transforming v using dg::forward_transform( ) if you do it very many times)
vThe vector to interpolate in dg::xspace, or dg::lspace s.a. dg::forward_transform( )
xX-coordinate of interpolation point
yY-coordinate of interpolation point
gThe Grid on which to operate
bcxdetermines what to do when a point lies outside the boundary in x. If dg::PER, the point will be shifted topologically back onto the domain. Else the point will be mirrored at the boundary: dg::NEU will then simply interpolate at the resulting point, dg::DIR will take the negative of the interpolation. (dg::DIR_NEU and dg::NEU_DIR apply dg::NEU / dg::DIR to the respective left or right boundary ) This means the result of the interpolation is as if the interpolated function were Fourier transformed with the correct boundary condition and thus extended beyond the grid boundaries. Note that if a point lies directly on the boundary between two grid cells, the value of the polynomial to the right is taken.
bcyanalogous to bcx, applies to y direction
Returns
interpolated point

◆ interpolate() [3/3]

template<class real_type >
real_type dg::interpolate ( dg::space  sp,
const thrust::host_vector< real_type > &  v,
real_type  x,
real_type  y,
const aRealTopologyX2d< real_type > &  g,
dg::bc  bcx = dg::NEU,
dg::bc  bcy = dg::NEU 
)

Interpolate a vector on a single point on a 2d Grid.

Parameters
spIndicate whether the elements of the vector v are in xspace or lspace (choose dg::xspace if you don't know what is going on here, It is faster to interpolate in dg::lspace so consider transforming v using dg::forward_transform( ) if you do it very many times)
vThe vector to interpolate in dg::xspace, or dg::lspace s.a. dg::forward_transform( )
xX-coordinate of interpolation point
yY-coordinate of interpolation point
gThe Grid on which to operate
bcxdetermines what to do when a point lies outside the boundary in x. If dg::PER, the point will be shifted topologically back onto the domain. Else the point will be mirrored at the boundary: dg::NEU will then simply interpolate at the resulting point, dg::DIR will take the negative of the interpolation. (dg::DIR_NEU and dg::NEU_DIR apply dg::NEU / dg::DIR to the respective left or right boundary ) This means the result of the interpolation is as if the interpolated function were Fourier transformed with the correct boundary condition and thus extended beyond the grid boundaries. Note that if a point lies directly on the boundary between two grid cells, the value of the polynomial to the right is taken.
bcyanalogous to bcx, applies to y direction
Returns
interpolated point
Note
g.contains(x,y) must return true

◆ interpolation() [1/18]

template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::interpolation ( const aRealMPITopology2d< real_type > &  g_new,
const aRealMPITopology2d< real_type > &  g_old,
std::string  method = "dg" 
)

Create interpolation between two grids.

This matrix interpolates vectors on the old grid g_old to the Gaussian nodes of the new grid g_new. The interpolation is of the order g_old.n()

See also
Introduction to dg methods
for integer multiples between old and new grid you may want to consider the dg::create::fast_interpolation functions
Parameters
g_newThe new grid
g_oldThe old grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Interpolation matrix with g_old.size() columns and g_new.size() rows
Attention
The 1d version does not remove explicit zeros from the interpolation matrix, but the 2d and 3d versions do
Note
The boundaries of the old grid must lie within the boundaries of the new grid
When interpolating a 2d grid to a 3d grid the third coordinate is simply ignored, i.e. the 2d vector will be trivially copied Nz times into the 3d vector
also check the transformation matrix, which is the more general solution

◆ interpolation() [2/18]

template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::interpolation ( const aRealMPITopology3d< real_type > &  g_new,
const aRealMPITopology2d< real_type > &  g_old,
std::string  method = "dg" 
)

Create interpolation between two grids.

This matrix interpolates vectors on the old grid g_old to the Gaussian nodes of the new grid g_new. The interpolation is of the order g_old.n()

See also
Introduction to dg methods
for integer multiples between old and new grid you may want to consider the dg::create::fast_interpolation functions
Parameters
g_newThe new grid
g_oldThe old grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Interpolation matrix with g_old.size() columns and g_new.size() rows
Attention
The 1d version does not remove explicit zeros from the interpolation matrix, but the 2d and 3d versions do
Note
The boundaries of the old grid must lie within the boundaries of the new grid
When interpolating a 2d grid to a 3d grid the third coordinate is simply ignored, i.e. the 2d vector will be trivially copied Nz times into the 3d vector
also check the transformation matrix, which is the more general solution

◆ interpolation() [3/18]

template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::interpolation ( const aRealMPITopology3d< real_type > &  g_new,
const aRealMPITopology3d< real_type > &  g_old,
std::string  method = "dg" 
)

Create interpolation between two grids.

This matrix interpolates vectors on the old grid g_old to the Gaussian nodes of the new grid g_new. The interpolation is of the order g_old.n()

See also
Introduction to dg methods
for integer multiples between old and new grid you may want to consider the dg::create::fast_interpolation functions
Parameters
g_newThe new grid
g_oldThe old grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Interpolation matrix with g_old.size() columns and g_new.size() rows
Attention
The 1d version does not remove explicit zeros from the interpolation matrix, but the 2d and 3d versions do
Note
The boundaries of the old grid must lie within the boundaries of the new grid
When interpolating a 2d grid to a 3d grid the third coordinate is simply ignored, i.e. the 2d vector will be trivially copied Nz times into the 3d vector
also check the transformation matrix, which is the more general solution

◆ interpolation() [4/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const aRealTopology2d< real_type > &  g_new,
const aRealTopology2d< real_type > &  g_old,
std::string  method = "dg" 
)

Create interpolation between two grids.

This matrix interpolates vectors on the old grid g_old to the Gaussian nodes of the new grid g_new. The interpolation is of the order g_old.n()

See also
Introduction to dg methods
for integer multiples between old and new grid you may want to consider the dg::create::fast_interpolation functions
Parameters
g_newThe new grid
g_oldThe old grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Interpolation matrix with g_old.size() columns and g_new.size() rows
Attention
The 1d version does not remove explicit zeros from the interpolation matrix, but the 2d and 3d versions do
Note
The boundaries of the old grid must lie within the boundaries of the new grid
When interpolating a 2d grid to a 3d grid the third coordinate is simply ignored, i.e. the 2d vector will be trivially copied Nz times into the 3d vector
also check the transformation matrix, which is the more general solution

◆ interpolation() [5/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const aRealTopology3d< real_type > &  g_new,
const aRealTopology2d< real_type > &  g_old,
std::string  method = "dg" 
)

Create interpolation between two grids.

This matrix interpolates vectors on the old grid g_old to the Gaussian nodes of the new grid g_new. The interpolation is of the order g_old.n()

See also
Introduction to dg methods
for integer multiples between old and new grid you may want to consider the dg::create::fast_interpolation functions
Parameters
g_newThe new grid
g_oldThe old grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Interpolation matrix with g_old.size() columns and g_new.size() rows
Attention
The 1d version does not remove explicit zeros from the interpolation matrix, but the 2d and 3d versions do
Note
The boundaries of the old grid must lie within the boundaries of the new grid
When interpolating a 2d grid to a 3d grid the third coordinate is simply ignored, i.e. the 2d vector will be trivially copied Nz times into the 3d vector
also check the transformation matrix, which is the more general solution

◆ interpolation() [6/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const aRealTopology3d< real_type > &  g_new,
const aRealTopology3d< real_type > &  g_old,
std::string  method = "dg" 
)

Create interpolation between two grids.

This matrix interpolates vectors on the old grid g_old to the Gaussian nodes of the new grid g_new. The interpolation is of the order g_old.n()

See also
Introduction to dg methods
for integer multiples between old and new grid you may want to consider the dg::create::fast_interpolation functions
Parameters
g_newThe new grid
g_oldThe old grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Interpolation matrix with g_old.size() columns and g_new.size() rows
Attention
The 1d version does not remove explicit zeros from the interpolation matrix, but the 2d and 3d versions do
Note
The boundaries of the old grid must lie within the boundaries of the new grid
When interpolating a 2d grid to a 3d grid the third coordinate is simply ignored, i.e. the 2d vector will be trivially copied Nz times into the 3d vector
also check the transformation matrix, which is the more general solution

◆ interpolation() [7/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const aRealTopologyX2d< real_type > &  g_new,
const aRealTopologyX2d< real_type > &  g_old 
)

Create interpolation between two grids.

This matrix can be applied to vectors defined on the old grid to obtain its values on the new grid.

Parameters
g_newThe new points
g_oldThe old grid
Returns
Interpolation matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid

◆ interpolation() [8/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const aRealTopologyX3d< real_type > &  g_new,
const aRealTopologyX3d< real_type > &  g_old 
)

Create interpolation between two grids.

This matrix can be applied to vectors defined on the old grid to obtain its values on the new grid.

Parameters
g_newThe new points
g_oldThe old grid
Returns
Interpolation matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid

◆ interpolation() [9/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const RealGrid1d< real_type > &  g_new,
const RealGrid1d< real_type > &  g_old,
std::string  method = "dg" 
)

Create interpolation between two grids.

This matrix interpolates vectors on the old grid g_old to the Gaussian nodes of the new grid g_new. The interpolation is of the order g_old.n()

See also
Introduction to dg methods
for integer multiples between old and new grid you may want to consider the dg::create::fast_interpolation functions
Parameters
g_newThe new grid
g_oldThe old grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Interpolation matrix with g_old.size() columns and g_new.size() rows
Attention
The 1d version does not remove explicit zeros from the interpolation matrix, but the 2d and 3d versions do
Note
The boundaries of the old grid must lie within the boundaries of the new grid
When interpolating a 2d grid to a 3d grid the third coordinate is simply ignored, i.e. the 2d vector will be trivially copied Nz times into the 3d vector
also check the transformation matrix, which is the more general solution

◆ interpolation() [10/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const RealGridX1d< real_type > &  g_new,
const RealGridX1d< real_type > &  g_old 
)

Create interpolation between two grids.

This matrix can be applied to vectors defined on the old grid to obtain its values on the new grid.

Parameters
g_newThe new points
g_oldThe old grid
Returns
Interpolation matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid

◆ interpolation() [11/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const thrust::host_vector< real_type > &  x,
const RealGrid1d< real_type > &  g,
dg::bc  bcx = dg::NEU,
std::string  method = "dg" 
)

Create interpolation matrix.

The created matrix has g.size() columns and x.size() rows. Per default it uses polynomial interpolation given by the dG polynomials, i.e. the interpolation has order g.n() . When applied to a vector the result contains the interpolated values at the given interpolation points. The given boundary conditions determine how interpolation points outside the grid domain are treated.

See also
Introduction to dg methods
Parameters
xX-coordinates of interpolation points
gThe Grid on which to operate
bcxdetermines what to do when a point lies outside the boundary in x. If dg::PER, the point will be shifted topologically back onto the domain. Else the point will be mirrored at the boundary: dg::NEU will then simply interpolate at the resulting point, dg::DIR will take the negative of the interpolation. (dg::DIR_NEU and dg::NEU_DIR apply dg::NEU / dg::DIR to the respective left or right boundary ) This means the result of the interpolation is as if the interpolated function were Fourier transformed with the correct boundary condition and thus extended beyond the grid boundaries. Note that if a point lies directly on the boundary between two grid cells, the value of the polynomial to the right is taken.
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
interpolation matrix
Attention
does not remove explicit zeros in the interpolation matrix

◆ interpolation() [12/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const thrust::host_vector< real_type > &  x,
const RealGridX1d< real_type > &  g 
)

Create interpolation matrix.

The matrix, when applied to a vector, interpolates its values to the given coordinates

Parameters
xX-coordinates of interpolation points
gThe Grid on which to operate
Returns
interpolation matrix

◆ interpolation() [13/18]

template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::interpolation ( const thrust::host_vector< real_type > &  x,
const thrust::host_vector< real_type > &  y,
const aRealMPITopology2d< real_type > &  g,
dg::bc  bcx = dg::NEU,
dg::bc  bcy = dg::NEU,
std::string  method = "dg" 
)

Create an MPI row distributed interpolation 2d matrix.

The created matrix has g.size() columns and x.size() rows. Per default it uses polynomial interpolation given by the dG polynomials, i.e. the interpolation has order g.n() . When applied to a vector the result contains the interpolated values at the given interpolation points. The given boundary conditions determine how interpolation points outside the grid domain are treated.

//create equidistant values
thrust::host_vector<double> x( g.size()), y(x);
for( unsigned i=0; i<g.Ny()*g.ny(); i++)
for( unsigned j=0; j<g.Nx()*g.nx(); j++)
{
//intentionally set values outside the grid domain
x[i*g.Nx()*g.nx() + j] =
g.x0() + g.lx() + (j+0.5)*g.hx()/(double)(g.nx());
y[i*g.Nx()*g.ny() + j] =
g.y0() + 2*g.ly() + (i+0.5)*g.hy()/(double)(g.ny());
}
//use DIR because the coo.2d is zero on the right boundary
Matrix B = dg::create::interpolation( x, y, g, dg::DIR, dg::DIR, "dg");
//values outside the grid are mirrored back in
const thrust::host_vector<double> vec = dg::evaluate( function, g);
thrust::host_vector<double> inter(vec);
dg::blas2::symv( B, vec, inter);
void symv(MatrixType &&M, const ContainerType1 &x, ContainerType2 &y)
Definition: blas2.h:287
@ DIR
homogeneous dirichlet boundaries
Definition: enums.h:17
@ y
y direction
@ x
x direction
thrust::host_vector< real_type > evaluate(UnaryOp f, const RealGrid1d< real_type > &g)
Evaluate a 1d function on grid coordinates.
Definition: evaluation.h:67
cusp::coo_matrix< int, real_type, cusp::host_memory > interpolation(const thrust::host_vector< real_type > &x, const RealGrid1d< real_type > &g, dg::bc bcx=dg::NEU, std::string method="dg")
Create interpolation matrix.
Definition: interpolation.h:254
See also
Introduction to dg methods
Parameters
xX-coordinates of interpolation points
yY-coordinates of interpolation points (y.size() must equal x.size())
gThe Grid on which to operate
bcxdetermines what to do when a point lies outside the boundary in x. If dg::PER, the point will be shifted topologically back onto the domain. Else the point will be mirrored at the boundary: dg::NEU will then simply interpolate at the resulting point, dg::DIR will take the negative of the interpolation. (dg::DIR_NEU and dg::NEU_DIR apply dg::NEU / dg::DIR to the respective left or right boundary ) This means the result of the interpolation is as if the interpolated function were Fourier transformed with the correct boundary condition and thus extended beyond the grid boundaries. Note that if a point lies directly on the boundary between two grid cells, the value of the polynomial to the right is taken.
bcyanalogous to bcx, applies to y direction
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
interpolation matrix
Attention
removes explicit zeros in the interpolation matrix

◆ interpolation() [14/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const thrust::host_vector< real_type > &  x,
const thrust::host_vector< real_type > &  y,
const aRealTopology2d< real_type > &  g,
dg::bc  bcx = dg::NEU,
dg::bc  bcy = dg::NEU,
std::string  method = "dg" 
)

Create interpolation matrix.

The created matrix has g.size() columns and x.size() rows. Per default it uses polynomial interpolation given by the dG polynomials, i.e. the interpolation has order g.n() . When applied to a vector the result contains the interpolated values at the given interpolation points. The given boundary conditions determine how interpolation points outside the grid domain are treated.

//create equidistant values
thrust::host_vector<double> x( g.size()), y(x);
for( unsigned i=0; i<g.Ny()*g.ny(); i++)
for( unsigned j=0; j<g.Nx()*g.nx(); j++)
{
//intentionally set values outside the grid domain
x[i*g.Nx()*g.nx() + j] =
g.x0() + g.lx() + (j+0.5)*g.hx()/(double)(g.nx());
y[i*g.Nx()*g.ny() + j] =
g.y0() + 2*g.ly() + (i+0.5)*g.hy()/(double)(g.ny());
}
//use DIR because the coo.2d is zero on the right boundary
Matrix B = dg::create::interpolation( x, y, g, dg::DIR, dg::DIR, "dg");
//values outside the grid are mirrored back in
const thrust::host_vector<double> vec = dg::evaluate( function, g);
thrust::host_vector<double> inter(vec);
dg::blas2::symv( B, vec, inter);
See also
Introduction to dg methods
Parameters
xX-coordinates of interpolation points
yY-coordinates of interpolation points (y.size() must equal x.size())
gThe Grid on which to operate
bcxdetermines what to do when a point lies outside the boundary in x. If dg::PER, the point will be shifted topologically back onto the domain. Else the point will be mirrored at the boundary: dg::NEU will then simply interpolate at the resulting point, dg::DIR will take the negative of the interpolation. (dg::DIR_NEU and dg::NEU_DIR apply dg::NEU / dg::DIR to the respective left or right boundary ) This means the result of the interpolation is as if the interpolated function were Fourier transformed with the correct boundary condition and thus extended beyond the grid boundaries. Note that if a point lies directly on the boundary between two grid cells, the value of the polynomial to the right is taken.
bcyanalogous to bcx, applies to y direction
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
interpolation matrix
Attention
removes explicit zeros in the interpolation matrix

◆ interpolation() [15/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const thrust::host_vector< real_type > &  x,
const thrust::host_vector< real_type > &  y,
const aRealTopologyX2d< real_type > &  g,
dg::bc  globalbcz = dg::NEU 
)

Create interpolation matrix.

The matrix, when applied to a vector, interpolates its values to the given coordinates

Parameters
xX-coordinates of interpolation points
yY-coordinates of interpolation points
gThe Grid on which to operate
globalbczNEU for common interpolation. DIR for zeros at Box
Returns
interpolation matrix

◆ interpolation() [16/18]

template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::interpolation ( const thrust::host_vector< real_type > &  x,
const thrust::host_vector< real_type > &  y,
const thrust::host_vector< real_type > &  z,
const aRealMPITopology3d< real_type > &  g,
dg::bc  bcx = dg::NEU,
dg::bc  bcy = dg::NEU,
dg::bc  bcz = dg::PER,
std::string  method = "linear" 
)

Create an MPI row distributed interpolation 3d matrix.

The created matrix has g.size() columns and x.size() rows. Per default it uses polynomial interpolation given by the dG polynomials, i.e. the interpolation has order g.n() . When applied to a vector the result contains the interpolated values at the given interpolation points.

//create equidistant values
thrust::host_vector<double> x( g.size()), y(x), z(x);
for( unsigned k=0; k<g.nz()*g.Nz(); k++)
for( unsigned i=0; i<g.Ny()*g.ny(); i++)
for( unsigned j=0; j<g.Nx()*g.nx(); j++)
{
x[(k*g.Ny()*g.ny() + i)*g.Nx()*g.nx() + j] =
g.x0() + (j+0.5)*g.hx()/(double)(g.nx());
y[(k*g.Ny()*g.ny() + i)*g.Nx()*g.nx() + j] =
g.y0() + (i+0.5)*g.hy()/(double)(g.ny());
z[(k*g.Ny()*g.ny() + i)*g.Nx()*g.nx() + j] =
g.z0() + (k+0.5)*g.hz()/(double)(g.nz());
}
std::vector<std::string> methods = {"nearest", "linear", "dg", "cubic"};
for ( auto method : methods)
{
Matrix B = dg::create::interpolation( x, y, z, g, dg::DIR, dg::DIR, dg::PER,
method);
const thrust::host_vector<double> vec = dg::evaluate( function, g);
thrust::host_vector<double> inter(vec);
dg::blas2::symv( B, vec, inter);
@ z
z direction
@ PER
periodic boundaries
Definition: enums.h:16
See also
Introduction to dg methods
Parameters
xX-coordinates of interpolation points
yY-coordinates of interpolation points (y.size() must equal x.size())
zZ-coordinates of interpolation points (z.size() must equal x.size())
gThe Grid on which to operate
bcxdetermines what to do when a point lies outside the boundary in x. If dg::PER, the point will be shifted topologically back onto the domain. Else the point will be mirrored at the boundary: dg::NEU will then simply interpolate at the resulting point, dg::DIR will take the negative of the interpolation. (dg::DIR_NEU and dg::NEU_DIR apply dg::NEU / dg::DIR to the respective left or right boundary ) This means the result of the interpolation is as if the interpolated function were Fourier transformed with the correct boundary condition and thus extended beyond the grid boundaries. Note that if a point lies directly on the boundary between two grid cells, the value of the polynomial to the right is taken.
bcyanalogous to bcx, applies to y direction
bczanalogous to bcx, applies to z direction
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
interpolation matrix
Attention
removes explicit zeros from the interpolation matrix
all points (x, y, z) must lie within or on the boundaries of g

◆ interpolation() [17/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const thrust::host_vector< real_type > &  x,
const thrust::host_vector< real_type > &  y,
const thrust::host_vector< real_type > &  z,
const aRealTopology3d< real_type > &  g,
dg::bc  bcx = dg::NEU,
dg::bc  bcy = dg::NEU,
dg::bc  bcz = dg::PER,
std::string  method = "dg" 
)

Create interpolation matrix.

The created matrix has g.size() columns and x.size() rows. Per default it uses polynomial interpolation given by the dG polynomials, i.e. the interpolation has order g.n() . When applied to a vector the result contains the interpolated values at the given interpolation points.

//create equidistant values
thrust::host_vector<double> x( g.size()), y(x), z(x);
for( unsigned k=0; k<g.nz()*g.Nz(); k++)
for( unsigned i=0; i<g.Ny()*g.ny(); i++)
for( unsigned j=0; j<g.Nx()*g.nx(); j++)
{
x[(k*g.Ny()*g.ny() + i)*g.Nx()*g.nx() + j] =
g.x0() + (j+0.5)*g.hx()/(double)(g.nx());
y[(k*g.Ny()*g.ny() + i)*g.Nx()*g.nx() + j] =
g.y0() + (i+0.5)*g.hy()/(double)(g.ny());
z[(k*g.Ny()*g.ny() + i)*g.Nx()*g.nx() + j] =
g.z0() + (k+0.5)*g.hz()/(double)(g.nz());
}
std::vector<std::string> methods = {"nearest", "linear", "dg", "cubic"};
for ( auto method : methods)
{
Matrix B = dg::create::interpolation( x, y, z, g, dg::DIR, dg::DIR, dg::PER,
method);
const thrust::host_vector<double> vec = dg::evaluate( function, g);
thrust::host_vector<double> inter(vec);
dg::blas2::symv( B, vec, inter);
See also
Introduction to dg methods
Parameters
xX-coordinates of interpolation points
yY-coordinates of interpolation points (y.size() must equal x.size())
zZ-coordinates of interpolation points (z.size() must equal x.size())
gThe Grid on which to operate
bcxdetermines what to do when a point lies outside the boundary in x. If dg::PER, the point will be shifted topologically back onto the domain. Else the point will be mirrored at the boundary: dg::NEU will then simply interpolate at the resulting point, dg::DIR will take the negative of the interpolation. (dg::DIR_NEU and dg::NEU_DIR apply dg::NEU / dg::DIR to the respective left or right boundary ) This means the result of the interpolation is as if the interpolated function were Fourier transformed with the correct boundary condition and thus extended beyond the grid boundaries. Note that if a point lies directly on the boundary between two grid cells, the value of the polynomial to the right is taken.
bcyanalogous to bcx, applies to y direction
bczanalogous to bcx, applies to z direction
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
interpolation matrix
Attention
removes explicit zeros from the interpolation matrix
all points (x, y, z) must lie within or on the boundaries of g

◆ interpolation() [18/18]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::interpolation ( const thrust::host_vector< real_type > &  x,
const thrust::host_vector< real_type > &  y,
const thrust::host_vector< real_type > &  z,
const aRealTopologyX3d< real_type > &  g,
dg::bc  globalbcz = dg::NEU 
)

Create interpolation matrix.

The matrix, when applied to a vector, interpolates its values to the given coordinates. In z-direction only a nearest neighbor interpolation is used

Parameters
xX-coordinates of interpolation points
yY-coordinates of interpolation points
zZ-coordinates of interpolation points
gThe Grid on which to operate
globalbczdetermines what to do if values lie exactly on the boundary
Returns
interpolation matrix
Note
The values of x, y and z must lie within the boundaries of g

◆ projection() [1/8]

template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::projection ( const aRealMPITopology2d< real_type > &  g_new,
const aRealMPITopology2d< real_type > &  g_old,
std::string  method = "dg" 
)

Create a projection between two grids.

This matrix can be applied to vectors defined on the old (fine) grid to obtain its values projected on the new (coarse) grid. (Projection means that the projection integrals over the base polynomials are computed). If the fine grid is a multiple of the coarse grid, the integral value of the projected vector will be conserved and the difference in the L2 norm between old and new vector small. The projection matrix is the adjoint of the interpolation matrix

See also
Introduction to dg methods
for integer multiples between old and new Topological grids and operations you may want to consider the dg::create::fast_projection A large collection
Parameters
g_newThe new (coarse) grid
g_oldThe old (fine) grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Projection matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
also check dg::create::transformation, which is the more general solution
Attention
Projection only works if the number of cells in the fine grid is a multiple of the number of cells in the coarse grid and if the number of polynomial coefficients is lower or the same in the new grid

◆ projection() [2/8]

template<class real_type >
dg::MIHMatrix_t< real_type > dg::create::projection ( const aRealMPITopology3d< real_type > &  g_new,
const aRealMPITopology3d< real_type > &  g_old,
std::string  method = "dg" 
)

Create a projection between two grids.

This matrix can be applied to vectors defined on the old (fine) grid to obtain its values projected on the new (coarse) grid. (Projection means that the projection integrals over the base polynomials are computed). If the fine grid is a multiple of the coarse grid, the integral value of the projected vector will be conserved and the difference in the L2 norm between old and new vector small. The projection matrix is the adjoint of the interpolation matrix

See also
Introduction to dg methods
for integer multiples between old and new Topological grids and operations you may want to consider the dg::create::fast_projection A large collection
Parameters
g_newThe new (coarse) grid
g_oldThe old (fine) grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Projection matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
also check dg::create::transformation, which is the more general solution
Attention
Projection only works if the number of cells in the fine grid is a multiple of the number of cells in the coarse grid and if the number of polynomial coefficients is lower or the same in the new grid

◆ projection() [3/8]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection ( const aRealTopology2d< real_type > &  g_new,
const aRealTopology2d< real_type > &  g_old,
std::string  method = "dg" 
)

Create a projection between two grids.

This matrix can be applied to vectors defined on the old (fine) grid to obtain its values projected on the new (coarse) grid. (Projection means that the projection integrals over the base polynomials are computed). If the fine grid is a multiple of the coarse grid, the integral value of the projected vector will be conserved and the difference in the L2 norm between old and new vector small. The projection matrix is the adjoint of the interpolation matrix

See also
Introduction to dg methods
for integer multiples between old and new Topological grids and operations you may want to consider the dg::create::fast_projection A large collection
Parameters
g_newThe new (coarse) grid
g_oldThe old (fine) grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Projection matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
also check dg::create::transformation, which is the more general solution
Attention
Projection only works if the number of cells in the fine grid is a multiple of the number of cells in the coarse grid and if the number of polynomial coefficients is lower or the same in the new grid

◆ projection() [4/8]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection ( const aRealTopology3d< real_type > &  g_new,
const aRealTopology3d< real_type > &  g_old,
std::string  method = "dg" 
)

Create a projection between two grids.

This matrix can be applied to vectors defined on the old (fine) grid to obtain its values projected on the new (coarse) grid. (Projection means that the projection integrals over the base polynomials are computed). If the fine grid is a multiple of the coarse grid, the integral value of the projected vector will be conserved and the difference in the L2 norm between old and new vector small. The projection matrix is the adjoint of the interpolation matrix

See also
Introduction to dg methods
for integer multiples between old and new Topological grids and operations you may want to consider the dg::create::fast_projection A large collection
Parameters
g_newThe new (coarse) grid
g_oldThe old (fine) grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Projection matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
also check dg::create::transformation, which is the more general solution
Attention
Projection only works if the number of cells in the fine grid is a multiple of the number of cells in the coarse grid and if the number of polynomial coefficients is lower or the same in the new grid

◆ projection() [5/8]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection ( const aRealTopologyX2d< real_type > &  g_new,
const aRealTopologyX2d< real_type > &  g_old,
std::string  method = "dg" 
)

Create a projection between two grids.

This matrix can be applied to vectors defined on the old (fine) grid to obtain its values projected on the new (coarse) grid. (Projection means that the projection integrals over the base polynomials are computed). If the fine grid is a multiple of the coarse grid, the integral value of the projected vector will be conserved and the difference in the L2 norm between old and new vector small. The projection matrix is the adjoint of the interpolation matrix

See also
Introduction to dg methods
for integer multiples between old and new Topological grids and operations you may want to consider the dg::create::fast_projection A large collection
Parameters
g_newThe new (coarse) grid
g_oldThe old (fine) grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Projection matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
also check dg::create::transformation, which is the more general solution
Attention
Projection only works if the number of cells in the fine grid is a multiple of the number of cells in the coarse grid and if the number of polynomial coefficients is lower or the same in the new grid

◆ projection() [6/8]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection ( const aRealTopologyX3d< real_type > &  g_new,
const aRealTopologyX3d< real_type > &  g_old,
std::string  method = "dg" 
)

Create a projection between two grids.

This matrix can be applied to vectors defined on the old (fine) grid to obtain its values projected on the new (coarse) grid. (Projection means that the projection integrals over the base polynomials are computed). If the fine grid is a multiple of the coarse grid, the integral value of the projected vector will be conserved and the difference in the L2 norm between old and new vector small. The projection matrix is the adjoint of the interpolation matrix

See also
Introduction to dg methods
for integer multiples between old and new Topological grids and operations you may want to consider the dg::create::fast_projection A large collection
Parameters
g_newThe new (coarse) grid
g_oldThe old (fine) grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Projection matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
also check dg::create::transformation, which is the more general solution
Attention
Projection only works if the number of cells in the fine grid is a multiple of the number of cells in the coarse grid and if the number of polynomial coefficients is lower or the same in the new grid

◆ projection() [7/8]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection ( const RealGrid1d< real_type > &  g_new,
const RealGrid1d< real_type > &  g_old,
std::string  method = "dg" 
)

Create a projection between two grids.

This matrix can be applied to vectors defined on the old (fine) grid to obtain its values projected on the new (coarse) grid. (Projection means that the projection integrals over the base polynomials are computed). If the fine grid is a multiple of the coarse grid, the integral value of the projected vector will be conserved and the difference in the L2 norm between old and new vector small. The projection matrix is the adjoint of the interpolation matrix

See also
Introduction to dg methods
for integer multiples between old and new Topological grids and operations you may want to consider the dg::create::fast_projection A large collection
Parameters
g_newThe new (coarse) grid
g_oldThe old (fine) grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Projection matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
also check dg::create::transformation, which is the more general solution
Attention
Projection only works if the number of cells in the fine grid is a multiple of the number of cells in the coarse grid and if the number of polynomial coefficients is lower or the same in the new grid

!! cusp::multiply removes explicit zeros in the output

◆ projection() [8/8]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::projection ( const RealGridX1d< real_type > &  g_new,
const RealGridX1d< real_type > &  g_old,
std::string  method = "dg" 
)

Create a projection between two grids.

This matrix can be applied to vectors defined on the old (fine) grid to obtain its values projected on the new (coarse) grid. (Projection means that the projection integrals over the base polynomials are computed). If the fine grid is a multiple of the coarse grid, the integral value of the projected vector will be conserved and the difference in the L2 norm between old and new vector small. The projection matrix is the adjoint of the interpolation matrix

See also
Introduction to dg methods
for integer multiples between old and new Topological grids and operations you may want to consider the dg::create::fast_projection A large collection
Parameters
g_newThe new (coarse) grid
g_oldThe old (fine) grid
methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial. Pay attention that linear and cubic entail nearest neighbor communication in mpi.
Returns
Projection matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
also check dg::create::transformation, which is the more general solution
Attention
Projection only works if the number of cells in the fine grid is a multiple of the number of cells in the coarse grid and if the number of polynomial coefficients is lower or the same in the new grid

◆ transformation() [1/3]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::transformation ( const aRealTopology2d< real_type > &  g_new,
const aRealTopology2d< real_type > &  g_old 
)

Create a transformation matrix between two grids.

The transformation matrix is probably the most correct way of transforming dG vectors between any two grids of different resolution. It first finds the least common multiple grid (lcm) of the old and the new grid. Then it interpolates the values to the lcm grid and finally projects them back to the new grid. In total we have

\[ \mathcal T = P Q \]

where \( Q\) is the interpolation matrix and \( P \) the projection. If either new or old grid is already the lcm grid this function reduces to the interpolation/projection function.

See also
Introduction to dg methods
Parameters
g_newThe new grid
g_oldThe old grid
Returns
transformation matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
If the grid are very incompatible the matrix-matrix multiplication can take a while

◆ transformation() [2/3]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::transformation ( const aRealTopology3d< real_type > &  g_new,
const aRealTopology3d< real_type > &  g_old 
)

Create a transformation matrix between two grids.

The transformation matrix is probably the most correct way of transforming dG vectors between any two grids of different resolution. It first finds the least common multiple grid (lcm) of the old and the new grid. Then it interpolates the values to the lcm grid and finally projects them back to the new grid. In total we have

\[ \mathcal T = P Q \]

where \( Q\) is the interpolation matrix and \( P \) the projection. If either new or old grid is already the lcm grid this function reduces to the interpolation/projection function.

See also
Introduction to dg methods
Parameters
g_newThe new grid
g_oldThe old grid
Returns
transformation matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
If the grid are very incompatible the matrix-matrix multiplication can take a while

◆ transformation() [3/3]

template<class real_type >
cusp::coo_matrix< int, real_type, cusp::host_memory > dg::create::transformation ( const RealGrid1d< real_type > &  g_new,
const RealGrid1d< real_type > &  g_old 
)

Create a transformation matrix between two grids.

The transformation matrix is probably the most correct way of transforming dG vectors between any two grids of different resolution. It first finds the least common multiple grid (lcm) of the old and the new grid. Then it interpolates the values to the lcm grid and finally projects them back to the new grid. In total we have

\[ \mathcal T = P Q \]

where \( Q\) is the interpolation matrix and \( P \) the projection. If either new or old grid is already the lcm grid this function reduces to the interpolation/projection function.

See also
Introduction to dg methods
Parameters
g_newThe new grid
g_oldThe old grid
Returns
transformation matrix
Note
The boundaries of the old grid must lie within the boundaries of the new grid
If the grid are very incompatible the matrix-matrix multiplication can take a while