#include /* necessary for hdf library routines */ #include /* IMPORTANT NOTE: Data Explorer does not provide HDF libraries. This sample module is for illustrative purposes only. Because we do not provide the HDF libraries, it will not be possible for you to compile and link this sample module unless you yourself have the HDF libraries installed */ #define MAXRANK 3 main(argc, argv) char *argv[]; { FILE *in; char filename[80]; int dims, counts[MAXRANK], numelements, i, j; float deltas[MAXRANK*MAXRANK], origins[MAXRANK], *databuf=NULL; if (argc < 2) { fprintf(stderr,"Usage simpleimportfilter \n"); return 0; } strcpy(filename, argv[1]); in = fopen(filename,"r"); if (!in) { fprintf(stderr, "cannot open filename %s\n", filename); return 0; } /* check to see that the file is accessible, and is an hdf file */ /* DFishdf is an hdf library routine */ if (DFishdf(filename) != 0) { fprintf(stderr, "file \"%s\" is either not accessible, or is not an hdf file\n", filename); return 0; } /* initialize */ /* DFSDrestart is an HDF library routine */ DFSDrestart(); /* this returns the dimensionality of the grid (1D, 2D, etc) in dims. The number of positions in each dimension is returned in the array counts */ /* DFSDgetdims is an HDF library routine */ DFSDgetdims(filename, &dims, counts, MAXRANK); /* figure out how many elements there are in the data array */ numelements=1; for (i=0; i