Discontinuous Galerkin Library
#include "dg/algorithm.h"
Collaboration diagram for create weights:

Functions

template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::weights (const aRealMPITopology2d< real_type > &g)
 Nodal weight coefficients. More...
 
template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::inv_weights (const aRealMPITopology2d< real_type > &g)
 inverse nodal weight coefficients More...
 
template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::weights (const aRealMPITopology2d< real_type > &g, enum coo2d coo)
 nodal weight coefficients More...
 
template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::weights (const aRealMPITopology3d< real_type > &g)
 Nodal weight coefficients. More...
 
template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::inv_weights (const aRealMPITopology3d< real_type > &g)
 inverse nodal weight coefficients More...
 
template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::weights (const aRealMPITopology3d< real_type > &g, enum coo3d coo)
 nodal weight coefficients More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::weights (const RealGrid1d< real_type > &g)
 Nodal weight coefficients. More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights (const RealGrid1d< real_type > &g)
 inverse nodal weight coefficients More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::weights (const aRealTopology2d< real_type > &g)
 Nodal weight coefficients. More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights (const aRealTopology2d< real_type > &g)
 inverse nodal weight coefficients More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::weights (const aRealTopology2d< real_type > &g, enum coo2d coo)
 nodal weight coefficients More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::weights (const aRealTopology3d< real_type > &g)
 Nodal weight coefficients. More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights (const aRealTopology3d< real_type > &g)
 inverse nodal weight coefficients More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::weights (const aRealTopology3d< real_type > &g, enum coo3d coo)
 nodal weight coefficients More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::weights (const dg::RealGridX1d< real_type > &g)
 Nodal weight coefficients. More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights (const RealGridX1d< real_type > &g)
 inverse nodal weight coefficients More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::weights (const aRealTopologyX2d< real_type > &g)
 Nodal weight coefficients. More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights (const aRealTopologyX2d< real_type > &g)
 inverse nodal weight coefficients More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::weights (const aRealTopologyX3d< real_type > &g)
 Nodal weight coefficients. More...
 
template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights (const aRealTopologyX3d< real_type > &g)
 inverse nodal weight coefficients More...
 

Detailed Description

overloads for the dg::create::weights and dg::create::inv_weights functions for all available topologies

Function Documentation

◆ inv_weights() [1/8]

template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::inv_weights ( const aRealMPITopology2d< real_type > &  g)

inverse nodal weight coefficients

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ inv_weights() [2/8]

template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::inv_weights ( const aRealMPITopology3d< real_type > &  g)

inverse nodal weight coefficients

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ inv_weights() [3/8]

template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights ( const aRealTopology2d< real_type > &  g)

inverse nodal weight coefficients

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ inv_weights() [4/8]

template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights ( const aRealTopology3d< real_type > &  g)

inverse nodal weight coefficients

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ inv_weights() [5/8]

template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights ( const aRealTopologyX2d< real_type > &  g)

inverse nodal weight coefficients

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ inv_weights() [6/8]

template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights ( const aRealTopologyX3d< real_type > &  g)

inverse nodal weight coefficients

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ inv_weights() [7/8]

template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights ( const RealGrid1d< real_type > &  g)

inverse nodal weight coefficients

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ inv_weights() [8/8]

template<class real_type >
thrust::host_vector< real_type > dg::create::inv_weights ( const RealGridX1d< real_type > &  g)

inverse nodal weight coefficients

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ weights() [1/12]

template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::weights ( const aRealMPITopology2d< real_type > &  g)

Nodal weight coefficients.

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

This code snippet demonstrates how to discretize and compute the norm of a function on a distributed memory system

