stat_r.h
Go to the documentation of this file.
1 /*<html><pre> -<a href="qh-stat_r.htm"
2  >-------------------------------</a><a name="TOP">-</a>
3 
4  stat_r.h
5  contains all statistics that are collected for qhull
6 
7  see qh-stat_r.htm and stat_r.c
8 
9  Copyright (c) 1993-2015 The Geometry Center.
10  $Id: //main/2015/qhull/src/libqhull_r/stat_r.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 /* Depends on realT. Do not include libqhull_r to avoid circular dependency */
25 
26 #ifndef DEFqhT
27 #define DEFqhT 1
28 typedef struct qhT qhT; /* Defined by libqhull_r.h */
29 #endif
30 
31 #ifndef DEFqhstatT
32 #define DEFqhstatT 1
33 typedef struct qhstatT qhstatT; /* Defined here */
34 #endif
35 
36 /*-<a href="qh-stat_r.htm#TOC"
37  >-------------------------------</a><a name="KEEPstatistics">-</a>
38 
39  qh_KEEPstatistics
40  0 turns off statistic gathering (except zzdef/zzinc/zzadd/zzval/wwval)
41 */
42 #ifndef qh_KEEPstatistics
43 #define qh_KEEPstatistics 1
44 #endif
45 
46 /*-<a href="qh-stat_r.htm#TOC"
47  >-------------------------------</a><a name="statistics">-</a>
48 
49  Zxxx for integers, Wxxx for reals
50 
51  notes:
52  be sure that all statistics are defined in stat_r.c
53  otherwise initialization may core dump
54  can pick up all statistics by:
55  grep '[zw].*_[(][ZW]' *.c >z.x
56  remove trailers with query">-</a>
57  remove leaders with query-replace-regexp [ ^I]+ (
58 */
59 #if qh_KEEPstatistics
60 enum qh_statistics { /* alphabetical after Z/W */
289 
290 /*-<a href="qh-stat_r.htm#TOC"
291  >-------------------------------</a><a name="ZZstat">-</a>
292 
293  Zxxx/Wxxx statistics that remain defined if qh_KEEPstatistics=0
294 
295  notes:
296  be sure to use zzdef, zzinc, etc. with these statistics (no double checking!)
297 */
298 #else
299 enum qh_statistics { /* for zzdef etc. macros */
300  Zback0,
301  Zbestdist,
303  Zcheckpart,
311  Zdistcheck,
312  Zdistconvex,
313  Zdistzero,
314  Zdoc1,
315  Zdoc2,
316  Zdoc3,
317  Zdoc11,
319  Zgauss0,
320  Zminnorm,
321  Zmultiridge,
326  Zpartition,
328  Zprocessed,
329  Zretry,
330  Zridge,
331  Wridge,
332  Wridgemax,
333  Zridge0,
334  Wridge0,
335  Wridge0max,
336  Zridgemid,
337  Wridgemid,
338  Wridgemidmax,
339  Zridgeok,
340  Wridgeok,
341  Wridgeokmax,
342  Zsetplane,
343  Ztotcheck,
344  Ztotmerge,
345  ZEND};
346 #endif
347 
348 /*-<a href="qh-stat_r.htm#TOC"
349  >-------------------------------</a><a name="ztype">-</a>
350 
351  ztype
352  the type of a statistic sets its initial value.
353 
354  notes:
355  The type should be the same as the macro for collecting the statistic
356 */
358 
359 /*========== macros and constants =============*/
360 
361 /*-<a href="qh-stat_r.htm#TOC"
362  >--------------------------------</a><a name="MAYdebugx">-</a>
363 
364  MAYdebugx
365  define as maydebug() to be called frequently for error trapping
366 */
367 #define MAYdebugx
368 
369 /*-<a href="qh-stat_r.htm#TOC"
370  >--------------------------------</a><a name="zdef_">-</a>
371 
372  zzdef_, zdef_( type, name, doc, -1)
373  define a statistic (assumes 'qhstat.next= 0;')
374 
375  zdef_( type, name, doc, count)
376  define an averaged statistic
377  printed as name/count
378 */
379 #define zzdef_(stype,name,string,cnt) qh->qhstat.id[qh->qhstat.next++]=name; \
380  qh->qhstat.doc[name]= string; qh->qhstat.count[name]= cnt; qh->qhstat.type[name]= stype
381 #if qh_KEEPstatistics
382 #define zdef_(stype,name,string,cnt) qh->qhstat.id[qh->qhstat.next++]=name; \
383  qh->qhstat.doc[name]= string; qh->qhstat.count[name]= cnt; qh->qhstat.type[name]= stype
384 #else
385 #define zdef_(type,name,doc,count)
386 #endif
387 
388 /*-<a href="qh-stat_r.htm#TOC"
389  >--------------------------------</a><a name="zinc_">-</a>
390 
391  zzinc_( name ), zinc_( name)
392  increment an integer statistic
393 */
394 #define zzinc_(id) {MAYdebugx; qh->qhstat.stats[id].i++;}
395 #if qh_KEEPstatistics
396 #define zinc_(id) {MAYdebugx; qh->qhstat.stats[id].i++;}
397 #else
398 #define zinc_(id) {}
399 #endif
400 
401 /*-<a href="qh-stat_r.htm#TOC"
402  >--------------------------------</a><a name="zadd_">-</a>
403 
404  zzadd_( name, value ), zadd_( name, value ), wadd_( name, value )
405  add value to an integer or real statistic
406 */
407 #define zzadd_(id, val) {MAYdebugx; qh->qhstat.stats[id].i += (val);}
408 #define wwadd_(id, val) {MAYdebugx; qh->qhstat.stats[id].r += (val);}
409 #if qh_KEEPstatistics
410 #define zadd_(id, val) {MAYdebugx; qh->qhstat.stats[id].i += (val);}
411 #define wadd_(id, val) {MAYdebugx; qh->qhstat.stats[id].r += (val);}
412 #else
413 #define zadd_(id, val) {}
414 #define wadd_(id, val) {}
415 #endif
416 
417 /*-<a href="qh-stat_r.htm#TOC"
418  >--------------------------------</a><a name="zval_">-</a>
419 
420  zzval_( name ), zval_( name ), wwval_( name )
421  set or return value of a statistic
422 */
423 #define zzval_(id) ((qh->qhstat.stats[id]).i)
424 #define wwval_(id) ((qh->qhstat.stats[id]).r)
425 #if qh_KEEPstatistics
426 #define zval_(id) ((qh->qhstat.stats[id]).i)
427 #define wval_(id) ((qh->qhstat.stats[id]).r)
428 #else
429 #define zval_(id) qh->qhstat.tempi
430 #define wval_(id) qh->qhstat.tempr
431 #endif
432 
433 /*-<a href="qh-stat_r.htm#TOC"
434  >--------------------------------</a><a name="zmax_">-</a>
435 
436  zmax_( id, val ), wmax_( id, value )
437  maximize id with val
438 */
439 #define wwmax_(id, val) {MAYdebugx; maximize_(qh->qhstat.stats[id].r,(val));}
440 #if qh_KEEPstatistics
441 #define zmax_(id, val) {MAYdebugx; maximize_(qh->qhstat.stats[id].i,(val));}
442 #define wmax_(id, val) {MAYdebugx; maximize_(qh->qhstat.stats[id].r,(val));}
443 #else
444 #define zmax_(id, val) {}
445 #define wmax_(id, val) {}
446 #endif
447 
448 /*-<a href="qh-stat_r.htm#TOC"
449  >--------------------------------</a><a name="zmin_">-</a>
450 
451  zmin_( id, val ), wmin_( id, value )
452  minimize id with val
453 */
454 #if qh_KEEPstatistics
455 #define zmin_(id, val) {MAYdebugx; minimize_(qh->qhstat.stats[id].i,(val));}
456 #define wmin_(id, val) {MAYdebugx; minimize_(qh->qhstat.stats[id].r,(val));}
457 #else
458 #define zmin_(id, val) {}
459 #define wmin_(id, val) {}
460 #endif
461 
462 /*================== stat_r.h types ==============*/
463 
464 
465 /*-<a href="qh-stat_r.htm#TOC"
466  >--------------------------------</a><a name="intrealT">-</a>
467 
468  intrealT
469  union of integer and real, used for statistics
470 */
471 typedef union intrealT intrealT; /* union of int and realT */
472 union intrealT {
473  int i;
474  realT r;
475 };
476 
477 /*-<a href="qh-stat_r.htm#TOC"
478  >--------------------------------</a><a name="qhstat">-</a>
479 
480  qhstat
481  Data structure for statistics, similar to qh and qhrbox
482 
483  Allocated as part of qhT (libqhull_r.h)
484 */
485 
486 struct qhstatT {
487  intrealT stats[ZEND]; /* integer and real statistics */
488  unsigned char id[ZEND+10]; /* id's in print order */
489  const char *doc[ZEND]; /* array of documentation strings */
490  short int count[ZEND]; /* -1 if none, else index of count to use */
491  char type[ZEND]; /* type, see ztypes above */
492  char printed[ZEND]; /* true, if statistic has been printed */
493  intrealT init[ZTYPEend]; /* initial values by types, set initstatistics */
494 
495  int next; /* next index for zdef_ */
496  int precision; /* index for precision problems */
497  int vridges; /* index for Voronoi ridges */
498  int tempi;
499  realT tempr;
500 };
501 
502 /*========== function prototypes ===========*/
503 
504 void qh_allstatA(qhT *qh);
505 void qh_allstatB(qhT *qh);
506 void qh_allstatC(qhT *qh);
507 void qh_allstatD(qhT *qh);
508 void qh_allstatE(qhT *qh);
509 void qh_allstatE2(qhT *qh);
510 void qh_allstatF(qhT *qh);
511 void qh_allstatG(qhT *qh);
512 void qh_allstatH(qhT *qh);
513 void qh_allstatI(qhT *qh);
514 void qh_allstatistics(qhT *qh);
516 void qh_initstatistics(qhT *qh);
517 boolT qh_newstats(qhT *qh, int idx, int *nextindex);
518 boolT qh_nostatistic(qhT *qh, int i);
519 void qh_printallstatistics(qhT *qh, FILE *fp, const char *string);
520 void qh_printstatistics(qhT *qh, FILE *fp, const char *string);
521 void qh_printstatlevel(qhT *qh, FILE *fp, int id);
522 void qh_printstats(qhT *qh, FILE *fp, int idx, int *nextindex);
523 realT qh_stddev(int num, realT tot, realT tot2, realT *ave);
524 
525 #endif /* qhDEFstat */
Definition: libqhull.h:465
ztypes
Definition: stat.h:347
void qh_printstatistics(qhT *qh, FILE *fp, const char *string)
Definition: stat_r.c:543
Definition: stat_r.h:243
Definition: stat_r.h:104
void qh_allstatE(qhT *qh)
Definition: stat_r.c:140
#define boolT
Definition: libqhull.h:121
void qh_allstatG(qhT *qh)
Definition: stat_r.c:210
void qh_printallstatistics(qhT *qh, FILE *fp, const char *string)
Definition: stat_r.c:524
Definition: stat_r.h:127
Definition: stat_r.h:288
Definition: stat_r.h:241
Definition: stat_r.h:121
boolT qh_nostatistic(qhT *qh, int i)
Definition: stat_r.c:507
Definition: stat_r.h:129
Definition: stat_r.h:64
void qh_printstats(qhT *qh, FILE *fp, int idx, int *nextindex)
Definition: stat_r.c:639
Definition: stat.h:462
Definition: stat_r.h:75
void qh_allstatA(qhT *qh)
Definition: stat_r.c:28
void qh_allstatistics(qhT *qh)
Definition: stat_r.c:293
Definition: stat_r.h:122
Definition: stat_r.h:357
void qh_allstatI(qhT *qh)
Definition: stat_r.c:262
void qh_allstatB(qhT *qh)
Definition: stat_r.c:52
void qh_allstatF(qhT *qh)
Definition: stat_r.c:181
void qh_collectstatistics(qhT *qh)
Definition: stat_r.c:308
Definition: stat_r.h:244
Definition: stat.h:503
Definition: stat_r.h:357
Definition: stat_r.h:124
void qh_allstatH(qhT *qh)
Definition: stat_r.c:233
#define qh
Definition: libqhull.h:457
Definition: stat_r.h:280
realT qh_stddev(int num, realT tot, realT tot2, realT *ave)
Definition: stat.c:702
Definition: stat_r.h:357
realT r
Definition: stat.h:464
int i
Definition: stat.h:463
void qh_allstatD(qhT *qh)
Definition: stat_r.c:114
void qh_allstatE2(qhT *qh)
Definition: stat_r.c:162
boolT qh_newstats(qhT *qh, int idx, int *nextindex)
Definition: stat_r.c:485
Definition: stat_r.h:357
Definition: stat_r.h:357
Definition: stat_r.h:357
Definition: stat_r.h:128
qh_statistics
Definition: stat.h:50
Definition: stat_r.h:131
Definition: stat_r.h:357
Definition: stat_r.h:123
void qh_allstatC(qhT *qh)
Definition: stat_r.c:82
Definition: stat_r.h:65
Definition: stat_r.h:130
void qh_initstatistics(qhT *qh)
Definition: stat_r.c:426
Definition: stat_r.h:99
Definition: stat_r.h:126
Definition: stat_r.h:125
Definition: stat_r.h:132
void qh_printstatlevel(qhT *qh, FILE *fp, int id)
Definition: stat_r.c:603
#define realT
Definition: user.h:154
Definition: stat_r.h:357


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