Changeset 14051
- Timestamp:
- 11/29/12 08:59:50 (12 years ago)
- Location:
- issm/trunk-jpl/src/c/modules/Krigingx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp
r14048 r14051 88 88 gate.predictions = predictions; 89 89 gate.error = error; 90 gate. percent = xNewZeroInit<double>(num);90 gate.numdone = xNewZeroInit<int>(num); 91 91 92 92 /*launch the thread manager with Krigingxt as a core: */ 93 93 LaunchThread(NearestNeighbort,(void*)&gate,num); 94 94 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 95 xDelete< double>(gate.percent);95 xDelete<int>(gate.numdone); 96 96 } 97 97 else if(strcmp(output,"idw")==0){ //Inverse distance weighting … … 109 109 gate.predictions = predictions; 110 110 gate.error = error; 111 gate. percent = xNewZeroInit<double>(num);111 gate.numdone = xNewZeroInit<int>(num); 112 112 gate.power = power; 113 113 … … 115 115 LaunchThread(idwt,(void*)&gate,num); 116 116 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 117 xDelete< double>(gate.percent);117 xDelete<int>(gate.numdone); 118 118 } 119 119 else if(strcmp(output,"v4")==0){ //Inverse distance weighting … … 129 129 gate.predictions = predictions; 130 130 gate.error = error; 131 gate. percent = xNewZeroInit<double>(num);131 gate.numdone = xNewZeroInit<int>(num); 132 132 133 133 /*launch the thread manager with Krigingxt as a core: */ 134 134 LaunchThread(v4t,(void*)&gate,num); 135 135 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 136 xDelete< double>(gate.percent);136 xDelete<int>(gate.numdone); 137 137 } 138 138 else if(strcmp(output,"prediction")==0){ … … 149 149 gate.predictions = predictions; 150 150 gate.error = error; 151 gate. percent = xNewZeroInit<double>(num);151 gate.numdone = xNewZeroInit<int>(num); 152 152 153 153 /*launch the thread manager with Krigingxt as a core: */ 154 154 LaunchThread(Krigingxt,(void*)&gate,num); 155 155 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 156 xDelete< double>(gate.percent);156 xDelete<int>(gate.numdone); 157 157 } 158 158 else{ … … 195 195 double *predictions = gate->predictions; 196 196 double *error = gate->error; 197 double *percent = gate->percent; 198 199 /*Intermediaries*/ 200 double localpercent; 197 int *numdone = gate->numdone; 201 198 202 199 /*partition loop across threads: */ … … 205 202 206 203 /*Print info*/ 207 percent[my_thread]=double(idx-i0)/double(i1-i0)*100.; 208 localpercent=percent[0]; 209 for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]); 210 if(my_thread==0) _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%"); 204 numdone[my_thread]=idx-i0; 205 if(my_thread==0){ 206 int alldone=numdone[0]; 207 for(int i=1;i<num_threads;i++) alldone+=numdone[i]; 208 _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(alldone)/double(n_interp)*100.<<"%"); 209 } 211 210 212 211 /*Kriging interpolation*/ … … 243 242 double *predictions = gate->predictions; 244 243 double *error = gate->error; 245 double *percent = gate->percent; 246 247 /*Intermediaries*/ 248 int i; 249 double localpercent; 244 int *numdone = gate->numdone; 250 245 251 246 /*partition loop across threads: */ … … 254 249 255 250 /*Print info*/ 256 percent[my_thread]=double(idx-i0)/double(i1-i0)*100.; 257 localpercent=percent[0]; 258 for(i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]); 259 if(my_thread==0) _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%"); 251 numdone[my_thread]=idx-i0; 252 if(my_thread==0){ 253 int alldone=numdone[0]; 254 for(int i=1;i<num_threads;i++) alldone+=numdone[i]; 255 _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(alldone)/double(n_interp)*100.<<"%"); 256 } 260 257 261 258 observations->InterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius); … … 291 288 double *predictions = gate->predictions; 292 289 double *error = gate->error; 293 double *percent = gate->percent;290 int *numdone = gate->numdone; 294 291 double power = gate->power; 295 296 /*Intermediaries*/297 double localpercent;298 292 299 293 /*partition loop across threads: */ … … 302 296 303 297 /*Print info*/ 304 percent[my_thread]=double(idx-i0)/double(i1-i0)*100.; 305 localpercent=percent[0]; 306 for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]); 307 if(my_thread==0) _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%"); 298 numdone[my_thread]=idx-i0; 299 if(my_thread==0){ 300 int alldone=numdone[0]; 301 for(int i=1;i<num_threads;i++) alldone+=numdone[i]; 302 _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(alldone)/double(n_interp)*100.<<"%"); 303 } 308 304 309 305 observations->InterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power); … … 338 334 double *predictions = gate->predictions; 339 335 double *error = gate->error; 340 double *percent = gate->percent; 341 342 /*Intermediaries*/ 343 double localpercent; 336 int *numdone = gate->numdone; 344 337 345 338 /*partition loop across threads: */ … … 348 341 349 342 /*Print info*/ 350 percent[my_thread]=double(idx-i0)/double(i1-i0)*100.; 351 localpercent=percent[0]; 352 for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]); 353 if(my_thread==0) _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%"); 343 numdone[my_thread]=idx-i0; 344 if(my_thread==0){ 345 int alldone=numdone[0]; 346 for(int i=1;i<num_threads;i++) alldone+=numdone[i]; 347 _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(alldone)/double(n_interp)*100.<<"%"); 348 } 354 349 355 350 observations->InterpolationV4(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata); -
issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.h
r14048 r14051 28 28 double *predictions; 29 29 double *error; 30 double *percent;30 int *numdone; 31 31 double power;//for idw 32 32 }KrigingxThreadStruct;
Note:
See TracChangeset
for help on using the changeset viewer.