aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@b716e942-a2de-43ad-8f52-f3dfe468e4e7>2005-10-19 15:16:34 +0000
committerschnetter <schnetter@b716e942-a2de-43ad-8f52-f3dfe468e4e7>2005-10-19 15:16:34 +0000
commitb5796e9102b6a39b53a9cf0e4bde9b855974a0d3 (patch)
tree8462831aba56e2bb05904b4f17defc96045e9a89
parent5d7f29b265659df0b093a44f629b6c3d1c8b3b81 (diff)
Add Fortran functions that test for nan.
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinUtils/TGRtensor/trunk@34 b716e942-a2de-43ad-8f52-f3dfe468e4e7
-rw-r--r--src/classify.F9029
-rw-r--r--src/classify.c32
-rw-r--r--src/make.code.defn3
3 files changed, 63 insertions, 1 deletions
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 <math.h>
+
+#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 \