Initial snark14m import
[snark14.git] / src / snark / disp.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/disp.cpp $
5 $LastChangedRevision: 85 $
6 $Date: 2014-07-02 16:07:08 -0400 (Wed, 02 Jul 2014) $
7 $Author: agulati $
8 **********************************************************************
9
10  PRODUCE THE NUMERIC DISPLAY OF A RECONSTRUCTION ON THE PRINTER.
11  CALLED BY DISP.
12 */
13
14 #include <cstdio>
15
16 #include "blkdta.h"
17
18 #include "disp.h"
19
20 void disp(REAL* a, INTEGER nrow, INTEGER mcol, REAL scale, FILE* file)
21 {
22     
23   INTEGER nlim;
24   INTEGER n;
25   int m, i;
26   INTEGER mfst;
27   INTEGER mlst;
28   INTEGER ifst;
29   INTEGER ilst;
30
31
32   fprintf(file, "\n                    scaling factor = %10.4f\n", scale);      
33       
34   nlim = nrow * mcol;
35   for(n = 0; n < nlim; n++) {
36   
37     a[n] = scale * a[n]; 
38   }
39
40   for(mfst = 0; mfst < mcol; mfst+=10) { // bug 130 - fix loop increment - swr - 7/6/05
41     mlst = MIN0(mfst + 9, mcol - 1);  // Bug 130 - fix the number of columns printed. Lajos, 7/8/05
42     fprintf(file, "\n\n                    printing columns %4i to %4i", mfst, mlst);
43     fprintf(file, "\n\n           ");
44     for(m = mfst; m <= mlst; m++) {
45       fprintf(file, " %10i", m);
46     }
47
48     ifst = mfst;
49     ilst = mlst;
50     for(n = 0; n <nrow; n++) {
51       fprintf(file, "\n  %5d     ",n);
52       for(i = ifst; i <= ilst; i++) {
53         fprintf(file, " %10.4f", a[i]);
54       }
55
56       ifst += mcol;
57       ilst += mcol;
58     }
59   }
60   return;
61 }