ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/eplus_adduvf.c
(Generate patch)

Comparing ray/src/util/eplus_adduvf.c (file contents):
Revision 2.10 by greg, Thu Feb 13 17:33:37 2014 UTC vs.
Revision 2.11 by greg, Sat Feb 15 01:31:36 2014 UTC

# Line 19 | Line 19 | static const char RCSid[] = "$Id$";
19   #define NSAMPLES        80000                   /* default number of samples */
20   #endif
21  
22 + #define SURF_EPS        0.0005                  /* surface testing epsilon */
23 +
24   char            *progname;                      /* global argv[0] */
25  
26   int             nsamps = NSAMPLES;              /* number of samples to use */
# Line 28 | Line 30 | char           temp_octree[128];               /* temporary octree */
30   const char      UVF_PNAME[] =
31                          "ZoneProperty:UserViewFactors:bySurfaceName";
32  
33 + const char      SUBSURF_PNAME[] =
34 +                        "FenestrationSurface:Detailed";
35 +
36   const char      ADD_HEADER[] =
37                          "\n!+++ User View Factors computed by Radiance +++!\n\n";
38  
39   #define NAME_FLD        1                       /* name field always first? */
40  
41 + #define SS_BASE_FLD     4                       /* subsurface base surface */
42 + #define SS_VERT_FLD     10                      /* subsurface vertex count */
43 +
44   typedef struct {
45          const char      *pname;                 /* object type name */
46          short           zone_fld;               /* zone field index */
# Line 51 | Line 59 | typedef struct s_zone {
59          const char      *zname;                 /* zone name */
60          struct s_zone   *next;                  /* next zone in list */
61          int             nsurf;                  /* surface count */
62 +        int             ntotal;                 /* surfaces+subsurfaces */
63          IDF_OBJECT      *pfirst;                /* first matching object */
64 <        IDF_OBJECT      *plast;                 /* last matching object */
64 >        IDF_OBJECT      *plast;                 /* last before subsurfaces */
65   } ZONE;                 /* a list of collected zone surfaces */
66  
67   ZONE            *zone_list = NULL;      /* our list of zones */
68  
69 + LUTAB           zonesurf_lut =          /* zone surface lookup table */
70 +                        LU_SINIT(NULL,NULL);
71 +
72   IDF_LOADED      *our_idf = NULL;        /* loaded/modified IDF */
73  
74   typedef struct {
75 +        FVECT           norm;           /* surface normal */
76 +        double          area;           /* surface area */
77 +        int             nv;             /* number of vertices */
78 +        FVECT           vl[3];          /* vertex list (extends struct) */
79 + } SURFACE;              /* a polygonal surface */
80 +
81 + typedef struct {
82          FVECT           sdir[3];        /* UVW unit sampling vectors */
83          double          poff;           /* W-offset for plane of polygon */
84          double          area_left;      /* area left to sample */
# Line 78 | Line 97 | new_zone(const char *zname, IDF_OBJECT *param)
97          znew->zname = zname;                    /* assumes static */
98          znew->next = zone_list;
99          znew->pfirst = znew->plast = param;
100 <        znew->nsurf = 1;
100 >        znew->ntotal = znew->nsurf = 1;
101          return(zone_list = znew);
102   }
103  
# Line 86 | Line 105 | new_zone(const char *zname, IDF_OBJECT *param)
105   static ZONE *
106   add2zone(IDF_OBJECT *param, const char *zname)
107   {
108 <        ZONE    *zptr;
108 >        IDF_FIELD       *nfp = idf_getfield(param, NAME_FLD);
109 >        ZONE            *zptr;
110 >        LUENT           *lep;
111  
112 +        if (nfp == NULL) {
113 +                fputs(progname, stderr);
114 +                fputs(": surface missing name field!\n", stderr);
115 +                return(NULL);
116 +        }
117          for (zptr = zone_list; zptr != NULL; zptr = zptr->next)
118                  if (!strcmp(zptr->zname, zname))
119                          break;
120 <        if (zptr == NULL)
121 <                return(new_zone(zname, param));
122 <                                                /* keep surfaces together */
120 >        if (zptr == NULL) {
121 >                zptr = new_zone(zname, param);
122 >        } else {                                /* keep surfaces together */
123 >                if (!idf_movobject(our_idf, param, zptr->plast))
124 >                        return(NULL);
125 >                zptr->plast = param;
126 >                zptr->nsurf++;
127 >                zptr->ntotal++;
128 >        }
129 >                                                /* add to lookup table */
130 >        lep = lu_find(&zonesurf_lut, nfp->val);
131 >        if (lep == NULL)
132 >                return(NULL);
133 >        if (lep->data != NULL) {
134 >                fputs(progname, stderr);
135 >                fputs(": duplicate surface name '", stderr);
136 >                fputs(nfp->val, stderr);
137 >                fputs("'\n", stderr);
138 >                return(NULL);
139 >        }
140 >        lep->key = nfp->val;
141 >        lep->data = (char *)zptr;
142 >        return(zptr);
143 > }
144 >
145 > /* Add a subsurface by finding its base surface and the corresponding zone */
146 > static ZONE *
147 > add_subsurf(IDF_OBJECT *param)
148 > {
149 >        IDF_FIELD       *bfp = idf_getfield(param, SS_BASE_FLD);
150 >        ZONE            *zptr;
151 >        LUENT           *lep;
152 >
153 >        if (bfp == NULL) {
154 >                fputs(progname, stderr);
155 >                fputs(": missing base field name in subsurface!\n", stderr);
156 >                return(NULL);
157 >        }
158 >        lep = lu_find(&zonesurf_lut, bfp->val); /* find base zone */
159 >        if (lep == NULL || lep->data == NULL) {
160 >                fputs(progname, stderr);
161 >                fputs(": cannot find referenced base surface '", stderr);
162 >                fputs(bfp->val, stderr);
163 >                fputs("'\n", stderr);
164 >                return(NULL);
165 >        }
166 >        zptr = (ZONE *)lep->data;               /* add this subsurface */
167          if (!idf_movobject(our_idf, param, zptr->plast))
168                  return(NULL);
169 <        zptr->plast = param;
100 <        zptr->nsurf++;
169 >        zptr->ntotal++;
170          return(zptr);
171   }
172  
# Line 106 | Line 175 | static IDF_FIELD *
175   get_vlist(IDF_OBJECT *param, const char *zname)
176   {
177          int             i = 0;
178 <        IDF_FIELD       *fptr;
178 >                                                /* check if subsurface */
179 >        if (!strcmp(param->pname, SUBSURF_PNAME)) {
180 >                if (zname != NULL) {
181 >                        LUENT   *lep = lu_find(&zonesurf_lut,
182 >                                        idf_getfield(param,SS_BASE_FLD)->val);
183 >                        if (strcmp((*(ZONE *)lep->data).zname, zname))
184 >                                return(NULL);
185 >                }
186 >                return(idf_getfield(param, SS_VERT_FLD));
187 >        }
188                                                  /* check for surface type */
189          while (strcmp(surf_type[i].pname, param->pname))
190                  if (surf_type[++i].pname == NULL)
191                          return(NULL);
192  
193          if (zname != NULL) {                    /* matches specified zone? */
194 <                fptr = idf_getfield(param, surf_type[i].zone_fld);
194 >                IDF_FIELD       *fptr = idf_getfield(param, surf_type[i].zone_fld);
195                  if (fptr == NULL || strcmp(fptr->val, zname))
196                          return(NULL);
197          }
# Line 121 | Line 199 | get_vlist(IDF_OBJECT *param, const char *zname)
199          return(idf_getfield(param, surf_type[i].vert_fld));
200   }
201  
202 + /* Get/allocate surface polygon */
203 + static SURFACE *
204 + get_surface(IDF_FIELD *fptr)
205 + {
206 +        SURFACE *surf;
207 +        int     nv;
208 +        FVECT   e1, e2, vc;
209 +        int     i, j;
210 +                                        /* get number of vertices */
211 +        if (fptr == NULL || (nv = atoi(fptr->val)) < 3) {
212 +                fputs(progname, stderr);
213 +                fputs(": bad vertex count for surface!\n", stderr);
214 +                return(NULL);
215 +        }
216 +        surf = (SURFACE *)malloc(sizeof(SURFACE)+sizeof(FVECT)*(nv-3));
217 +        if (surf == NULL)
218 +                return(NULL);
219 +        surf->nv = nv;
220 +        for (i = nv; i--; )             /* reverse vertex order/orientation */
221 +                for (j = 0; j < 3; j++) {
222 +                        fptr = fptr->next;
223 +                        if (fptr == NULL) {
224 +                                fputs(progname, stderr);
225 +                                fputs(": missing vertex in get_surface()\n", stderr);
226 +                                free(surf);
227 +                                return(NULL);
228 +                        }
229 +                        if ((surf->vl[i][j] = atof(fptr->val)) == 0 &&
230 +                                                        !isflt(fptr->val)) {
231 +                                fputs(progname, stderr);
232 +                                fputs(": bad vertex in get_surface()\n", stderr);
233 +                                free(surf);
234 +                                return(NULL);
235 +                        }
236 +                }
237 +                                        /* compute area and normal */
238 +        surf->norm[0] = surf->norm[1] = surf->norm[2] = 0;
239 +        VSUB(e1, surf->vl[1], surf->vl[0]);
240 +        for (i = 2; i < nv; i++) {
241 +                VSUB(e2, surf->vl[i], surf->vl[0]);
242 +                fcross(vc, e1, e2);
243 +                surf->norm[0] += vc[0];
244 +                surf->norm[1] += vc[1];
245 +                surf->norm[2] += vc[2];
246 +                VCOPY(e1, e2);
247 +        }
248 +        surf->area = .5 * normalize(surf->norm);
249 +        if (surf->area == 0) {
250 +                fputs(progname, stderr);
251 +                fputs(": degenerate polygon in get_surface()\n", stderr);
252 +                free(surf);
253 +                return(NULL);
254 +        }
255 +        return(surf);
256 + }
257 +
258   /* Convert surface to Radiance with modifier based on unique name */
259   static int
260   rad_surface(IDF_OBJECT *param, FILE *ofp)
261   {
262          const char      *sname = idf_getfield(param,NAME_FLD)->val;
263          IDF_FIELD       *fptr = get_vlist(param, NULL);
264 <        int             nvert, i;
264 >        const char      **fargs;
265 >        int             nvert, i, j;
266  
267          if (fptr == NULL || (nvert = atoi(fptr->val)) < 3) {
268                  fprintf(stderr, "%s: bad surface '%s'\n", progname, sname);
269                  return(0);
270          }
271 +        fargs = (const char **)malloc(sizeof(const char *)*3*nvert);
272 +        if (fargs == NULL)
273 +                return(0);
274          fprintf(ofp, "\nvoid glow '%s'\n0\n0\n4 1 1 1 0\n", sname);
275          fprintf(ofp, "\n'%s' polygon 's_%s'\n0\n0\n%d\n", sname, sname, 3*nvert);
276 <        while (nvert--) {
277 <                for (i = 3; i--; ) {
276 >        for (j = nvert; j--; ) {                /* get arguments in reverse */
277 >                for (i = 0; i < 3; i++) {
278                          fptr = fptr->next;
279                          if (fptr == NULL || !isflt(fptr->val)) {
280                                  fprintf(stderr,
# Line 144 | Line 282 | rad_surface(IDF_OBJECT *param, FILE *ofp)
282                                                  progname, param->pname, sname);
283                                  return(0);
284                          }
285 +                        fargs[3*j + i] = fptr->val;
286 +                }
287 +        }
288 +        for (j = 0; j < nvert; j++) {           /* output reversed verts */
289 +                for (i = 0; i < 3; i++) {
290                          fputc('\t', ofp);
291 <                        fputs(fptr->val, ofp);
291 >                        fputs(fargs[3*j + i], ofp);
292                  }
293                  fputc('\n', ofp);
294          }
295 +        free(fargs);
296          return(!ferror(ofp));
297   }
298  
299 + /* Convert subsurface to Radiance with modifier based on unique name */
300 + static int
301 + rad_subsurface(IDF_OBJECT *param, FILE *ofp)
302 + {
303 +        const char      *sname = idf_getfield(param,NAME_FLD)->val;
304 +        SURFACE         *surf = get_surface(idf_getfield(param,SS_VERT_FLD));
305 +        int             i;
306 +
307 +        if (surf == NULL) {
308 +                fprintf(stderr, "%s: bad subsurface '%s'\n", progname, sname);
309 +                return(0);
310 +        }
311 +        fprintf(ofp, "\nvoid glow '%s'\n0\n0\n4 1 1 1 0\n", sname);
312 +        fprintf(ofp, "\n'%s' polygon 'ss_%s'\n0\n0\n%d\n",
313 +                                                sname, sname, 3*surf->nv);
314 +        for (i = 0; i < surf->nv; i++) {        /* offset vertices */
315 +                FVECT   vert;
316 +                VSUM(vert, surf->vl[i], surf->norm, 2.*SURF_EPS);
317 +                fprintf(ofp, "\t%.12f %.12f %.12f\n", vert[0], vert[1], vert[2]);
318 +        }
319 +        free(surf);
320 +        return(!ferror(ofp));
321 + }
322 +
323   /* Start rcontrib process */
324   static int
325   start_rcontrib(SUBPROC *pd, ZONE *zp)
326   {
327 < #define BASE_AC         5
327 > #define BASE_AC         6
328          static char     *base_av[BASE_AC] = {
329 <                                "rcontrib", "-fff", "-h", "-x", "1"
329 >                                "rcontrib", "-V+", "-fff", "-h", "-x", "1"
330                          };
331          char            cbuf[300];
332          char            **av;
333          FILE            *ofp;
334          IDF_OBJECT      *pptr;
335 +        IDF_FIELD       *fptr;
336          int             i, n;
337                                                  /* start oconv command */
338          sprintf(cbuf, "oconv - > '%s'", temp_octree);
# Line 173 | Line 342 | start_rcontrib(SUBPROC *pd, ZONE *zp)
342                  return(0);
343          }
344                                                  /* allocate argument list */
345 <        av = (char **)malloc(sizeof(char *)*(BASE_AC+4+2*zp->nsurf));
345 >        av = (char **)malloc(sizeof(char *)*(BASE_AC+4+2*(zp->ntotal)));
346          if (av == NULL)
347                  return(0);
348          for (i = 0; i < BASE_AC; i++)
349                  av[i] = base_av[i];
350          sprintf(cbuf, "%d", nsamps);
351          av[i++] = "-c";
352 <        av[i++] = cbuf;                         /* add modifier arguments */
353 <        for (n = zp->nsurf, pptr = zp->pfirst; n--; pptr = pptr->dnext) {
354 <                IDF_FIELD       *fptr = idf_getfield(pptr,NAME_FLD);
352 >        av[i++] = cbuf;                         /* add modifiers & surfaces */
353 >        for (n = 0, pptr = zp->pfirst; n < zp->nsurf; n++, pptr = pptr->dnext) {
354 >                fptr = idf_getfield(pptr,NAME_FLD);
355                  if (fptr == NULL || !fptr->val[0]) {
356                          fputs(progname, stderr);
357                          fputs(": missing name for surface object\n", stderr);
# Line 193 | Line 362 | start_rcontrib(SUBPROC *pd, ZONE *zp)
362                  av[i++] = "-m";
363                  av[i++] = fptr->val;
364          }
365 +                                                /* now subsurfaces */
366 +        for ( ; n < zp->ntotal; n++, pptr = pptr->dnext) {
367 +                fptr = idf_getfield(pptr,NAME_FLD);
368 +                if (fptr == NULL || !fptr->val[0]) {
369 +                        fputs(progname, stderr);
370 +                        fputs(": missing name for subsurface object\n", stderr);
371 +                        return(0);
372 +                }
373 +                if (!rad_subsurface(pptr, ofp)) /* add surface to octree */
374 +                        return(0);
375 +                av[i++] = "-m";
376 +                av[i++] = fptr->val;
377 +        }
378          if (pclose(ofp) != 0) {                 /* finish oconv */
379                  fputs(progname, stderr);
380                  fputs(": error running oconv process\n", stderr);
# Line 212 | Line 394 | start_rcontrib(SUBPROC *pd, ZONE *zp)
394  
395   /* Initialize polygon sampling */
396   static Vert2_list *
397 < init_poly(POLYSAMP *ps, IDF_FIELD *f0, int nv)
397 > init_poly(POLYSAMP *ps, IDF_FIELD *f0)
398   {
399 <        IDF_FIELD       *fptr = f0;
400 <        int             i, j;
401 <        FVECT           *vl3, e1, e2, vc;
402 <        Vert2_list      *vl2 = polyAlloc(nv);
403 <
399 >        SURFACE         *surf;
400 >        Vert2_list      *vl2;
401 >        int             i;
402 >                                        /* get 3-D polygon vertices */
403 >        if ((surf = get_surface(f0)) == NULL)
404 >                return(NULL);
405 >        vl2 = polyAlloc(surf->nv);
406          if (vl2 == NULL)
407                  return(NULL);
224        vl2->p = ps;
225                                        /* get 3-D vertices */
226        vl3 = (FVECT *)malloc(sizeof(FVECT)*nv);
227        if (vl3 == NULL)
228                return(NULL);
229        for (i = nv; i--; )             /* reverse vertex ordering */
230                for (j = 0; j < 3; j++) {
231                        if (fptr == NULL) {
232                                fputs(progname, stderr);
233                                fputs(": missing vertex in init_poly()\n", stderr);
234                                return(NULL);
235                        }
236                        vl3[i][j] = atof(fptr->val);
237                        fptr = fptr->next;
238                }
239                                        /* compute area and normal */
240        ps->sdir[2][0] = ps->sdir[2][1] = ps->sdir[2][2] = 0;
241        VSUB(e1, vl3[1], vl3[0]);
242        for (i = 2; i < nv; i++) {
243                VSUB(e2, vl3[i], vl3[0]);
244                fcross(vc, e1, e2);
245                ps->sdir[2][0] += vc[0];
246                ps->sdir[2][1] += vc[1];
247                ps->sdir[2][2] += vc[2];
248                VCOPY(e1, e2);
249        }
250        ps->area_left = .5 * normalize(ps->sdir[2]);
251        if (ps->area_left == .0) {
252                fputs(progname, stderr);
253                fputs(": degenerate polygon in init_poly()\n", stderr);
254                return(0);
255        }
408                                          /* create X & Y axes */
409 <        VCOPY(ps->sdir[0], e1);
410 <        normalize(ps->sdir[0]);
409 >        VCOPY(ps->sdir[2], surf->norm);
410 >        VSUB(ps->sdir[0], surf->vl[1], surf->vl[0]);
411 >        if (normalize(ps->sdir[0]) == 0)
412 >                return(NULL);
413          fcross(ps->sdir[1], ps->sdir[2], ps->sdir[0]);
414                                          /* compute plane offset */
415 <        ps->poff = DOT(vl3[0], ps->sdir[2]);
415 >        ps->poff = DOT(surf->vl[0], ps->sdir[2]);
416                                          /* assign 2-D vertices */
417 <        for (i = 0; i < nv; i++) {
418 <                vl2->v[i].mX = DOT(vl3[i], ps->sdir[0]);
419 <                vl2->v[i].mY = DOT(vl3[i], ps->sdir[1]);
417 >        for (i = 0; i < surf->nv; i++) {
418 >                vl2->v[i].mX = DOT(surf->vl[i], ps->sdir[0]);
419 >                vl2->v[i].mY = DOT(surf->vl[i], ps->sdir[1]);
420          }
421 <        free(vl3);                      /* it's ready! */
421 >        ps->area_left = surf->area;
422 >        free(surf);                     /* it's ready! */
423 >        vl2->p = (void *)ps;
424          return(vl2);
425   }
426  
# Line 282 | Line 438 | sample_triangle(const Vert2_list *vl2, int a, int b, i
438          for (i = 3; i--; ) {
439                  orig[i] = vl2->v[a].mX*ps->sdir[0][i] +
440                                  vl2->v[a].mY*ps->sdir[1][i] +
441 <                                (ps->poff+.001)*ps->sdir[2][i];
441 >                                (ps->poff+SURF_EPS)*ps->sdir[2][i];
442                  ab[i] = (vl2->v[b].mX - vl2->v[a].mX)*ps->sdir[0][i] +
443                                  (vl2->v[b].mY - vl2->v[a].mY)*ps->sdir[1][i];
444                  ac[i] = (vl2->v[c].mX - vl2->v[a].mX)*ps->sdir[0][i] +
# Line 339 | Line 495 | sample_triangle(const Vert2_list *vl2, int a, int b, i
495   static int
496   sample_surface(IDF_OBJECT *param, int wd)
497   {
342        IDF_FIELD       *fptr = get_vlist(param, NULL);
498          POLYSAMP        psamp;
499          int             nv;
500          Vert2_list      *vlist2;
501                                          /* set up our polygon sampler */
502 <        if (fptr == NULL || (nv = atoi(fptr->val)) < 3 ||
348 <                        (vlist2 = init_poly(&psamp, fptr->next, nv)) == NULL) {
502 >        if ((vlist2 = init_poly(&psamp, get_vlist(param, NULL))) == NULL) {
503                  fprintf(stderr, "%s: bad polygon %s '%s'\n",
504                                  progname, param->pname,
505                                  idf_getfield(param,NAME_FLD)->val);
# Line 353 | Line 507 | sample_surface(IDF_OBJECT *param, int wd)
507          }
508          psamp.samp_left = nsamps;       /* assign samples & destination */
509          psamp.wd = wd;
510 +                                        /* hack for subsurface sampling */
511 +        psamp.poff += 2.*SURF_EPS * !strcmp(param->pname, SUBSURF_PNAME);
512                                          /* sample each subtriangle */
513          if (!polyTriangulate(vlist2, &sample_triangle))
514                  return(0);
# Line 370 | Line 526 | compute_uvfs(SUBPROC *pd, ZONE *zp)
526          int             n, m;
527                                                  /* create output object */
528          pout = idf_newobject(our_idf, UVF_PNAME,
529 <                        "    ! computed by Radiance\n        ", zp->plast);
529 >                        "    ! computed by Radiance\n        ", our_idf->plast);
530          if (pout == NULL) {
531                  fputs(progname, stderr);
532                  fputs(": cannot create new IDF object\n", stderr);
# Line 383 | Line 539 | compute_uvfs(SUBPROC *pd, ZONE *zp)
539                  return(0);
540          }
541                                                  /* allocate read buffer */
542 <        uvfa = (float *)malloc(sizeof(float)*3*zp->nsurf);
542 >        uvfa = (float *)malloc(sizeof(float)*3*zp->ntotal);
543          if (uvfa == NULL)
544                  return(0);
545                                                  /* UVFs from each surface */
546 <        for (n = zp->nsurf, pptr = zp->pfirst; n--; pptr = pptr->dnext) {
546 >        for (n = 0, pptr = zp->pfirst; n < zp->ntotal; n++, pptr = pptr->dnext) {
547                  double  vfsum = 0;
548                                                  /* send samples to rcontrib */
549                  if (!sample_surface(pptr, pd->w))
550                          return(0);
551                                                  /* read results */
552 <                if (readbuf(pd->r, (char *)uvfa, sizeof(float)*3*zp->nsurf) !=
553 <                                sizeof(float)*3*zp->nsurf) {
552 >                if (readbuf(pd->r, (char *)uvfa, sizeof(float)*3*zp->ntotal) !=
553 >                                sizeof(float)*3*zp->ntotal) {
554                          fputs(progname, stderr);
555                          fputs(": read error from rcontrib process\n", stderr);
556                          return(0);
557                  }
558                                                  /* append UVF fields */
559                  for (m = 0, pptr1 = zp->pfirst;
560 <                                m < zp->nsurf; m++, pptr1 = pptr1->dnext) {
560 >                                m < zp->ntotal; m++, pptr1 = pptr1->dnext) {
561                          vfsum += uvfa[3*m + 1];
562 <                        if (pptr1 == pptr) {
563 <                                if (uvfa[3*m + 1] > .001)
408 <                                        fprintf(stderr,
562 >                        if (pptr1 == pptr && uvfa[3*m + 1] > .001)
563 >                                fprintf(stderr,
564                  "%s: warning - non-zero self-VF (%.1f%%) for surface '%s'\n",
565                                                  progname, 100.*uvfa[3*m + 1],
566                                                  idf_getfield(pptr,NAME_FLD)->val);
412                                continue;       /* don't record self-factor */
413                        }
567                          sprintf(uvfbuf, "%.4f", uvfa[3*m + 1]);
568                          if (!idf_addfield(pout,
569                                          idf_getfield(pptr,NAME_FLD)->val, NULL) ||
570                                  !idf_addfield(pout,
571                                          idf_getfield(pptr1,NAME_FLD)->val, NULL) ||
572                                  !idf_addfield(pout, uvfbuf,
573 <                                                (n || m < zp->nsurf-2) ?
574 <                                                        "\n        " : "\n\n")) {
573 >                                                (n+m < 2*zp->ntotal-2) ?
574 >                                                "\n        " : "\n\n")) {
575                                  fputs(progname, stderr);
576                                  fputs(": error adding UVF fields\n", stderr);
577                                  return(0);
# Line 529 | Line 682 | main(int argc, char *argv[])
682                          if (add2zone(pptr, fptr->val) == NULL)
683                                  return(1);
684                  }
685 +                                                /* add subsurfaces */
686 +        for (pptr = idf_getobject(our_idf, SUBSURF_PNAME);
687 +                        pptr != NULL; pptr = pptr->pnext)
688 +                if (add_subsurf(pptr) == NULL)
689 +                        return(1);
690                                                  /* run rcontrib on each zone */
691          if (!compute_zones())
692                  return(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines