]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove checks for various isnan functions. 4776/head
authorDavid Wells <wellsd2@rpi.edu>
Thu, 10 Aug 2017 22:13:14 +0000 (18:13 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Thu, 10 Aug 2017 22:21:32 +0000 (18:21 -0400)
This PR removes

DEAL_II_HAVE_ISNAN
DEAL_II_HAVE_STD_ISNAN
DEAL_II_HAVE_UNDERSCORE_ISNAN

in favor of using std::isnan, which is a C++11 function, instead.

cmake/checks/check_01_cxx_features.cmake
include/deal.II/base/config.h.in
include/deal.II/base/numbers.h
include/deal.II/lac/solver_control.h
source/lac/solver_control.cc

index d5e3b15e3c3f90331720a2b1c01a11c1b59eec6f..d1dc5b79148456ac7dadf987bd0c0e08745c49d5 100644 (file)
@@ -22,8 +22,6 @@
 #   DEAL_II_WITH_CXX17
 #
 #   DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE
-#   DEAL_II_HAVE_ISNAN
-#   DEAL_II_HAVE_UNDERSCORE_ISNAN
 #   DEAL_II_HAVE_ISFINITE
 #   DEAL_II_HAVE_FP_EXCEPTIONS
 #   DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
@@ -497,30 +495,6 @@ CHECK_CXX_SOURCE_COMPILES(
   "
   DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE)
 
-CHECK_CXX_SOURCE_COMPILES(
-  "
-  #include <cmath>
-  int main(){ double d=0; std::isnan (d); return 0; }
-  "
-  DEAL_II_HAVE_STD_ISNAN)
-
-
-CHECK_CXX_SOURCE_COMPILES(
-  "
-  #include <cmath>
-  int main(){ double d=0; isnan (d); return 0; }
-  "
-  DEAL_II_HAVE_ISNAN)
-
-
-CHECK_CXX_SOURCE_COMPILES(
-  "
-  #include <cmath>
-  int main(){ double d=0; _isnan (d); return 0; }
-  "
-  DEAL_II_HAVE_UNDERSCORE_ISNAN)
-
-
 CHECK_CXX_SOURCE_COMPILES(
   "
   #include <cmath>
index 609e390f8f979088ff2368a935591d22a0a2a64d..10b97ec829bba5acba56f4840ed96204593af5c5 100644 (file)
  */
 
 #cmakedefine DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE
-#cmakedefine DEAL_II_HAVE_ISNAN
-#cmakedefine DEAL_II_HAVE_STD_ISNAN
-#cmakedefine DEAL_II_HAVE_UNDERSCORE_ISNAN
 #cmakedefine DEAL_II_HAVE_ISFINITE
 #cmakedefine DEAL_II_HAVE_FP_EXCEPTIONS
 #cmakedefine DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
index 6e3782926b14ecd0a51143f360a07c4cc76af9e6..ded2ddbdeb987eff9cd62e6905a52ef253ce0952 100644 (file)
@@ -141,8 +141,11 @@ namespace numbers
    *
    * If none of the functions detecting NaN is available, this function
    * returns false.
+   *
+   * @deprecated This function has been deprecated in favor of the C++11
+   * function <code>std::isnan</code>.
    */
-  bool is_nan (const double x);
+  bool is_nan (const double x) DEAL_II_DEPRECATED;
 
   /**
    * Return @p true if the given value is a finite floating point number, i.e.
@@ -283,21 +286,13 @@ namespace numbers
 
   inline bool is_nan (const double x)
   {
-#ifdef DEAL_II_HAVE_STD_ISNAN
     return std::isnan(x);
-#elif defined(DEAL_II_HAVE_ISNAN)
-    return isnan(x);
-#elif defined(DEAL_II_HAVE_UNDERSCORE_ISNAN)
-    return _isnan(x);
-#else
-    return false;
-#endif
   }
 
   inline bool is_finite (const double x)
   {
 #ifdef DEAL_II_HAVE_ISFINITE
-    return !is_nan(x) && std::isfinite (x);
+    return !std::isnan(x) && std::isfinite (x);
 #else
     // Check against infinities. Note
     // that if x is a NaN, then both
index 71434fed6d1739c2c07a61df0b9c6813e4f22678..2156664839e6a076eae38b471f0acebb42de9e74 100644 (file)
@@ -176,11 +176,7 @@ public:
    * procedure.
    *
    * The iteration is also aborted if the residual becomes a denormalized
-   * value (@p NaN). Note, however, that this check is only performed if the
-   * @p isnan function is provided by the operating system, which is not
-   * always true. CMake checks this with the 'check_01_cxx_features.cmake'
-   * test and sets the flag @p DEAL_II_HAVE_ISNAN in the include file
-   * <tt>deal.II/base/config.h</tt> if this function was found.
+   * value (@p NaN).
    *
    * <tt>check()</tt> additionally preserves @p step and @p check_value. These
    * values are accessible by <tt>last_value()</tt> and <tt>last_step()</tt>.
index ceb720cf707bd48b6dd989cc1d89e44b3dd16764..d20d5fe552c3bc45ec8681779435596039c73494 100644 (file)
@@ -93,7 +93,7 @@ SolverControl::check (const unsigned int step,
     }
 
   if ((step >= maxsteps) ||
-      numbers::is_nan(check_value) ||
+      std::isnan(check_value) ||
       (check_failure && (check_value > failure_residual))
      )
     {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.