--- ray/src/gen/gendaymtx.c 2014/05/30 00:00:54 2.14 +++ ray/src/gen/gendaymtx.c 2015/08/01 23:27:04 2.20 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: gendaymtx.c,v 2.14 2014/05/30 00:00:54 greg Exp $"; +static const char RCSid[] = "$Id: gendaymtx.c,v 2.20 2015/08/01 23:27:04 greg Exp $"; #endif /* * gendaymtx.c @@ -86,8 +86,10 @@ static const char RCSid[] = "$Id: gendaymtx.c,v 2.14 2 #include #include #include "rtmath.h" +#include "resolu.h" #include "platform.h" #include "color.h" +#include "resolu.h" char *progname; /* Program name */ char errmsg[128]; /* Error message buffer */ @@ -319,6 +321,7 @@ main(int argc, char *argv[]) int dir_is_horiz; /* direct is meas. on horizontal? */ float *mtx_data = NULL; /* our matrix data */ int ntsteps = 0; /* number of rows in matrix */ + int step_alloc = 0; int last_monthly = 0; /* month of last report */ int mo, da; /* month (1-12) and day (1-31) */ double hr; /* hour (local standard time) */ @@ -391,7 +394,8 @@ main(int argc, char *argv[]) break; case '5': /* 5-phase calculation */ nsuns = 1; - fixed_sun_sa = 6.797e-05; + fixed_sun_sa = PI/360.*atof(argv[++i]); + fixed_sun_sa *= fixed_sun_sa*PI; break; default: goto userr; @@ -460,7 +464,10 @@ main(int argc, char *argv[]) double sda, sta; /* make space for next time step */ mtx_offset = 3*nskypatch*ntsteps++; - mtx_data = resize_dmatrix(mtx_data, ntsteps, nskypatch); + if (ntsteps > step_alloc) { + step_alloc += (step_alloc>>1) + ntsteps + 7; + mtx_data = resize_dmatrix(mtx_data, step_alloc, nskypatch); + } if (dif <= 1e-4) { memset(mtx_data+mtx_offset, 0, sizeof(float)*3*nskypatch); continue; @@ -515,7 +522,7 @@ main(int argc, char *argv[]) printf("NROWS=%d\n", nskypatch); printf("NCOLS=%d\n", ntsteps); printf("NCOMP=3\n"); - fputformat(getfmtname(outfmt), stdout); + fputformat((char *)getfmtname(outfmt), stdout); putchar('\n'); } /* patches are rows (outer sort) */