diff options
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 |