278 const char* edge_use_name =
"1D Side";
279 const char* vertex_name =
"Vertex";
283 if( stats.
stats[i].
count > 0 ) have_some =
true;
287 std::cout <<
"NO MESH" << std::endl;
292 unsigned type_width = std::max( strlen( vertex_name ), strlen( edge_use_name ) );
293 unsigned count_width = 5;
294 unsigned total_width = 5;
295 unsigned total_prec = 2;
296 unsigned precision = 5;
297 int total_log = -10000;
299 unsigned node_count_width = (unsigned)( ceil( log10( (
double)stats.
nodes ) ) ) + 1;
300 if( count_width < node_count_width ) count_width = node_count_width;
306 if( s.
count == 0 )
continue;
308 unsigned len = strlen( CN::EntityTypeName( i ) );
309 if( len > type_width ) type_width = len;
311 unsigned cw = (unsigned)( ceil( log10( (
double)s.
count ) ) ) + 1;
312 if( cw > count_width ) count_width = cw;
314 int tl = (unsigned)( ceil( log10( fabs( s.
sum ) ) ) ) + 1;
315 if( tl > total_log ) total_log = tl;
318 if( total_log > (
int)total_width || total_log == -10000 )
323 else if( total_log <= -(
int)total_width )
325 total_width = -total_log + 5;
328 else if( total_log < 1 )
330 total_width = -total_log + 4;
331 total_prec = -total_log + 1;
339 unsigned term_width = 80;
340 #if !defined( _MSC_VER ) && !defined( __MINGW32__ )
342 if( ioctl( fileno( stdout ), TIOCGWINSZ, (
char*)&
size ) == 0 ) term_width =
size.ws_col;
343 if( !term_width ) term_width = 80;
345 assert( term_width > 7 + type_width + count_width + total_width );
348 term_width -= type_width;
349 term_width -= count_width;
350 term_width -= total_width;
351 unsigned val_width = term_width / 5;
352 if( val_width < 8 ) val_width = 8;
354 printf(
"%*s %*s %*s %*s %*s %*s %*s %*s\n", type_width,
"type", count_width,
"count", total_width,
"total",
355 val_width,
"minimum", val_width,
"average", val_width,
"rms", val_width,
"maximum", val_width,
"std.dev." );
357 printf(
"%*s ", type_width,
dashes( type_width ) );
358 printf(
"%*s ", count_width,
dashes( count_width ) );
359 printf(
"%*s ", total_width,
dashes( total_width ) );
360 printf(
"%*s ", val_width,
dashes( val_width ) );
361 printf(
"%*s ", val_width,
dashes( val_width ) );
362 printf(
"%*s ", val_width,
dashes( val_width ) );
363 printf(
"%*s ", val_width,
dashes( val_width ) );
364 printf(
"%*s\n", val_width,
dashes( val_width ) );
370 if( s.
count == 0 )
continue;
375 if( tmp_dbl < -100.0 * DBL_EPSILON )
376 std::cout <<
"WARNING: stat values dubious, s^2 - sig_s = " << tmp_dbl << std::endl;
380 printf(
"%*s %*ld %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g\n", type_width,
381 i ==
MBMAXTYPE ? edge_use_name : CN::EntityTypeName( i ), count_width, s.
count, total_width, total_prec,
382 s.
sum, val_width, precision, s.
min, val_width, precision, s.
sum / s.
count, val_width, precision,
383 sqrt( s.
sqr / s.
count ), val_width, precision, s.
max, val_width, precision, sqrt( tmp_dbl ) );
385 printf(
"%*s %*lu\n", type_width, vertex_name, count_width, (
unsigned long)stats.
nodes );