From b5796e9102b6a39b53a9cf0e4bde9b855974a0d3 Mon Sep 17 00:00:00 2001 From: schnetter Date: Wed, 19 Oct 2005 15:16:34 +0000 Subject: Add Fortran functions that test for nan. git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinUtils/TGRtensor/trunk@34 b716e942-a2de-43ad-8f52-f3dfe468e4e7 --- src/classify.F90 | 29 +++++++++++++++++++++++++++++ src/classify.c | 32 ++++++++++++++++++++++++++++++++ src/make.code.defn | 3 ++- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/classify.F90 create mode 100644 src/classify.c diff --git a/src/classify.F90 b/src/classify.F90 new file mode 100644 index 0000000..43a08a4 --- /dev/null +++ b/src/classify.F90 @@ -0,0 +1,29 @@ +! $Header$ + +#include "cctk.h" + +module classify + implicit none + + interface + elemental integer function TAT_isnan (x) + implicit none + CCTK_REAL, intent(in) :: x + end function TAT_isnan + end interface + + interface + elemental integer function TAT_isinf (x) + implicit none + CCTK_REAL, intent(in) :: x + end function TAT_isinf + end interface + + interface + elemental integer function TAT_finite (x) + implicit none + CCTK_REAL, intent(in) :: x + end function TAT_finite + end interface + +end module classify diff --git a/src/classify.c b/src/classify.c new file mode 100644 index 0000000..a2feeb6 --- /dev/null +++ b/src/classify.c @@ -0,0 +1,32 @@ +/* $Header$ */ + +#include + +#include "cctk.h" + +int CCTK_FCALL CCTK_FNAME(TAT_isnan) (const CCTK_REAL * restrict const x) +{ +#ifdef HAVE_ISNAN + return isnan(*x); +#else + return 0; +#endif +} + +int CCTK_FCALL CCTK_FNAME(TAT_isinf) (const CCTK_REAL * restrict const x) +{ +#ifdef HAVE_ISINF + return isinf(*x); +#else + return 0; +#endif +} + +int CCTK_FCALL CCTK_FNAME(TAT_finite) (const CCTK_REAL * restrict const x) +{ +#ifdef HAVE_FINITE + return finite(*x); +#else + return 1; +#endif +} diff --git a/src/make.code.defn b/src/make.code.defn index 462985e..8fabfd0 100644 --- a/src/make.code.defn +++ b/src/make.code.defn @@ -4,6 +4,8 @@ # Source files in this directory SRCS = adm_metric.F90 \ cactus.F90 \ + classify.c \ + classify.F90 \ constants.F90 \ conversion.F90 \ covderivs.F90 \ @@ -11,7 +13,6 @@ SRCS = adm_metric.F90 \ derivs.F90 \ derivs2.F90 \ gram_schmidt.F90 \ - isnan.c \ lapack.F90 \ matdet.F90 \ matexp.F90 \ -- cgit v1.2.3