]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Flag log_result added
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 3 May 1999 15:52:51 +0000 (15:52 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 3 May 1999 15:52:51 +0000 (15:52 +0000)
git-svn-id: https://svn.dealii.org/trunk@1251 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 414c278e7efec473cb592ad55919e1b3d0bddda0..75471e2dbbd29a42665289ec493224f60c8fc3c9 100644 (file)
@@ -46,7 +46,8 @@ class SolverControl : public Subscriptor
                                      * maximal number of iterations.
                                      * </OL>
                                      */
-    enum State {
+    enum State
+    {
          iterate = 0, success, failure
     };
     
@@ -63,10 +64,14 @@ class SolverControl : public Subscriptor
                                      * be checked and the number of
                                      * the iteration step) shall be
                                      * printed to #deallog# stream.
-                                     * Default is: do not print.
+                                     * Default is: do not print. Similarly,
+                                     *  #log_result#
+                                     * specifies the whether the final result is logged
+                                     * to #deallog#. Default is yes.
                                      */
     SolverControl (const unsigned int n, const double tol,
-                  const bool log_history = false);
+                  const bool log_history = false,
+                  const bool log_result = true);
     
                                     /**
                                      * Virtual destructor is needed
@@ -142,6 +147,13 @@ class SolverControl : public Subscriptor
                                      * Log convergence history to #deallog#?
                                      */
     const bool         log_history;
+                                    /**
+                                     * Log iteration result to #deallog#?
+                                     * If true, after finishing the iteration, a
+                                     * statement about failure or success together with
+                                     * #lstep# and #lvalue# are logged.
+                                     */
+    const bool         log_result;
 };
 
 
index 51ed3ab0b87f8bd8fba4bddd1d2280d7e239a109..302823a644e6956679df35bd2d87e72faca60ab7 100644 (file)
@@ -9,12 +9,14 @@
 
 SolverControl::SolverControl (const unsigned int maxiter,
                              const double tolerance,
-                             const bool log_history) :
+                             const bool log_history,
+                             const bool log_result) :
                maxsteps(maxiter),
                tol(tolerance),
                lvalue(1.e300),
                lstep(0),
-               log_history(log_history)
+               log_history(log_history),
+               log_result(log_result)
 {};
 
 
@@ -33,14 +35,16 @@ SolverControl::check (const unsigned int step,
   lvalue = check_value;
   if (step>=maxsteps)
     {
-      deallog << "Failure step " << step
-             << " value " << check_value << endl;
+      if (log_result)
+       deallog << "Failure step " << step
+               << " value " << check_value << endl;
       return failure;
     }
   if (check_value <= tol)
     {
-      deallog << "Convergence step " << step
-             << " value " << check_value << endl;      
+      if (log_result)
+       deallog << "Convergence step " << step
+               << " value " << check_value << endl;      
       return success;
     }
   return iterate;

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.