--- imach/src/imach.c 2002/02/20 17:08:52 1.15 +++ imach/src/imach.c 2002/02/20 17:12:32 1.16 @@ -85,7 +85,7 @@ double jmean; /* Mean space between 2 wa double **oldm, **newm, **savm; /* Working pointers to matrices */ double **oldms, **newms, **savms; /* Fixed working pointers to matrices */ FILE *fic,*ficpar, *ficparo,*ficres, *ficrespl, *ficrespij, *ficrest,*ficresf; -FILE *ficgp, *fichtm,*ficresprob; +FILE *ficgp, *fichtm,*ficresprob,*ficpop; FILE *ficreseij; char filerese[FILENAMELENGTH]; FILE *ficresvij; @@ -1860,6 +1860,7 @@ int main() char fileres[FILENAMELENGTH], filerespij[FILENAMELENGTH], filereso[FILENAMELENGTH], fileresf[FILENAMELENGTH]; char filerest[FILENAMELENGTH]; char fileregp[FILENAMELENGTH]; + char popfile[FILENAMELENGTH]; char path[80],pathc[80],pathcd[80],pathtot[80],model[20]; int firstobs=1, lastobs=10; int sdeb, sfin; /* Status at beginning and end */ @@ -1867,8 +1868,9 @@ int main() int ju,jl, mi; int i1,j1, k1,k2,k3,jk,aa,bb, stepsize, ij; int jnais,jdc,jint4,jint1,jint2,jint3,**outcome,**adl,*tab; - int mobilav=0, fprev, lprev ,fprevfore=1, lprevfore=1,nforecast; + int mobilav=0, fprev, lprev ,fprevfore=1, lprevfore=1,nforecast,popforecast=0; int hstepm, nhstepm; + int *popage; double bage, fage, age, agelim, agebase; double ftolpl=FTOL; @@ -1882,7 +1884,8 @@ int main() double ***eij, ***vareij; double **varpl; /* Variances of prevalence limits by age */ double *epj, vepp; - double kk1; + double kk1, kk2; + double *popeffectif,*popcount; char version[80]="Imach version 64b, May 2001, INED-EUROREVES "; char *alph[]={"a","a","b","c","d","e"}, str[4]; @@ -1898,7 +1901,7 @@ int main() gettimeofday(&start_time, (struct timezone*)0); */ /* at first time */ - printf("\nIMACH, Version 0.64b"); + printf("\nIMACH, Version 0.7"); printf("\nEnter the parameter file name: "); #ifdef windows @@ -1955,6 +1958,8 @@ while((c=getc(ficpar))=='#' && c!= EOF){ ungetc(c,ficpar); fscanf(ficpar,"fprevalence=%d lprevalence=%d pop_based=%d\n",&fprev,&lprev,&popbased); + fprintf(ficparo,"fprevalence=%d lprevalence=%d pop_based=%d\n",fprev,lprev,popbased); + while((c=getc(ficpar))=='#' && c!= EOF){ ungetc(c,ficpar); fgets(line, MAXLINE, ficpar); @@ -1964,6 +1969,18 @@ while((c=getc(ficpar))=='#' && c!= EOF){ ungetc(c,ficpar); fscanf(ficpar,"fprevalence=%d lprevalence=%d nforecast=%d mob_average=%d\n",&fprevfore,&lprevfore,&nforecast,&mobilav); + fprintf(ficparo,"fprevalence=%d lprevalence=%d nforecast=%d mob_average=%d\n",fprevfore,lprevfore,nforecast,mobilav); + + +while((c=getc(ficpar))=='#' && c!= EOF){ + ungetc(c,ficpar); + fgets(line, MAXLINE, ficpar); + puts(line); + fputs(line,ficparo); + } + ungetc(c,ficpar); + + fscanf(ficpar,"popforecast=%d popfile=%s\n",&popforecast,popfile); covar=matrix(0,NCOVMAX,1,n); cptcovn=0; @@ -2335,8 +2352,10 @@ printf("Total number of individuals= %d, } /*--------- results files --------------*/ - fprintf(ficres,"\ntitle=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%e stepm=%d ncov=%d nlstate=%d ndeath=%d maxwav=%d mle=%d weight=%d\nmodel=%s\n", title, datafile, lastobs, firstpass,lastpass,ftol, stepm, ncov, nlstate, ndeath, maxwav, mle,weightopt,model); - + fprintf(ficres,"title=%s datafile=%s lastobs=%d firstpass=%d lastpass=%d\nftol=%e stepm=%d ncov=%d nlstate=%d ndeath=%d maxwav=%d mle=%d weight=%d\nmodel=%s\n", title, datafile, lastobs, firstpass,lastpass,ftol, stepm, ncov, nlstate, ndeath, maxwav, mle,weightopt,model); + fprintf(ficres,"fprevalence=%d lprevalence=%d pop_based=%d\n",fprev,lprev,popbased); + fprintf(ficres,"fprevalence=%d lprevalence=%d nforecast=%d mob_average=%d\n",fprevfore,lprevfore,nforecast,mobilav); + jk=1; fprintf(ficres,"# Parameters\n"); printf("# Parameters\n"); @@ -2618,7 +2637,7 @@ chdir(path); printf("Problem with %s \n",optionfilehtm);goto end; } - fprintf(fichtm,"