Discontinuous Galerkin Library
#include "dg/algorithm.h"
functions.h
Go to the documentation of this file.
1
2#pragma once
9#define DG_DEVICE
10#ifdef __CUDACC__
11#undef DG_DEVICE
12#define DG_DEVICE __host__ __device__
13#endif
14
15namespace dg{
18
20DG_DEVICE static inline double one( double x) {return 1;}
21
23DG_DEVICE static inline double one( double x, double y) {return 1;}
24
26DG_DEVICE static inline double one( double x, double y, double z) {return 1;}
27
29DG_DEVICE static inline double zero( double x) {return 0.;}
30
32DG_DEVICE static inline double zero( double x, double y) {return 0.;}
33
35DG_DEVICE static inline double zero( double x, double y, double z) {return 0.;}
36
38DG_DEVICE static inline double cooX1d( double x) {return x;}
40DG_DEVICE static inline double cooX2d( double x, double y) {return x;}
42DG_DEVICE static inline double cooX3d( double x, double y, double z) {return x;}
43
45DG_DEVICE static inline double cooY2d( double x, double y) {return y;}
47DG_DEVICE static inline double cooY3d( double x, double y, double z) {return y;}
49DG_DEVICE static inline double cooZ3d( double x, double y, double z) {return z;}
50
51
53DG_DEVICE static inline double cooRZP2X( double R, double Z, double P){ return R*sin(P);}
55DG_DEVICE static inline double cooRZP2Y( double R, double Z, double P){ return R*cos(P);}
57DG_DEVICE static inline double cooRZP2Z( double R, double Z, double P){ return Z;}
58
60DG_DEVICE static inline float one( float x) {return 1;}
61
63DG_DEVICE static inline float one( float x, float y) {return 1;}
64
66DG_DEVICE static inline float one( float x, float y, float z) {return 1;}
67
69DG_DEVICE static inline float zero( float x) {return 0.;}
70
72DG_DEVICE static inline float zero( float x, float y) {return 0.;}
73
75DG_DEVICE static inline float zero( float x, float y, float z) {return 0.;}
76
78} //namespace dg
#define DG_DEVICE
Expands to __host__ __device__ if compiled with nvcc else is empty.
Definition: functions.h:9
static DG_DEVICE double cooX1d(double x)
Definition: functions.h:38
static DG_DEVICE double cooRZP2X(double R, double Z, double P)
Definition: functions.h:53
static DG_DEVICE double cooY2d(double x, double y)
Definition: functions.h:45
static DG_DEVICE double cooRZP2Y(double R, double Z, double P)
Definition: functions.h:55
static DG_DEVICE double cooZ3d(double x, double y, double z)
Definition: functions.h:49
static DG_DEVICE double cooY3d(double x, double y, double z)
Definition: functions.h:47
static DG_DEVICE double cooRZP2Z(double R, double Z, double P)
Definition: functions.h:57
static DG_DEVICE double one(double x)
Definition: functions.h:20
static DG_DEVICE double zero(double x)
Definition: functions.h:29
static DG_DEVICE double cooX2d(double x, double y)
Definition: functions.h:40
static DG_DEVICE double cooX3d(double x, double y, double z)
Definition: functions.h:42
@ z
z direction
@ y
y direction
@ x
x direction
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...