diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2010-09-30 20:55:17 +0200 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2010-09-30 20:55:17 +0200 |
commit | 360447ee27288198b70c30bf2f2f10ace3dc29b9 (patch) | |
tree | 33dac3267461e06329ea6d20bf470061a00c5389 /Auxiliary/Cactus/KrancNumericalTools/GenericFD/src | |
parent | 92ce7d11645bead38983194dc7c26831e0172966 (diff) |
MathematicaCompat.h: Add Min3 and VanLeer macros
Diffstat (limited to 'Auxiliary/Cactus/KrancNumericalTools/GenericFD/src')
-rw-r--r-- | Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/MathematicaCompat.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/MathematicaCompat.h b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/MathematicaCompat.h index bd9f1e5..bf5936d 100644 --- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/MathematicaCompat.h +++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/MathematicaCompat.h @@ -6,6 +6,7 @@ #ifdef KRANC_C #define Abs(x) (fabs(x)) #define Min(x, y) (fmin((x), (y))) +#define Min3(x, y, z) (fmin(fmin((x), (y)), (z))) #define Max(x, y) (fmax((x), (y))) #define IfThen(x,y,z) ((x) ? (y) : (z)) #else @@ -15,8 +16,16 @@ /* IfThen cannot be expressed in Fortran */ #endif +#ifdef KRANC_C +#define Sign(x) (signbit(x)?-1:+1) +#else +#define Sign(x) (sgn(x)) +#endif + #define MinMod(x, y) ((x) * (y) < 0 ? 0 : (fabs((x)) < fabs((y)) ? (x) : (y))) +#define VanLeer(x, y) ((x) * (y) < 0 ? 0 : (Min3(2*fabs(x),2*fabs(y),0.5*(fabs(x)+fabs(y)))*Sign((x)+(y)))) + #define Exp(x) (exp(x)) #define Log(x) (log(x)) @@ -33,12 +42,6 @@ #define Tanh(x) (tanh(x)) #ifdef KRANC_C -#define Sign(x) (signbit(x)?-1:+1) -#else -#define Sign(x) (sgn(x)) -#endif - -#ifdef KRANC_C #define E M_E #define Pi M_PI #else |