aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/defs.hh
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-02-13 18:40:08 -0600
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 16:45:28 +0000
commit06238e6cf8c1fd51ee4baab9604aa75d58d7437d (patch)
tree1d95b78e3d42c9510ca05d58a60ec6ffa3374da1 /Carpet/CarpetLib/src/defs.hh
parentc31d9ab162dd8225554675152b9512d38bea5129 (diff)
CarpetLib: Handle the system's isnan function better
Diffstat (limited to 'Carpet/CarpetLib/src/defs.hh')
-rw-r--r--Carpet/CarpetLib/src/defs.hh36
1 files changed, 28 insertions, 8 deletions
diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh
index 9c42e2bdc..577f35e6d 100644
--- a/Carpet/CarpetLib/src/defs.hh
+++ b/Carpet/CarpetLib/src/defs.hh
@@ -209,6 +209,28 @@ inline const char * typestring (const CCTK_COMPLEX32&)
+// Capture the system's isnan function
+
+#ifdef HAVE_CCTK_REAL4
+inline int myisnan (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST;
+int myisnan (CCTK_REAL4 const & x)
+{ return isnan (x); }
+#endif
+#ifdef HAVE_CCTK_REAL8
+inline int myisnan (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST;
+inline int myisnan (CCTK_REAL8 const & x)
+{ return isnan (x); }
+#endif
+#ifdef HAVE_CCTK_REAL16
+inline int myisnan (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST;
+inline int myisnan (CCTK_REAL16 const & x)
+{ return isnan (x); }
+#endif
+
+#undef isnan
+
+
+
namespace CarpetLib {
namespace good {
@@ -272,8 +294,6 @@ namespace CarpetLib {
// isnan
//
-#undef isnan
-
// Default implementation, only good for integers
template <typename T>
inline int isnan (T const & x) CCTK_ATTRIBUTE_CONST;
@@ -284,33 +304,33 @@ namespace CarpetLib {
#ifdef HAVE_CCTK_REAL4
template<> inline int isnan (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST;
template<> inline int isnan (CCTK_REAL4 const & x)
- { return ::isnan (x); }
+ { return myisnan (x); }
#endif
#ifdef HAVE_CCTK_REAL8
template<> inline int isnan (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST;
template<> inline int isnan (CCTK_REAL8 const & x)
- { return ::isnan (x); }
+ { return myisnan (x); }
#endif
#ifdef HAVE_CCTK_REAL16
template<> inline int isnan (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST;
template<> inline int isnan (CCTK_REAL16 const & x)
- { return ::isnan (x); }
+ { return myisnan (x); }
#endif
#ifdef HAVE_CCTK_COMPLEX8
template<> inline int isnan (CCTK_COMPLEX8 const & x) CCTK_ATTRIBUTE_CONST;
template<> inline int isnan (CCTK_COMPLEX8 const & x)
- { return ::isnan (CCTK_Cmplx8Real (x)) or ::isnan (CCTK_Cmplx8Imag (x)); }
+ { return myisnan (CCTK_Cmplx8Real (x)) or myisnan (CCTK_Cmplx8Imag (x)); }
#endif
#ifdef HAVE_CCTK_COMPLEX16
template<> inline int isnan (CCTK_COMPLEX16 const & x) CCTK_ATTRIBUTE_CONST;
template<> inline int isnan (CCTK_COMPLEX16 const & x)
- { return ::isnan (CCTK_Cmplx16Real (x)) or ::isnan (CCTK_Cmplx16Imag (x)); }
+ { return myisnan (CCTK_Cmplx16Real (x)) or myisnan (CCTK_Cmplx16Imag (x)); }
#endif
#ifdef HAVE_CCTK_COMPLEX32
template<> inline int isnan (CCTK_COMPLEX32 const & x) CCTK_ATTRIBUTE_CONST;
template<> inline int isnan (CCTK_COMPLEX32 const & x)
- { return ::isnan (CCTK_Cmplx32Real (x)) or std::isnan (CCTK_Cmplx32Imag (x)); }
+ { return myisnan (CCTK_Cmplx32Real (x)) or myisnan (CCTK_Cmplx32Imag (x)); }
#endif
} // namespace good