Discontinuous Galerkin Library
#include "dg/algorithm.h"
Loading...
Searching...
No Matches
functions.h
Go to the documentation of this file.
1
2#pragma once
7#include "../backend/config.h" // DG_DEVICE
8
9
10namespace dg{
13
15
17template<class T, class ...Ts>
19T zero(T x, Ts ...xs){return T(0);}
20
22template<class T, class ...Ts>
24T one(T x, Ts ...xs){return T(1);}
25
27struct ZERO
28{
29 template<class T, class ...Ts>
31 T operator()(T x, Ts ...xs)const{return T(0);}
32};
33
35struct ONE
36{
37 template<class T, class ...Ts>
39 T operator()(T x, Ts ...xs)const{return T(1);}
40};
41
44{
50 CONSTANT( double cte): m_value(cte){}
51
52 template<class T, class ...Ts>
54 T operator()(T x, Ts ...xs)const{return T(m_value);}
55 private:
56 double m_value;
57};
58
60DG_DEVICE inline double cooX1d( double x) {return x;}
62DG_DEVICE inline double cooX2d( double x, double y) {return x;}
64DG_DEVICE inline double cooX3d( double x, double y, double z) {return x;}
65
67DG_DEVICE inline double cooY2d( double x, double y) {return y;}
69DG_DEVICE inline double cooY3d( double x, double y, double z) {return y;}
71DG_DEVICE inline double cooZ3d( double x, double y, double z) {return z;}
72
73
75DG_DEVICE inline double cooRZP2X( double R, double Z, double P){ return R*sin(P);}
77DG_DEVICE inline double cooRZP2Y( double R, double Z, double P){ return R*cos(P);}
79DG_DEVICE inline double cooRZP2Z( double R, double Z, double P){ return Z;}
80
81
83} //namespace dg
DG_DEVICE double cooY3d(double x, double y, double z)
Definition functions.h:69
DG_DEVICE double cooX3d(double x, double y, double z)
Definition functions.h:64
DG_DEVICE double cooZ3d(double x, double y, double z)
Definition functions.h:71
DG_DEVICE double cooRZP2Z(double R, double Z, double P)
Definition functions.h:79
DG_DEVICE T one(T x, Ts ...xs)
Definition functions.h:24
DG_DEVICE double cooX1d(double x)
Definition functions.h:60
DG_DEVICE double cooRZP2X(double R, double Z, double P)
Definition functions.h:75
DG_DEVICE T zero(T x, Ts ...xs)
This enum can be used in dg::evaluate.
Definition functions.h:19
DG_DEVICE double cooY2d(double x, double y)
Definition functions.h:67
DG_DEVICE double cooX2d(double x, double y)
Definition functions.h:62
DG_DEVICE double cooRZP2Y(double R, double Z, double P)
Definition functions.h:77
@ z
z direction
@ y
y direction
@ x
x direction
#define DG_DEVICE
Expands to __host__ __device__ if compiled with nvcc else is empty.
Definition dg_doc.h:378
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Definition functions.h:44
DG_DEVICE T operator()(T x, Ts ...xs) const
Definition functions.h:54
CONSTANT(double cte)
Construct with a value.
Definition functions.h:50
Definition functions.h:36
DG_DEVICE T operator()(T x, Ts ...xs) const
Definition functions.h:39
Definition functions.h:28
DG_DEVICE T operator()(T x, Ts ...xs) const
Definition functions.h:31