1 |
C $Header: /u/gcmpack/MITgcm/pkg/rw/read_write_rec.F,v 1.2 2006/08/04 02:48:05 jmc Exp $ |
2 |
C $Name: $ |
3 |
#include "RW_OPTIONS.h" |
4 |
|
5 |
C-- File read_write_rec.F: Routines to handle mid-level I/O interface. |
6 |
C-- Contents |
7 |
C-- o SET_WRITE_GLOBAL_REC |
8 |
C-- o WRITE_REC_XY_RS |
9 |
C-- o WRITE_REC_XY_RL |
10 |
C-- o WRITE_REC_XYZ_RS |
11 |
C-- o WRITE_REC_XYZ_RL |
12 |
C-- o WRITE_REC_3D_RS |
13 |
C-- o WRITE_REC_3D_RL |
14 |
|
15 |
CBOP |
16 |
C !ROUTINE: SET_WRITE_GLOBAL_REC |
17 |
C !INTERFACE: |
18 |
SUBROUTINE SET_WRITE_GLOBAL_REC ( flag ) |
19 |
IMPLICIT NONE |
20 |
|
21 |
C !DESCRIPTION: \bv |
22 |
C SET_WRITE_GLOBAL_FLD( flag ) sets an internal logical state to |
23 |
C indicate whether files written by subsequent call to the |
24 |
C READ_WRITE_FLD package should create "global" or "tiled" files. |
25 |
C flag = .TRUE. indicates "global" files |
26 |
C flag = .FALSE. indicates "tiled" files |
27 |
C \ev |
28 |
|
29 |
C !INPUT/OUTPUT PARAMETERS: |
30 |
C Arguments |
31 |
LOGICAL flag |
32 |
C !USES: |
33 |
C Common |
34 |
COMMON /RD_WR_REC/ globalFile |
35 |
LOGICAL globalFile |
36 |
CEOP |
37 |
|
38 |
globalFile=flag |
39 |
|
40 |
RETURN |
41 |
END |
42 |
|
43 |
CBOP |
44 |
C !ROUTINE: WRITE_REC_XY_RS |
45 |
C !INTERFACE: |
46 |
SUBROUTINE WRITE_REC_XY_RS( fName,field,iRec,myIter,myThid) |
47 |
|
48 |
C !DESCRIPTION: \bv |
49 |
C WRITE_REC_XY_RS is a "front-end" interface to the low-level I/O |
50 |
C routines. |
51 |
C \ev |
52 |
|
53 |
C !USES: |
54 |
IMPLICIT NONE |
55 |
C Global |
56 |
#include "SIZE.h" |
57 |
#include "EEPARAMS.h" |
58 |
#include "PARAMS.h" |
59 |
|
60 |
C !INPUT/OUTPUT PARAMETERS: |
61 |
C Arguments |
62 |
CHARACTER*(*) fName |
63 |
_RS field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy) |
64 |
INTEGER iRec |
65 |
INTEGER myIter |
66 |
INTEGER myThid |
67 |
|
68 |
C Functions |
69 |
c INTEGER ILNBLNK |
70 |
|
71 |
C Common |
72 |
COMMON /RD_WR_REC/ globalFile |
73 |
LOGICAL globalFile |
74 |
|
75 |
C !LOCAL VARIABLES: |
76 |
C Local |
77 |
CHARACTER*(2) fType |
78 |
INTEGER nNz |
79 |
c INTEGER IL |
80 |
c CHARACTER*(MAX_LEN_FNAM) fullName |
81 |
CEOP |
82 |
|
83 |
|
84 |
c IF (myIter.GE.0) THEN |
85 |
c IL=ILNBLNK( fName ) |
86 |
c WRITE(fullName,'(2a,i10.10)') fName(1:IL),'.',myIter |
87 |
c ELSE |
88 |
c fullName=fName |
89 |
c ENDIF |
90 |
|
91 |
fType='RS' |
92 |
nNz=1 |
93 |
c globalFile=.FALSE. |
94 |
#ifdef ALLOW_MDSIO |
95 |
CALL MDSWRITEFIELD( fName, writeBinaryPrec, globalFile, |
96 |
& fType, nNz, field, iRec, myIter, myThid ) |
97 |
#endif |
98 |
RETURN |
99 |
END |
100 |
|
101 |
CBOP |
102 |
C !ROUTINE: WRITE_REC_XY_RL |
103 |
C !INTERFACE: |
104 |
SUBROUTINE WRITE_REC_XY_RL( fName,field,iRec,myIter,myThid) |
105 |
|
106 |
C !DESCRIPTION: \bv |
107 |
C WRITE_REC_XY_RL is a "front-end" interface to the low-level I/O |
108 |
C routines. |
109 |
C \ev |
110 |
|
111 |
C !USES: |
112 |
IMPLICIT NONE |
113 |
C Global |
114 |
#include "SIZE.h" |
115 |
#include "EEPARAMS.h" |
116 |
#include "PARAMS.h" |
117 |
|
118 |
C !INPUT/OUTPUT PARAMETERS: |
119 |
C Arguments |
120 |
CHARACTER*(*) fName |
121 |
_RL field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy) |
122 |
INTEGER iRec |
123 |
INTEGER myIter |
124 |
INTEGER myThid |
125 |
|
126 |
C Functions |
127 |
c INTEGER ILNBLNK |
128 |
|
129 |
C Common |
130 |
COMMON /RD_WR_REC/ globalFile |
131 |
LOGICAL globalFile |
132 |
|
133 |
C !LOCAL VARIABLES: |
134 |
C Local |
135 |
CHARACTER*(2) fType |
136 |
INTEGER nNz |
137 |
c INTEGER IL |
138 |
c CHARACTER*(MAX_LEN_FNAM) fullName |
139 |
CEOP |
140 |
|
141 |
|
142 |
c IF (myIter.GE.0) THEN |
143 |
c IL=ILNBLNK( fName ) |
144 |
c WRITE(fullName,'(2a,i10.10)') fName(1:IL),'.',myIter |
145 |
c ELSE |
146 |
c fullName=fName |
147 |
c ENDIF |
148 |
|
149 |
fType='RL' |
150 |
nNz=1 |
151 |
c globalFile=.FALSE. |
152 |
#ifdef ALLOW_MDSIO |
153 |
CALL MDSWRITEFIELD( fName, writeBinaryPrec, globalFile, |
154 |
& fType, nNz, field, iRec, myIter, myThid ) |
155 |
#endif |
156 |
RETURN |
157 |
END |
158 |
|
159 |
CBOP |
160 |
C !ROUTINE: WRITE_REC_XYZ_RS |
161 |
C !INTERFACE: |
162 |
SUBROUTINE WRITE_REC_XYZ_RS( fName,field,iRec,myIter,myThid) |
163 |
|
164 |
C !DESCRIPTION: \bv |
165 |
C WRITE_REC_XYZ_RS is a "front-end" interface to the low-level I/O |
166 |
C routines. |
167 |
C \ev |
168 |
|
169 |
C !USES: |
170 |
IMPLICIT NONE |
171 |
C Global |
172 |
#include "SIZE.h" |
173 |
#include "EEPARAMS.h" |
174 |
#include "PARAMS.h" |
175 |
|
176 |
C !INPUT/OUTPUT PARAMETERS: |
177 |
C Arguments |
178 |
CHARACTER*(*) fName |
179 |
_RS field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
180 |
INTEGER iRec |
181 |
INTEGER myIter |
182 |
INTEGER myThid |
183 |
|
184 |
C Functions |
185 |
c INTEGER ILNBLNK |
186 |
|
187 |
C Common |
188 |
COMMON /RD_WR_REC/ globalFile |
189 |
LOGICAL globalFile |
190 |
|
191 |
C !LOCAL VARIABLES: |
192 |
C Local |
193 |
CHARACTER*(2) fType |
194 |
INTEGER nNz |
195 |
c INTEGER IL |
196 |
c CHARACTER*(MAX_LEN_FNAM) fullName |
197 |
CEOP |
198 |
|
199 |
|
200 |
c IF (myIter.GE.0) THEN |
201 |
c IL=ILNBLNK( fName ) |
202 |
c WRITE(fullName,'(2a,i10.10)') fName(1:IL),'.',myIter |
203 |
c ELSE |
204 |
c fullName=fName |
205 |
c ENDIF |
206 |
|
207 |
fType='RS' |
208 |
nNz=Nr |
209 |
c globalFile=.FALSE. |
210 |
#ifdef ALLOW_MDSIO |
211 |
CALL MDSWRITEFIELD( fName, writeBinaryPrec, globalFile, |
212 |
& fType, nNz, field, iRec, myIter, myThid ) |
213 |
#endif |
214 |
RETURN |
215 |
END |
216 |
|
217 |
CBOP |
218 |
C !ROUTINE: WRITE_REC_XYZ_RL |
219 |
C !INTERFACE: |
220 |
SUBROUTINE WRITE_REC_XYZ_RL( fName,field,iRec,myIter,myThid) |
221 |
|
222 |
C !DESCRIPTION: \bv |
223 |
C WRITE_REC_XYZ_RL is a "front-end" interface to the low-level I/O |
224 |
C routines. |
225 |
C \ev |
226 |
|
227 |
C !USES: |
228 |
IMPLICIT NONE |
229 |
C Global |
230 |
#include "SIZE.h" |
231 |
#include "EEPARAMS.h" |
232 |
#include "PARAMS.h" |
233 |
|
234 |
C !INPUT/OUTPUT PARAMETERS: |
235 |
C Arguments |
236 |
CHARACTER*(*) fName |
237 |
_RL field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
238 |
INTEGER iRec |
239 |
INTEGER myIter |
240 |
INTEGER myThid |
241 |
|
242 |
C Functions |
243 |
c INTEGER ILNBLNK |
244 |
|
245 |
C Common |
246 |
COMMON /RD_WR_REC/ globalFile |
247 |
LOGICAL globalFile |
248 |
|
249 |
C !LOCAL VARIABLES: |
250 |
C Local |
251 |
CHARACTER*(2) fType |
252 |
INTEGER nNz |
253 |
c INTEGER IL |
254 |
c CHARACTER*(MAX_LEN_FNAM) fullName |
255 |
CEOP |
256 |
|
257 |
|
258 |
c IF (myIter.GE.0) THEN |
259 |
c IL=ILNBLNK( fName ) |
260 |
c WRITE(fullName,'(2a,i10.10)') fName(1:IL),'.',myIter |
261 |
c ELSE |
262 |
c fullName=fName |
263 |
c ENDIF |
264 |
|
265 |
fType='RL' |
266 |
nNz=Nr |
267 |
c globalFile=.FALSE. |
268 |
#ifdef ALLOW_MDSIO |
269 |
CALL MDSWRITEFIELD( fName, writeBinaryPrec, globalFile, |
270 |
& fType, nNz, field, iRec, myIter, myThid ) |
271 |
#endif |
272 |
RETURN |
273 |
END |
274 |
|
275 |
CBOP |
276 |
C !ROUTINE: WRITE_REC_3D_RS |
277 |
C !INTERFACE: |
278 |
SUBROUTINE WRITE_REC_3D_RS( |
279 |
I fName, fPrec, nNz, field, |
280 |
I iRec, myIter, myThid ) |
281 |
|
282 |
C !DESCRIPTION: \bv |
283 |
C WRITE_REC_3D_RS is a "front-end" interface to the low-level I/O routines. |
284 |
C write a full 3D field (nNz levels) to record number "iRec" |
285 |
C in binary file "fName" (precision "fPrec", generally =32 or 64). |
286 |
C \ev |
287 |
|
288 |
C !USES: |
289 |
IMPLICIT NONE |
290 |
C Global |
291 |
#include "SIZE.h" |
292 |
#include "EEPARAMS.h" |
293 |
#include "PARAMS.h" |
294 |
|
295 |
C !INPUT/OUTPUT PARAMETERS: |
296 |
C Arguments |
297 |
CHARACTER*(*) fName |
298 |
INTEGER fPrec |
299 |
INTEGER nNz |
300 |
_RS field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nNz,nSx,nSy) |
301 |
INTEGER iRec |
302 |
INTEGER myIter |
303 |
INTEGER myThid |
304 |
|
305 |
C Functions |
306 |
c INTEGER ILNBLNK |
307 |
|
308 |
C Common |
309 |
COMMON /RD_WR_REC/ globalFile |
310 |
LOGICAL globalFile |
311 |
|
312 |
C !LOCAL VARIABLES: |
313 |
C Local |
314 |
CHARACTER*(2) fType |
315 |
c INTEGER IL |
316 |
c CHARACTER*(MAX_LEN_FNAM) fullName |
317 |
CEOP |
318 |
|
319 |
|
320 |
c IF (myIter.GE.0) THEN |
321 |
c IL=ILNBLNK( fName ) |
322 |
c WRITE(fullName,'(2a,i10.10)') fName(1:IL),'.',myIter |
323 |
c ELSE |
324 |
c fullName=fName |
325 |
c ENDIF |
326 |
|
327 |
fType='RS' |
328 |
c globalFile=.FALSE. |
329 |
#ifdef ALLOW_MDSIO |
330 |
CALL MDSWRITEFIELD( fName, fPrec, globalFile, |
331 |
& fType, nNz, field, iRec, myIter, myThid ) |
332 |
#endif |
333 |
RETURN |
334 |
END |
335 |
|
336 |
CBOP |
337 |
C !ROUTINE: WRITE_REC_3D_RL |
338 |
C !INTERFACE: |
339 |
SUBROUTINE WRITE_REC_3D_RL( |
340 |
I fName, fPrec, nNz, field, |
341 |
I iRec, myIter, myThid ) |
342 |
|
343 |
C !DESCRIPTION: \bv |
344 |
C WRITE_REC_3D_RL is a "front-end" interface to the low-level I/O routines. |
345 |
C write a full 3D field (nNz levels) to record number "iRec" |
346 |
C in binary file "fName" (precision "fPrec", generally =32 or 64). |
347 |
C \ev |
348 |
|
349 |
C !USES: |
350 |
IMPLICIT NONE |
351 |
C Global |
352 |
#include "SIZE.h" |
353 |
#include "EEPARAMS.h" |
354 |
#include "PARAMS.h" |
355 |
|
356 |
C !INPUT/OUTPUT PARAMETERS: |
357 |
C Arguments |
358 |
CHARACTER*(*) fName |
359 |
INTEGER fPrec |
360 |
INTEGER nNz |
361 |
_RL field(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nNz,nSx,nSy) |
362 |
INTEGER iRec |
363 |
INTEGER myIter |
364 |
INTEGER myThid |
365 |
|
366 |
C Functions |
367 |
c INTEGER ILNBLNK |
368 |
|
369 |
C Common |
370 |
COMMON /RD_WR_REC/ globalFile |
371 |
LOGICAL globalFile |
372 |
|
373 |
C !LOCAL VARIABLES: |
374 |
C Local |
375 |
CHARACTER*(2) fType |
376 |
c INTEGER IL |
377 |
c CHARACTER*(MAX_LEN_FNAM) fullName |
378 |
CEOP |
379 |
|
380 |
|
381 |
c IF (myIter.GE.0) THEN |
382 |
c IL=ILNBLNK( fName ) |
383 |
c WRITE(fullName,'(2a,i10.10)') fName(1:IL),'.',myIter |
384 |
c ELSE |
385 |
c fullName=fName |
386 |
c ENDIF |
387 |
|
388 |
fType='RL' |
389 |
c globalFile=.FALSE. |
390 |
#ifdef ALLOW_MDSIO |
391 |
CALL MDSWRITEFIELD( fName, fPrec, globalFile, |
392 |
& fType, nNz, field, iRec, myIter, myThid ) |
393 |
#endif |
394 |
RETURN |
395 |
END |