stat.h
Go to the documentation of this file.
1 /*<html><pre> -<a href="qh-stat.htm"
2  >-------------------------------</a><a name="TOP">-</a>
3 
4  stat.h
5  contains all statistics that are collected for qhull
6 
7  see qh-stat.htm and stat.c
8 
9  Copyright (c) 1993-2015 The Geometry Center.
10  $Id: //main/2015/qhull/src/libqhull/stat.h#4 $$Change: 2062 $
11  $DateTime: 2016/01/17 13:13:18 $$Author: bbarber $
12 
13  recompile qhull if you change this file
14 
15  Integer statistics are Z* while real statistics are W*.
16 
17  define maydebugx to call a routine at every statistic event
18 
19 */
20 
21 #ifndef qhDEFstat
22 #define qhDEFstat 1
23 
24 #include "libqhull.h"
25 
26 /*-<a href="qh-stat.htm#TOC"
27  >-------------------------------</a><a name="KEEPstatistics">-</a>
28 
29  qh_KEEPstatistics
30  0 turns off statistic gathering (except zzdef/zzinc/zzadd/zzval/wwval)
31 */
32 #ifndef qh_KEEPstatistics
33 #define qh_KEEPstatistics 1
34 #endif
35 
36 /*-<a href="qh-stat.htm#TOC"
37  >-------------------------------</a><a name="statistics">-</a>
38 
39  Zxxx for integers, Wxxx for reals
40 
41  notes:
42  be sure that all statistics are defined in stat.c
43  otherwise initialization may core dump
44  can pick up all statistics by:
45  grep '[zw].*_[(][ZW]' *.c >z.x
46  remove trailers with query">-</a>
47  remove leaders with query-replace-regexp [ ^I]+ (
48 */
49 #if qh_KEEPstatistics
50 enum qh_statistics { /* alphabetical after Z/W */
279 
280 /*-<a href="qh-stat.htm#TOC"
281  >-------------------------------</a><a name="ZZstat">-</a>
282 
283  Zxxx/Wxxx statistics that remain defined if qh_KEEPstatistics=0
284 
285  notes:
286  be sure to use zzdef, zzinc, etc. with these statistics (no double checking!)
287 */
288 #else
289 enum qh_statistics { /* for zzdef etc. macros */
290  Zback0,
291  Zbestdist,
293  Zcheckpart,
301  Zdistcheck,
302  Zdistconvex,
303  Zdistzero,
304  Zdoc1,
305  Zdoc2,
306  Zdoc3,
307  Zdoc11,
309  Zgauss0,
310  Zminnorm,
311  Zmultiridge,
316  Zpartition,
318  Zprocessed,
319  Zretry,
320  Zridge,
321  Wridge,
322  Wridgemax,
323  Zridge0,
324  Wridge0,
325  Wridge0max,
326  Zridgemid,
327  Wridgemid,
328  Wridgemidmax,
329  Zridgeok,
330  Wridgeok,
331  Wridgeokmax,
332  Zsetplane,
333  Ztotcheck,
334  Ztotmerge,
335  ZEND};
336 #endif
337 
338 /*-<a href="qh-stat.htm#TOC"
339  >-------------------------------</a><a name="ztype">-</a>
340 
341  ztype
342  the type of a statistic sets its initial value.
343 
344  notes:
345  The type should be the same as the macro for collecting the statistic
346 */
348 
349 /*========== macros and constants =============*/
350 
351 /*-<a href="qh-stat.htm#TOC"
352  >--------------------------------</a><a name="MAYdebugx">-</a>
353 
354  MAYdebugx
355  define as maydebug() to be called frequently for error trapping
356 */
357 #define MAYdebugx
358 
359 /*-<a href="qh-stat.htm#TOC"
360  >--------------------------------</a><a name="zdef_">-</a>
361 
362  zzdef_, zdef_( type, name, doc, -1)
363  define a statistic (assumes 'qhstat.next= 0;')
364 
365  zdef_( type, name, doc, count)
366  define an averaged statistic
367  printed as name/count
368 */
369 #define zzdef_(stype,name,string,cnt) qhstat id[qhstat next++]=name; \
370  qhstat doc[name]= string; qhstat count[name]= cnt; qhstat type[name]= stype
371 #if qh_KEEPstatistics
372 #define zdef_(stype,name,string,cnt) qhstat id[qhstat next++]=name; \
373  qhstat doc[name]= string; qhstat count[name]= cnt; qhstat type[name]= stype
374 #else
375 #define zdef_(type,name,doc,count)
376 #endif
377 
378 /*-<a href="qh-stat.htm#TOC"
379  >--------------------------------</a><a name="zinc_">-</a>
380 
381  zzinc_( name ), zinc_( name)
382  increment an integer statistic
383 */
384 #define zzinc_(id) {MAYdebugx; qhstat stats[id].i++;}
385 #if qh_KEEPstatistics
386 #define zinc_(id) {MAYdebugx; qhstat stats[id].i++;}
387 #else
388 #define zinc_(id) {}
389 #endif
390 
391 /*-<a href="qh-stat.htm#TOC"
392  >--------------------------------</a><a name="zadd_">-</a>
393 
394  zzadd_( name, value ), zadd_( name, value ), wadd_( name, value )
395  add value to an integer or real statistic
396 */
397 #define zzadd_(id, val) {MAYdebugx; qhstat stats[id].i += (val);}
398 #define wwadd_(id, val) {MAYdebugx; qhstat stats[id].r += (val);}
399 #if qh_KEEPstatistics
400 #define zadd_(id, val) {MAYdebugx; qhstat stats[id].i += (val);}
401 #define wadd_(id, val) {MAYdebugx; qhstat stats[id].r += (val);}
402 #else
403 #define zadd_(id, val) {}
404 #define wadd_(id, val) {}
405 #endif
406 
407 /*-<a href="qh-stat.htm#TOC"
408  >--------------------------------</a><a name="zval_">-</a>
409 
410  zzval_( name ), zval_( name ), wwval_( name )
411  set or return value of a statistic
412 */
413 #define zzval_(id) ((qhstat stats[id]).i)
414 #define wwval_(id) ((qhstat stats[id]).r)
415 #if qh_KEEPstatistics
416 #define zval_(id) ((qhstat stats[id]).i)
417 #define wval_(id) ((qhstat stats[id]).r)
418 #else
419 #define zval_(id) qhstat tempi
420 #define wval_(id) qhstat tempr
421 #endif
422 
423 /*-<a href="qh-stat.htm#TOC"
424  >--------------------------------</a><a name="zmax_">-</a>
425 
426  zmax_( id, val ), wmax_( id, value )
427  maximize id with val
428 */
429 #define wwmax_(id, val) {MAYdebugx; maximize_(qhstat stats[id].r,(val));}
430 #if qh_KEEPstatistics
431 #define zmax_(id, val) {MAYdebugx; maximize_(qhstat stats[id].i,(val));}
432 #define wmax_(id, val) {MAYdebugx; maximize_(qhstat stats[id].r,(val));}
433 #else
434 #define zmax_(id, val) {}
435 #define wmax_(id, val) {}
436 #endif
437 
438 /*-<a href="qh-stat.htm#TOC"
439  >--------------------------------</a><a name="zmin_">-</a>
440 
441  zmin_( id, val ), wmin_( id, value )
442  minimize id with val
443 */
444 #if qh_KEEPstatistics
445 #define zmin_(id, val) {MAYdebugx; minimize_(qhstat stats[id].i,(val));}
446 #define wmin_(id, val) {MAYdebugx; minimize_(qhstat stats[id].r,(val));}
447 #else
448 #define zmin_(id, val) {}
449 #define wmin_(id, val) {}
450 #endif
451 
452 /*================== stat.h types ==============*/
453 
454 
455 /*-<a href="qh-stat.htm#TOC"
456  >--------------------------------</a><a name="intrealT">-</a>
457 
458  intrealT
459  union of integer and real, used for statistics
460 */
461 typedef union intrealT intrealT; /* union of int and realT */
462 union intrealT {
463  int i;
465 };
466 
467 /*-<a href="qh-stat.htm#TOC"
468  >--------------------------------</a><a name="qhstat">-</a>
469 
470  qhstat
471  global data structure for statistics, similar to qh and qhrbox
472 
473  notes:
474  access to qh_qhstat is via the "qhstat" macro. There are two choices
475  qh_QHpointer = 1 access globals via a pointer
476  enables qh_saveqhull() and qh_restoreqhull()
477  = 0 qh_qhstat is a static data structure
478  only one instance of qhull() can be active at a time
479  default value
480  qh_QHpointer is defined in libqhull.h
481  qh_QHpointer_dllimport and qh_dllimport define qh_qh as __declspec(dllimport) [libqhull.h]
482 
483  allocated in stat.c using qh_malloc()
484 */
485 #ifndef DEFqhstatT
486 #define DEFqhstatT 1
487 typedef struct qhstatT qhstatT;
488 #endif
489 
490 #if qh_QHpointer_dllimport
491 #define qhstat qh_qhstat->
492 __declspec(dllimport) extern qhstatT *qh_qhstat;
493 #elif qh_QHpointer
494 #define qhstat qh_qhstat->
495 extern qhstatT *qh_qhstat;
496 #elif qh_dllimport
497 #define qhstat qh_qhstat.
498 __declspec(dllimport) extern qhstatT qh_qhstat;
499 #else
500 #define qhstat qh_qhstat.
501 extern qhstatT qh_qhstat;
502 #endif
503 struct qhstatT {
504  intrealT stats[ZEND]; /* integer and real statistics */
505  unsigned char id[ZEND+10]; /* id's in print order */
506  const char *doc[ZEND]; /* array of documentation strings */
507  short int count[ZEND]; /* -1 if none, else index of count to use */
508  char type[ZEND]; /* type, see ztypes above */
509  char printed[ZEND]; /* true, if statistic has been printed */
510  intrealT init[ZTYPEend]; /* initial values by types, set initstatistics */
511 
512  int next; /* next index for zdef_ */
513  int precision; /* index for precision problems */
514  int vridges; /* index for Voronoi ridges */
515  int tempi;
517 };
518 
519 /*========== function prototypes ===========*/
520 
521 void qh_allstatA(void);
522 void qh_allstatB(void);
523 void qh_allstatC(void);
524 void qh_allstatD(void);
525 void qh_allstatE(void);
526 void qh_allstatE2(void);
527 void qh_allstatF(void);
528 void qh_allstatG(void);
529 void qh_allstatH(void);
530 void qh_allstatI(void);
531 void qh_allstatistics(void);
532 void qh_collectstatistics(void);
533 void qh_freestatistics(void);
534 void qh_initstatistics(void);
535 boolT qh_newstats(int idx, int *nextindex);
536 boolT qh_nostatistic(int i);
537 void qh_printallstatistics(FILE *fp, const char *string);
538 void qh_printstatistics(FILE *fp, const char *string);
539 void qh_printstatlevel(FILE *fp, int id);
540 void qh_printstats(FILE *fp, int idx, int *nextindex);
541 realT qh_stddev(int num, realT tot, realT tot2, realT *ave);
542 
543 #endif /* qhDEFstat */
Definition: stat.h:131
Definition: stat.h:236
ztypes
Definition: stat.h:347
void qh_freestatistics(void)
Definition: stat.c:430
Definition: stat.h:57
Definition: stat.h:202
#define boolT
Definition: libqhull.h:121
void qh_allstatC(void)
Definition: stat.c:90
Definition: stat.h:115
void qh_allstatI(void)
Definition: stat.c:270
Definition: stat.h:67
void qh_printstats(FILE *fp, int idx, int *nextindex)
Definition: stat.c:674
Definition: stat.h:89
Definition: stat.h:162
Definition: stat.h:261
Definition: stat.h:234
Definition: stat.h:99
Definition: stat.h:111
Definition: stat.h:125
Definition: stat.h:59
Definition: stat.h:122
Definition: stat.h:347
Definition: stat.h:119
Definition: stat.h:120
Definition: stat.h:347
void qh_allstatH(void)
Definition: stat.c:241
Definition: stat.h:462
Definition: stat.h:186
Definition: stat.h:347
Definition: stat.h:113
Definition: stat.h:80
Definition: stat.h:65
void qh_printallstatistics(FILE *fp, const char *string)
Definition: stat.c:559
Definition: stat.h:114
boolT qh_nostatistic(int i)
Definition: stat.c:542
Definition: stat.h:503
realT tempr
Definition: stat.h:516
Definition: stat.h:243
Definition: stat.h:347
Definition: stat.h:347
Definition: stat.h:242
Definition: stat.h:106
void qh_allstatG(void)
Definition: stat.c:218
void qh_allstatF(void)
Definition: stat.c:189
int next
Definition: stat.h:512
realT r
Definition: stat.h:464
Definition: stat.h:121
Definition: stat.h:149
int i
Definition: stat.h:463
Definition: stat.h:112
Definition: stat.h:55
Definition: stat.h:116
void qh_allstatE(void)
Definition: stat.c:148
Definition: stat.h:118
Definition: stat.h:95
Definition: stat.h:62
int precision
Definition: stat.h:513
Definition: stat.h:347
Definition: stat.h:347
Definition: stat.h:231
void qh_initstatistics(void)
Definition: stat.c:450
Definition: stat.h:60
Definition: stat.h:75
void qh_printstatistics(FILE *fp, const char *string)
Definition: stat.c:578
realT qh_stddev(int num, realT tot, realT tot2, realT *ave)
Definition: stat.c:702
void qh_allstatA(void)
Definition: stat.c:36
Definition: stat.h:278
void qh_allstatistics(void)
Definition: stat.c:301
Definition: stat.h:56
qhstatT qh_qhstat
Definition: stat.c:21
Definition: stat.h:130
qh_statistics
Definition: stat.h:50
Definition: stat.h:270
Definition: stat.h:54
Definition: stat.h:96
Definition: stat.h:200
Definition: stat.h:94
Definition: stat.h:347
Definition: stat.h:237
int vridges
Definition: stat.h:514
Definition: stat.h:347
Definition: stat.h:117
Definition: stat.h:197
Definition: stat.h:61
void qh_collectstatistics(void)
Definition: stat.c:316
boolT qh_newstats(int idx, int *nextindex)
Definition: stat.c:520
void qh_allstatD(void)
Definition: stat.c:122
Definition: stat.h:144
Definition: stat.h:274
void qh_allstatE2(void)
Definition: stat.c:170
#define realT
Definition: user.h:154
void qh_printstatlevel(FILE *fp, int id)
Definition: stat.c:638
int tempi
Definition: stat.h:515
void qh_allstatB(void)
Definition: stat.c:60
Definition: stat.h:233


hpp-fcl
Author(s):
autogenerated on Fri Jun 2 2023 02:39:02