Changeset 13621


Ignore:
Timestamp:
10/11/12 11:20:39 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: cosmetics, removing all deboule blank lines and indent single white lines correctly

Location:
issm/trunk-jpl/src/c/solutions
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/solutions/AdjointCorePointerFromSolutionEnum.cpp

    r13056 r13621  
    2424
    2525        switch(solutiontype){
    26        
     26
    2727                case DiagnosticSolutionEnum:
    2828                        adjointcore=&adjointdiagnostic_core;
     
    3838                        break;
    3939        }
    40        
     40
    4141        /*Assign output pointer:*/
    4242        _assert_(padjointcore);
  • TabularUnified issm/trunk-jpl/src/c/solutions/AnalysisConfiguration.cpp

    r13056 r13621  
    2626        /*Analyses lists*/
    2727        switch(solutiontype){
    28        
     28
    2929                case DiagnosticSolutionEnum:
    3030                        numanalyses=5;
     
    5656                        analyses[1]=MeltingAnalysisEnum;
    5757                        break;
    58                
     58
    5959                case EnthalpySolutionEnum:
    6060                        numanalyses=1;
     
    6262                        analyses[0]=EnthalpyAnalysisEnum;
    6363                        break;
    64                
     64
    6565                case HydrologySolutionEnum:
    6666                        numanalyses=3;
     
    108108                        analyses[8]=PrognosticAnalysisEnum;
    109109                        break;
    110                
     110
    111111                default:
    112112                        _error_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!");
  • TabularUnified issm/trunk-jpl/src/c/solutions/CorePointerFromSolutionEnum.cpp

    r13540 r13621  
    2727        bool tao_analysis=false;
    2828        bool dakota_analysis=false;
    29        
     29
    3030        /* retrieve some parameters that tell us whether wrappers are allowed, or whether we return
    3131         * a pure core. Wrappers can be dakota_core (which samples many solution_cores) or control_core (which
  • TabularUnified issm/trunk-jpl/src/c/solutions/DakotaSpawnCore.cpp

    r13612 r13621  
    11/*!\file:  DakotaSpawnCore.cpp
    2  
     2
    33 * \brief: run core ISSM solution using Dakota inputs coming from CPU 0.
    44 * \sa qmu.cpp DakotaPlugin.cpp
     
    2727#endif
    2828
    29 
    3029#include "../classes/objects/objects.h"
    3130#include "../io/io.h"
     
    4342/*Notice the d_, which prefixes anything that is being provided to us by the Dakota pluggin. Careful. some things are ours, some are dakotas!: */
    4443int DakotaSpawnCore(double* d_responses, int d_numresponses, double* d_variables, char** d_variables_descriptors,int d_numvariables, void* void_femmodel,int counter){
    45        
     44
    4645        int i;
    47        
     46
    4847        char   **responses_descriptors     = NULL; //these are our!  there are only numresponsedescriptors of them, not d_numresponses!!!
    4948        int      numresponsedescriptors;
     
    5554        FemModel* femmodel                 = NULL;
    5655        bool      nodakotacore             = true;
    57 
    5856
    5957        /*If counter==-1 on cpu0, it means that the dakota runs are done. In which case, bail out and return 0: */
     
    7068        femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
    7169        femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
    72        
     70
    7371        if(VerboseQmu()) _pprintLine_("qmu iteration: " << counter);
    7472
     
    8987        if(VerboseQmu()) _pprintLine_("compute dakota responses:");
    9088        DakotaResponsesx(d_responses,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,responses_descriptors,numresponsedescriptors,d_numresponses);
    91        
     89
    9290        /*Free ressources:*/
    9391        DakotaFree(&d_variables,&d_variables_descriptors,&responses_descriptors, d_numvariables, numresponsedescriptors);
     
    126124        /*numvariables: */
    127125        MPI_Bcast(&numvariables,1,MPI_INT,0,IssmComm::GetComm());
    128        
     126
    129127        /*variables:*/
    130128        if(my_rank!=0)variables=xNew<double>(numvariables);
     
    156154} /*}}}*/
    157155void DakotaFree(double** pvariables,char*** pvariables_descriptors,char*** presponses_descriptors,int numvariables,int numresponses){ /*{{{*/
    158  
     156
    159157        /*\brief DakotaFree: free allocations on other cpus, not done by Dakota.*/
    160158
    161159        int i;
    162160        int my_rank;
    163        
     161
    164162        double  *variables             = NULL;
    165163        char   **variables_descriptors = NULL;
     
    184182                xDelete<char*>(variables_descriptors);
    185183        }
    186        
     184
    187185        //responses descriptors on every cpu
    188186        for(i=0;i<numresponses;i++){
  • TabularUnified issm/trunk-jpl/src/c/solutions/EnvironmentInit.cpp

    r13589 r13621  
    2525        #endif
    2626        #endif
    27        
    2827
    2928}
  • TabularUnified issm/trunk-jpl/src/c/solutions/PureCorePointerFromSolutionEnum.cpp

    r13540 r13621  
    2424
    2525        switch(solutiontype){
    26        
     26
    2727                case DiagnosticSolutionEnum:
    2828                        #ifdef _HAVE_DIAGNOSTIC_
     
    9999                        break;
    100100        }
    101        
     101
    102102        /*Assign output pointer:*/
    103103        _assert_(psolutioncore);
  • TabularUnified issm/trunk-jpl/src/c/solutions/ResetBoundaryConditions.cpp

    r13216 r13621  
    99
    1010void ResetBoundaryConditions(FemModel* femmodel, int analysis_type){
    11        
     11
    1212        /*variables: */
    1313        Vector<IssmDouble>*    yg    = NULL;
     
    1616
    1717        if(VerboseSolution()) _pprintLine_("   updating boundary conditions...");
    18                        
     18
    1919        /*set current analysis: */
    2020        femmodel->SetCurrentConfiguration(analysis_type);
  • TabularUnified issm/trunk-jpl/src/c/solutions/ad_core.cpp

    r13546 r13621  
    99#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1010#endif
    11 
    1211
    1312#include <set>
     
    2423
    2524void ad_core(FemModel* femmodel){
    26        
     25
    2726        /*diverse: */
    2827        int     i;
     
    4544                #ifdef _HAVE_ADOLC_
    4645
    47                
    4846                        /*First, stop tracing: */
    4947                        trace_off();
     
    5351                        femmodel->parameters->FindParam(&num_independents,AutodiffNumIndependentsEnum);
    5452                        if(!(num_dependents*num_independents)) return;
    55                        
     53
    5654                        if(VerboseAutodiff())_pprintLine_("   start ad core");
    57                        
     55
    5856                        /*retrieve state variable: */
    5957                        femmodel->parameters->FindParam(&axp,&dummy,AutodiffXpEnum);
     
    7674
    7775                        if (strcmp(driver,"fos_forward")==0){
    78                                
     76
    7977                                int     anIndepIndex;
    8078                                double *tangentDir         = NULL;
    8179                                double *jacTimesTangentDir = NULL;
    8280                                double *theOutput          = NULL;
    83                                
     81
    8482                                /*retrieve direction index: */
    8583                                femmodel->parameters->FindParam(&anIndepIndex,AutodiffFosForwardIndexEnum);
    86                                
     84
    8785                                if (anIndepIndex<0 || anIndepIndex>=num_independents) _error_("index value for AutodiffFosForwardIndexEnum should be in [0,num_independents-1]");
    8886
    8987                                tangentDir=xNewZeroInit<double>(num_independents);
    9088                                tangentDir[anIndepIndex]=1.0;
    91                        
     89
    9290                                jacTimesTangentDir=xNew<double>(num_dependents);
    9391                                theOutput=xNew<double>(num_dependents);
    94                                
     92
    9593                                /*set the forward method function pointer: */
    9694                                anEDF_for_solverx_p->fos_forward=EDF_fos_forward_for_solverx;
     
    105103                                /*add to results*/
    106104                                femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,jacTimesTangentDir,num_dependents,1,1,0.0));
    107                                
     105
    108106                                /*free resources :*/
    109107                                xDelete(theOutput);
     
    112110                        }
    113111                        else if ((strcmp(driver,"fov_forward")==0) || (strcmp(driver,"fov_forward_all")==0)){
    114                                
     112
    115113                                int      tangentDirNum;
    116114                                int      dummy;
     
    120118                                double  *theOutput     = NULL;
    121119                                std::set<unsigned int> anIndexSet;
    122                                        
    123                                        
     120
    124121                                /*retrieve directions:*/
    125122                                if (strcmp(driver,"fov_forward_all")==0){
     
    137134                                /* full Jacobian or Jacobian projection:*/
    138135                                jacTimesSeed=xNew<double>(num_dependents,tangentDirNum);
    139                                
     136
    140137                                /*set the forward method function pointers: */
    141138                                anEDF_for_solverx_p->fov_forward=EDF_fov_forward_for_solverx;
     
    223220                                std::set<unsigned int> anIndexSet;
    224221
    225 
    226222                                /*retrieve directions:*/
    227223                                if (strcmp(driver,"fov_reverse_all")==0){
     
    278274                        else _error_("driver: " << driver << " not yet supported!");
    279275
    280 
    281276                        /* delete the allocated space for the parameters:*/
    282277                        xDelete(anEDF_for_solverx_p->dp_x);
     
    290285                        xDelete(anEDF_for_solverx_p->dp_Z);
    291286                        xDelete(anEDF_for_solverx_p->dpp_Z);
    292        
     287
    293288                        /*Print statistics:*/
    294289                        tapestats(1,tape_stats); //reading of tape statistics
     
    303298                        }
    304299                        if(VerboseAutodiff())_pprintLine_("   end AD core");
    305                        
     300
    306301                        /*Free resources: */
    307302                        xDelete(xp);
  • TabularUnified issm/trunk-jpl/src/c/solutions/adjointbalancethickness_core.cpp

    r12832 r13621  
    1414
    1515void adjointbalancethickness_core(FemModel* femmodel){
    16        
     16
    1717        /*parameters: */
    1818        bool save_results;
     
    3333        femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum,AdjointBalancethicknessAnalysisEnum);
    3434        solver_adjoint_linear(femmodel);
    35        
     35
    3636        /*Save results*/
    3737        if(save_results){
  • TabularUnified issm/trunk-jpl/src/c/solutions/adjointdiagnostic_core.cpp

    r12832 r13621  
    1414
    1515void adjointdiagnostic_core(FemModel* femmodel){
    16        
     16
    1717        /*parameters: */
    1818        bool isstokes;
     
    3636        femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum,AdjointHorizAnalysisEnum);
    3737        solver_adjoint_linear(femmodel);
    38        
     38
    3939        /*Save results*/
    4040        if(save_results){
  • TabularUnified issm/trunk-jpl/src/c/solutions/balancethickness_core.cpp

    r12832 r13621  
    2020        /*activate formulation: */
    2121        femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum);
    22        
     22
    2323        /*recover parameters: */
    2424        femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
  • TabularUnified issm/trunk-jpl/src/c/solutions/bedslope_core.cpp

    r12832 r13621  
    2626        femmodel->SetCurrentConfiguration(BedSlopeAnalysisEnum,BedSlopeYAnalysisEnum);
    2727        solver_linear(femmodel);
    28        
     28
    2929        if(save_results){
    3030                if(VerboseSolution()) _pprintLine_("   saving results");
  • TabularUnified issm/trunk-jpl/src/c/solutions/control_core.cpp

    r13540 r13621  
    1616
    1717        int     i,n;
    18        
     18
    1919        /*parameters: */
    2020        int     num_controls,num_responses;
     
    3232        IssmDouble* maxiter=NULL;
    3333        IssmDouble* cm_jump=NULL;
    34                
     34
    3535        /*intermediary: */
    3636        IssmDouble  search_scalar=1;
     
    7272        J=xNew<IssmDouble>(nsteps);
    7373        step_responses=xNew<int>(num_responses);
    74                
     74
    7575        /*Initialize some of the BrentSearch arguments: */
    7676        optargs.femmodel=femmodel;
    7777        optpars.xmin=0; optpars.xmax=1;
    78        
     78
    7979        /*Start looping: */
    8080        for(n=0;n<nsteps;n++){
     
    8484                for(i=0;i<num_responses;i++) step_responses[i]=reCast<int,IssmDouble>(responses[n*num_responses+i]);
    8585                femmodel->parameters->SetParam(step_responses,1,num_responses,StepResponsesEnum);
    86                
     86
    8787                /*In steady state inversion, compute new temperature field now*/
    8888                if(solution_type==SteadystateSolutionEnum) solutioncore(femmodel);
     
    104104                if(VerboseControl()) _pprintLine_("   updating parameter using optimized search scalar"); //true means update save controls
    105105                InputControlUpdatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,search_scalar,true);
    106                
     106
    107107                if(controlconvergence(J[n],tol_cm)) break;
    108108        }
  • TabularUnified issm/trunk-jpl/src/c/solutions/dakota_core.cpp

    r13612 r13621  
    5454void dakota_core(FemModel* femmodel){
    5555
     56        #ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in.
    5657
    57         #ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in.
    58        
    5958        int                my_rank;
    6059        char*              dakota_input_file  = NULL;
     
    6968        femmodel->parameters->FindParam(&dakota_output_file,QmuOutNameEnum);
    7069        femmodel->parameters->FindParam(&dakota_error_file,QmuErrNameEnum);
    71        
     70
    7271        /*recover my_rank:*/
    7372        my_rank=IssmComm::GetRank();
    7473
    7574        if(my_rank==0){
    76        
     75
    7776                // Instantiate/initialize the parallel library and problem description
    7877                // database objects.
     
    105104                        interface.assign_rep(new SIM::DakotaPlugin(problem_db,(void*)femmodel), false);
    106105                }
    107        
     106
    108107                // Execute the strategy
    109108                problem_db.lock(); // prevent run-time DB queries
    110109                selected_strategy.run_strategy();
    111                
     110
    112111                //Warn other cpus that we are done running the dakota iterator, by setting the counter to -1:
    113112                DakotaSpawnCore(NULL,0, NULL,NULL,0,femmodel,-1);
  • TabularUnified issm/trunk-jpl/src/c/solutions/diagnostic_core.cpp

    r13438 r13621  
    6060
    6161        if(ishutter){
    62                        
     62
    6363                if(VerboseSolution()) _pprintLine_("   computing hutter velocities");
    6464
     
    6868                femmodel->SetCurrentConfiguration(DiagnosticHutterAnalysisEnum);
    6969                solver_linear(femmodel);
    70                
     70
    7171                if (ismacayealpattyn) ResetBoundaryConditions(femmodel,DiagnosticHorizAnalysisEnum);
    7272        }
    7373
    7474        if ((ismacayealpattyn || isl1l2) ^ isstokes){ // ^ = xor
    75                
     75
    7676                if(VerboseSolution()) _pprintLine_("   computing velocities");
    7777                femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum);
     
    105105                RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs);
    106106        }
    107        
     107
    108108        if(solution_type==DiagnosticSolutionEnum)RequestedDependentsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
    109109
  • TabularUnified issm/trunk-jpl/src/c/solutions/hydrology_core.cpp

    r13073 r13621  
    4444        /*Loop through time: */
    4545        for(i=0;i<nsteps;i++){
    46                
     46
    4747                if(nsteps)if(VerboseSolution()) _pprintLine_("time step:" << i+1 << "/" << nsteps);
    4848                time+=dt;
     
    5757                        //InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVxEnum,i+1,time);
    5858                        //InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVyEnum,i+1,time);
    59                        
     59
    6060                        /*unload results*/
    6161                        if(VerboseSolution()) _pprintLine_("   saving temporary results");
     
    6464        }
    6565}
    66 
  • TabularUnified issm/trunk-jpl/src/c/solutions/hydrology_core_step.cpp

    r12832 r13621  
    1414
    1515void hydrology_core_step(FemModel* femmodel,int step, IssmDouble time){
    16        
     16
    1717        bool modify_loads=true;
    1818
  • TabularUnified issm/trunk-jpl/src/c/solutions/issm.cpp

    r13611 r13621  
    44
    55#include "../issm.h"
    6        
     6
    77int main(int argc,char **argv){
    8 
    98
    109        /*Initialize exception trapping: */
     
    2221        /*Output results: */
    2322        femmodel->OutputResults();
    24        
     23
    2524        /*Wrap up: */
    2625        delete femmodel;
  • TabularUnified issm/trunk-jpl/src/c/solutions/objectivefunction.cpp

    r13056 r13621  
    2323
    2424        int i; 
    25        
     25
    2626        /*output: */
    2727        IssmDouble J;
    28        
     28
    2929        /*parameters: */
    3030        int        solution_type,analysis_type;
  • TabularUnified issm/trunk-jpl/src/c/solutions/prognostic_core.cpp

    r13438 r13621  
    2323        /*activate formulation: */
    2424        femmodel->SetCurrentConfiguration(PrognosticAnalysisEnum);
    25        
     25
    2626        /*recover parameters: */
    2727        femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
     
    4747        if(VerboseSolution()) _pprintLine_("   call computational core");
    4848        solver_linear(femmodel);
    49        
     49
    5050        if(save_results){
    5151                if(VerboseSolution()) _pprintLine_("   saving results");
     
    5353                RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs);
    5454        }
    55        
     55
    5656        if(solution_type==PrognosticSolutionEnum)RequestedDependentsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
    57        
     57
    5858        /*Free ressources:*/
    5959        xDelete<int>(requested_outputs);
  • TabularUnified issm/trunk-jpl/src/c/solutions/steadystate_core.cpp

    r13056 r13621  
    2929        int  numoutputs         = 0;
    3030        int  *requested_outputs = NULL;
    31        
     31
    3232        /* recover parameters:*/
    3333        femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
     
    4242
    4343        for(;;){
    44        
     44
    4545                if(VerboseSolution()) _pprintLine_("   computing temperature and velocity for step: " << step);
    4646                #ifdef _HAVE_THERMAL_
     
    6666                        break;
    6767                }
    68                
     68
    6969                if(VerboseSolution()) _pprintLine_("   saving velocity, temperature and pressure to check for convergence at next step");
    7070                InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum,VxPicardEnum);
     
    7373                InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,PressureEnum,PressurePicardEnum);
    7474                InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum,TemperatureOldEnum);
    75                
     75
    7676                //increase counter
    7777                step++;
    7878        }
    79        
     79
    8080        if(save_results){
    8181                if(VerboseSolution()) _pprintLine_("   saving results");
  • TabularUnified issm/trunk-jpl/src/c/solutions/steadystateconvergence.cpp

    r12832 r13621  
    1818
    1919bool steadystateconvergence(FemModel* femmodel){
    20        
     20
    2121        /*output: */
    2222        bool converged=false;
     
    3232        /*retrieve parameters: */
    3333        femmodel->parameters->FindParam(&convergencecriterionvalue[0],SteadystateReltolEnum);
    34        
     34
    3535        /*figure out convergence at the input level, because we don't have the solution vectors!: */
    3636        velocity_converged=InputConvergencex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,&velocityenums[0],8,&convergencecriterion[0],&convergencecriterionvalue[0],1);
  • TabularUnified issm/trunk-jpl/src/c/solutions/surfaceslope_core.cpp

    r12832 r13621  
    2626        femmodel->SetCurrentConfiguration(SurfaceSlopeAnalysisEnum,SurfaceSlopeYAnalysisEnum);
    2727        solver_linear(femmodel);
    28        
     28
    2929        if(save_results){
    3030                if(VerboseSolution()) _pprintLine_("saving results:");
  • TabularUnified issm/trunk-jpl/src/c/solutions/transient_core.cpp

    r13283 r13621  
    3131        int    numoutputs         = 0;
    3232        int    *requested_outputs = NULL;
    33        
     33
    3434        /*intermediary: */
    3535        int    step;
     
    107107                        #endif
    108108                }
    109                
     109
    110110                if(isdiagnostic){
    111111                        if(VerboseSolution()) _pprintLine_("   computing new velocity");
     
    153153
    154154        RequestedDependentsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
    155        
     155
    156156        /*Free ressources:*/
    157157        xDelete<int>(requested_outputs);
Note: See TracChangeset for help on using the changeset viewer.