2 ***********************************************************
3 $SNARK_Header: S N A R K 1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4 $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/read_fomfile.c $
5 $LastChangedRevision: 94 $
6 $Date: 2014-07-02 18:53:30 -0400 (Wed, 02 Jul 2014) $
8 ***********************************************************
10 Previously part of SuperSNARK
15 #include "experimenter.h"
17 #include "read_fomfile.h"
19 /* ----------------------------- read_fomfile.c -------------------------
21 This function reads the fom values stored in fomfile.
24 iexp - experiment number
26 compare - counter for the number of COMPAREs read in so far
27 niters - number of iterations to be compared
28 fom - character string denoting the figure of merit
31 fom1 - array of length niters containing the fom for the first algorithm.
32 fom2 - array of length niters containing the fom for the second algorithm.
36 void read_fomfile(int iexp, int irun, int compare, int niters, char* fom, double* fom1, double* fom2)
38 int itr_a, itr_b, rexp, rrun, rcompare, i;
40 char string[MAXLINESIZE];
43 strcpy(string, "fomfil");
44 sprintf(string, "%s.%d", string, iexp);
46 if ((fomfile = fopen(string, "r")) == NULL)
48 errorc("in read_fomfile.c: error in opening file ", string);
53 /* Read fomfil until a line which contains the strings
54 'run','experiment', and 'compare' is reached. If this
55 line contains the correct combination of iexp, irun
56 and compare break out of while loop */
58 fgets(string, sizeof(string), fomfile);
59 if (strstr(string, "experiment") != NULL)
61 sscanf(string, "%*s %d %*s %d %*s %d", &rexp, &rrun, &rcompare);
62 if ((rexp == iexp) && (rrun == irun) && (rcompare == compare))
70 /* Continue reading fomfil until a line which contains
71 either the string '*****' or the fom is reached
72 then break out of while loop */
74 fgets(string, sizeof(string), fomfile);
75 if (strstr(string, fom) != NULL)
80 if (strstr(string, "*****") != NULL)
82 /* the string '*****' means no paired structures */
83 for (i = 0; i < niters; i++)
93 /* now read in the iteration numbers and the foms */
95 for (i = 0; i < niters; i++)
97 fgets(string, sizeof(string), fomfile);
98 sscanf(string, "%d %lf %d %lf", &itr_a, &fom_a, &itr_b, &fom_b);