gridspec_api/host/nccf_inq_host_statfilename.c

00001 /*
00002  * Inquire from the host object a static file name given a grid index and 
00003  * a static file index
00004  *
00005  * $Id: nccf_inq_host_statfilename.c 513 2011-02-14 22:48:17Z dkindig $ 
00006  * */
00007 
00008 #include <string.h>
00009 #include <nccf_errors.h>
00010 #include <nccf_utility_functions.h>
00011 #include <nccf_host.h>
00012 
00013 int nccf_inq_host_statfilename(int hostid, int vfindx, int gfindx, 
00014                                char *fname) {
00015   int index;
00016   int dims[2];
00017   const int inx[] = {vfindx, gfindx};
00018   char *fn;
00019 
00020   struct nccf_host_type *self;
00021   self = nccf_li_find(&CFLIST_HOST, hostid);
00022   dims[0] = self->nStatDataFiles;
00023   dims[1] = self->nGrids;
00024 
00025   // flatten the indices
00026   index = nccf_get_flat_index(2, dims, inx);
00027   fn = nccf_li_find(&self->statDataFiles, index);
00028   if (fn) {
00029     strcpy(fname, fn);
00030     return NC_NOERR;
00031   } 
00032   else {
00033     return NCCF_EINDEXOUTOFRANGE;
00034   }
00035 }
 All Classes Files Functions Defines

Generated on Tue Mar 1 2011 06:36:59 for libCF. LibCF is a Unidata library.