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

Comparing ray/src/util/rsensor.c (file contents):
Revision 2.16 by greg, Thu Apr 23 23:54:08 2015 UTC vs.
Revision 2.19 by greg, Mon Jul 20 15:54:29 2020 UTC

# Line 77 | Line 77 | quit(ec)                       /* make sure exit is called */
77   int     ec;
78   {
79          if (ray_pnprocs > 0)    /* close children if any */
80 <                ray_pclose(0);          
80 >                ray_pclose(0);
81 >        else if (ray_pnprocs < 0)
82 >                _exit(ec);      /* avoid flush in child */
83          exit(ec);
84   }
85  
# Line 237 | Line 239 | load_sensor(
239                  cp = fskip(cp);
240                  if (cp == NULL)
241                          break;
242 <                if (ntp[1] > 1 && sarr[ntp[1]+1] <= sarr[ntp[1]]) {
242 >                if (ntp[1] > 1 && sarr[ntp[1]+1] <= sarr[ntp[1]]+FTINY) {
243                          sprintf(errmsg,
244                  "Phi values not monotinically increasing in sensor file '%s'",
245                                          sfile);
# Line 263 | Line 265 | load_sensor(
265                          cp = fskip(cp);
266                          if (cp == NULL)
267                                  break;
268 <                        if (i && sarr[i] < .0) {
268 >                        if (sarr[i] < .0) {
269                                  if (!warnedneg++) {
270                                          sprintf(errmsg,
271                  "Negative value(s) in sensor file '%s' (ignored)\n", sfile);
272                                          error(WARNING, errmsg);
273                                  }
274                                  sarr[i] = .0;
275 <                        } else if (i > ntp[0]*(ntp[1]+1) && sarr[i] > FTINY)
275 >                        } else if (sarr[i] > FTINY && i > ntp[0]*(ntp[1]+1))
276                                  last_pos_val = i;
277                          ++i;
278                  }
279 <                if (i == ntp[0]*(ntp[1]+1))
279 >                if (i == ntp[0]*(ntp[1]+1))     /* empty line? */
280                          break;
281                  if (ntp[0] > 1 && sarr[ntp[0]*(ntp[1]+1)] <=
282                                          sarr[(ntp[0]-1)*(ntp[1]+1)]) {
# Line 297 | Line 299 | load_sensor(
299          errmsg[0] = '\0';                       /* sanity checks */
300          if (!last_pos_val)
301                  sprintf(errmsg, "no positive sensor values in file '%s'", sfile);
300        if (ntp[0] <= 0)
301                sprintf(errmsg, "no data in sensor file '%s'", sfile);
302          else if (fabs(sarr[ntp[1]+1]) > FTINY)
303                  sprintf(errmsg, "minimum theta must be 0 in sensor file '%s'",
304                                  sfile);
305          else if (fabs(sarr[1]) > FTINY)
306                  sprintf(errmsg, "minimum phi must be 0 in sensor file '%s'",
307                                  sfile);
308 <        else if (sarr[ntp[1]] <= FTINY)
308 >        else if (sarr[ntp[1]] < 270.-FTINY)
309                  sprintf(errmsg,
310 <                        "maximum phi must be positive in sensor file '%s'",
310 >                        "maximum phi must be 270 or greater in sensor file '%s'",
311                                  sfile);
312 <        else if (sarr[ntp[0]*(ntp[1]+1)] <= FTINY)
312 >        else if (sarr[ntp[1]] >= 360.-FTINY)
313                  sprintf(errmsg,
314 <                        "maximum theta (%f) must be positive in sensor file '%s'",
315 <                                sarr[ntp[0]*(ntp[1]+1)], sfile);
314 >                        "maximum phi must be less than 360 in sensor file '%s'",
315 >                                sfile);
316          if (errmsg[0])
317                  error(USER, errmsg);
318          return((float *)realloc((void *)sarr, sizeof(float)*nelem));
# Line 372 | Line 372 | init_ptable(
372          psize = PI*tsize/maxtheta;
373          if (sntp[0]*sntp[1] < samptot)  /* don't overdo resolution */
374                  samptot = sntp[0]*sntp[1];
375 <        ntheta = (int)(sqrt((double)samptot*tsize/psize) + 0.5);
375 >        ntheta = (int)(sqrt((double)samptot*tsize/psize)*sntp[0]/sntp[1]) + 1;
376          if (ntheta > MAXNT)
377                  ntheta = MAXNT;
378          nphi = samptot/ntheta;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines