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/solutions/control_core.cpp

    r6226 r6323  
    1717       
    1818        /*parameters: */
    19         int     verbose=0;
    2019        int     num_controls;
    2120        int     nsteps;
     
    6766
    6867        /*Launch once a complete solution to set up all inputs*/
    69         _printf_("%s\n","      preparing initial solution");
     68        ISSMPRINTF(VerboseControl(),"%s\n","   preparing initial solution");
    7069        if (isstokes) solutioncore(femmodel);
    7170
     
    8180
    8281                /*Display info*/
    83                 _printf_("\n%s%i%s%i\n","   control method step ",n+1,"/",nsteps);
     82                ISSMPRINTF(VerboseControl(),"\n%s%i%s%i\n","   control method step ",n+1,"/",nsteps);
    8483                InputUpdateFromConstantx(femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,(int)responses[n],CmResponseEnum);
    8584               
     
    8786                if (solution_type==SteadystateSolutionEnum) solutioncore(femmodel);
    8887
    89                 _printf_("%s\n","      compute adjoint state:");
     88                ISSMPRINTF(VerboseControl(),"%s\n","   compute adjoint state:");
    9089                adjointcore(femmodel);
    9190       
    92                 _printf_("%s\n","      computing gradJ...");
    9391                gradient_core(femmodel,n,search_scalar);
    9492
     
    9997                }
    10098
    101                 _printf_("%s\n","      optimizing along gradient direction");
     99                ISSMPRINTF(VerboseControl(),"%s\n","   optimizing along gradient direction");
    102100                optargs.n=n; optpars.maxiter=(int)maxiter[n]; optpars.cm_jump=cm_jump[n];
    103101                BrentSearch(&search_scalar,J+n,&optpars,&objectivefunctionC,&optargs);
    104102                //OptimalSearch(&search_scalar,J+n,&optpars,&objectivefunctionC,&optargs);
    105103
    106                 _printf_("%s\n","      updating parameter using optimized search scalar..."); //true means update save controls
     104                ISSMPRINTF(VerboseControl(),"%s\n","   updating parameter using optimized search scalar"); //true means update save controls
    107105                InputControlUpdatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,search_scalar,true);
    108106               
     
    111109                /*Temporary saving every 5 control steps: */
    112110                if (((n+1)%5)==0){
    113                         _printf_("%s\n","      saving temporary results...");
     111                        ISSMPRINTF(VerboseControl(),"%s\n","   saving temporary results");
    114112                        controlrestart(femmodel,J);
    115113                }
    116114        }
    117115
    118         _printf_("%s\n","      preparing final solution");
     116        ISSMPRINTF(VerboseControl(),"%s\n","   preparing final solution");
    119117        femmodel->parameters->SetParam(false,ControlAnalysisEnum); //needed to turn control result output in solutioncore
    120118        solutioncore(femmodel);
Note: See TracChangeset for help on using the changeset viewer.