--- ray/src/util/eplus_adduvf.c 2014/04/04 17:56:45 2.17 +++ ray/src/util/eplus_adduvf.c 2020/01/20 17:53:40 2.21 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: eplus_adduvf.c,v 2.17 2014/04/04 17:56:45 greg Exp $"; +static const char RCSid[] = "$Id: eplus_adduvf.c,v 2.21 2020/01/20 17:53:40 greg Exp $"; #endif /* * Add User View Factors to EnergyPlus Input Data File @@ -8,6 +8,8 @@ static const char RCSid[] = "$Id: eplus_adduvf.c,v 2.1 */ #include +#include +#include "platform.h" #include "rtio.h" #include "rtmath.h" #include "random.h" @@ -39,7 +41,7 @@ const char ADD_HEADER[] = #define NAME_FLD 1 /* name field always first? */ #define SS_BASE_FLD 4 /* subsurface base surface */ -#define SS_VERT_FLD 10 /* subsurface vertex count */ +#define SS_VERT_FLD 9 /* subsurface vertex count */ typedef struct { const char *pname; /* object type name */ @@ -203,7 +205,7 @@ get_vlist(IDF_OBJECT *param, const char *zname) } res = idf_getfield(param, surf_type[i].vert_fld); } - if (!res->val[0]) { /* hack for missing #vert */ + if (!res->val[0] || tolower(res->val[0]) == 'a') { /* autocalculate */ IDF_FIELD *fptr; if (next_fbp >= fld_buf+sizeof(fld_buf)) next_fbp = fld_buf; @@ -708,6 +710,15 @@ main(int argc, char *argv[]) fputs("'\n", stderr); return(1); } + /* check version (warning) */ + if ((pptr = idf_getobject(our_idf, "Version")) != NULL && + pptr->flist != NULL && pptr->flist->val[0] != '9') { + fputs(progname, stderr); + fputs(": warning - written for IDF version 9.x, not ", + stderr); + fputs(pptr->flist->val, stderr); + fputc('\n', stderr); + } /* remove existing UVFs */ if ((pptr = idf_getobject(our_idf, UVF_PNAME)) != NULL) { IDF_OBJECT *pnext; @@ -716,7 +727,7 @@ main(int argc, char *argv[]) do { pnext = pptr->pnext; idf_delobject(our_idf, pptr); - } while (pnext != NULL); + } while ((pptr = pnext) != NULL); } /* add to header */ if (our_idf->hrem == NULL ||