Initial snark14m import
[snark14.git] / src / snark / creatr.cpp
1 /*
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/creatr.cpp $
5 $LastChangedRevision: 85 $
6 $Date: 2014-07-02 16:07:08 -0400 (Wed, 02 Jul 2014) $
7 $Author: agulati $
8 ***********************************************************
9  */
10
11 // CREATR GENERATES FILE11 WITH THE FORMAT REQUIRED
12 // FOR INPUT BY THE 'PICTURE' AND 'PROJECTION' COMMANDS
13
14 #include <cstdlib>
15 #include <cstdio>
16
17 #include "blkdta.h"
18 #include "creacm.h"
19 #include "uiod.h"
20
21 #include "geom.h"
22 #include "creatr.h"
23 #include "creaer.h"
24 #include "creaph.h"
25 #include "creapr.h"
26 #include "second.h"
27
28 #include "file11.h"
29 #include "infile.h"
30
31 void creatr() {
32     REAL time;
33     REAL begin;
34     REAL end;
35
36     static BOOLEAN called = FALSE;
37
38     //??  real aperwt
39
40     // TEST FOR MULTIPLE CALLS FOR CREATR; CALLED = .TRUE. IF
41     // CREATR HAS BEEN CALLED ONCE
42
43     if (called) {
44         creaer(1);
45     }
46     called = TRUE;
47
48
49     // INPUT PHASE
50
51     InFile.CreaInCrea();
52
53     // IF ERFLAG IS SET TO .TRUE. THEN INPUT HAS ERRORS; ABORT JOB
54     if (Creacm.erflag) {
55         fprintf(output, "\n **** error in inputfile");
56         fprintf(output, "\n **** program aborted\n");
57         exit(-1);
58     }
59
60     // IF PHANTOM IS SPECIFIED, PICFLG = .TRUE. THEN START CREATING FILE1
61
62     if (Creacm.picflg) {
63         second(&begin);
64         File11.wrhdr(CHAR2INT('p', 'h', 'a', 'n'));
65         creaph( );
66         second(&end);
67         time = end - begin;
68
69
70         fprintf(output, "\n         %10.3f seconds phantom creation", time); // changed precision to three digits - swr 1/21/06
71     }
72
73     // IF RAYSUMS ARE SPECIFIED, PRJFLG = .TRUE. , START CREATING FILE11
74
75     if (Creacm.prjflg) {
76         second(&begin);
77         File11.wrhdr(CHAR2INT('r', 'a', 'y', 's'));
78         File11.Flush();
79         creapr( );
80         File11.Flush();
81         second(&end);
82         time = end - begin;
83
84         fprintf(output, "\n         %10.3f seconds projection data creation", time); // changed precision to two digits - swr 1/21/06
85     }
86
87 }