MFIX  2016-1
out_bin_512r.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
2 ! C
3 ! Module name: OUT_BIN_512R C
4 ! Purpose: write out an array in chunks of 512 bytes (REAL WORDS) C
5 ! C
6 ! Author: P. Nicoletti Date: 02-JAN-92 C
7 ! Reviewer: P. Nicoletti, W. Rogers, M. Syamlal Date: 24-JAN-92 C
8 ! C
9 ! Revision Number: C
10 ! Purpose: C
11 ! Author: Date: dd-mmm-yy C
12 ! Reviewer: Date: dd-mmm-yy C
13 ! C
14 ! Literature/Document References: C
15 ! C
16 ! Variables referenced: C
17 ! Variables modified: C
18 ! C
19 ! Local variables: NWORDS, L, NSEG, NREM, LC, N1, N2 C
20 ! C
21 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
22 !
23  SUBROUTINE out_bin_512r(IUNIT, ARRAY, N, NEXT_REC)
24 !...Translated by Pacific-Sierra Research VAST-90 2.06G5 12:17:31 12/09/98
25 !...Switches: -xf
26 !
27 !-----------------------------------------------
28 ! M o d u l e s
29 !-----------------------------------------------
30  USE machine
31  IMPLICIT NONE
32 !-----------------------------------------------
33 ! D u m m y A r g u m e n t s
34 !-----------------------------------------------
35 !
36 ! array to write out
37  REAL ARRAY(*)
38 !
39 ! output unit number
40  INTEGER IUNIT
41 !
42 ! number of elements in ARRAY
43  INTEGER N
44 !
45 ! next record number in direct access output file
46  INTEGER NEXT_REC
47 !
48 ! local variables
49 !
50 ! number of words for 512 bytes (nwords * 4 = 512)
51  INTEGER NWORDS
52 !
53 ! loop counter
54  INTEGER L
55 !
56 ! number of full 512 byte segments need to write N
57 ! double precision words
58  INTEGER NSEG
59 !
60 ! number of double precision words in the partially
61 ! filled last record
62  INTEGER NREM
63 !
64 ! loop counter
65  INTEGER LC
66 !
67 ! write out array elements N1 to N2
68  INTEGER N1 , N2
69 !
70 !-----------------------------------------------
71 !
72 !
73  nwords = nwords_r
74  IF (n <= nwords) THEN
75  WRITE (iunit, rec=next_rec) (array(l),l=1,n)
76  next_rec = next_rec + 1
77  RETURN
78  ENDIF
79 !
80  nseg = n/nwords
81  nrem = mod(n,nwords)
82  n1 = 1
83  n2 = nwords
84 !
85 ! write out the full 512 byte segments
86 !
87  DO lc = 1, nseg
88  WRITE (iunit, rec=next_rec) (array(l),l=n1,n2)
89  n1 = n1 + nwords
90  n2 = n2 + nwords
91  next_rec = next_rec + 1
92  END DO
93  IF (nrem /= 0) THEN
94  WRITE (iunit, rec=next_rec) (array(l),l=n1,n)
95  next_rec = next_rec + 1
96  ENDIF
97 !
98  RETURN
99  END SUBROUTINE out_bin_512r
subroutine out_bin_512r(IUNIT, ARRAY, N, NEXT_REC)
Definition: out_bin_512r.f:24
integer nwords_r
Definition: machine_mod.f:11