home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- *
- *
- * NCSA HDF version 3.2r2
- * October 30, 1992
- *
- * NCSA HDF Version 3.2 source code and documentation are in the public
- * domain. Specifically, we give to the public domain all rights for future
- * licensing of the source code, all resale rights, and all publishing rights.
- *
- * We ask, but do not require, that the following message be included in all
- * derived works:
- *
- * Portions developed at the National Center for Supercomputing Applications at
- * the University of Illinois at Urbana-Champaign, in collaboration with the
- * Information Technology Institute of Singapore.
- *
- * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
- * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
- * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
- *
- ****************************************************************************
- */
-
- #ifdef RCSID
- static char RcsId[] = "@(#)$Revision: 1.4 $";
- #endif
- /*
- $Header: /hdf/hdf/v3.2r2/test/RCS/tv1.c,v 1.4 1992/10/23 19:09:28 koziol beta koziol $
-
- $Log: tv1.c,v $
- * Revision 1.4 1992/10/23 19:09:28 koziol
- * Updated for new Vset calls, DFvsetopen(), DFvsetclose, and changed
- * VFREESPACE and VGETSPACE to HDfreespace() and HDgetspace()
- *
- * Revision 1.3 1992/05/27 21:51:19 chouck
- * Added a few casts to VSwrite() calls
- *
- * Revision 1.2 1992/05/18 22:11:07 sxu
- * modified constants for number types
- *
- * Revision 1.1 1992/03/01 22:29:07 dilg
- * Initial revision
- *
- * Revision 1.1 1992/02/29 19:55:07 likkai
- * Initial revision
- *
- */
- /*
- =================================
- HDF VSET TEST PROGRAM
- Jason Ng Feb-28-92 NCSA
- =================================
- */
-
- #include "vg.h"
-
- #define FS "tv1.hdf"
- main(ac,av)
- int ac;
- char**av;
- {
- int num;
-
- if(ac!=2) num = 5;
- else sscanf(av[1],"%d",&num);
-
- printf("%s: tests the basic vgroup and vdata creation routines\n", av[0]);
- printf("creates %d vgroups and %d vdatas in %s\n",num,num,FS);
- createm(FS,num);
- printf("success: file %s created.\n", FS);
- printf("use the utility vshow to examine this file:\n");
- printf("\t\tvshow %s +\n",FS);
- printf("results should be as in %s.result\n",av[0]);
- }
-
- createm(fs,n) char*fs;
- int n;
- {
- VGROUP * vg;
- VDATA * vs;
- HFILEID f;
- char ss[30];
- int i,ne=0;
- float buf[100];
-
- if( FAIL==(f=DFvsetopen(fs,DFACC_ALL,0))) {
- printf("open err %s\n",fs);
- exit(0);
- }
- for(i=0;i<n;i++) {
- vg = (VGROUP*) Vattach(f,-1,"w");
- sprintf(ss,"test_vgroup#%d",i);
- Vsetname(vg,ss);
- Vdetach(vg);
- printf("created VGROUP %s \n",ss);
- }
-
- for(i=0;i<n;i++) {
- ne +=5;
- vs = (VDATA*) VSattach(f,-1,"w");
- sprintf(ss,"vdata#%d",i);
- VSsetname(vs,ss);
- VSfdefine(vs,"PRESS",DFNT_FLOAT32,1);
- VSsetfields(vs,"PRESS");
- makefloatdata(buf,ne);
- VSwrite(vs, (unsigned char *) buf, ne, FULL_INTERLACE);
- VSdetach(vs);
- printf("created VDATA %s with %d elements\n",ss,ne);
- }
- DFvsetclose(f);
- }
-
- makefloatdata(xx,n)
- int n;
- float xx[];
- {
- int i;
- for(i=0;i<n;i++) xx[i] = n*100.0 + i*i;
- }
-
-