//define the function to integrate
double function(double x, double y, double amp){
return amp*exp(x)*exp(y);
}
// create a grid of the domain [0,2]x[0,2] with 20 cells in x and y and 3 polynomial coefficients
//... use MPI_Cart_create to create 2d Cartesian communicator
dg::MPIGrid2d g2d( 0, 2, 0, 2, 3, 20, 20, comm2d);
// create the Gaussian weights (volume form) for the integration
const dg::MHVec w2d = dg::create::weights( g2d);
// our function needs to depend only on x and y so let's fix the amplitude to 2
using namespace std::placeholders; //for _1, _2
auto functor = std::bind( function, _1, _2, 2.);
// discretize the function on the grid
const dg::MHVec vec = dg::evaluate( functor, g2d);
// multiply and sum the results
double norm = dg::blas2::dot( vec, w2d, vec);
// norm is now: (e^4-1)^2
get_value_type< MatrixType > dot(const ContainerType1 &x, const MatrixType &m, const ContainerType2 &y)
; Binary reproducible general dot product
Definition: blas2.h:85
thrust::host_vector< real_type > evaluate(UnaryOp f, const RealGrid1d< real_type > &g)
Evaluate a 1d function on grid coordinates.
Definition: evaluation.h:67
MPI_Vector< thrust::host_vector< real_type > > weights(const aRealMPITopology2d< real_type > &g)
Nodal weight coefficients.
Definition: mpi_weights.h:22
mpi Vector class
Definition: mpi_vector.h:32
The simplest implementation of aRealMPITopology2d.
Definition: mpi_grid.h:691

◆ weights() [2/12]

template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::weights ( const aRealMPITopology2d< real_type > &  g,
enum coo2d  coo 
)

nodal weight coefficients

Parameters
gThe grid
cooThe coordinate for which to generate the weights (in 2d only dg::x and dg::y are allowed)
Returns
Host Vector with full grid size
See also
Introduction to dg methods

◆ weights() [3/12]

template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::weights ( const aRealMPITopology3d< real_type > &  g)

Nodal weight coefficients.

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

This code snippet demonstrates how to discretize and compute the norm of a function

// define the function to integrate
double function(double x, double y, double z, double amp){
return amp*exp(x)*exp(y)*exp(z);
}
// create a grid of the domain [0,2]x[0,2]x[0,2] with 20 cells in x, y and z and 3 polynomial coefficients and x and y and 1 in z
//... use MPI_Cart_create to create 3d Cartesian communicator
dg::MPIGrid3d g3d( 0, 2, 0, 2, 0, 2, 3, 20, 20, 20, comm3d);
// create the Gaussian weights (volume form) for the integration
const dg::MHVec w3d = dg::create::weights( g3d);
// our function needs to depend only on x, y and z so let's fix the amplitude to 2
using namespace std::placeholders; //for _1, _2, _3
auto functor = std::bind( function, _1, _2, _3, 2.);
// discretize the function on the grid
const dg::MHVec vec = dg::evaluate( functor, g3d);
// now compute the scalar product (the L2 norm)
double norm = dg::blas2::dot(vec, w3d, vec);
// norm is now: (exp(4)-exp(0))^3/2
The simplest implementation of aRealMPITopology3d.
Definition: mpi_grid.h:727

◆ weights() [4/12]

template<class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::create::weights ( const aRealMPITopology3d< real_type > &  g,
enum coo3d  coo 
)

nodal weight coefficients

Parameters
gThe grid
cooThe coordinate for which to generate the weights (in 2d only dg::x and dg::y are allowed)
Returns
Host Vector with full grid size
See also
Introduction to dg methods

◆ weights() [5/12]

template<class real_type >
thrust::host_vector< real_type > dg::create::weights ( const aRealTopology2d< real_type > &  g)

Nodal weight coefficients.

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

This code snippet demonstrates how to discretize and compute the norm of a function on a shared memory system

// define the function to integrate
double function(double x, double y, double amp){
return amp*exp(x)*exp(y);
}
// create a grid of the domain [0,2]x[0,2] with 20 cells in x and y and 3 polynomial coefficients
dg::Grid2d g2d( 0, 2, 0, 2, 3, 20, 20);
// create the Gaussian weights (volume form) for the integration
const dg::HVec w2d = dg::create::weights( g2d);
// our function needs to depend only on x and y so let's fix the amplitude to 2
using namespace std::placeholders; //for _1, _2
auto functor = std::bind( function, _1, _2, 2.);
// discretize the function on the grid
const dg::HVec vec = dg::evaluate( functor, g2d);
// now compute the scalar product (the L2 norm)
double norm = dg::blas2::dot( vec, w2d, vec);
// norm is now: (e^4-1)^2
thrust::host_vector< double > HVec
Host Vector.
Definition: typedefs.h:19

