/*@@ @file GHExtension.c @date Tue 9th Feb 1999 @author Gabrielle Allen @desc IOUtil GH extension stuff. @enddesc @history @endhistory @@*/ /*#define DEBUG_IO*/ #include #include #include #include "cctk.h" #include "util_String.h" #include "cctk_Parameters.h" #include "ioHDF5UtilGH.h" static char *rcsid = "$Header$"; CCTK_FILEVERSION(BetaThorns_IOStreamedHDF5_ParseVars_c) /* =============================================================== utility routines used by other IO thorns ===============================================================*/ /*@@ @routine IOUtil_ParseVarsForOutput @date Sat March 6 1999 @author Gabrielle Allen @desc Sets each flag in the do_output[] do_output to true if var[i] could be found in the list of variable names. var_list my also contain group names of variables as well as the special keyword "all" which indicates that output is requested on all variables. @enddesc @history @endhistory @var var_list @vdesc list of variables and/or group names @vtype const char * @vio in @endvar @var do_output @vdesc do_output of flags indicating output was requested for var[i] @vtype char [] @vio out @endvar @@*/ int IOHDF5Util_ParseVarsForOutput (const char *var_list, char do_output[], ioHDF5Geo_t geo_output[]) { char *outname=NULL; char *before=NULL; char *after=NULL; char *splitstring; int first,groupnum,i,last,index,varnum; ioHDF5Geo_t geo_tmp; int ierr=0; int GeometryParserH5stream(const char *before, char **outname, ioHDF5Geo_t *geo); /* First initialise every variable to no output */ for (i=0; i 0) { /* Extract geometry information */ ierr=GeometryParserH5stream(before, &outname, &geo_tmp); if ((ierr<0)||(outname==NULL)) { CCTK_WARN(1,"GeometryParserH5stream failed."); return(-1); } /* Look for any special tokens */ if (CCTK_Equals(outname,"all")) { int ilab; for (ilab=0;ilab in IO string (invalid token)",outname); CCTK_WARN(2,msg); free(msg); } else { /* We have a group so now need all the variables in the group */ first = CCTK_FirstVarIndexI(groupnum); last = first+CCTK_NumVarsInGroupI(groupnum)-1; for (index=first;index<=last;index++) { geo_output[index]=geo_tmp; do_output[index] =1; } } } else { geo_output[varnum]= geo_tmp; do_output[varnum] = 1; } } } if(before) { free(before); before = NULL; } if(outname) { free(outname); outname = NULL; } if(splitstring != var_list) { free(splitstring); } splitstring = after; } if (strlen(splitstring)>0) { /* Extract geometry information */ ierr=GeometryParserH5stream(splitstring, &outname, &geo_tmp); if (ierr<0) printf("GeometryParser failed: >%s<\n",before); /* Special cases */ if (CCTK_Equals(outname,"all")) { int ilab; for (ilab=0;ilab