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" |
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 |
|
|
610 |
|
|
611 |
|
|
612 |
|
|
613 |
+ |
void |
614 |
+ |
skip_comments(FILE *fp) /* skip comments in file */ |
615 |
+ |
{ |
616 |
+ |
int c; |
617 |
+ |
|
618 |
+ |
while ((c = getc(fp)) != EOF) |
619 |
+ |
if (c == '#') { |
620 |
+ |
while ((c = getc(fp)) != EOF) |
621 |
+ |
if (c == '\n') |
622 |
+ |
break; |
623 |
+ |
} else if (!isspace(c)) { |
624 |
+ |
ungetc(c, fp); |
625 |
+ |
break; |
626 |
+ |
} |
627 |
+ |
} |
628 |
|
|
629 |
|
|
630 |
|
|
614 |
– |
|
615 |
– |
|
616 |
– |
|
617 |
– |
|
618 |
– |
|
631 |
|
/* Perez models */ |
632 |
|
|
633 |
|
/* Perez global horizontal luminous efficacy model */ |
1010 |
|
{ |
1011 |
|
/*printf("file %s open\n", filename);*/ |
1012 |
|
} |
1013 |
+ |
|
1014 |
+ |
skip_comments(fcoeff_perez); |
1015 |
|
|
1002 |
– |
rewind(fcoeff_perez); /* on se place en debut de fichier */ |
1003 |
– |
|
1016 |
|
for (i=0;i<8;i++) |
1017 |
|
for (j=0;j<20;j++) |
1018 |
|
{ |
1195 |
|
fprintf(stderr,"Cannot open file %s in function theta_ordered\n",filename); |
1196 |
|
exit(1); |
1197 |
|
} |
1198 |
+ |
|
1199 |
+ |
skip_comments(file_in); |
1200 |
|
|
1187 |
– |
rewind(file_in); |
1188 |
– |
|
1201 |
|
if ( (ptr = malloc(145*sizeof(float))) == NULL ) |
1202 |
|
{ |
1203 |
|
fprintf(stderr,"Out of memory in function theta_ordered\n"); |
1241 |
|
fprintf(stderr,"Cannot open file %s in function phi_ordered\n",filename); |
1242 |
|
exit(1); |
1243 |
|
} |
1244 |
< |
|
1245 |
< |
rewind(file_in); |
1244 |
> |
|
1245 |
> |
skip_comments(file_in); |
1246 |
|
|
1247 |
|
if ( (ptr = malloc(145*sizeof(float))) == NULL ) |
1248 |
|
{ |