diff options
Diffstat (limited to 'Auxiliary/Cactus/KrancNumericalTools/GenericFD/src')
-rw-r--r-- | Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/MathematicaCompat.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/MathematicaCompat.h b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/MathematicaCompat.h index 1823cd8..e48daa2 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,6 +16,16 @@ # define IfThen(x,y,z) ((x)*(y) + (1-(x))*(z)) #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)) @@ -73,9 +84,10 @@ #ifdef KRANC_C # define E M_E # define Pi M_PI + #else # define E 2.71828182845904523536029d0 # define Pi 3.14159265358979323846264d0 #endif -#define UnitStep(x) ((x)>0) +#define StepFunction(x) ((x)>0) |