[12679] | 1 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/include/macros.h
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/include/macros.h (revision 12506)
|
---|
| 4 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/include/macros.h (revision 12507)
|
---|
| 5 | @@ -49,12 +49,12 @@
|
---|
| 6 | /* _printLine_ {{{*/
|
---|
| 7 | /* macro to print a line, adds std::endl */
|
---|
| 8 | #define _printLine_(StreamArgs)\
|
---|
| 9 | - {std::cout << StreamArgs << std::endl;}
|
---|
| 10 | + do{std::cout << StreamArgs << std::endl;}while(0)
|
---|
| 11 | /*}}}*/
|
---|
| 12 | /* _printString_ {{{*/
|
---|
| 13 | /* macro to print some string, adds std::ends */
|
---|
| 14 | #define _printString_(StreamArgs)\
|
---|
| 15 | - {std::cout << StreamArgs;}
|
---|
| 16 | + do{std::cout << StreamArgs;}while(0)
|
---|
| 17 | /*}}}*/
|
---|
| 18 | /* _assert_ {{{*/
|
---|
| 19 | /*Assertion macro: do nothing if macro _ISSM_DEBUG_ undefined*/
|
---|
| 20 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp
|
---|
| 21 | ===================================================================
|
---|
| 22 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp (revision 12506)
|
---|
| 23 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp (revision 12507)
|
---|
| 24 | @@ -14,6 +14,7 @@
|
---|
| 25 | #include "../../io/io.h"
|
---|
| 26 | #include "../../shared/shared.h"
|
---|
| 27 | #include <float.h>
|
---|
| 28 | +#include <iomanip>
|
---|
| 29 |
|
---|
| 30 | void BrentSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){
|
---|
| 31 |
|
---|
| 32 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/shared/Elements/elements.h
|
---|
| 33 | ===================================================================
|
---|
| 34 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/shared/Elements/elements.h (revision 12506)
|
---|
| 35 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/shared/Elements/elements.h (revision 12507)
|
---|
| 36 | @@ -29,31 +29,30 @@
|
---|
| 37 | #endif
|
---|
| 38 |
|
---|
| 39 | inline void printarray(IssmDouble* array,int lines,int cols=1){
|
---|
| 40 | - printf("\n");
|
---|
| 41 | + _printLine_("");
|
---|
| 42 | for(int i=0;i<lines;i++){
|
---|
| 43 | - printf(" [ ");
|
---|
| 44 | - for(int j=0;j<cols;j++) printf(" %12.7g ",array[i*cols+j]);
|
---|
| 45 | - printf(" ]\n");
|
---|
| 46 | + _printString_(" [ ");
|
---|
| 47 | + for(int j=0;j<cols;j++) _printString_( " " << setw(11) << setprecision (5) << array[i*cols+j]);
|
---|
| 48 | + _printLine_(" ]");
|
---|
| 49 | }
|
---|
| 50 | - printf("\n");
|
---|
| 51 | + _printLine_("");
|
---|
| 52 | }
|
---|
| 53 | inline void printarray(int* array,int lines,int cols=1){
|
---|
| 54 | - printf("\n");
|
---|
| 55 | + _printLine_("");
|
---|
| 56 | for(int i=0;i<lines;i++){
|
---|
| 57 | - printf(" [ ");
|
---|
| 58 | - for(int j=0;j<cols;j++) printf(" %6i",array[i*cols+j]);
|
---|
| 59 | - printf(" ]\n");
|
---|
| 60 | + _printString_(" [ ");
|
---|
| 61 | + for(int j=0;j<cols;j++) _printString_( " " << setw(11) << setprecision (5) << array[i*cols+j]);
|
---|
| 62 | + _printLine_(" ]");
|
---|
| 63 | }
|
---|
| 64 | - printf("\n");
|
---|
| 65 | + _printLine_("");
|
---|
| 66 | }
|
---|
| 67 | inline void printbinary(int n) {
|
---|
| 68 | unsigned int i=1L<<(sizeof(n)*8-1);
|
---|
| 69 | -
|
---|
| 70 | while (i>0) {
|
---|
| 71 | if (n&i)
|
---|
| 72 | - printf("1");
|
---|
| 73 | + _printString_("1");
|
---|
| 74 | else
|
---|
| 75 | - printf("0");
|
---|
| 76 | + _printString_("0");
|
---|
| 77 | i>>=1;
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp
|
---|
| 81 | ===================================================================
|
---|
| 82 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp (revision 12506)
|
---|
| 83 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp (revision 12507)
|
---|
| 84 | @@ -16,19 +16,19 @@
|
---|
| 85 | int interpolation_type;
|
---|
| 86 | bool debug;
|
---|
| 87 | int nels_data;
|
---|
| 88 | - double* index_data=NULL;
|
---|
| 89 | - double* x_data=NULL;
|
---|
| 90 | - double* y_data=NULL;
|
---|
| 91 | - double* data=NULL;
|
---|
| 92 | - double xmin,xmax;
|
---|
| 93 | - double ymin,ymax;
|
---|
| 94 | - int nods_prime;
|
---|
| 95 | - Vector* data_prime=NULL;
|
---|
| 96 | - double* x_prime=NULL;
|
---|
| 97 | - double* y_prime=NULL;
|
---|
| 98 | - double* default_values=NULL;
|
---|
| 99 | + double *index_data = NULL;
|
---|
| 100 | + double *x_data = NULL;
|
---|
| 101 | + double *y_data = NULL;
|
---|
| 102 | + double *data = NULL;
|
---|
| 103 | + double xmin ,xmax;
|
---|
| 104 | + double ymin ,ymax;
|
---|
| 105 | + int nods_prime;
|
---|
| 106 | + Vector *data_prime = NULL;
|
---|
| 107 | + double *x_prime = NULL;
|
---|
| 108 | + double *y_prime = NULL;
|
---|
| 109 | + double *default_values = NULL;
|
---|
| 110 | int num_default_values;
|
---|
| 111 | - double* incontour=NULL;
|
---|
| 112 | + double *incontour = NULL;
|
---|
| 113 |
|
---|
| 114 | /*intermediary: */
|
---|
| 115 | int i0;
|
---|
| 116 | @@ -45,35 +45,34 @@
|
---|
| 117 | num_threads=handle->num;
|
---|
| 118 |
|
---|
| 119 | /*recover parameters :*/
|
---|
| 120 | - interpolation_type=gate->interpolation_type;
|
---|
| 121 | - debug=gate->debug;
|
---|
| 122 | - nels_data=gate->nels_data;
|
---|
| 123 | - index_data=gate->index_data;
|
---|
| 124 | - x_data=gate->x_data;
|
---|
| 125 | - y_data=gate->y_data;
|
---|
| 126 | - data=gate->data;
|
---|
| 127 | - xmin=gate->xmin;
|
---|
| 128 | - xmax=gate->xmax;
|
---|
| 129 | - ymin=gate->ymin;
|
---|
| 130 | - ymax=gate->ymax;
|
---|
| 131 | - nods_prime=gate->nods_prime;
|
---|
| 132 | - data_prime=gate->data_prime;
|
---|
| 133 | - x_prime=gate->x_prime;
|
---|
| 134 | - y_prime=gate->y_prime;
|
---|
| 135 | - default_values=gate->default_values;
|
---|
| 136 | - num_default_values=gate->num_default_values;
|
---|
| 137 | - incontour=gate->incontour;
|
---|
| 138 | + interpolation_type = gate->interpolation_type;
|
---|
| 139 | + debug = gate->debug;
|
---|
| 140 | + nels_data = gate->nels_data;
|
---|
| 141 | + index_data = gate->index_data;
|
---|
| 142 | + x_data = gate->x_data;
|
---|
| 143 | + y_data = gate->y_data;
|
---|
| 144 | + data = gate->data;
|
---|
| 145 | + xmin = gate->xmin;
|
---|
| 146 | + xmax = gate->xmax;
|
---|
| 147 | + ymin = gate->ymin;
|
---|
| 148 | + ymax = gate->ymax;
|
---|
| 149 | + nods_prime = gate->nods_prime;
|
---|
| 150 | + data_prime = gate->data_prime;
|
---|
| 151 | + x_prime = gate->x_prime;
|
---|
| 152 | + y_prime = gate->y_prime;
|
---|
| 153 | + default_values = gate->default_values;
|
---|
| 154 | + num_default_values = gate->num_default_values;
|
---|
| 155 | + incontour = gate->incontour;
|
---|
| 156 |
|
---|
| 157 | /*partition loop across threads: */
|
---|
| 158 | PartitionRange(&i0,&i1,nels_data,num_threads,my_thread);
|
---|
| 159 |
|
---|
| 160 | /*Loop over the elements*/
|
---|
| 161 | - if (debug && my_thread==0) printf(" interpolation progress: %5.2lf %%",0.0);
|
---|
| 162 | -
|
---|
| 163 | for (i=i0;i<i1;i++){
|
---|
| 164 |
|
---|
| 165 | /*display current iteration*/
|
---|
| 166 | - if (debug && my_thread==0 && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nels_data*100*num_threads);
|
---|
| 167 | + if (debug && my_thread==0 && fmod((double)i,(double)100)==0)
|
---|
| 168 | + _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%");
|
---|
| 169 |
|
---|
| 170 | /*if there is no point inside the domain, go to next iteration*/
|
---|
| 171 | if ( (x_data[(int)index_data[3*i+0]-1]<xmin) && (x_data[(int)index_data[3*i+1]-1]<xmin) && (x_data[(int)index_data[3*i+2]-1]<xmin)) continue;
|
---|
| 172 | @@ -124,8 +123,7 @@
|
---|
| 173 | }
|
---|
| 174 | }
|
---|
| 175 | }
|
---|
| 176 | - if (debug && my_thread==0) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
|
---|
| 177 | -
|
---|
| 178 | + if(debug && my_thread==0)
|
---|
| 179 | + _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
|
---|
| 180 | return NULL;
|
---|
| 181 | -
|
---|
| 182 | }
|
---|
| 183 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp
|
---|
| 184 | ===================================================================
|
---|
| 185 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp (revision 12506)
|
---|
| 186 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp (revision 12507)
|
---|
| 187 | @@ -84,11 +84,11 @@
|
---|
| 188 | }
|
---|
| 189 |
|
---|
| 190 | /*Loop over the elements*/
|
---|
| 191 | - if (debug) printf(" interpolation progress: %5.2lf %%",0.0);
|
---|
| 192 | for (n=0;n<nels;n++){
|
---|
| 193 |
|
---|
| 194 | /*display current iteration*/
|
---|
| 195 | - if (debug && fmod((double)n,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)n/nels*100);
|
---|
| 196 | + if (debug && fmod((double)n,(double)100)==0)
|
---|
| 197 | + _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(n)/double(nels)*100<<"%");
|
---|
| 198 |
|
---|
| 199 | /*Get extrema coordinates of current elements*/
|
---|
| 200 | x_tria_min=x_mesh[(int)index_mesh[3*n+0]-1]; x_tria_max=x_tria_min;
|
---|
| 201 | @@ -167,7 +167,8 @@
|
---|
| 202 | }
|
---|
| 203 | }
|
---|
| 204 | }
|
---|
| 205 | - if (debug) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
|
---|
| 206 | + if (debug)
|
---|
| 207 | + _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
|
---|
| 208 |
|
---|
| 209 | /*Assign output pointers:*/
|
---|
| 210 | *pgriddata=griddata;
|
---|
| 211 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/HoleFillerx/HoleFillerx.cpp
|
---|
| 212 | ===================================================================
|
---|
| 213 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/HoleFillerx/HoleFillerx.cpp (revision 12506)
|
---|
| 214 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/HoleFillerx/HoleFillerx.cpp (revision 12507)
|
---|
| 215 | @@ -76,7 +76,7 @@
|
---|
| 216 | }
|
---|
| 217 | }
|
---|
| 218 | printf( "\n" );
|
---|
| 219 | - printf("Number of zeroes remaining: %10ld",lines*samps-counter);
|
---|
| 220 | + printf("Number of zeroes remaining: %d",lines*samps-counter);
|
---|
| 221 | fflush( stdout );
|
---|
| 222 | #endif
|
---|
| 223 |
|
---|
| 224 | @@ -95,7 +95,7 @@
|
---|
| 225 | }
|
---|
| 226 | // n u m b e r o f z e r o e s r e m a i n i n g : 1 2 3 4 5 6 7 8 9 10
|
---|
| 227 | printf( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" );
|
---|
| 228 | - printf("Number of zeroes remaining: %10ld",lines*samps-counter);
|
---|
| 229 | + printf("Number of zeroes remaining: %d",lines*samps-counter);
|
---|
| 230 | fflush( stdout );
|
---|
| 231 | #endif
|
---|
| 232 |
|
---|
| 233 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp
|
---|
| 234 | ===================================================================
|
---|
| 235 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp (revision 12506)
|
---|
| 236 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp (revision 12507)
|
---|
| 237 | @@ -95,7 +95,7 @@
|
---|
| 238 |
|
---|
| 239 | /*launch the thread manager with Krigingxt as a core: */
|
---|
| 240 | LaunchThread(NearestNeighbort,(void*)&gate,num);
|
---|
| 241 | - printf("\r interpolation progress: 100.00%%\n");
|
---|
| 242 | + _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
|
---|
| 243 | xDelete<double>(gate.percent);
|
---|
| 244 | }
|
---|
| 245 | else if(strcmp(output,"idw")==0){ //Inverse distance weighting
|
---|
| 246 | @@ -114,7 +114,7 @@
|
---|
| 247 |
|
---|
| 248 | /*launch the thread manager with Krigingxt as a core: */
|
---|
| 249 | LaunchThread(idwt,(void*)&gate,num);
|
---|
| 250 | - printf("\r interpolation progress: 100.00%%\n");
|
---|
| 251 | + _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
|
---|
| 252 | xDelete<double>(gate.percent);
|
---|
| 253 | }
|
---|
| 254 | else if(strcmp(output,"prediction")==0){
|
---|
| 255 | @@ -134,7 +134,7 @@
|
---|
| 256 |
|
---|
| 257 | /*launch the thread manager with Krigingxt as a core: */
|
---|
| 258 | LaunchThread(Krigingxt,(void*)&gate,num);
|
---|
| 259 | - printf("\r interpolation progress: 100.00%%\n");
|
---|
| 260 | + _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
|
---|
| 261 | xDelete<double>(gate.percent);
|
---|
| 262 | }
|
---|
| 263 | else{
|
---|
| 264 | @@ -189,7 +189,7 @@
|
---|
| 265 | percent[my_thread]=double(idx-i0)/double(i1-i0)*100.;
|
---|
| 266 | localpercent=percent[0];
|
---|
| 267 | for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]);
|
---|
| 268 | - printf("\r interpolation progress: %5.2lf%%",localpercent);
|
---|
| 269 | + _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%");
|
---|
| 270 |
|
---|
| 271 | /*Kriging interpolation*/
|
---|
| 272 | observations->InterpolationKriging(&predictions[idx],&error[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,variogram);
|
---|
| 273 | @@ -238,7 +238,7 @@
|
---|
| 274 | percent[my_thread]=double(idx-i0)/double(i1-i0)*100.;
|
---|
| 275 | localpercent=percent[0];
|
---|
| 276 | for(i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]);
|
---|
| 277 | - printf("\r interpolation progress: %5.2lf%%",localpercent);
|
---|
| 278 | + _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%");
|
---|
| 279 |
|
---|
| 280 | observations->InterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius);
|
---|
| 281 | }
|
---|
| 282 | @@ -286,7 +286,7 @@
|
---|
| 283 | percent[my_thread]=double(idx-i0)/double(i1-i0)*100.;
|
---|
| 284 | localpercent=percent[0];
|
---|
| 285 | for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]);
|
---|
| 286 | - printf("\r interpolation progress: %5.2lf%%",localpercent);
|
---|
| 287 | + _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%");
|
---|
| 288 |
|
---|
| 289 | observations->InterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power);
|
---|
| 290 | }
|
---|
| 291 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp
|
---|
| 292 | ===================================================================
|
---|
| 293 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp (revision 12506)
|
---|
| 294 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp (revision 12507)
|
---|
| 295 | @@ -57,11 +57,11 @@
|
---|
| 296 | for (i=0;i<nods_prime;i++) data_prime->SetValue(i,default_value,INS_VAL);
|
---|
| 297 |
|
---|
| 298 | /*Loop over the elements*/
|
---|
| 299 | - if (debug) printf(" interpolation progress: %5.2lf %%",0.0);
|
---|
| 300 | for (i=0;i<nels_data;i++){
|
---|
| 301 |
|
---|
| 302 | /*display current iteration*/
|
---|
| 303 | - if (debug && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nels_data*100);
|
---|
| 304 | + if (debug && fmod((double)i,(double)100)==0)
|
---|
| 305 | + _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(i)/double(nels_data)*100<<"%");
|
---|
| 306 |
|
---|
| 307 | /*Get extrema coordinates of current elements*/
|
---|
| 308 | x_tria_min=x_data[(int)index_data[6*i+0]-1]; x_tria_max=x_tria_min;
|
---|
| 309 | @@ -131,7 +131,8 @@
|
---|
| 310 | }
|
---|
| 311 | }
|
---|
| 312 | }
|
---|
| 313 | - if (debug) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
|
---|
| 314 | + if (debug)
|
---|
| 315 | + _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
|
---|
| 316 |
|
---|
| 317 | /*Assign output pointers:*/
|
---|
| 318 | *pdata_prime=data_prime;
|
---|
| 319 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp
|
---|
| 320 | ===================================================================
|
---|
| 321 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp (revision 12506)
|
---|
| 322 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp (revision 12507)
|
---|
| 323 | @@ -123,17 +123,22 @@
|
---|
| 324 | double *x = gate->x;
|
---|
| 325 | double *y = gate->y;
|
---|
| 326 | int nods = gate->nods;
|
---|
| 327 | - Vector* data_mesh = gate->data_mesh;
|
---|
| 328 | + Vector *data_mesh = gate->data_mesh;
|
---|
| 329 | double *data = gate->data;
|
---|
| 330 | double default_value = gate->default_value;
|
---|
| 331 | int interpenum = gate->interp;
|
---|
| 332 | int M = gate->M;
|
---|
| 333 | int N = gate->N;
|
---|
| 334 |
|
---|
| 335 | + bool debug = M*N>1? true:false;
|
---|
| 336 | + debug = true;
|
---|
| 337 | +
|
---|
| 338 | /*partition loop across threads: */
|
---|
| 339 | PartitionRange(&i0,&i1,nods,num_threads,my_thread);
|
---|
| 340 | for (i=i0;i<i1;i++) {
|
---|
| 341 |
|
---|
| 342 | + if(debug && my_thread==0)
|
---|
| 343 | + _printLine_("\r interpolation progress: "<<setw(5)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%%");
|
---|
| 344 | x_grid=*(x_mesh+i);
|
---|
| 345 | y_grid=*(y_mesh+i);
|
---|
| 346 |
|
---|
| 347 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp
|
---|
| 348 | ===================================================================
|
---|
| 349 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp (revision 12506)
|
---|
| 350 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp (revision 12507)
|
---|
| 351 | @@ -44,12 +44,11 @@
|
---|
| 352 | PartitionRange(&i0,&i1,nods,num_threads,my_thread);
|
---|
| 353 |
|
---|
| 354 | /*Loop over the nodes*/
|
---|
| 355 | - if (my_thread==0) printf(" loop progress: %5.2lf %%",0.0);
|
---|
| 356 | -
|
---|
| 357 | for (i=i0;i<i1;i++){
|
---|
| 358 |
|
---|
| 359 | /*display current iteration*/
|
---|
| 360 | - if (my_thread==0 && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nods*100*num_threads);
|
---|
| 361 | + if (my_thread==0 && fmod((double)i,(double)100)==0)
|
---|
| 362 | + _printString_("\r loop progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%");
|
---|
| 363 |
|
---|
| 364 | distance=mindistance+100; //make sure initialization respects min distance criterion.
|
---|
| 365 | for (j=0;j<nods;j++){
|
---|
| 366 | @@ -69,7 +68,8 @@
|
---|
| 367 | }
|
---|
| 368 | }
|
---|
| 369 | }
|
---|
| 370 | - if (my_thread==0) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
|
---|
| 371 | + if (my_thread==0)
|
---|
| 372 | + _printLine_("\r loop progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
|
---|
| 373 |
|
---|
| 374 | /*Free ressources:*/
|
---|
| 375 | xDelete<bool>(already);
|
---|
| 376 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Numerics/ElementMatrix.cpp
|
---|
| 377 | ===================================================================
|
---|
| 378 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Numerics/ElementMatrix.cpp (revision 12506)
|
---|
| 379 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Numerics/ElementMatrix.cpp (revision 12507)
|
---|
| 380 | @@ -376,45 +376,45 @@
|
---|
| 381 | void ElementMatrix::Echo(void){
|
---|
| 382 |
|
---|
| 383 | int i,j;
|
---|
| 384 | - printf("Element Matrix echo: \n");
|
---|
| 385 | - printf(" nrows: %i\n",nrows);
|
---|
| 386 | - printf(" ncols: %i\n",ncols);
|
---|
| 387 | - printf(" dofsymmetrical: %s\n",dofsymmetrical?"true":"false");
|
---|
| 388 | + _printLine_("Element Matrix echo:");
|
---|
| 389 | + _printLine_(" nrows: " << nrows);
|
---|
| 390 | + _printLine_(" ncols: " << nrows);
|
---|
| 391 | + _printLine_(" dofsymmetrical: " << (dofsymmetrical?"true":"false"));
|
---|
| 392 |
|
---|
| 393 | - printf(" values: \n");
|
---|
| 394 | + _printLine_(" values:");
|
---|
| 395 | for(i=0;i<nrows;i++){
|
---|
| 396 | - printf(" %i: ",i);
|
---|
| 397 | - for(j=0;j<ncols;j++) printf("%10g ",*(values+ncols*i+j));
|
---|
| 398 | - printf("\n");
|
---|
| 399 | + _printString_(setw(4) << right << i << ": ");
|
---|
| 400 | + for(j=0;j<ncols;j++) _printString_( " " << setw(11) << setprecision (5) << right << values[i*ncols+j]);
|
---|
| 401 | + _printLine_("");
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 | - printf(" gglobaldoflist (%p): ",gglobaldoflist);
|
---|
| 405 | - if(gglobaldoflist) for(i=0;i<nrows;i++)printf("%i ",gglobaldoflist[i]); printf("\n");
|
---|
| 406 | + _printString_(" gglobaldoflist (" << gglobaldoflist << "): ");
|
---|
| 407 | + if(gglobaldoflist) for(i=0;i<nrows;i++) _printString_(" " << gglobaldoflist[i]); _printLine_("");
|
---|
| 408 |
|
---|
| 409 | - printf(" row_fsize: %i\n",row_fsize);
|
---|
| 410 | - printf(" row_flocaldoflist (%p): ",row_flocaldoflist);
|
---|
| 411 | - if(row_flocaldoflist) for(i=0;i<row_fsize;i++)printf("%i ",row_flocaldoflist[i]); printf("\n");
|
---|
| 412 | - printf(" row_fglobaldoflist (%p): ",row_fglobaldoflist);
|
---|
| 413 | - if(row_fglobaldoflist)for(i=0;i<row_fsize;i++)printf("%i ",row_fglobaldoflist[i]); printf("\n");
|
---|
| 414 | + _printLine_(" row_fsize: " << row_fsize);
|
---|
| 415 | + _printString_(" row_flocaldoflist (" << row_flocaldoflist << "): ");
|
---|
| 416 | + if(row_flocaldoflist) for(i=0;i<row_fsize;i++) _printString_(" " << row_flocaldoflist[i]); _printLine_(" ");
|
---|
| 417 | + _printString_(" row_fglobaldoflist (" << row_fglobaldoflist << "): ");
|
---|
| 418 | + if(row_fglobaldoflist) for(i=0;i<row_fsize;i++) _printString_(" " << row_fglobaldoflist[i]); _printLine_(" ");
|
---|
| 419 |
|
---|
| 420 | - printf(" row_ssize: %i\n",row_ssize);
|
---|
| 421 | - printf(" row_slocaldoflist (%p): ",row_slocaldoflist);
|
---|
| 422 | - if(row_slocaldoflist)for(i=0;i<row_ssize;i++)printf("%i ",row_slocaldoflist[i]); printf("\n");
|
---|
| 423 | - printf(" row_sglobaldoflist (%p): ",row_sglobaldoflist);
|
---|
| 424 | - if(row_sglobaldoflist)for(i=0;i<row_ssize;i++)printf("%i ",row_sglobaldoflist[i]); printf("\n");
|
---|
| 425 | + _printLine_(" row_ssize: " << row_ssize);
|
---|
| 426 | + _printString_(" row_slocaldoflist (" << row_slocaldoflist << "): ");
|
---|
| 427 | + if(row_slocaldoflist) for(i=0;i<row_ssize;i++) _printString_(" " << row_slocaldoflist[i]); _printLine_(" ");
|
---|
| 428 | + _printString_(" row_sglobaldoflist (" << row_sglobaldoflist << "): ");
|
---|
| 429 | + if(row_sglobaldoflist) for(i=0;i<row_ssize;i++) _printString_(" " << row_sglobaldoflist[i]); _printLine_(" ");
|
---|
| 430 |
|
---|
| 431 | if(!dofsymmetrical){
|
---|
| 432 | - printf(" col_fsize: %i\n",col_fsize);
|
---|
| 433 | - printf(" col_flocaldoflist (%p): ",col_flocaldoflist);
|
---|
| 434 | - if(col_flocaldoflist)for(i=0;i<col_fsize;i++)printf("%i ",col_flocaldoflist[i]); printf("\n");
|
---|
| 435 | - printf(" col_fglobaldoflist (%p): ",col_fglobaldoflist);
|
---|
| 436 | - if(col_fglobaldoflist)for(i=0;i<col_fsize;i++)printf("%i ",col_fglobaldoflist[i]); printf("\n");
|
---|
| 437 | + _printLine_(" col_fsize: " << col_fsize);
|
---|
| 438 | + _printString_(" col_flocaldoflist (" << col_flocaldoflist << "): ");
|
---|
| 439 | + if(col_flocaldoflist) for(i=0;i<col_fsize;i++) _printString_(" " << col_flocaldoflist[i]); _printLine_(" ");
|
---|
| 440 | + _printString_(" col_fglobaldoflist (" << col_fglobaldoflist << "): ");
|
---|
| 441 | + if(col_fglobaldoflist) for(i=0;i<col_fsize;i++) _printString_(" " << col_fglobaldoflist[i]); _printLine_(" ");
|
---|
| 442 |
|
---|
| 443 | - printf(" col_ssize: %i\n",col_ssize);
|
---|
| 444 | - printf(" col_slocaldoflist (%p): ",col_slocaldoflist);
|
---|
| 445 | - if(col_slocaldoflist)for(i=0;i<col_ssize;i++)printf("%i ",col_slocaldoflist[i]); printf("\n");
|
---|
| 446 | - printf(" col_sglobaldoflist (%p): ",col_sglobaldoflist);
|
---|
| 447 | - if(col_sglobaldoflist)for(i=0;i<col_ssize;i++)printf("%i ",col_sglobaldoflist[i]); printf("\n");
|
---|
| 448 | + _printLine_(" col_ssize: " << col_ssize);
|
---|
| 449 | + _printString_(" col_slocaldoflist (" << col_slocaldoflist << "): ");
|
---|
| 450 | + if(col_slocaldoflist) for(i=0;i<col_ssize;i++) _printString_(" " << col_slocaldoflist[i]); _printLine_(" ");
|
---|
| 451 | + _printString_(" col_sglobaldoflist (" << col_sglobaldoflist << "): ");
|
---|
| 452 | + if(col_sglobaldoflist) for(i=0;i<col_ssize;i++) _printString_(" " << col_sglobaldoflist[i]); _printLine_(" ");
|
---|
| 453 | }
|
---|
| 454 | }
|
---|
| 455 | /*}}}*/
|
---|
| 456 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Numerics/ElementVector.cpp
|
---|
| 457 | ===================================================================
|
---|
| 458 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Numerics/ElementVector.cpp (revision 12506)
|
---|
| 459 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Numerics/ElementVector.cpp (revision 12507)
|
---|
| 460 | @@ -221,11 +221,6 @@
|
---|
| 461 | int i,j;
|
---|
| 462 | _printLine_("Element Vector echo:");
|
---|
| 463 | _printLine_(" nrows: " << nrows);
|
---|
| 464 | -
|
---|
| 465 | - _printLine_(" test:");
|
---|
| 466 | - for(i=0;i<nrows;i++) _printString_(" " << i);
|
---|
| 467 | - _printLine_("HERE");
|
---|
| 468 | -
|
---|
| 469 | _printLine_(" values:");
|
---|
| 470 | for(i=0;i<nrows;i++){
|
---|
| 471 | _printLine_(setw(4) << right << i << ": " << setw(10) << values[i]);
|
---|
| 472 | @@ -236,10 +231,12 @@
|
---|
| 473 | _printLine_(" ");
|
---|
| 474 |
|
---|
| 475 | _printLine_(" fsize: " << fsize);
|
---|
| 476 | - printf(" flocaldoflist (%p): ",flocaldoflist);
|
---|
| 477 | - if(flocaldoflist) for(i=0;i<fsize;i++)printf("%i ",flocaldoflist[i]); printf("\n");
|
---|
| 478 | - printf(" fglobaldoflist (%p): ",fglobaldoflist);
|
---|
| 479 | - if(fglobaldoflist)for(i=0;i<fsize;i++)printf("%i ",fglobaldoflist[i]); printf("\n");
|
---|
| 480 | + _printString_(" flocaldoflist (" << flocaldoflist << "): ");
|
---|
| 481 | + if(flocaldoflist) for(i=0;i<fsize;i++) _printString_(" " << flocaldoflist[i] );
|
---|
| 482 | + _printLine_(" ");
|
---|
| 483 | + _printString_(" fglobaldoflist (" << fglobaldoflist << "): ");
|
---|
| 484 | + if(fglobaldoflist) for(i=0;i<fsize;i++) _printString_(" " << fglobaldoflist[i] );
|
---|
| 485 | + _printLine_(" ");
|
---|
| 486 | }
|
---|
| 487 | /*}}}*/
|
---|
| 488 | /*FUNCTION ElementVector::Init{{{*/
|
---|
| 489 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp
|
---|
| 490 | ===================================================================
|
---|
| 491 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp (revision 12506)
|
---|
| 492 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp (revision 12507)
|
---|
| 493 | @@ -76,13 +76,12 @@
|
---|
| 494 | printf(" time: %g\n",this->time);
|
---|
| 495 | printf(" matrix size: %i-%i\n",this->M,this->N);
|
---|
| 496 | for (i=0;i<this->M;i++){
|
---|
| 497 | - printf(" [ ");
|
---|
| 498 | + _printString_(" [ ");
|
---|
| 499 | for (j=0;j<this->N;j++){
|
---|
| 500 | - printf(" %12.6g ",this->values[i*this->N+j]);
|
---|
| 501 | + _printString_( " " << setw(11) << setprecision (5) << this->values[i*this->N+j]);
|
---|
| 502 | }
|
---|
| 503 | - printf(" ]\n");
|
---|
| 504 | + _printLine_(" ]");
|
---|
| 505 | }
|
---|
| 506 | - printf("\n");
|
---|
| 507 |
|
---|
| 508 | }
|
---|
| 509 | /*}}}*/
|
---|
| 510 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Bamg/Mesh.cpp
|
---|
| 511 | ===================================================================
|
---|
| 512 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Bamg/Mesh.cpp (revision 12506)
|
---|
| 513 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Bamg/Mesh.cpp (revision 12507)
|
---|
| 514 | @@ -2404,14 +2404,14 @@
|
---|
| 515 | printf(" nbq = %i\n",nbq);
|
---|
| 516 | printf(" index:\n");
|
---|
| 517 | for (i=0;i<nbt;i++){
|
---|
| 518 | - printf(" %4i: [%4i %4i %4i]\n",i+1,
|
---|
| 519 | - ((BamgVertex *)triangles[i](0))?GetId(triangles[i][0])+1:0,
|
---|
| 520 | - ((BamgVertex *)triangles[i](1))?GetId(triangles[i][1])+1:0,
|
---|
| 521 | - ((BamgVertex *)triangles[i](2))?GetId(triangles[i][2])+1:0);
|
---|
| 522 | + _printLine_(" " << setw(4) << i+1 << ": ["
|
---|
| 523 | + << setw(4) << (((BamgVertex *)triangles[i](0))?GetId(triangles[i][0])+1:0) << " "
|
---|
| 524 | + << setw(4) << (((BamgVertex *)triangles[i](0))?GetId(triangles[i][1])+1:0) << " "
|
---|
| 525 | + << setw(4) << (((BamgVertex *)triangles[i](0))?GetId(triangles[i][2])+1:0) << "]");
|
---|
| 526 | }
|
---|
| 527 | printf(" coordinates:\n");
|
---|
| 528 | for (i=0;i<nbv;i++){
|
---|
| 529 | - printf(" %4i: [%g %g]\n",i+1,vertices[i].r.x,vertices[i].r.y);
|
---|
| 530 | + _printLine_(" " << setw(4) << i+1 << ": [" << vertices[i].r.x << " " << vertices[i].r.y << "]");
|
---|
| 531 | }
|
---|
| 532 |
|
---|
| 533 | }
|
---|
| 534 | @@ -4066,11 +4066,11 @@
|
---|
| 535 | printf(" length of edge in | %% of edge | Nb of edges \n");
|
---|
| 536 | printf(" --------------------+-------------+-------------\n");
|
---|
| 537 | for (i=0;i<=kmax;i++){
|
---|
| 538 | - if (i==0) printf(" %10i",0);
|
---|
| 539 | - else printf(" %10g",exp(lmin+i/delta));
|
---|
| 540 | + if (i==0) _printString_( " " << setw(10) << 0.);
|
---|
| 541 | + else _printString_( " " << setw(10) << exp(lmin+i/delta));
|
---|
| 542 | if (i==kmax) printf(" +inf ");
|
---|
| 543 | - else printf(" %10g",exp(lmin+(i+1)/delta));
|
---|
| 544 | - printf("| %10g |\n",((long) ((10000.0 * histo[i])/ nbedges))/100.0);
|
---|
| 545 | + else _printString_( " " << setw(10) << exp(lmin+(i+1)/delta));
|
---|
| 546 | + _printLine_("| " << setw(10) << (long((10000. * histo[i])/ nbedges)/100.) << " |");
|
---|
| 547 | printf(" %i\n",histo[i]);
|
---|
| 548 | }
|
---|
| 549 | printf(" --------------------+-------------+-------------\n");
|
---|
| 550 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp
|
---|
| 551 | ===================================================================
|
---|
| 552 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp (revision 12506)
|
---|
| 553 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp (revision 12507)
|
---|
| 554 | @@ -65,8 +65,7 @@
|
---|
| 555 | if (!( (nlhs==6) || (nrhs==5))){
|
---|
| 556 | mexPrintf(" %s format error.\n", __FUNCT__);
|
---|
| 557 | TriMeshProcessRiftsUsage();
|
---|
| 558 | - printf(" ");
|
---|
| 559 | - mexErrMsgTxt(" ");
|
---|
| 560 | + _error_("bad usage");
|
---|
| 561 | }
|
---|
| 562 |
|
---|
| 563 | /*Fetch index_in: */
|
---|
| 564 | @@ -81,8 +80,7 @@
|
---|
| 565 | }
|
---|
| 566 | }
|
---|
| 567 | else{
|
---|
| 568 | - printf("%s%s\n",__FUNCT__," error message: first argument should be the element list!");
|
---|
| 569 | - mexErrMsgTxt(" ");
|
---|
| 570 | + _error_("first argument should be the element list");
|
---|
| 571 | }
|
---|
| 572 |
|
---|
| 573 | /*Fetch x_in: */
|
---|
| 574 | @@ -95,8 +93,7 @@
|
---|
| 575 | }
|
---|
| 576 | }
|
---|
| 577 | else{
|
---|
| 578 | - printf("%s%s\n",__FUNCT__," error message: second argument should be the x corrdinate list!");
|
---|
| 579 | - mexErrMsgTxt(" ");
|
---|
| 580 | + _error_("second argument should be the x corrdinate list");
|
---|
| 581 | }
|
---|
| 582 |
|
---|
| 583 | /*Fetch y_in: */
|
---|
| 584 | @@ -108,8 +105,7 @@
|
---|
| 585 | }
|
---|
| 586 | }
|
---|
| 587 | else{
|
---|
| 588 | - printf("%s%s\n",__FUNCT__," error message: third argument should be the y corrdinate list!");
|
---|
| 589 | - mexErrMsgTxt(" ");
|
---|
| 590 | + _error_("third argument should be the y corrdinate list");
|
---|
| 591 | }
|
---|
| 592 |
|
---|
| 593 | /*Fetch segments_in: */
|
---|
| 594 | @@ -124,8 +120,7 @@
|
---|
| 595 | }
|
---|
| 596 | }
|
---|
| 597 | else{
|
---|
| 598 | - printf("%s%s\n",__FUNCT__," error message: fourth argument should be the segments list!");
|
---|
| 599 | - mexErrMsgTxt(" ");
|
---|
| 600 | + _error_("fourth argument should be the segments list");
|
---|
| 601 | }
|
---|
| 602 |
|
---|
| 603 | /*Fetch segment markers: */
|
---|
| 604 | @@ -137,32 +132,9 @@
|
---|
| 605 | }
|
---|
| 606 | }
|
---|
| 607 | else{
|
---|
| 608 | - printf("%s%s\n",__FUNCT__," error message: fourth argument should be the segmentmarkers list!");
|
---|
| 609 | - mexErrMsgTxt(" ");
|
---|
| 610 | + _error_("fourth argument should be the segmentmarkers list");
|
---|
| 611 | }
|
---|
| 612 |
|
---|
| 613 | - /*
|
---|
| 614 | - printf("Index: \n");
|
---|
| 615 | - for (i=0;i<nel;i++){
|
---|
| 616 | - for(j=0;j<3;j++){
|
---|
| 617 | - printf("%lf ",*(index_in+3*i+j));
|
---|
| 618 | - }
|
---|
| 619 | - printf("\n");
|
---|
| 620 | - }
|
---|
| 621 | - printf("x,y: \n");
|
---|
| 622 | - for (i=0;i<nods;i++){
|
---|
| 623 | - printf("%16.16lf %16.16lf\n",x_in[i],y_in[i]);
|
---|
| 624 | - }
|
---|
| 625 | - printf("segments:\n");
|
---|
| 626 | - for (i=0;i<num_seg;i++){
|
---|
| 627 | - for(j=0;j<3;j++){
|
---|
| 628 | - printf("%lf ",*(segments_in+3*i+j));
|
---|
| 629 | - }
|
---|
| 630 | - printf("%lf ",segmentmarkers_in[i]);
|
---|
| 631 | - printf("\n");
|
---|
| 632 | - }
|
---|
| 633 | - */
|
---|
| 634 | -
|
---|
| 635 | /*First, do some fixing on the existing mesh: we do not want any element belonging entirely to the segment list (ie:
|
---|
| 636 | *all the nodes of this element belong to the segments (tends to happen when there are corners: */
|
---|
| 637 | RemoveCornersFromRifts(&index_in,&nel,&x_in,&y_in,&nods,segments_in,segmentmarkers_in,num_seg);
|
---|