◆ weights() [6/12]

template<class real_type >
thrust::host_vector< real_type > dg::create::weights ( const aRealTopology2d< real_type > &  g,
enum coo2d  coo 
)

nodal weight coefficients

Parameters
gThe grid
cooThe coordinate for which to generate the weights (in 2d only dg::x and dg::y are allowed)
Returns
Host Vector with full grid size
See also
Introduction to dg methods

◆ weights() [7/12]

template<class real_type >
thrust::host_vector< real_type > dg::create::weights ( const aRealTopology3d< real_type > &  g)

Nodal weight coefficients.

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

This code snippet demonstrates how to discretize and compute the norm of a function

// define the function to integrate
double function(double x, double y, double z, double amp){
return amp*exp(x)*exp(y)*exp(z);
}
// create a grid of the domain [0,2]x[0,2]x[0,2] with 20 cells in x, y and z and 3 polynomial coefficients and x and y and 1 in z
dg::Grid3d g3d( 0, 2, 0, 2, 0, 2, 3, 20, 20, 20);
// create the Gaussian weights (volume form) for the integration
const dg::HVec w3d = dg::create::weights( g3d);
// our function needs to depend only on x, y and z so let's fix the amplitude to 2
using namespace std::placeholders; //for _1, _2, _3
auto functor = std::bind( function, _1, _2, _3, 2.);
// discretize the function on the grid
const dg::HVec vec = dg::evaluate( functor, g3d);
// now compute the scalar product (the L2 norm)
double norm = dg::blas2::dot(vec, w3d, vec);
// norm is now: (exp(4)-exp(0))^3/2
The simplest implementation of aRealTopology3d.
Definition: grid.h:844

◆ weights() [8/12]

template<class real_type >
thrust::host_vector< real_type > dg::create::weights ( const aRealTopology3d< real_type > &  g,
enum coo3d  coo 
)

nodal weight coefficients

Parameters
gThe grid
cooThe coordinate for which to generate the weights (in 2d only dg::x and dg::y are allowed)
Returns
Host Vector with full grid size
See also
Introduction to dg methods

◆ weights() [9/12]

template<class real_type >
thrust::host_vector< real_type > dg::create::weights ( const aRealTopologyX2d< real_type > &  g)

Nodal weight coefficients.

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ weights() [10/12]

template<class real_type >
thrust::host_vector< real_type > dg::create::weights ( const aRealTopologyX3d< real_type > &  g)

Nodal weight coefficients.

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ weights() [11/12]

template<class real_type >
thrust::host_vector< real_type > dg::create::weights ( const dg::RealGridX1d< real_type > &  g)

Nodal weight coefficients.

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

◆ weights() [12/12]

template<class real_type >
thrust::host_vector< real_type > dg::create::weights ( const RealGrid1d< real_type > &  g)

Nodal weight coefficients.

Parameters
gThe grid
Returns
Host Vector
See also
Introduction to dg methods

This code snippet demonstrates how to discretize and integrate a function

// create a one-dimensional grid on the domain [0,2] with 3 polynomial coefficients and 20 cells
dg::Grid1d g1d( 0, 2, 3, 20);
// create the Gaussian weights (volume form) for the integration
const dg::HVec w1d = dg::create::weights( g1d);
// discretize the exponential function on the grid
const dg::HVec vec = dg::evaluate( exp, g1d);
// now compute the scalar product (the integral)
double integral = dg::blas1::dot( w1d, vec);
// integral is now: e^2-1
get_value_type< ContainerType1 > dot(const ContainerType1 &x, const ContainerType2 &y)
Binary reproducible Euclidean dot product between two vectors
Definition: blas1.h:87