Discontinuous Galerkin Library
#include "dg/algorithm.h"
|
\( f_i = f(\vec x_i) \) More...
Functions | |
template<class UnaryOp , class real_type > | |
thrust::host_vector< real_type > | dg::evaluate (UnaryOp f, const RealGrid1d< real_type > &g) |
Evaluate a 1d function on grid coordinates. More... | |
template<class BinaryOp , class real_type > | |
thrust::host_vector< real_type > | dg::evaluate (const BinaryOp &f, const aRealTopology2d< real_type > &g) |
Evaluate a 2d function on grid coordinates. More... | |
template<class TernaryOp , class real_type > | |
thrust::host_vector< real_type > | dg::evaluate (const TernaryOp &f, const aRealTopology3d< real_type > &g) |
Evaluate a 3d function on grid coordinates. More... | |
template<class real_type > | |
thrust::host_vector< real_type > | dg::integrate (const thrust::host_vector< real_type > &in, const RealGrid1d< real_type > &g, dg::direction dir=dg::forward) |
Indefinite integral of a function on a grid. More... | |
template<class UnaryOp , class real_type > | |
thrust::host_vector< real_type > | dg::integrate (UnaryOp f, const RealGrid1d< real_type > &g, dg::direction dir=dg::forward) |
Indefinite integral of a function on a grid. More... | |
template<class UnaryOp , class real_type > | |
thrust::host_vector< real_type > | dg::evaluate (UnaryOp f, const RealGridX1d< real_type > &g) |
Evaluate a 1d function on grid coordinates. More... | |
template<class BinaryOp , class real_type > | |
thrust::host_vector< real_type > | dg::evaluate (const BinaryOp &f, const aRealTopologyX2d< real_type > &g) |
Evaluate a 2d function on grid coordinates. More... | |
template<class TernaryOp , class real_type > | |
thrust::host_vector< real_type > | dg::evaluate (const TernaryOp &f, const aRealTopologyX3d< real_type > &g) |
Evaluate a 3d function on grid coordinates. More... | |
template<class BinaryOp , class real_type > | |
MPI_Vector< thrust::host_vector< real_type > > | dg::evaluate (const BinaryOp &f, const aRealMPITopology2d< real_type > &g) |
Evaluate a 2d function on mpi distributed grid coordinates. More... | |
template<class TernaryOp , class real_type > | |
MPI_Vector< thrust::host_vector< real_type > > | dg::evaluate (const TernaryOp &f, const aRealMPITopology3d< real_type > &g) |
Evaluate a 3d function on mpi distributed grid coordinates. More... | |
\( f_i = f(\vec x_i) \)
The function discretisation routines compute the dG discretisation of analytic functions on a given grid. In 1D the discretisation simply consists of n function values per grid cell ( where n is the number of Legendre coefficients used; currently \( 1 <= n <= 20\) ) evaluated at the Gaussian abscissas in the respective cell. In 2D and 3D we simply use the product space.
MPI_Vector< thrust::host_vector< real_type > > dg::evaluate | ( | const BinaryOp & | f, |
const aRealMPITopology2d< real_type > & | g | ||
) |
Evaluate a 2d function on mpi distributed grid coordinates.
Evaluate is equivalent to the following:
This code snippet demonstrates how to discretize and compute the norm of a function on a distributed memory system
BinaryOp | A class or function type with a member/signature equivalent to
|
f | The function to evaluate: f = f(x,y) |
g | The 2d grid on which to evaluate f |
v
as an MPI host Vector dg::cooX2d
) to generate the list of grid coordinates in x
direction (or analogous in y
, dg::cooY2d
) thrust::host_vector< real_type > dg::evaluate | ( | const BinaryOp & | f, |
const aRealTopology2d< real_type > & | g | ||
) |
Evaluate a 2d function on grid coordinates.
Evaluate is equivalent to the following:
This code snippet demonstrates how to discretize and compute the norm of a function on a shared memory system
BinaryOp | A class or function type with a member/signature equivalent to
|
f | The function to evaluate: \( f = f(x,y)\), see A large collection for a host of predefined functors to evaluate |
g | The 2d grid on which to evaluate f |
v
as a host vector dg::cooX2d
) to generate the list of grid coordinates in x
direction (or analogous in y
, dg::cooY2d
) dg::pullback
if you want to evaluate a function in physical space thrust::host_vector< real_type > dg::evaluate | ( | const BinaryOp & | f, |
const aRealTopologyX2d< real_type > & | g | ||
) |
Evaluate a 2d function on grid coordinates.
Evaluate is equivalent to the following:
This code snippet demonstrates how to discretize and compute the norm of a function on a shared memory system
BinaryOp | A class or function type with a member/signature equivalent to
|
f | The function to evaluate: \( f = f(x,y)\), see A large collection for a host of predefined functors to evaluate |
g | The 2d grid on which to evaluate f |
v
as a host vector dg::cooX2d
) to generate the list of grid coordinates in x
direction (or analogous in y
, dg::cooY2d
) dg::pullback
if you want to evaluate a function in physical space MPI_Vector< thrust::host_vector< real_type > > dg::evaluate | ( | const TernaryOp & | f, |
const aRealMPITopology3d< real_type > & | g | ||
) |
Evaluate a 3d function on mpi distributed grid coordinates.
Evaluate is equivalent to the following:
This code snippet demonstrates how to discretize and compute the norm of a function
TernaryOp | A class or function type with a member/signature equivalent to
|
f | The function to evaluate: f = f(x,y,z) |
g | The 3d grid on which to evaluate f |
v
as an MPI host Vector dg::cooX3d
) to generate the list of grid coordinates in x
direction (or analogous in y
, dg::cooY3d
or z
, dg::cooZ3d
) thrust::host_vector< real_type > dg::evaluate | ( | const TernaryOp & | f, |
const aRealTopology3d< real_type > & | g | ||
) |
Evaluate a 3d function on grid coordinates.
Evaluate is equivalent to the following:
This code snippet demonstrates how to discretize and compute the norm of a function
TernaryOp | A class or function type with a member/signature equivalent to
|
f | The function to evaluate: \( f = f(x,y,z) \), see A large collection for a host of predefined functors to evaluate |
g | The 3d grid on which to evaluate f |
v
as a host vector dg::cooX3d
) to generate the list of grid coordinates in x
direction (or analogous in y
, dg::cooY3d
or z
, dg::cooZ3d
) dg::pullback
if you want to evaluate a function in physical space thrust::host_vector< real_type > dg::evaluate | ( | const TernaryOp & | f, |
const aRealTopologyX3d< real_type > & | g | ||
) |
Evaluate a 3d function on grid coordinates.
Evaluate is equivalent to the following:
This code snippet demonstrates how to discretize and compute the norm of a function
TernaryOp | A class or function type with a member/signature equivalent to
|
f | The function to evaluate: \( f = f(x,y,z) \), see A large collection for a host of predefined functors to evaluate |
g | The 3d grid on which to evaluate f |
v
as a host vector dg::cooX3d
) to generate the list of grid coordinates in x
direction (or analogous in y
, dg::cooY3d
or z
, dg::cooZ3d
) dg::pullback
if you want to evaluate a function in physical space thrust::host_vector< real_type > dg::evaluate | ( | UnaryOp | f, |
const RealGrid1d< real_type > & | g | ||
) |
Evaluate a 1d function on grid coordinates.
Evaluate is equivalent to the following:
i
This code snippet demonstrates how to discretize and integrate a function
UnaryOp | Model of Unary Function real_type f(real_type) |
f | The function to evaluate, see A large collection for a host of predefined functors to evaluate |
g | The grid that defines the computational space on which to evaluate f |
v
as a host vector dg::cooX1d()
) to generate the list of grid coordinates dg::pullback
if you want to evaluate a function in physical space thrust::host_vector< real_type > dg::evaluate | ( | UnaryOp | f, |
const RealGridX1d< real_type > & | g | ||
) |
Evaluate a 1d function on grid coordinates.
Evaluate is equivalent to the following:
i
This code snippet demonstrates how to discretize and integrate a function
UnaryOp | Model of Unary Function real_type f(real_type) |
f | The function to evaluate, see A large collection for a host of predefined functors to evaluate |
g | The grid that defines the computational space on which to evaluate f |
v
as a host vector dg::cooX1d()
) to generate the list of grid coordinates dg::pullback
if you want to evaluate a function in physical space thrust::host_vector< real_type > dg::integrate | ( | const thrust::host_vector< real_type > & | in, |
const RealGrid1d< real_type > & | g, | ||
dg::direction | dir = dg::forward |
||
) |
Indefinite integral of a function on a grid.
\[ F_h(x) = \int_a^x f_h(x') dx' \]
This function computes the indefinite integral of a given input
in | Host vector discretized on g |
g | The grid |
dir | If dg::backward then the integral starts at the right boundary (i.e. goes in the reverse direction) \[ F_h(x) = \int_b^x f_h(x') dx' = \int_a^x f_h(x') dx' - \int_a^b f_h(x') dx' \] |
in
on the grid g
thrust::host_vector< real_type > dg::integrate | ( | UnaryOp | f, |
const RealGrid1d< real_type > & | g, | ||
dg::direction | dir = dg::forward |
||
) |
Indefinite integral of a function on a grid.
\[ F_h(x) = \int_a^x f_h(x') dx' \]
This function first evaluates f on the given grid and then computes and returns its indefinite integral
f | The function to evaluate and then integrate |
g | The grid |
dir | If dg::backward then the integral starts at the right boundary (i.e. goes in the reverse direction) \[ F_h(x) = \int_b^x f_h(x') dx' = \int_a^x f_h(x') dx' - \int_a^b f_h(x') dx' \] |
f
on the grid g