| 8 |
|
*/ |
| 9 |
|
|
| 10 |
|
#include <stdlib.h> |
| 11 |
+ |
#include "platform.h" |
| 12 |
|
#include "rtio.h" |
| 13 |
|
#include "rtmath.h" |
| 14 |
|
#include "random.h" |
| 177 |
|
static IDF_FIELD * |
| 178 |
|
get_vlist(IDF_OBJECT *param, const char *zname) |
| 179 |
|
{ |
| 180 |
< |
const int itm_len = sizeof(IDF_FIELD)+6; |
| 181 |
< |
static char fld_buf[4*itm_len]; |
| 182 |
< |
static char *next_fbp = fld_buf; |
| 183 |
< |
int i; |
| 184 |
< |
IDF_FIELD *res; |
| 180 |
> |
#define itm_len (sizeof(IDF_FIELD)+6) |
| 181 |
> |
static char fld_buf[4*itm_len]; |
| 182 |
> |
static char *next_fbp = fld_buf; |
| 183 |
> |
int i; |
| 184 |
> |
IDF_FIELD *res; |
| 185 |
|
/* check if subsurface */ |
| 186 |
|
if (!strcmp(param->pname, SUBSURF_PNAME)) { |
| 187 |
|
if (zname != NULL) { |
| 220 |
|
sprintf(res->val, "%d", i/3); |
| 221 |
|
} |
| 222 |
|
return(res); |
| 223 |
+ |
#undef itm_len |
| 224 |
|
} |
| 225 |
|
|
| 226 |
|
/* Get/allocate surface polygon */ |
| 325 |
|
rad_subsurface(IDF_OBJECT *param, FILE *ofp) |
| 326 |
|
{ |
| 327 |
|
const char *sname = idf_getfield(param,NAME_FLD)->val; |
| 328 |
< |
SURFACE *surf = get_surface(idf_getfield(param,SS_VERT_FLD)); |
| 328 |
> |
SURFACE *surf = get_surface(get_vlist(param, NULL)); |
| 329 |
|
double area; |
| 330 |
|
int i; |
| 331 |
|
|
| 363 |
|
IDF_FIELD *fptr; |
| 364 |
|
int i, j, n; |
| 365 |
|
/* start oconv command */ |
| 366 |
< |
sprintf(cbuf, "oconv - > '%s'", temp_octree); |
| 366 |
> |
sprintf(cbuf, "oconv - > \"%s\"", temp_octree); |
| 367 |
|
if ((ofp = popen(cbuf, "w")) == NULL) { |
| 368 |
|
fputs(progname, stderr); |
| 369 |
|
fputs(": cannot open oconv process\n", stderr); |
| 393 |
|
/* now subsurfaces */ |
| 394 |
|
if (zp->ntotal > zp->nsurf) { |
| 395 |
|
if (zp->area_redu != NULL) |
| 396 |
< |
memset(zp->area_redu, 0, sizeof(float)*zp->nsurf); |
| 397 |
< |
else if ((zp->area_redu = (float *)calloc(zp->nsurf, |
| 396 |
> |
memset(zp->area_redu, 0, sizeof(float)*zp->ntotal); |
| 397 |
> |
else if ((zp->area_redu = (float *)calloc(zp->ntotal, |
| 398 |
|
sizeof(float))) == NULL) |
| 399 |
|
return(0); |
| 400 |
|
} |
| 709 |
|
fputs("'\n", stderr); |
| 710 |
|
return(1); |
| 711 |
|
} |
| 712 |
+ |
/* check version (warning) */ |
| 713 |
+ |
if ((pptr = idf_getobject(our_idf, "Version")) != NULL && |
| 714 |
+ |
pptr->flist != NULL && atoi(pptr->flist->val) != 7) { |
| 715 |
+ |
fputs(progname, stderr); |
| 716 |
+ |
fputs(": warning - written for IDF version 7.x, not ", |
| 717 |
+ |
stderr); |
| 718 |
+ |
fputs(pptr->flist->val, stderr); |
| 719 |
+ |
fputc('\n', stderr); |
| 720 |
+ |
} |
| 721 |
|
/* remove existing UVFs */ |
| 722 |
|
if ((pptr = idf_getobject(our_idf, UVF_PNAME)) != NULL) { |
| 723 |
|
IDF_OBJECT *pnext; |
| 726 |
|
do { |
| 727 |
|
pnext = pptr->pnext; |
| 728 |
|
idf_delobject(our_idf, pptr); |
| 729 |
< |
} while (pnext != NULL); |
| 729 |
> |
} while ((pptr = pnext) != NULL); |
| 730 |
|
} |
| 731 |
|
/* add to header */ |
| 732 |
|
if (our_idf->hrem == NULL || |