Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

stat.h

Go to the documentation of this file.
00001   /*<html><pre>  -<a                             href="qh-stat.htm"
00002   >-------------------------------</a><a name="TOP">-</a>
00003 
00004    stat.h 
00005      contains all statistics that are collected for qhull
00006 
00007    see qh-stat.htm and stat.c
00008 
00009    copyright (c) 1993-2001, The Geometry Center
00010 
00011    recompile qhull if you change this file
00012 
00013    Integer statistics are Z* while real statistics are W*.  
00014 
00015    define maydebugx to call a routine at every statistic event
00016 
00017 */
00018 
00019 #ifndef qhDEFstat
00020 #define qhDEFstat 1
00021 
00022 
00023 /*-<a                             href="qh-stat.htm#TOC"
00024   >-------------------------------</a><a name="KEEPstatistics">-</a>
00025 
00026   qh_KEEPstatistics
00027     0 turns off statistic gathering (except zzdef/zzinc/zzadd/zzval/wwval)
00028 */
00029 #ifndef qh_KEEPstatistics
00030 #define qh_KEEPstatistics 1
00031 #endif
00032 
00033 /*-<a                             href="qh-stat.htm#TOC"
00034   >-------------------------------</a><a name="statistics">-</a>
00035 
00036   Zxxx for integers, Wxxx for reals
00037 
00038   notes:
00039     be sure that all statistics are defined in stat.c
00040       otherwise initialization may core dump
00041     can pick up all statistics by:
00042       grep '[zw].*_[(][ZW]' *.c >z.x
00043     remove trailers with query">-</a>
00044     remove leaders with  query-replace-regexp [ ^I]+  (
00045 */
00046 #if qh_KEEPstatistics
00047 enum statistics {     /* alphabetical after Z/W */
00048     Zacoplanar,
00049     Wacoplanarmax,
00050     Wacoplanartot,
00051     Zangle,
00052     Wangle,
00053     Wanglemax,
00054     Wanglemin,
00055     Zangletests,
00056     Wareatot,
00057     Wareamax,
00058     Wareamin,
00059     Zavoidold,
00060     Wavoidoldmax,
00061     Wavoidoldtot,
00062     Zback0,
00063     Zbestcentrum,
00064     Zbestdist,
00065     Zcentrumtests,
00066     Zcheckpart,
00067     Zcomputefurthest,
00068     Zconcave,
00069     Wconcavemax,
00070     Wconcavetot,
00071     Zconcaveridges,
00072     Zconcaveridge,
00073     Zcoplanar,
00074     Wcoplanarmax,
00075     Wcoplanartot,
00076     Zcoplanarangle,
00077     Zcoplanarcentrum,
00078     Zcoplanarhorizon,
00079     Zcoplanarinside,
00080     Zcoplanarpart,
00081     Zcoplanarridges,
00082     Wcpu,
00083     Zcyclefacetmax,
00084     Zcyclefacettot,
00085     Zcyclehorizon,
00086     Zcyclevertex,
00087     Zdegen,
00088     Wdegenmax,
00089     Wdegentot,
00090     Zdegenvertex,
00091     Zdelfacetdup, 
00092     Zdelridge,
00093     Zdelvertextot,
00094     Zdelvertexmax,
00095     Zdetsimplex,
00096     Zdistcheck,
00097     Zdistconvex,
00098     Zdistgood,
00099     Zdistio,
00100     Zdistplane,
00101     Zdiststat,
00102     Zdistvertex,
00103     Zdistzero,
00104     Zdoc1,
00105     Zdoc2,
00106     Zdoc3,
00107     Zdoc4,
00108     Zdoc5,
00109     Zdoc6,
00110     Zdoc7,
00111     Zdoc8,
00112     Zdoc9,
00113     Zdoc10,
00114     Zdoc11,
00115     Zdropdegen,
00116     Zdropneighbor,
00117     Zdupflip,
00118     Zduplicate,
00119     Wduplicatemax,
00120     Wduplicatetot,
00121     Zdupridge,
00122     Zdupsame,
00123     Zfindfail,
00124     Zflipped, 
00125     Wflippedmax, 
00126     Wflippedtot, 
00127     Zflippedfacets,
00128     Zgauss0,
00129     Zgoodfacet,
00130     Zhashlookup,
00131     Zhashridge,
00132     Zhashridgetest,
00133     Zhashtests,
00134     Zinsidevisible,
00135     Zintersect,
00136     Zintersectfail,
00137     Zintersectmax,
00138     Zintersectnum,
00139     Zintersecttot,
00140     Zmaxneighbors,
00141     Wmaxout,
00142     Wmaxoutside,
00143     Zmaxridges,
00144     Zmaxvertex,
00145     Zmaxvertices,
00146     Zmaxvneighbors,
00147     Zmemfacets,
00148     Zmempoints,
00149     Zmemridges,
00150     Zmemvertices,
00151     Zmergeflipdup,
00152     Zmergehorizon,
00153     Zmergeinittot,
00154     Zmergeinitmax,
00155     Zmergeinittot2,
00156     Zmergeintohorizon,
00157     Zmergenew,
00158     Zmergesettot,
00159     Zmergesetmax,
00160     Zmergesettot2,
00161     Zmergesimplex,
00162     Zmergevertex,
00163     Wmindenom,
00164     Wminvertex,
00165     Zminnorm,
00166     Zmultiridge,
00167     Znearlysingular,
00168     Zneighbor,
00169     Wnewbalance,
00170     Wnewbalance2,
00171     Znewfacettot,
00172     Znewfacetmax,
00173     Znewvertex,
00174     Wnewvertex,
00175     Wnewvertexmax,
00176     Znoarea,
00177     Znonsimplicial,
00178     Znowsimplicial,
00179     Znotgood,
00180     Znotgoodnew,
00181     Znotmax,
00182     Znumfacets,
00183     Znummergemax,
00184     Znummergetot,
00185     Znumneighbors,
00186     Znumridges,
00187     Znumvertices,
00188     Znumvisibility,
00189     Znumvneighbors,
00190     Zonehorizon,
00191     Zpartcoplanar,
00192     Zpartinside,
00193     Zpartition, 
00194     Zpartitionall,
00195     Zpartnear,
00196     Zpbalance,
00197     Wpbalance,
00198     Wpbalance2, 
00199     Zpostfacets, 
00200     Zpremergetot,
00201     Zprocessed,
00202     Zremvertex,
00203     Zremvertexdel,
00204     Zrenameall,
00205     Zrenamepinch,
00206     Zrenameshare,
00207     Zretry,
00208     Wretrymax,
00209     Zridge,
00210     Wridge,
00211     Wridgemax,
00212     Zridge0,
00213     Wridge0,
00214     Wridge0max,
00215     Zridgemid,
00216     Wridgemid,
00217     Wridgemidmax,
00218     Zridgeok,
00219     Wridgeok,
00220     Wridgeokmax,
00221     Zsearchpoints,
00222     Zsetplane,
00223     Ztestvneighbor,
00224     Ztotcheck,
00225     Ztothorizon,
00226     Ztotmerge,
00227     Ztotpartcoplanar,
00228     Ztotpartition,
00229     Ztotridges,
00230     Ztotvertices,
00231     Ztotvisible,
00232     Wvertexmax,
00233     Wvertexmin,
00234     Zvertexridge,
00235     Zvertexridgetot,
00236     Zvertexridgemax,
00237     Zvertices,
00238     Zvisfacettot,
00239     Zvisfacetmax,
00240     Zvisvertextot,
00241     Zvisvertexmax,
00242     Zwidefacet,
00243     Zwidevertices,
00244     ZEND};
00245 
00246 /*-<a                             href="qh-stat.htm#TOC"
00247   >-------------------------------</a><a name="ZZstat">-</a>
00248 
00249   Zxxx/Wxxx statistics that remain defined if qh_KEEPstatistics=0
00250 
00251   notes:
00252     be sure to use zzdef, zzinc, etc. with these statistics (no double checking!)
00253 */
00254 #else
00255 enum statistics {     /* for zzdef etc. macros */
00256   Zback0,
00257   Zbestdist,
00258   Zcentrumtests,
00259   Zconcaveridges,
00260   Zcoplanarhorizon,
00261   Zcoplanarpart,
00262   Zcoplanarridges,
00263   Zcyclefacettot,
00264   Zcyclehorizon,
00265   Zdistcheck,
00266   Zdistconvex,
00267   Zdistzero,
00268   Zdoc1,
00269   Zdoc2,
00270   Zdoc3,
00271   Zdoc11,
00272   Zflippedfacets,
00273   Zgauss0,
00274   Zminnorm,
00275   Zmultiridge,
00276   Znearlysingular,
00277   Wnewvertexmax,
00278   Znumvisibility,
00279   Zpartcoplanar,
00280   Zpartition,
00281   Zpartitionall,
00282   Zprocessed,
00283   Zretry,
00284   Zridge,
00285   Wridge,
00286   Wridgemax,
00287   Zridge0,
00288   Wridge0,
00289   Wridge0max,
00290   Zridgemid,
00291   Wridgemid,
00292   Wridgemidmax,
00293   Zridgeok,
00294   Wridgeok,
00295   Wridgeokmax,
00296   Zsetplane,
00297   Ztotmerge,
00298     ZEND};
00299 #endif
00300 
00301 /*-<a                             href="qh-stat.htm#TOC"
00302   >-------------------------------</a><a name="ztype">-</a>
00303   
00304   ztype
00305     the type of a statistic sets its initial value.  
00306 
00307   notes:
00308     The type should be the same as the macro for collecting the statistic
00309 */
00310 enum ztypes {zdoc,zinc,zadd,zmax,zmin,ZTYPEreal,wadd,wmax,wmin,ZTYPEend};
00311 
00312 /*========== macros and constants =============*/
00313 
00314 /*-<a                             href="qh-stat.htm#TOC"
00315   >--------------------------------</a><a name="MAYdebugx">-</a>
00316   
00317   MAYdebugx
00318     define as maydebug() to be called frequently for error trapping
00319 */
00320 #define MAYdebugx 
00321 
00322 /*-<a                             href="qh-stat.htm#TOC"
00323   >--------------------------------</a><a name="zdef_">-</a>
00324   
00325   zzdef_, zdef_( type, name, doc, -1)
00326     define a statistic (assumes 'qhstat.next= 0;')
00327 
00328   zdef_( type, name, doc, count)
00329     define an averaged statistic
00330     printed as name/count
00331 */
00332 #define zzdef_(stype,name,string,cnt) qhstat id[qhstat next++]=name; \
00333    qhstat doc[name]= string; qhstat count[name]= cnt; qhstat type[name]= stype
00334 #if qh_KEEPstatistics
00335 #define zdef_(stype,name,string,cnt) qhstat id[qhstat next++]=name; \
00336    qhstat doc[name]= string; qhstat count[name]= cnt; qhstat type[name]= stype
00337 #else
00338 #define zdef_(type,name,doc,count)
00339 #endif
00340 
00341 /*-<a                             href="qh-stat.htm#TOC"
00342   >--------------------------------</a><a name="zinc_">-</a>
00343   
00344   zzinc_( name ), zinc_( name)
00345     increment an integer statistic
00346 */
00347 #define zzinc_(id) {MAYdebugx; qhstat stats[id].i++;}
00348 #if qh_KEEPstatistics
00349 #define zinc_(id) {MAYdebugx; qhstat stats[id].i++;}
00350 #else
00351 #define zinc_(id) {}
00352 #endif
00353 
00354 /*-<a                             href="qh-stat.htm#TOC"
00355   >--------------------------------</a><a name="zadd_">-</a>
00356   
00357   zzadd_( name, value ), zadd_( name, value ), wadd_( name, value )
00358     add value to an integer or real statistic
00359 */
00360 #define zzadd_(id, val) {MAYdebugx; qhstat stats[id].i += (val);}
00361 #define wwadd_(id, val) {MAYdebugx; qhstat stats[id].r += (val);}
00362 #if qh_KEEPstatistics
00363 #define zadd_(id, val) {MAYdebugx; qhstat stats[id].i += (val);}
00364 #define wadd_(id, val) {MAYdebugx; qhstat stats[id].r += (val);}
00365 #else
00366 #define zadd_(id, val) {}
00367 #define wadd_(id, val) {}
00368 #endif
00369 
00370 /*-<a                             href="qh-stat.htm#TOC"
00371   >--------------------------------</a><a name="zval_">-</a>
00372 
00373   zzval_( name ), zval_( name ), wwval_( name )
00374     set or return value of a statistic
00375 */
00376 #define zzval_(id) ((qhstat stats[id]).i)
00377 #define wwval_(id) ((qhstat stats[id]).r)
00378 #if qh_KEEPstatistics
00379 #define zval_(id) ((qhstat stats[id]).i)
00380 #define wval_(id) ((qhstat stats[id]).r)
00381 #else
00382 #define zval_(id) qhstat tempi
00383 #define wval_(id) qhstat tempr
00384 #endif
00385 
00386 /*-<a                             href="qh-stat.htm#TOC"
00387   >--------------------------------</a><a name="zmax_">-</a>
00388 
00389   zmax_( id, val ), wmax_( id, value )
00390     maximize id with val
00391 */
00392 #define wwmax_(id, val) {MAYdebugx; maximize_(qhstat stats[id].r,(val));}
00393 #if qh_KEEPstatistics
00394 #define zmax_(id, val) {MAYdebugx; maximize_(qhstat stats[id].i,(val));}
00395 #define wmax_(id, val) {MAYdebugx; maximize_(qhstat stats[id].r,(val));}
00396 #else
00397 #define zmax_(id, val) {}
00398 #define wmax_(id, val) {}
00399 #endif
00400 
00401 /*-<a                             href="qh-stat.htm#TOC"
00402   >--------------------------------</a><a name="zmin_">-</a>
00403 
00404   zmin_( id, val ), wmin_( id, value )
00405     minimize id with val
00406 */
00407 #if qh_KEEPstatistics
00408 #define zmin_(id, val) {MAYdebugx; minimize_(qhstat stats[id].i,(val));}
00409 #define wmin_(id, val) {MAYdebugx; minimize_(qhstat stats[id].r,(val));}
00410 #else
00411 #define zmin_(id, val) {}
00412 #define wmin_(id, val) {}
00413 #endif
00414 
00415 /*================== stat.h types ==============*/
00416 
00417 
00418 /*-<a                             href="qh-stat.htm#TOC"
00419   >--------------------------------</a><a name="intrealT">-</a>
00420  
00421   intrealT
00422     union of integer and real, used for statistics
00423 */
00424 typedef union intrealT intrealT;    /* union of int and realT */
00425 union intrealT {
00426     int i;
00427     realT r;
00428 };
00429 
00430 /*-<a                             href="qh-stat.htm#TOC"
00431   >--------------------------------</a><a name="qhstat">-</a>
00432   
00433   qhstat
00434     global data structure for statistics
00435   
00436   notes:
00437    access to qh_qhstat is via the "qhstat" macro.  There are two choices
00438    qh_QHpointer = 1     access globals via a pointer
00439                         enables qh_saveqhull() and qh_restoreqhull()
00440                 = 0     qh_qhstat is a static data structure
00441                         only one instance of qhull() can be active at a time
00442                         default value
00443    qh_QHpointer is defined in qhull.h
00444 
00445    allocated in stat.c
00446 */
00447 typedef struct qhstatT qhstatT; 
00448 #if qh_QHpointer
00449 #define qhstat qh_qhstat->
00450 extern qhstatT *qh_qhstat;
00451 #else
00452 #define qhstat qh_qhstat.
00453 extern qhstatT qh_qhstat; 
00454 #endif
00455 struct qhstatT {  
00456   intrealT   stats[ZEND];     /* integer and real statistics */
00457   unsigned   char id[ZEND+10]; /* id's in print order */
00458   char      *doc[ZEND];       /* array of documentation strings */
00459   short int  count[ZEND];     /* -1 if none, else index of count to use */
00460   char       type[ZEND];      /* type, see ztypes above */
00461   char       printed[ZEND];   /* true, if statistic has been printed */
00462   intrealT   init[ZTYPEend];  /* initial values by types, set initstatistics */
00463 
00464   int        next;            /* next index for zdef_ */
00465   int        precision;       /* index for precision problems */
00466   int        vridges;         /* index for Voronoi ridges */
00467   int        tempi;
00468   realT      tempr;
00469 };
00470 
00471 /*========== function prototypes ===========*/
00472 
00473 void    qh_allstatA(void);
00474 void    qh_allstatB(void);
00475 void    qh_allstatC(void);
00476 void    qh_allstatD(void);
00477 void    qh_allstatE(void);
00478 void    qh_allstatF(void);
00479 void    qh_allstatG(void);
00480 void    qh_allstatH(void);
00481 void    qh_allstatI(void);
00482 void    qh_allstatistics (void);
00483 void    qh_collectstatistics (void);
00484 void    qh_freestatistics (void);
00485 void    qh_initstatistics (void);
00486 boolT   qh_newstats (int index, int *nextindex);
00487 boolT   qh_nostatistic (int i);
00488 void    qh_printallstatistics (FILE *fp, char *string);
00489 void    qh_printstatistics (FILE *fp, char *string);
00490 void    qh_printstatlevel (FILE *fp, int id, int start);
00491 void    qh_printstats (FILE *fp, int index, int *nextindex);
00492 realT   qh_stddev (int num, realT tot, realT tot2, realT *ave);
00493 
00494 #endif   /* qhDEFstat */
 

Powered by Plone

This site conforms to the following standards: