|
Discontinuous Galerkin Library
#include "dg/algorithm.h"
|
\( f_i = f(\vec x_i) \) More...
Functions | |
| template<class Functor , class Topology > | |
| auto | dg::evaluate (Functor &&f, const Topology &g) |
| Evaluate a function on grid coordinates | |
| template<class real_type > | |
| thrust::host_vector< real_type > | dg::integrate (const thrust::host_vector< real_type > &in, const RealGrid< real_type, 1 > &g, dg::direction dir=dg::forward) |
| Indefinite integral of a function on a grid. | |
| template<class UnaryOp , class real_type > | |
| thrust::host_vector< real_type > | dg::integrate (UnaryOp f, const RealGrid< real_type, 1 > &g, dg::direction dir=dg::forward) |
| Untility shortcut. | |
| template<class Topology > | |
| auto | dg::create::weights (const Topology &g) |
| Nodal weight coefficients. | |
| template<class Topology > | |
| auto | dg::create::weights (const Topology &g, std::array< bool, Topology::ndim()> remains) |
| Nodal weight coefficients on a subset of dimensions. | |
| template<class Topology > | |
| auto | dg::create::inv_weights (const Topology &g) |
| Inverse nodal weight coefficients. | |
\( f_i = f(\vec x_i) \)
| auto dg::evaluate | ( | Functor && | f, |
| const Topology & | g ) |
Evaluate a function on grid coordinates
Evaluate is equivalent to the following:
x_i = g.abscissas( i) representing the given computational space discretization in each dimension v = dg::kronecker( f, x_0, x_1, ...) The dimension number i is thus mapped to the argument number of the function f. The 0 dimension is the contiguous dimension in the return vector v e.g. in 2D the first element of the resulting vector lies in the grid corner \( (x_0,y_0)\), the second is \((x_1, y_0)\) and so on.For example for a 2d grid the implementation is equivalent to
See here an application example
| Topology | A fixed sized grid type with member functions static constexpr size_t Topology::ndim() giving the number of dimensions and vector_type Topology::abscissas( unsigned dim) giving the abscissas in dimension dim |
| Functor | Callable as return_type f(real_type, ...). Functor needs to be callable with Topology::ndim arguments. |
| 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. Its value type is determined by the return type of Functor dg::cooX1d ) to generate the list of grid coordinates dg::pullback if you want to evaluate a function in physical space dg::kronecker | thrust::host_vector< real_type > dg::integrate | ( | const thrust::host_vector< real_type > & | in, |
| const RealGrid< real_type, 1 > & | 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 RealGrid< real_type, 1 > & | g, | ||
| dg::direction | dir = dg::forward ) |
Untility shortcut.
for
| auto dg::create::inv_weights | ( | const Topology & | g | ) |
Inverse nodal weight coefficients.
Short for
| auto dg::create::weights | ( | const Topology & | g | ) |
Nodal weight coefficients.
Equivalent to the following:
w_i = g.weights( i) w = dg::kronecker( dg::Product(), w_0, w_1, ...) The 0 dimension is the contiguous dimension in the return vector w For example
| Topology | A fixed sized grid type with member functions static constexpr size_t Topology::ndim() giving the number of dimensions and vector_type Topology::weights( unsigned dim) giving the integration weights in dimension dim |
| g | The grid |
w as a host vector. Its value type is the same as the grid value type | auto dg::create::weights | ( | const Topology & | g, |
| std::array< bool, Topology::ndim()> | remains ) |
Nodal weight coefficients on a subset of dimensions.
Equivalent to the following:
w_i = remains[i] ? g.weights( i) : 1 w = dg::kronecker( dg::Product(), w_0, w_1, ...) The 0 dimension is the contiguous dimension in the return vector w | Topology | A fixed sized grid type with member functions static constexpr size_t Topology::ndim() giving the number of dimensions and vector_type Topology::weights( unsigned dim) giving the integration weights in dimension dim |
| g | The grid |
| remains | For each dimension determine whether to use weights or a vector of 1s |
dg::create::weights( sub_grid) The difference is the size of the resulting vector or the result of this function is to prolongate the sub-grid weights to the full grid again