Changeset 12232


Ignore:
Timestamp:
05/10/12 16:54:05 (13 years ago)
Author:
Mathieu Morlighem
Message:

minor

Location:
issm/trunk-jpl/src/c/modules/Krigingx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp

    r12231 r12232  
    6464                gate.variogram    = variogram;
    6565                gate.observations = observations;
    66                 gate.predictions     = predictions;
     66                gate.predictions  = predictions;
     67                gate.percent      = (double*)xcalloc(num,sizeof(double));
    6768
    6869                /*launch the thread manager with Krigingxt as a core: */
    6970                LaunchThread(Krigingxt,(void*)&gate,num);
     71                printf("\r      interpolation progress:  100.00%%\n");
     72                xfree((void**)&gate.percent);
    7073        }
    7174        else{
     
    104107        Observations *observations = gate->observations;
    105108        double       *predictions  = gate->predictions;
     109        double       *percent      = gate->percent;
    106110
    107111        /*Intermediaries*/
    108112        int           i,j,n_obs;
    109         double        numerator,denominator,ratio;
     113        double        numerator,denominator,ratio,localpercent;
    110114        double       *x            = NULL;
    111115        double       *y            = NULL;
     
    119123
    120124        /*partition loop across threads: */
    121         if(my_thread==0) printf("      interpolation progress:  %5.2lf %%",0.0);
    122125        PartitionRange(&i0,&i1,n_interp,num_threads,my_thread);
    123126        for(int idx=i0;idx<i1;idx++){
    124                 if(my_thread==0 && idx%10==0) printf("\b\b\b\b\b\b\b%5.2lf %%",double(idx-i0)/double(i1-i0)*100);
     127
     128                /*Print info*/
     129                percent[my_thread]=double(idx-i0)/double(i1-i0)*100.;
     130                localpercent=percent[0];
     131                for(i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]);
     132                printf("\r      interpolation progress: %5.2lf%%",localpercent);
    125133
    126134                /*Get list of observations for current point*/
     
    128136
    129137                /*Allocate intermediary matrix and vectors*/
    130                 Gamma       =(double*)xmalloc(n_obs*n_obs*sizeof(double));
    131                 gamma0      =(double*)xmalloc(n_obs*sizeof(double));
    132                 ones        =(double*)xmalloc(n_obs*sizeof(double));
     138                Gamma  = (double*)xmalloc(n_obs*n_obs*sizeof(double));
     139                gamma0 = (double*)xmalloc(n_obs*sizeof(double));
     140                ones   = (double*)xmalloc(n_obs*sizeof(double));
    133141
    134142                /*First: Create semivariogram matrix for observations*/
     
    169177                xfree((void**)&GinvZ);
    170178        }
    171         if(my_thread==0) printf("\b\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
    172179
    173180        return NULL;
  • issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.h

    r12231 r12232  
    2525        Observations *observations;
    2626        double       *predictions;
     27        double       *percent;
    2728}KrigingxThreadStruct;
    2829
Note: See TracChangeset for help on using the changeset viewer.