File: /nfs/home/0/users/jenkins/mfix.git/model/out_bin_512i.f

1     !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
2     !                                                                      C
3     !  Module name: OUT_BIN_512I                                           C
4     !  Purpose: write out an array in chunks of 512 bytes (INTEGER 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_512I(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           INTEGER          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_I
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_512I
100