3#include "dg/backend/config.h"
23 template<
class T1,
class T2>
32 template<
class T1,
class T2>
41 template<
class T1,
class T2>
50 template<
class T1,
class T2>
59 template<
class T1,
class T2>
73 template<
class T1,
class T2>
84 template<
class T1,
class ...Ts>
88 sum( tmp,
x, rest...);
92 template<
class T,
class ...Ts>
93DG_DEVICE void sum( T& tmp, T x, Ts... rest)
const
110 template<
class T,
class ...Ts>
114 sum( tmp, a,
x, rest...);
118 template<
class T,
class ...Ts>
119DG_DEVICE void sum( T& tmp, T alpha, T x, Ts... rest)
const
121 tmp = DG_FMA( alpha, x, tmp);
126DG_DEVICE void sum( T& tmp, T alpha, T x)
const
128 tmp = DG_FMA(alpha, x, tmp);
135 template<
class T1,
class ...Ts>
139 sum( tmp, a, x1, y1, rest...);
143 template<
class T,
class ...Ts>
144DG_DEVICE void sum( T& tmp, T alpha, T x, T y, Ts... rest)
const
146 tmp = DG_FMA( alpha*x, y, tmp);
151DG_DEVICE void sum( T& tmp, T alpha, T x, T y)
const
153 tmp = DG_FMA(alpha*x, y, tmp);
166 template<
class T1,
class ...Ts>
171 sum(
y, yt, rest...);
174 template<
class T1,
class ...Ts>
175DG_DEVICE void sum( T1& y_1, T1& yt_1, T1 b, T1 bt, T1 k, Ts... rest)
const
177 y_1 = DG_FMA( b, k, y_1);
178 yt_1 = DG_FMA( bt, k, yt_1);
179 sum( y_1, yt_1, rest...);
183DG_DEVICE void sum( T1& y_1, T1& yt_1, T1 b, T1 bt, T1 k)
const
185 y_1 = DG_FMA( b, k, y_1);
186 yt_1 = DG_FMA( bt, k, yt_1);
191template<
class BinarySub,
class Functor>
204#pragma hd_warning_disable
206 template<
class T,
class... Ts>
250 y = DG_FMA( m_a,
x, temp);
264 y = DG_FMA( m_a*
x,
y, temp);
278 temp = DG_FMA( m_a,
x, temp);
279 temp = DG_FMA( m_b,
y, temp);
294 z = DG_FMA( m_a*
x,
y, temp);
300 y = DG_FMA( m_a*x1, x2*x3, temp);
306 temp = DG_FMA( m_a*x1, y1, temp);
307 temp = DG_FMA( m_b*x2, y2, temp);
323 z = DG_FMA( m_a,
z/
y, temp);
328 z = DG_FMA( m_a,
x/
y, temp);
338template<
class F,
class G>
341 Compose( F f, G g):m_f(f), m_g(g){}
342 template<
class ...Xs>
343 auto operator() ( Xs&& ... xs){
344 return m_f(m_g(std::forward<Xs>(xs)...));
346 template<
class ...Xs>
347 auto operator() ( Xs&& ... xs)
const {
348 return m_f(m_g(std::forward<Xs>(xs)...));
379template <
class UnaryOp,
class Functor>
381 return detail::Compose<UnaryOp,Functor>( f, g);
391template <
class UnaryOp,
typename... Functors>
Some utility functions for the dg::evaluate routines.
#define DG_DEVICE
Expands to __host__ __device__ if compiled with nvcc else is empty.
Definition: functions.h:9
auto compose(UnaryOp f, Functor g)
Create Composition functor .
Definition: subroutines.h:380
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Definition: subroutines.h:245
DG_DEVICE void operator()(T x, T &y) const
Definition: subroutines.h:248
Axpby(T a, T b)
Definition: subroutines.h:246
Definition: subroutines.h:273
Axpbypgz(T a, T b, T g)
Definition: subroutines.h:274
DG_DEVICE void operator()(T x, T y, T &z) const
Definition: subroutines.h:276
Definition: subroutines.h:259
DG_DEVICE void operator()(T x, T &y) const
Definition: subroutines.h:262
AxyPby(T a, T b)
Definition: subroutines.h:260
Definition: subroutines.h:164
DG_DEVICE void operator()(T1 &y, T1 &yt, T1 b, T1 bt, Ts... rest) const
Definition: subroutines.h:167
Definition: subroutines.h:193
DG_DEVICE void operator()(T &y, Ts... xs)
Definition: subroutines.h:207
Evaluate(BinarySub sub, Functor g)
Definition: subroutines.h:194
Definition: subroutines.h:11
DG_DEVICE T operator()(T x) const
Definition: subroutines.h:13
Definition: subroutines.h:108
DG_DEVICE T operator()(T a, T x, Ts... rest) const
Definition: subroutines.h:111
Definition: subroutines.h:231
DG_DEVICE void operator()(T &y) const
Definition: subroutines.h:234
Plus(T a)
Definition: subroutines.h:232
Definition: subroutines.h:317
DG_DEVICE void operator()(T x, T y, T &z) const
Definition: subroutines.h:326
DG_DEVICE void operator()(T y, T &z) const
Definition: subroutines.h:321
PointwiseDivide(T a, T b)
Definition: subroutines.h:318
Definition: subroutines.h:289
DG_DEVICE void operator()(T x1, T x2, T x3, T &y) const
Definition: subroutines.h:298
DG_DEVICE void operator()(T x, T y, T &z) const
Definition: subroutines.h:292
PointwiseDot(T a, T b, T g=(T) 0)
Definition: subroutines.h:290
DG_DEVICE void operator()(T x1, T y1, T x2, T y2, T &z) const
Definition: subroutines.h:304
Definition: subroutines.h:218
DG_DEVICE void operator()(T &y) const
Definition: subroutines.h:221
Scal(T a)
Definition: subroutines.h:219
Definition: subroutines.h:82
DG_DEVICE T1 operator()(T1 x, Ts... rest) const
Definition: subroutines.h:85
Definition: subroutines.h:133
DG_DEVICE T1 operator()(T1 a, T1 x1, T1 y1, Ts... rest) const
Definition: subroutines.h:136
Definition: subroutines.h:58
DG_DEVICE void operator()(T1 x, T2 &y) const
Definition: subroutines.h:60
Definition: subroutines.h:72
DG_DEVICE T1 operator()(T1 x1, T2 x2) const
Definition: subroutines.h:74
Definition: subroutines.h:22
DG_DEVICE void operator()(T1 x, T2 &y) const
Definition: subroutines.h:24
Definition: subroutines.h:40
DG_DEVICE void operator()(T1 x, T2 &y) const
Definition: subroutines.h:42
Definition: subroutines.h:31
DG_DEVICE void operator()(T1 x, T2 &y) const
Definition: subroutines.h:33
Definition: subroutines.h:49
DG_DEVICE void operator()(T1 x, T2 &y) const
Definition: subroutines.h:51