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