/[MITgcm]/MITgcm/pkg/mdsio/mdsio_facef_read.F
ViewVC logotype

Contents of /MITgcm/pkg/mdsio/mdsio_facef_read.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Sun Jun 28 01:06:39 2009 UTC (14 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint62, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61s, checkpoint61z, checkpoint61x, checkpoint61y, HEAD
Changes since 1.3: +2 -2 lines
add bj in exch2 arrays and S/R

1 C $Header: /u/gcmpack/MITgcm/pkg/mdsio/mdsio_facef_read.F,v 1.3 2009/05/12 19:56:35 jmc Exp $
2 C $Name: $
3
4 #include "MDSIO_OPTIONS.h"
5
6 C-- File mdsio_read_facefile.F:
7 C-- Contents
8 C-- o MDS_FACEF_READ_RS
9 C-- o MDS_FACEF_READ_RL <- not yet coded
10
11 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
12
13 CBOP
14 C !ROUTINE: MDS_FACEF_READ_RS
15 C !INTERFACE:
16 SUBROUTINE MDS_FACEF_READ_RS(
17 I fName, fPrec, irec,
18 U array,
19 I bi,bj, myThid )
20 C !DESCRIPTION: \bv
21 C *==========================================================*
22 C | SUBROUTINE MDS_FACEF_READ_RS
23 C *==========================================================*
24 C | Read 1 field from a file which contains all the data from
25 C | 1 "face" (= piece of domain with rectangular topology)
26 C *==========================================================*
27 C \ev
28
29 C !USES:
30 IMPLICIT NONE
31 C === Global variables ===
32 #include "SIZE.h"
33 #include "EEPARAMS.h"
34 #ifdef ALLOW_EXCH2
35 #include "W2_EXCH2_SIZE.h"
36 #include "W2_EXCH2_TOPOLOGY.h"
37 #endif /* ALLOW_EXCH2 */
38
39 C !INPUT/OUTPUT PARAMETERS:
40 C == Routine arguments ==
41 CHARACTER*(*) fName
42 INTEGER fPrec
43 INTEGER irec
44 _RS array(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy)
45 INTEGER bi,bj, myThid
46 CEOP
47
48 C !FUNCTIONS:
49 INTEGER MDS_RECLEN
50 EXTERNAL MDS_RECLEN
51 INTEGER ILNBLNK
52 EXTERNAL ILNBLNK
53
54 C !LOCAL VARIABLES:
55 C == Local variables ==
56 INTEGER i,j, dUnit, iLen
57 INTEGER length_of_rec
58 CHARACTER*(MAX_LEN_MBUF) msgBuf
59 #ifdef ALLOW_EXCH2
60 INTEGER tN, dNx, dNy, tBx, tBy, tNx, tNY, jj, jBase
61 Real*4 ioBuf4(1:sNx*nSx*nPx+1)
62 Real*8 ioBuf8(1:sNx*nSx*nPx+1)
63 #else
64 Real*4 ioBuf4(1:sNx+1,1:sNy+1)
65 Real*8 ioBuf8(1:sNx+1,1:sNy+1)
66 #endif /* ALLOW_EXCH2 */
67
68 iLen = ILNBLNK(fName)
69 #ifdef ALLOW_EXCH2
70 C Figure out offset of tile within face
71 tN = W2_myTileList(bi,bj)
72 dNx = exch2_mydnx(tN)
73 dNy = exch2_mydny(tN)
74 tBx = exch2_tbasex(tN)
75 tBy = exch2_tbasey(tN)
76 tNx = exch2_tnx(tN)
77 tNy = exch2_tny(tN)
78
79 CALL MDSFINDUNIT( dUnit, myThid )
80 length_of_rec = MDS_RECLEN( fPrec, (dNx+1), myThid )
81 OPEN( dUnit, file=fName(1:iLen), status='old',
82 & access='direct', recl=length_of_rec )
83 j = 0
84 jBase=(irec-1)*(dNy+1)
85 IF ( fPrec.EQ.precFloat32 ) THEN
86 DO jj=1+tBy,sNy+1+tBy
87 READ(dUnit,rec=jj+jBase) (ioBuf4(i),i=1,dNx+1)
88 #ifdef _BYTESWAPIO
89 CALL MDS_BYTESWAPR4( (dNx+1), ioBuf4 )
90 #endif
91 j = j+1
92 DO i=1,sNx+1
93 array(i,j,bi,bj) = ioBuf4(i+tBx)
94 ENDDO
95 ENDDO
96 ELSEIF ( fPrec.EQ.precFloat64 ) THEN
97 DO jj=1+tBy,sNy+1+tBy
98 READ(dUnit,rec=jj+jBase) (ioBuf8(i),i=1,dNx+1)
99 #ifdef _BYTESWAPIO
100 CALL MDS_BYTESWAPR8( (dNx+1), ioBuf8 )
101 #endif
102 j = j+1
103 DO i=1,sNx+1
104 array(i,j,bi,bj) = ioBuf8(i+tBx)
105 ENDDO
106 ENDDO
107 ELSE
108 WRITE(msgBuf,'(A,I8,A)') ' MDS_FACEF_READ_RS:',
109 & fPrec, ' = illegal value for fPrec'
110 CALL PRINT_ERROR( msgBuf, myThid )
111 STOP 'ABNORMAL END: S/R MDS_FACEF_READ_RS'
112 ENDIF
113 CLOSE( dUnit )
114
115 #else /* ALLOW_EXCH2 */
116
117 CALL MDSFINDUNIT( dUnit, myThid )
118 length_of_rec = MDS_RECLEN( fPrec, (sNx+1)*(sNy+1), myThid )
119 OPEN( dUnit, file=fName(1:iLen), status='old',
120 & access='direct', recl=length_of_rec )
121 IF ( fPrec.EQ.precFloat32 ) THEN
122 READ(dUnit, rec=irec) ioBuf4
123 #ifdef _BYTESWAPIO
124 CALL MDS_BYTESWAPR4( (sNx+1)*(sNy+1), ioBuf4 )
125 #endif
126 DO j=1,sNy+1
127 DO i=1,sNx+1
128 array(i,j,bi,bj) = ioBuf4(i,j)
129 ENDDO
130 ENDDO
131 ELSEIF ( fPrec.EQ.precFloat64 ) THEN
132 READ(dUnit, rec=irec) ioBuf8
133 #ifdef _BYTESWAPIO
134 CALL MDS_BYTESWAPR8( (sNx+1)*(sNy+1), ioBuf8 )
135 #endif
136 DO j=1,sNy+1
137 DO i=1,sNx+1
138 array(i,j,bi,bj) = ioBuf8(i,j)
139 ENDDO
140 ENDDO
141 ELSE
142 WRITE(msgBuf,'(A,I8,A)') ' MDS_FACEF_READ_RS:',
143 & fPrec, ' = illegal value for fPrec'
144 CALL PRINT_ERROR( msgBuf, myThid )
145 STOP 'ABNORMAL END: S/R MDS_FACEF_READ_RS'
146 ENDIF
147 CLOSE( dUnit )
148
149 #endif /* ALLOW_EXCH2 */
150
151 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
152
153 RETURN
154 END

  ViewVC Help
Powered by ViewVC 1.1.22