23 char tmp[1024], tmp2[1024], tmp3[1024];
26 if(verbose>0) printf(
"res2ift()\n");
29 if(res==NULL || ift==NULL) {
30 if(verbose>0) fprintf(stderr,
"Error: invalid input\n");
41 if(verbose>0) fprintf(stderr,
"Error: cannot set IFT content\n");
46 strftime(tmp, 256,
"%Y-%m-%d %H:%M:%S", &st);
47 iftPut(ift,
"date", tmp, NULL, 0);
59 snprintf(tmp, 1024,
"%d", res->
datanr);
iftPut(ift,
"datanr", tmp, NULL, 0);}
63 snprintf(tmp, 1024,
"%g", res->
density);
iftPut(ift,
"density", tmp, NULL, 0);}
65 snprintf(tmp, 1024,
"%g", res->
lc);
iftPut(ift,
"lc", tmp, NULL, 0);}
68 iftPut(ift,
"concentration", tmp, NULL, 0);
71 snprintf(tmp, 1024,
"%g", res->
beta);
iftPut(ift,
"beta", tmp, NULL, 0);}
73 snprintf(tmp, 1024,
"%g", res->
Vb);
iftPut(ift,
"Vb", tmp, NULL, 0);}
75 snprintf(tmp, 1024,
"%g", res->
fA);
iftPut(ift,
"fA", tmp, NULL, 0);}
77 snprintf(tmp, 1024,
"%g", res->
E);
iftPut(ift,
"E", tmp, NULL, 0);}
78 if(res->
isweight>0) strcpy(tmp,
"yes");
79 else if(res->
isweight==0) strcpy(tmp,
"no");
80 else strcpy(tmp,
"unknown");
81 iftPut(ift,
"weighting", tmp, NULL, 0);
84 for(ri=0; ri<res->
voiNr; ri++) {
91 for(pi=0; pi<res->
parNr; pi++) {
92 snprintf(tmp2, 1024,
"%s%s", tmp, res->
parname[pi]);
96 strcat(tmp3,
" "); strcat(tmp3, res->
parunit[pi]);}
97 iftPut(ift, tmp2, tmp3, NULL, 0);
98 if(!isnan(res->
voi[ri].
sd[pi])) {
99 snprintf(tmp2, 1024,
"%s%s_%s", tmp, res->
parname[pi],
"SD");
100 snprintf(tmp3, 1024,
"%g", res->
voi[ri].
sd[pi]);
102 strcat(tmp3,
" "); strcat(tmp3, res->
parunit[pi]);}
103 iftPut(ift, tmp2, tmp3, NULL, 0);
105 if(!isnan(res->
voi[ri].
cl1[pi])) {
106 snprintf(tmp2, 1024,
"%s%s_%s", tmp, res->
parname[pi],
"CL1");
107 snprintf(tmp3, 1024,
"%g", res->
voi[ri].
cl1[pi]);
109 strcat(tmp3,
" "); strcat(tmp3, res->
parunit[pi]);}
110 iftPut(ift, tmp2, tmp3, NULL, 0);
112 if(!isnan(res->
voi[ri].
cl2[pi])) {
113 snprintf(tmp2, 1024,
"%s%s_%s", tmp, res->
parname[pi],
"CL2");
114 snprintf(tmp3, 1024,
"%g", res->
voi[ri].
cl2[pi]);
116 strcat(tmp3,
" "); strcat(tmp3, res->
parunit[pi]);}
117 iftPut(ift, tmp2, tmp3, NULL, 0);
struct tm * gmtime_r(const time_t *t, struct tm *tm)
Convert time_t to GMT struct tm.
int iftPut(IFT *ift, char *key, char *value, char *cmt_type, int verbose)
Header file for libtpccurveio.
int rnameRmDots(char *rname1, char *rname2)
int res2ift(RES *res, IFT *ift, int verbose)
char plasmafile2[FILENAME_MAX]
char studynr[MAX_STUDYNR_LEN+1]
char parname[MAX_RESPARAMS][MAX_RESPARNAME_LEN+1]
char plasmafile[FILENAME_MAX]
char datafile[FILENAME_MAX]
char reffile[FILENAME_MAX]
char parunit[MAX_RESPARAMS][MAX_RESPARNAME_LEN+1]
char bloodfile[FILENAME_MAX]
double parameter[MAX_RESPARAMS]
double cl2[MAX_RESPARAMS]
double cl1[MAX_RESPARAMS]
char name[MAX_REGIONNAME_LEN+1]