1 | SUBROUTINE TOBUF( A,IFL )
|
---|
2 |
|
---|
3 | C-----------------------------------------------------------------------
|
---|
4 | C (WRITE) TO BUF(FER)
|
---|
5 | C
|
---|
6 | C WRITES UP TO NSUBBL DATA BLOCKS TO OUTPUT BUFFER AND PUTS THE FULL
|
---|
7 | C BUFFER TO TAPE
|
---|
8 | C THIS SUBROUTINE IS CALLED FROM MAIN, ELECTR, PHOTON, INPRM, OUTEND,
|
---|
9 | C OUTPUT, OUTPT2, AND PHOTON
|
---|
10 | C ARGUMENTS:
|
---|
11 | C A = ARRAY TO BE WRITTEN TO TAPE
|
---|
12 | C IFL = STARTING OF FINAL OUTPUT
|
---|
13 | C = 0 NORMAL BLOCK
|
---|
14 | C = 1 NORMAL BLOCK WITH END OF OUTPUT
|
---|
15 | C = 2 ONLY END OF OUTPUT
|
---|
16 | C-----------------------------------------------------------------------
|
---|
17 |
|
---|
18 | IMPLICIT NONE
|
---|
19 | *KEEP,BUFFS.
|
---|
20 | COMMON /BUFFS/ RUNH,RUNE,EVTH,EVTE,DATAB,LH
|
---|
21 | INTEGER MAXBUF,MAXLEN
|
---|
22 | PARAMETER (MAXBUF=39*7)
|
---|
23 | PARAMETER (MAXLEN=12)
|
---|
24 | REAL RUNH(MAXBUF),EVTH(MAXBUF),EVTE(MAXBUF),
|
---|
25 | * RUNE(MAXBUF),DATAB(MAXBUF)
|
---|
26 | INTEGER LH
|
---|
27 | CHARACTER*4 CRUNH,CRUNE,CEVTH,CEVTE
|
---|
28 | EQUIVALENCE (RUNH(1),CRUNH), (RUNE(1),CRUNE)
|
---|
29 | EQUIVALENCE (EVTH(1),CEVTH), (EVTE(1),CEVTE)
|
---|
30 | *KEEP,RECORD.
|
---|
31 | COMMON /RECORD/ IRECOR
|
---|
32 | INTEGER IRECOR
|
---|
33 | *KEEP,RUNPAR.
|
---|
34 | COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
|
---|
35 | * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
|
---|
36 | * MONIOU,MDEBUG,NUCNUC,
|
---|
37 | * CETAPE,
|
---|
38 | * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
|
---|
39 | * N1STTR,MDBASE,
|
---|
40 | * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
|
---|
41 | * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
|
---|
42 | * ,GHEISH,GHESIG
|
---|
43 | COMMON /RUNPAC/ DSN,HOST,USER
|
---|
44 | DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
|
---|
45 | REAL STEPFC
|
---|
46 | INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
|
---|
47 | * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
|
---|
48 | * N1STTR,MDBASE
|
---|
49 | INTEGER CETAPE
|
---|
50 | CHARACTER*79 DSN
|
---|
51 | CHARACTER*20 HOST,USER
|
---|
52 |
|
---|
53 | LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
|
---|
54 | * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
|
---|
55 | * ,GHEISH,GHESIG
|
---|
56 | *KEND.
|
---|
57 |
|
---|
58 | INTEGER NSUBBL
|
---|
59 | PARAMETER (NSUBBL=21)
|
---|
60 | REAL A(*)
|
---|
61 | C NSUBBL IS NUMBER OF SUBBLOCKS IN ONE OUTPUT RECORD
|
---|
62 | C (OUTPUT RECORD LENGTH = NSUBBL * 39 * 7 * 4 BYTES <= 22932 )
|
---|
63 | C IBLK IS COUNTER FOR SUBBLOCKS
|
---|
64 | C OUTPUT BUFFER FOR PARTICLE OUTPUT
|
---|
65 | REAL OUTBUF(MAXBUF,NSUBBL)
|
---|
66 | INTEGER I,IBLK,IFL,K
|
---|
67 | SAVE OUTBUF
|
---|
68 | DATA IBLK / 0 /
|
---|
69 | C-----------------------------------------------------------------------
|
---|
70 |
|
---|
71 | IF ( DEBUG ) WRITE(MDEBUG,*) 'TOBUF : IFL =',IFL
|
---|
72 |
|
---|
73 |
|
---|
74 | C COPY TO BUFFER
|
---|
75 | IF ( IFL .LE. 1 ) THEN
|
---|
76 | IBLK = IBLK + 1
|
---|
77 | DO 1 I = 1,MAXBUF
|
---|
78 | OUTBUF(I,IBLK) = A(I)
|
---|
79 | 1 CONTINUE
|
---|
80 | ENDIF
|
---|
81 |
|
---|
82 | C WRITE TO TAPE IF BLOCK IS FULL OR IF IFL IS 1
|
---|
83 | IF ( IFL .GE. 1 .OR. IBLK .EQ. NSUBBL ) THEN
|
---|
84 | NRECS = NRECS + 1
|
---|
85 | NBLKS = NBLKS + IBLK
|
---|
86 | c>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
---|
87 | c WRITE(PATAPE) ((OUTBUF(I,K),I=1,MAXBUF),K=1,NSUBBL)
|
---|
88 | call jcdatsave(outbuf)
|
---|
89 | c>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
---|
90 | IRECOR = IRECOR + MAXBUF * NSUBBL
|
---|
91 | IBLK = 0
|
---|
92 | DO 2 K = 1,NSUBBL
|
---|
93 | DO 2 I = 1,MAXBUF
|
---|
94 | OUTBUF(I,K) = 0.0
|
---|
95 | 2 CONTINUE
|
---|
96 | ENDIF
|
---|
97 |
|
---|
98 | RETURN
|
---|
99 | END
|
---|