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/projection.c $
5 $LastChangedRevision: 118 $
6 $Date: 2014-07-09 14:22:29 -0400 (Wed, 09 Jul 2014) $
8 ***********************************************************
11 /*--------------------------------------------------------------------------
13 Written by Jingsheng Zheng... November 1992
15 Modified by Jolyon Browne... June 1993
16 ----------------------------------------------------------------------------*/
20 #include "experimenter.h"
22 #include "projection.h"
24 /*--------------------------------------------------------------------------
26 This function echos the information stored in the file specified on
27 line 3 of the SuperSNARK input sequence. This information is sent to the
31 proj_flname - name of file containing information about generation of the
32 projection data. This is the file specified on line 3 of the
33 SuperSNARK input sequence.
34 seed - seed used in the random number generator.
38 ----------------------------------------------------------------------------*/
41 * 20140618 - BPRO: BUG 288 QUICK-FIX
43 * Replace current version of void projection(char* proj_flname, long seed)
44 * with the version from tar-ball: snark14.11.02.23
47 * The current version (tar-ball: snark14.14.04.10) should verify the
48 * input file of the projection command regarding its validity, but is missing
49 * some options (e.g. NITERS).
50 * The old version (tar-ball: snark14.11.02.23) does not perform any checks but
51 * copies all lines into the snark_e[runNo].in file.
53 * The file projection.c of the current version has been added as
54 * projection_snark14.14.04.10.c
55 * to SVN --> it can be used as basis for a "real" bug fix of bug 288
57 void projection(char* proj_flname, long seed)
59 char string[MAXLINESIZE];
62 //seed = -1; // bug 176 - swr - 11/8/05
63 // bug 269, Joanna Klukowska, Feb. 13, 2011
64 // projection seed is generated randomly based on the seed in the input file
65 long projection_seed = (long) (100000000 * drand48());
67 if ((projfl = fopen(proj_flname, "r")) == NULL)
69 errorc("error in opening file", proj_flname);
72 while ((fgets(string, sizeof(string), projfl)) != NULL)
74 while (isSkip(string)) //it's a comment line,
75 { //echo it to output and read next line
76 if (isComment(string))
77 fprintf(pstream, "%s", string);
78 if (fgets(string, sizeof(string), projfl) == NULL)
81 if (strncasecmp(string, "seed", 4) == 0)
83 fprintf(pstream, "seed %ld\n", projection_seed);
87 fprintf(pstream, "%s", string);