5#include <thrust/host_vector.h> 
    6#include "dg/backend/config.h" 
   17template< 
class Functor, 
class Topology, 
size_t ...I>
 
   18auto do_evaluate( Functor&& f, 
const Topology& g, std::index_sequence<I...>)
 
   20    return dg::kronecker( std::forward<Functor>(f), g.abscissas(I)...);
 
   73template< 
class Functor, 
class Topology>
 
   84    return do_evaluate( std::forward<Functor>(f), g, std::make_index_sequence<Topology::ndim()>());
 
 
   93template<
class Topology, 
class value_type = 
typename Topology::value_type, 
class result_type = 
typename Topology::value_type, 
typename = std::enable_if_t<Topology::ndim() == 1 > >
 
   96    return do_evaluate( f, g, std::make_index_sequence<Topology::ndim()>());
 
   98template<
class Topology, 
class value_type0 = 
typename Topology::value_type, 
class value_type1 = 
typename Topology::value_type, 
class result_type = 
typename Topology::value_type, 
typename = std::enable_if_t<Topology::ndim() == 2 > >
 
   99auto evaluate( result_type (*f)( value_type0, value_type1), 
const Topology& g)
 
  101    return do_evaluate( f, g, std::make_index_sequence<Topology::ndim()>());
 
  103template<
class Topology, 
class value_type0 = 
typename Topology::value_type, 
class value_type1 = 
typename Topology::value_type, 
class value_type2 = 
typename Topology::value_type, 
class result_type = 
typename Topology::value_type, 
typename = std::enable_if_t<Topology::ndim() == 3 > >
 
  104auto evaluate( result_type (*f)( value_type0, value_type1, value_type2), 
const Topology& g)
 
  106    return do_evaluate( f, g, std::make_index_sequence<Topology::ndim()>());
 
  125template<
class real_type>
 
  130    thrust::host_vector<real_type> to_out(g.
size(), 0.);
 
  131    thrust::host_vector<real_type> to_in(in);
 
  134        for( 
unsigned i=0; i<in.size(); i++)
 
  135            to_in[i] = in[ in.size()-1-i];
 
  145    real_type constant = 0.;
 
  147    for( 
unsigned i=0; i<g.
Nx(); i++)
 
  149        for( 
unsigned k=0; k<
n; k++)
 
  151            for( 
unsigned l=0; l<
n; l++)
 
  152                to_out[ i*
n + k] += ninj(k,l)*to_in[ i*
n + l];
 
  153            to_out[ i*
n + k] += constant;
 
  155        for( 
unsigned l=0; l<
n; l++)
 
  156            constant += h*
forward(0,l)*to_in[i*
n+l];
 
  158    thrust::host_vector<real_type> out(to_out);
 
  161        for( 
unsigned i=0; i<in.size(); i++)
 
  162            out[i] = -to_out[ in.size()-1-i]; 
 
 
  177template< 
class UnaryOp,
class real_type>
 
  180    thrust::host_vector<real_type> vector = 
evaluate( f, g);
 
 
  184template<
class real_type>
 
  187    thrust::host_vector<real_type> vector = 
evaluate( f, g);
 
A square nxn matrix.
Definition operator.h:31
auto kronecker(Functor &&f, const ContainerType &x0, const ContainerTypes &... xs)
Memory allocating version of dg::blas1::kronecker
Definition blas1.h:857
direction
Direction of a discrete derivative.
Definition enums.h:97
@ backward
backward derivative (cell to the left and current cell)
Definition enums.h:99
@ forward
forward derivative (cell to the right and current cell)
Definition enums.h:98
thrust::host_vector< real_type > 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.
Definition evaluation.h:126
auto evaluate(Functor &&f, const Topology &g)
Evaluate a function on grid coordinates
Definition evaluation.h:74
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
static std::vector< real_type > backward(unsigned n)
Return backward DLT trafo matrix.
Definition dlt.h:139
static std::vector< real_type > forward(unsigned n)
Return forward DLT trafo matrix.
Definition dlt.h:195
The simplest implementation of aRealTopology.
Definition grid.h:710
real_type hx() const
Equivalent to h(0)
Definition grid.h:314
unsigned size() const
The total number of points.
Definition grid.h:532
unsigned Nx() const
Equivalent to N(0)
Definition grid.h:334
unsigned nx() const
Equivalent to n(0)
Definition grid.h:324