]> https://gitweb.dealii.org/ - dealii.git/commitdiff
NaN is always a failure
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 5 Jul 2000 21:50:45 +0000 (21:50 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 5 Jul 2000 21:50:45 +0000 (21:50 +0000)
git-svn-id: https://svn.dealii.org/trunk@3138 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/solver_control.h
deal.II/lac/source/solver_control.cc

index afb9a12a4512dae9148c9b1755db2eda8cfbd451..df2c4b784b6d207e76f4a1c4e953b36ea48f16da 100644 (file)
@@ -123,6 +123,21 @@ class SolverControl : public Subscriptor
                                      * continuation of the iterative
                                      * 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. The @p{configure}
+                                     * scripts checks for this and
+                                     * sets the flag @p{HAVE_ISNAN}
+                                     * in the file
+                                     * @p{Make.global_options} if
+                                     * this function was found.
+                                     *
                                      * @p{check()} additionally
                                      * preserves @p{step} and
                                      * @p{check_value}. These
@@ -167,23 +182,6 @@ class SolverControl : public Subscriptor
                                      * @p{ReturnState} @p{failure} if
                                      * @p{residual>failure_residual} with
                                      * @p{failure_residual:=rel_failure_residual*first_residual}.
-                                     *
-                                     * If a failure criterion was set
-                                     * using this method, then 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
-                                     * the case. The @p{configure}
-                                     * scripts checks for this and
-                                     * sets the flag @p{HAVE_ISNAN}
-                                     * in the file
-                                     * @p{Make.global_options} is
-                                     * this function was found.
                                      */
     void set_failure_criterion (const double rel_failure_residual);
 
index 60bc3787d54203ffb19956b835f6b889ef6c9173..faeb234e67902d094fd1100b5c91d5049013d669 100644 (file)
@@ -66,11 +66,11 @@ SolverControl::check (const unsigned int step,
 
   
   if ((step >= maxsteps) ||
-      (check_failure && ((check_value > failure_residual)
 #ifdef HAVE_ISNAN
-                        || isnan(check_value)
+      isnan(check_value) ||
 #endif
-      )))
+      (check_failure && (check_value > failure_residual))
+  )
     {
       if (_log_result)
        deallog << "Failure step " << step

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.