/**************************************************************************** * NCSA HDF * * Software Development Group * * National Center for Supercomputing Applications * * University of Illinois at Urbana-Champaign * * 605 E. Springfield, Champaign IL 61820 * * * * For conditions of distribution and use, see the accompanying * * hdf/COPYING file. * * * ****************************************************************************/ /* $Id$ */ /* FILE tbbt.c Test HDF Threaded-Balanced-Binary Tree (tbbt) routines. REMARKS DESIGN BUGS/LIMITATIONS EXPORTED ROUTINES AUTHOR Quincey Koziol MODIFICATION HISTORY 4/22/00 - Converted from HDF4 test routine. */ #include #include "testhdf5.h" #include "H5TBprivate.h" #define MAX_TEST_SIZE 31 /* maximum number of elements to insert */ #define NUM_TEST_RUNS 100 /* number of times to insert & remove each size */ #define RandInt(a,b) ((rand()%(((b)-(a))+1))+(a)) int tcompare (void * k1, void * k2, int cmparg); static void swap_arr(int *arr, int a, int b) { int t; if (a != b) { t = arr[a]; arr[a] = arr[b]; arr[b] = t; } /* end if */ } /* end swap_arr() */ int tcompare(void * k1, void * k2, int cmparg) { /* shut compiler up */ cmparg=cmparg; return ((int) ((*(int *) k1) - (*(int *) k2))); } void test_tbbt(void) { int test_size; int i, j; int ins_arr[MAX_TEST_SIZE]; int rem_arr[MAX_TEST_SIZE]; int t; H5TB_TREE *tree; void * *r; t = (int)time(NULL); srand((unsigned)t); for (test_size = 3; test_size <= MAX_TEST_SIZE; test_size++) { MESSAGE(7, ("\nTesting trees with %d elements\n", test_size)); MESSAGE(8, ("Testing tree #:")); for (j = 0; j < NUM_TEST_RUNS; j++) { MESSAGE(8, (" %d", j)); for (i = 0; i < test_size; i++) { /* initialize the arrays */ ins_arr[i] = i; rem_arr[i] = i; } /* end for */ for (i = 0; i < test_size; i++) { /* shuffle the arrays */ t = RandInt(i, test_size - 1); swap_arr(ins_arr, i, t); t = RandInt(i, test_size - 1); swap_arr(rem_arr, i, t); } /* end for */ if (Verbosity > 9) { printf("ins_arr: \n"); for (i = 0; i < test_size; i++) /* print the arrays */ printf("%d \n", (int) ins_arr[i]); printf("\nrem_arr: \n"); for (i = 0; i < test_size; i++) /* print the arrays */ printf("%d \n", (int) rem_arr[i]); printf("\n"); } /* end if */ tree = H5TB_dmake(tcompare, sizeof(int),0); for (i = 0; i < test_size; i++) { MESSAGE(9, ("inserting %d\n", (int) ins_arr[i])); H5TB_dins(tree, (void *) &ins_arr[i], NULL); #ifdef H5TB_DEBUG if(Verbosity>9) H5TB_dump(tree, -1); #endif /* H5TB_DEBUG */ } #ifdef H5TB_DEBUG if(Verbosity>9) H5TB_dump(tree, -1); #endif /* H5TB_DEBUG */ for (i = 0; i < test_size; i++) { int key; key = rem_arr[i]; r = (void * *) H5TB_dfind(tree, (void *) &key, NULL); MESSAGE(9, ("removing %d\n", (int) key)); H5TB_rem((H5TB_NODE **) tree, (H5TB_NODE *) r, NULL); #ifdef H5TB_DEBUG if(Verbosity>9) H5TB_dump(tree, -1); #endif /* H5TB_DEBUG */ } /* end for */ H5TB_dfree(tree, NULL, NULL); } /* end for */ } /* end for */ } /* end test_tbbt() */ > Mirror from: https://github.com/HDFGroup/hdf5.git
summaryrefslogtreecommitdiffstats
path: root/src/Makefile.am
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-07-03 04:22:31 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-07-03 04:22:31 (GMT)
commit1521b1dd1b00808da0f03f9b5e312100e8f83ee4 (patch)
tree4ac2fb3286b250524edb97dbbceffdaab60d8861 /src/Makefile.am
parente844def040da6235cf37ce7feb136720e423edb4 (diff)
downloadhdf5-1521b1dd1b00808da0f03f9b5e312100e8f83ee4.zip
hdf5-1521b1dd1b00808da0f03f9b5e312100e8f83ee4.tar.gz
hdf5-1521b1dd1b00808da0f03f9b5e312100e8f83ee4.tar.bz2
[svn-r17155] Description:
Bring r17154 from 'revise_chunks' branch to trunk: Add fixed array data structure. (For initial use as a chunk index) Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.7 (amazon) in debug mode Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode