34 |
|
#define NAME_FLD 1 /* name field always first? */ |
35 |
|
|
36 |
|
typedef struct { |
37 |
< |
const char *pname; /* parameter type name */ |
37 |
> |
const char *pname; /* object type name */ |
38 |
|
short zone_fld; /* zone field index */ |
39 |
|
short vert_fld; /* vertex field index */ |
40 |
|
} SURF_PTYPE; /* surface type we're interested in */ |
51 |
|
const char *zname; /* zone name */ |
52 |
|
struct s_zone *next; /* next zone in list */ |
53 |
|
int nsurf; /* surface count */ |
54 |
< |
IDF_PARAMETER *pfirst; /* first matching parameter */ |
55 |
< |
IDF_PARAMETER *plast; /* last matching parameter */ |
54 |
> |
IDF_OBJECT *pfirst; /* first matching object */ |
55 |
> |
IDF_OBJECT *plast; /* last matching object */ |
56 |
|
} ZONE; /* a list of collected zone surfaces */ |
57 |
|
|
58 |
|
ZONE *zone_list = NULL; /* our list of zones */ |
69 |
|
|
70 |
|
/* Create a new zone and push to top of our list */ |
71 |
|
static ZONE * |
72 |
< |
new_zone(const char *zname, IDF_PARAMETER *param) |
72 |
> |
new_zone(const char *zname, IDF_OBJECT *param) |
73 |
|
{ |
74 |
|
ZONE *znew = (ZONE *)malloc(sizeof(ZONE)); |
75 |
|
|
84 |
|
|
85 |
|
/* Add the detailed surface (polygon) to the named zone */ |
86 |
|
static ZONE * |
87 |
< |
add2zone(IDF_PARAMETER *param, const char *zname) |
87 |
> |
add2zone(IDF_OBJECT *param, const char *zname) |
88 |
|
{ |
89 |
|
ZONE *zptr; |
90 |
|
|
94 |
|
if (zptr == NULL) |
95 |
|
return(new_zone(zname, param)); |
96 |
|
/* keep surfaces together */ |
97 |
< |
if (!idf_movparam(our_idf, param, zptr->plast)) |
97 |
> |
if (!idf_movobject(our_idf, param, zptr->plast)) |
98 |
|
return(NULL); |
99 |
|
zptr->plast = param; |
100 |
|
zptr->nsurf++; |
101 |
|
return(zptr); |
102 |
|
} |
103 |
|
|
104 |
< |
/* Return field for vertices in the given parameter */ |
104 |
> |
/* Return field for vertices in the given object */ |
105 |
|
static IDF_FIELD * |
106 |
< |
get_vlist(IDF_PARAMETER *param, const char *zname) |
106 |
> |
get_vlist(IDF_OBJECT *param, const char *zname) |
107 |
|
{ |
108 |
|
int i = 0; |
109 |
|
IDF_FIELD *fptr; |
123 |
|
|
124 |
|
/* Convert surface to Radiance with modifier based on unique name */ |
125 |
|
static int |
126 |
< |
rad_surface(IDF_PARAMETER *param, FILE *ofp) |
126 |
> |
rad_surface(IDF_OBJECT *param, FILE *ofp) |
127 |
|
{ |
128 |
|
const char *sname = idf_getfield(param,NAME_FLD)->val; |
129 |
|
IDF_FIELD *fptr = get_vlist(param, NULL); |
158 |
|
{ |
159 |
|
#define BASE_AC 5 |
160 |
|
static char *base_av[BASE_AC] = { |
161 |
< |
"rcontrib", "-ff", "-h", "-x", "1" |
161 |
> |
"rcontrib", "-fff", "-h", "-x", "1" |
162 |
|
}; |
163 |
|
char cbuf[300]; |
164 |
|
char **av; |
165 |
|
FILE *ofp; |
166 |
< |
IDF_PARAMETER *pptr; |
166 |
> |
IDF_OBJECT *pptr; |
167 |
|
int i, n; |
168 |
|
/* start oconv command */ |
169 |
|
sprintf(cbuf, "oconv - > '%s'", temp_octree); |
185 |
|
IDF_FIELD *fptr = idf_getfield(pptr,NAME_FLD); |
186 |
|
if (fptr == NULL || !fptr->val[0]) { |
187 |
|
fputs(progname, stderr); |
188 |
< |
fputs(": missing name for surface parameter\n", stderr); |
188 |
> |
fputs(": missing name for surface object\n", stderr); |
189 |
|
return(0); |
190 |
|
} |
191 |
|
if (!rad_surface(pptr, ofp)) /* add surface to octree */ |
200 |
|
} |
201 |
|
av[i++] = temp_octree; /* add final octree argument */ |
202 |
|
av[i] = NULL; |
203 |
< |
if (!open_process(pd, av)) { /* start process */ |
203 |
> |
if (open_process(pd, av) <= 0) { /* start process */ |
204 |
|
fputs(progname, stderr); |
205 |
|
fputs(": cannot start rcontrib process\n", stderr); |
206 |
|
return(0); |
337 |
|
|
338 |
|
/* Sample the given surface */ |
339 |
|
static int |
340 |
< |
sample_surface(IDF_PARAMETER *param, int wd) |
340 |
> |
sample_surface(IDF_OBJECT *param, int wd) |
341 |
|
{ |
342 |
|
IDF_FIELD *fptr = get_vlist(param, NULL); |
343 |
|
POLYSAMP psamp; |
364 |
|
static int |
365 |
|
compute_uvfs(SUBPROC *pd, ZONE *zp) |
366 |
|
{ |
367 |
< |
IDF_PARAMETER *pptr, *pout, *pptr1; |
367 |
> |
IDF_OBJECT *pptr, *pout, *pptr1; |
368 |
|
float *uvfa; |
369 |
|
char uvfbuf[24]; |
370 |
|
int n, m; |
371 |
< |
/* create output parameter */ |
372 |
< |
pout = idf_newparam(our_idf, UVF_PNAME, |
371 |
> |
/* create output object */ |
372 |
> |
pout = idf_newobject(our_idf, UVF_PNAME, |
373 |
|
" ! computed by Radiance\n ", zp->plast); |
374 |
|
if (pout == NULL) { |
375 |
|
fputs(progname, stderr); |
376 |
< |
fputs(": cannot create new IDF parameter\n", stderr); |
376 |
> |
fputs(": cannot create new IDF object\n", stderr); |
377 |
|
return(0); |
378 |
|
} |
379 |
|
if (!idf_addfield(pout, zp->zname, |
466 |
|
{ |
467 |
|
int incl_comments = 1; |
468 |
|
char *origIDF, *revIDF; |
469 |
< |
IDF_PARAMETER *pptr; |
469 |
> |
IDF_OBJECT *pptr; |
470 |
|
int i; |
471 |
|
|
472 |
|
progname = *argv++; argc--; /* get options if any */ |
501 |
|
return(1); |
502 |
|
} |
503 |
|
/* remove existing UVFs */ |
504 |
< |
if ((pptr = idf_getparam(our_idf, UVF_PNAME)) != NULL) { |
505 |
< |
IDF_PARAMETER *pnext; |
504 |
> |
if ((pptr = idf_getobject(our_idf, UVF_PNAME)) != NULL) { |
505 |
> |
IDF_OBJECT *pnext; |
506 |
|
fputs(progname, stderr); |
507 |
|
fputs(": removing previous User View Factors\n", stderr); |
508 |
|
do { |
509 |
|
pnext = pptr->pnext; |
510 |
< |
idf_delparam(our_idf, pptr); |
510 |
> |
idf_delobject(our_idf, pptr); |
511 |
|
} while (pnext != NULL); |
512 |
|
} |
513 |
|
/* add to header */ |
517 |
|
idf_add2hdr(our_idf, ADD_HEADER); |
518 |
|
/* gather zone surfaces */ |
519 |
|
for (i = 0; surf_type[i].pname != NULL; i++) |
520 |
< |
for (pptr = idf_getparam(our_idf, surf_type[i].pname); |
520 |
> |
for (pptr = idf_getobject(our_idf, surf_type[i].pname); |
521 |
|
pptr != NULL; pptr = pptr->pnext) { |
522 |
|
IDF_FIELD *fptr = idf_getfield(pptr, |
523 |
|
surf_type[i].zone_fld); |