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

Comparing ray/src/gen/gendaylit.c (file contents):
Revision 2.1 by greg, Sat Jun 6 20:18:32 2009 UTC vs.
Revision 2.3 by greg, Sat Jun 20 21:34:34 2009 UTC

# Line 21 | Line 21 | static const char RCSid[] = "$Id$";
21   #include  <string.h>
22   #include  <math.h>
23   #include  <stdlib.h>
24 + #include  <ctype.h>
25  
26   #include  "rtio.h"
27   #include  "fvect.h"
# Line 71 | Line 72 | void   theta_phi_to_dzeta_gamma(double theta,double phi,
72   double  integ_lv(float *lv,float *theta);
73   float   *theta_ordered(char *filename);
74   float   *phi_ordered(char *filename);
75 + void    skip_comments(FILE *fp);
76  
77  
78  
# Line 470 | Line 472 | computesky()                   /* compute sky parameters */
472   /* Compute the ground radiance */
473   zenithbr=calc_rel_lum_perez(0.0,radians(sunzenith),radians(sunzenith),skyclearness,skybrightness,coeff_perez);
474   zenithbr*=diffnormalization;
475 + /*
476   fprintf(stderr, "gendaylit : the actual zenith radiance(W/m^2/sr) or luminance(cd/m^2) is : %.0lf\n", zenithbr);
477 <        
477 > */
478 >
479   if (skyclearness==1)
480          normfactor = 0.777778;
481                  
# Line 608 | Line 612 | register char  **av;
612  
613  
614  
615 + void
616 + skip_comments(FILE *fp)         /* skip comments in file */
617 + {
618 +        int     c;
619 +        
620 +        while ((c = getc(fp)) != EOF)
621 +                if (c == '#') {
622 +                        while ((c = getc(fp)) != EOF)
623 +                                if (c == '\n')
624 +                                        break;
625 +                } else if (!isspace(c)) {
626 +                        ungetc(c, fp);
627 +                        break;
628 +                }
629 + }
630  
631  
632  
614
615
616
617
618
633   /* Perez models */
634  
635   /* Perez global horizontal luminous efficacy model */
# Line 998 | Line 1012 | int lect_coeff_perez(char *filename,float **coeff_pere
1012          {
1013                  /*printf("file %s  open\n", filename);*/
1014          }
1015 +        
1016 +        skip_comments(fcoeff_perez);
1017  
1002        rewind(fcoeff_perez); /* on se place en debut de fichier */
1003
1018          for (i=0;i<8;i++)
1019                  for (j=0;j<20;j++)
1020                  {
# Line 1183 | Line 1197 | float *theta_ordered(char *filename)
1197                  fprintf(stderr,"Cannot open file %s in function theta_ordered\n",filename);
1198                  exit(1);
1199          }
1200 +        
1201 +        skip_comments(file_in);
1202  
1187        rewind(file_in);
1188
1203          if ( (ptr = malloc(145*sizeof(float))) == NULL )
1204          {
1205                  fprintf(stderr,"Out of memory in function theta_ordered\n");
# Line 1229 | Line 1243 | float *phi_ordered(char *filename)
1243                  fprintf(stderr,"Cannot open file %s in function phi_ordered\n",filename);
1244                  exit(1);
1245          }
1246 <
1247 <        rewind(file_in);
1246 >        
1247 >        skip_comments(file_in);
1248  
1249          if ( (ptr = malloc(145*sizeof(float))) == NULL )
1250          {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines