Ignore:
Timestamp:
10/15/10 16:13:34 (14 years ago)
Author:
Mathieu Morlighem
Message:

Added some verbosity levels and generalized

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/shared/Numerics/OptimalSearch.cpp

    r5607 r6323  
    4141        fx1= (*f)(x1,optargs);
    4242        if isnan(fx1) ISSMERROR("Function evaluation returned NaN");
    43         _printf_("\n        Iteration         x           f(x)       Tolerance\n\n");
    44         _printf_("        %s    %12.6g  %12.6g  %s","   N/A",x1,fx1,"         N/A\n");
     43        ISSMPRINTF(VerboseControl(),"\n        Iteration         x           f(x)       Tolerance\n\n");
     44        ISSMPRINTF(VerboseControl(),"        %s    %12.6g  %12.6g  %s","   N/A",x1,fx1,"         N/A\n");
    4545
    4646        //update tolerances
     
    5454                fx2 = (*f)(x2,optargs);
    5555                if isnan(fx2) ISSMERROR("Function evaluation returned NaN");
    56                 _printf_("         %5i    %12.6g  %12.6g  %12.6g\n",iter,x2,fx2,fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1));
     56                ISSMPRINTF(VerboseControl(),"         %5i    %12.6g  %12.6g  %12.6g\n",iter,x2,fx2,fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1));
    5757
    5858                //Stop the optimization?
    5959                if ((fabs(x2-x1)+seps)<tolerance || (fabs(fx2-fx1)+seps)<tolerance){
    60                         _printf_("      %s%g\n","optimization terminated: the current x satisfies the termination criteria using 'tolx' of " ,tolerance);
     60                        ISSMPRINTF(VerboseControl(),"      %s%g\n","optimization terminated: the current x satisfies the termination criteria using 'tolx' of " ,tolerance);
    6161                        loop=false;
    6262                }
    6363                else if (iter>=maxiter){
    64                         _printf_("      %s\n","exiting: Maximum number of iterations has been exceeded  - increase 'maxiter'\n");
     64                        ISSMPRINTF(VerboseControl(),"      %s\n","exiting: Maximum number of iterations has been exceeded  - increase 'maxiter'\n");
    6565                        loop=false;
    6666                }
Note: See TracChangeset for help on using the changeset viewer.