1 |
jmc |
1.1 |
C $Header: $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "RW_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
C-- File read_mflds.F: Routines to handle reading Multi-Fields File (+ meta file) |
7 |
|
|
C-- Contents |
8 |
|
|
C-- o READ_MFLDS_INIT |
9 |
|
|
C-- o READ_MFLDS_SET |
10 |
|
|
C-- o READ_MFLDS_3D_RL |
11 |
|
|
C-- o READ_MFLDS_CHECK |
12 |
|
|
|
13 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
14 |
|
|
CBOP |
15 |
|
|
C !ROUTINE: READ_MFLDS_INIT |
16 |
|
|
C !INTERFACE: |
17 |
|
|
SUBROUTINE READ_MFLDS_INIT( |
18 |
|
|
I myThid ) |
19 |
|
|
|
20 |
|
|
C !DESCRIPTION: |
21 |
|
|
C Initialise Multi-Fields read variables in common block |
22 |
|
|
|
23 |
|
|
C !USES: |
24 |
|
|
IMPLICIT NONE |
25 |
|
|
c#include "SIZE.h" |
26 |
|
|
#include "EEPARAMS.h" |
27 |
|
|
#include "RW_MFLDS.h" |
28 |
|
|
|
29 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
30 |
|
|
C myThid :: my Thread Id. number |
31 |
|
|
INTEGER myThid |
32 |
|
|
CEOP |
33 |
|
|
|
34 |
|
|
C !LOCAL VARIABLES: |
35 |
|
|
C i :: loop counter |
36 |
|
|
INTEGER i |
37 |
|
|
C- for debug print: |
38 |
|
|
c CHARACTER*(MAX_LEN_MBUF) msgBuf |
39 |
|
|
|
40 |
|
|
C----- |
41 |
|
|
|
42 |
|
|
C- Initialise variables in common block: |
43 |
|
|
thirdDim = 0 |
44 |
|
|
nFl3D = 0 |
45 |
|
|
nFlds = 0 |
46 |
|
|
nMissFld = 0 |
47 |
|
|
mFldsFile = ' ' |
48 |
|
|
DO i=1,sizFldList |
49 |
|
|
fldList(i) = ' ' |
50 |
|
|
fldMiss(i) = ' ' |
51 |
|
|
ENDDO |
52 |
|
|
|
53 |
|
|
RETURN |
54 |
|
|
END |
55 |
|
|
|
56 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
57 |
|
|
CBOP |
58 |
|
|
C !ROUTINE: READ_MFLDS_SET |
59 |
|
|
C !INTERFACE: |
60 |
|
|
SUBROUTINE READ_MFLDS_SET( |
61 |
|
|
I fName, |
62 |
|
|
O nbFields, filePrec, |
63 |
|
|
I fileDim3, myIter, myThid ) |
64 |
|
|
|
65 |
|
|
C !DESCRIPTION: |
66 |
|
|
C This is the controlling routine for preparing Multi-Fields read |
67 |
|
|
C by reading the corresponding meta file. |
68 |
|
|
C the meta-file content is stored in common block (header: RW_MFLDS.h) |
69 |
|
|
C to be reachable by all threads |
70 |
|
|
|
71 |
|
|
C !USES: |
72 |
|
|
IMPLICIT NONE |
73 |
|
|
#include "SIZE.h" |
74 |
|
|
#include "EEPARAMS.h" |
75 |
|
|
#include "PARAMS.h" |
76 |
|
|
#include "RW_MFLDS.h" |
77 |
|
|
|
78 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
79 |
|
|
C fName :: current MFLDS file name (prefix) to read |
80 |
|
|
C nbFields :: Number of fields in current MFLDS file |
81 |
|
|
C filePrec :: data-precision in current MFLDS file |
82 |
|
|
C fileDim3 :: 3rd dimension of fields in current MFLDS file |
83 |
|
|
C myIter :: Iteration number |
84 |
|
|
C myThid :: my Thread Id. number |
85 |
|
|
CHARACTER*(MAX_LEN_FNAM) fName |
86 |
|
|
INTEGER nbFields |
87 |
|
|
INTEGER filePrec |
88 |
|
|
INTEGER fileDim3 |
89 |
|
|
INTEGER myIter |
90 |
|
|
INTEGER myThid |
91 |
|
|
CEOP |
92 |
|
|
|
93 |
|
|
C !FUNCTIONS |
94 |
|
|
INTEGER ILNBLNK |
95 |
|
|
EXTERNAL ILNBLNK |
96 |
|
|
|
97 |
|
|
C !LOCAL VARIABLES: |
98 |
|
|
C- do change dir. (using mdsioLocalDir): |
99 |
|
|
LOGICAL useCurrentDir |
100 |
|
|
C- output of MDS_READ_META : |
101 |
|
|
INTEGER nSizD, nSizT |
102 |
|
|
PARAMETER( nSizD = 5 , nSizT = 20 ) |
103 |
|
|
CHARACTER*(MAX_LEN_PREC/2) simulName |
104 |
|
|
CHARACTER*(MAX_LEN_MBUF/2) titleLine |
105 |
|
|
INTEGER nDims, nTimRec |
106 |
|
|
INTEGER dimList(3,nSizD) |
107 |
|
|
_RL timList(nSizT) |
108 |
|
|
INTEGER nRecords, fileIter |
109 |
|
|
C- for debug print: |
110 |
|
|
INTEGER i, j, ioUnit |
111 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
112 |
|
|
|
113 |
|
|
C----- |
114 |
|
|
|
115 |
|
|
#ifdef RW_SAFE_MFLDS |
116 |
|
|
i = ILNBLNK(mFldsFile) |
117 |
|
|
IF ( i.NE.0 ) THEN |
118 |
|
|
i = MIN(i, MAX_LEN_MBUF-48-34 ) |
119 |
|
|
WRITE(msgBuf,'(4A)') 'READ_MFLDS_SET: ', |
120 |
|
|
& 'MFLDS file-name already set to: ',mFldsFile(1:i) |
121 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
122 |
|
|
STOP 'ABNORMAL END: S/R READ_MFLDS_SET (fileName)' |
123 |
|
|
ENDIF |
124 |
|
|
_BARRIER |
125 |
|
|
#endif /* RW_SAFE_MFLDS */ |
126 |
|
|
_BEGIN_MASTER( myThid ) |
127 |
|
|
|
128 |
|
|
C- Initialise variables in common block: |
129 |
|
|
thirdDim = fileDim3 |
130 |
|
|
nFl3D = 0 |
131 |
|
|
nFlds = 0 |
132 |
|
|
nMissFld = 0 |
133 |
|
|
mFldsFile = fName |
134 |
|
|
DO i=1,sizFldList |
135 |
|
|
fldList(i) = ' ' |
136 |
|
|
fldMiss(i) = ' ' |
137 |
|
|
ENDDO |
138 |
|
|
|
139 |
|
|
#ifdef ALLOW_MDSIO |
140 |
|
|
useCurrentDir = .FALSE. |
141 |
|
|
nDims = nSizD |
142 |
|
|
nFlds = sizFldList |
143 |
|
|
nTimRec = nSizT |
144 |
|
|
CALL MDS_READ_META( |
145 |
|
|
I fName, |
146 |
|
|
O simulName, |
147 |
|
|
O titleLine, |
148 |
|
|
O filePrec, |
149 |
|
|
U nDims, nFlds, nTimRec, |
150 |
|
|
O dimList, fldList, timList, |
151 |
|
|
O nRecords, fileIter, |
152 |
|
|
I useCurrentDir, myThid ) |
153 |
|
|
#endif /* ALLOW_MDSIO */ |
154 |
|
|
|
155 |
|
|
C- evaluate Nb of 3.D fields (used if mix 3-D & 2-D fields in file): |
156 |
|
|
nFl3D = 0 |
157 |
|
|
IF ( nFlds.GE.1 ) THEN |
158 |
|
|
IF ( nDims.EQ.2 .AND. thirdDim.GT.1 |
159 |
|
|
& .AND. nFlds.LT.nRecords ) THEN |
160 |
|
|
IF ( MOD( nRecords-nFlds , thirdDim-1 ) .EQ. 0 ) |
161 |
|
|
& nFl3D = (nRecords-nFlds)/(thirdDim-1) |
162 |
|
|
ENDIF |
163 |
|
|
IF ( nFlds.NE.nRecords .AND. nFl3D.EQ.0 ) THEN |
164 |
|
|
C- here we have a problem |
165 |
|
|
WRITE(msgBuf,'(A,I5,A,I4,A)') |
166 |
|
|
& 'READ_MFLDS_SET: Pb with Nb of records=', nRecords, |
167 |
|
|
& ' (3rd-Dim=', thirdDim,')' |
168 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
169 |
|
|
WRITE(msgBuf,'(A,I5,A,I4,A)') |
170 |
|
|
& ' does not match Nb of flds=', nFlds |
171 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
172 |
|
|
STOP 'ABNORMAL END: S/R READ_MFLDS_SET (Nb-records Pb)' |
173 |
|
|
ENDIF |
174 |
|
|
c IF ( nFl3D.EQ.0 ) nFl3D = nFlds |
175 |
|
|
ENDIF |
176 |
|
|
|
177 |
|
|
C- set output arguments: |
178 |
|
|
nbFields = nFlds |
179 |
|
|
|
180 |
|
|
C- write to Standard Output |
181 |
|
|
IF ( debugLevel.GE.debLevA ) THEN |
182 |
|
|
ioUnit = standardMessageUnit |
183 |
|
|
i = ILNBLNK(simulName) |
184 |
|
|
IF ( i.GE.1 ) THEN |
185 |
|
|
WRITE(msgBuf,'(3A)') ' simulName=>', simulName(1:i), '<' |
186 |
|
|
CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
187 |
|
|
ENDIF |
188 |
|
|
i = ILNBLNK(titleLine) |
189 |
|
|
IF ( i.GE.1 ) THEN |
190 |
|
|
WRITE(msgBuf,'(3A)') ' titleLine=>', titleLine(1:i), '<' |
191 |
|
|
CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
192 |
|
|
ENDIF |
193 |
|
|
WRITE(msgBuf,'(2(A,I4),A,I10)') |
194 |
|
|
& ' nRecords =', nRecords, ' ; filePrec =', filePrec, |
195 |
|
|
& ' ; fileIter =', fileIter |
196 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
197 |
|
|
WRITE(msgBuf,'(A,I4,A)') ' nDims =', nDims, ' , dims:' |
198 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
199 |
|
|
DO j=1,nDims |
200 |
|
|
WRITE(msgBuf,'(I4,A,3I4)') j,':',(dimList(i,j),i=1,3) |
201 |
|
|
CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
202 |
|
|
ENDDO |
203 |
|
|
WRITE(msgBuf,'(3(A,I4))') |
204 |
|
|
& ' nFlds =', nFlds, ' , nFl3D =', nFl3D, ' , fields:' |
205 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
206 |
|
|
DO j=1,nFlds,20 |
207 |
|
|
WRITE(msgBuf,'(20(A2,A8,A))') |
208 |
|
|
& (' >', fldList(i), '<', i=j,MIN(j+19,nFlds) ) |
209 |
|
|
CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
210 |
|
|
ENDDO |
211 |
|
|
WRITE(msgBuf,'(A,I4,A)') ' nTimRec =',nTimRec,' , timeList:' |
212 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
213 |
|
|
IF ( nTimRec.GE.1 ) THEN |
214 |
|
|
WRITE(msgBuf,'(1P20E20.12)') (timList(i),i=1,nTimRec) |
215 |
|
|
CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
216 |
|
|
ENDIF |
217 |
|
|
ENDIF |
218 |
|
|
|
219 |
|
|
_END_MASTER( myThid ) |
220 |
|
|
_BARRIER |
221 |
|
|
|
222 |
|
|
RETURN |
223 |
|
|
END |
224 |
|
|
|
225 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
226 |
|
|
CBOP |
227 |
|
|
C !ROUTINE: READ_MFLDS_3D_RL |
228 |
|
|
C !INTERFACE: |
229 |
|
|
SUBROUTINE READ_MFLDS_3D_RL( |
230 |
|
|
I fldName, |
231 |
|
|
O field, |
232 |
|
|
U nj, |
233 |
|
|
I fPrec, nNz, myIter, myThid ) |
234 |
|
|
|
235 |
|
|
C !DESCRIPTION: |
236 |
|
|
C Read, from a Multi-Fields binary file, field "fldName" into array "field" |
237 |
|
|
C record Nb "nj" is search through the field-list (from meta-file) which |
238 |
|
|
C has been set before (calling READ_MFLDS_SET). |
239 |
|
|
C In case nFlds is <=0 , by-pass the search and directly read record number "nj" |
240 |
|
|
|
241 |
|
|
C !USES: |
242 |
|
|
IMPLICIT NONE |
243 |
|
|
#include "SIZE.h" |
244 |
|
|
#include "EEPARAMS.h" |
245 |
|
|
#include "PARAMS.h" |
246 |
|
|
#include "RW_MFLDS.h" |
247 |
|
|
|
248 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
249 |
|
|
C fldName :: Name of the field to read |
250 |
|
|
C field :: Output array to read in |
251 |
|
|
C nj (in) :: number of the record (in file) just before the one to read |
252 |
|
|
C nj (out):: number of the record (from current file) which was read in |
253 |
|
|
C fPrec :: File precision (number of bits per word, = 32 or 64) |
254 |
|
|
C nNz :: Number of levels to read in |
255 |
|
|
C myIter :: Iteration number |
256 |
|
|
C myThid :: My Thread Id number |
257 |
|
|
CHARACTER*(8) fldName |
258 |
|
|
_RL field(*) |
259 |
|
|
INTEGER nj |
260 |
|
|
INTEGER fPrec |
261 |
|
|
INTEGER nNz |
262 |
|
|
INTEGER myIter |
263 |
|
|
INTEGER myThid |
264 |
|
|
CEOP |
265 |
|
|
|
266 |
|
|
C !FUNCTIONS |
267 |
|
|
INTEGER ILNBLNK |
268 |
|
|
EXTERNAL ILNBLNK |
269 |
|
|
|
270 |
|
|
C !LOCAL VARIABLES: |
271 |
|
|
INTEGER j, iL, ioUnit |
272 |
|
|
CHARACTER*(2) fType |
273 |
|
|
CHARACTER*(MAX_LEN_FNAM) fName |
274 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
275 |
|
|
|
276 |
|
|
C----- |
277 |
|
|
|
278 |
|
|
iL = ILNBLNK(mFldsFile) |
279 |
|
|
#ifdef RW_SAFE_MFLDS |
280 |
|
|
IF ( iL.EQ.0 ) THEN |
281 |
|
|
WRITE(msgBuf,'(2A,I4)') 'READ_MFLDS_3D_RL: ', |
282 |
|
|
& 'empty MFLDS file-name' |
283 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
284 |
|
|
STOP 'ABNORMAL END: S/R READ_MFLDS_3D_RL (fileName)' |
285 |
|
|
ENDIF |
286 |
|
|
#endif /* RW_SAFE_MFLDS */ |
287 |
|
|
|
288 |
|
|
ioUnit = standardMessageUnit |
289 |
|
|
IF ( nFlds.GE.1 ) THEN |
290 |
|
|
C-- Search for "fldName" in list of field-names: |
291 |
|
|
nj = 0 |
292 |
|
|
DO j=1,nFlds |
293 |
|
|
IF ( fldName.EQ.fldList(j) .AND. nj.EQ.0 ) nj = j |
294 |
|
|
ENDDO |
295 |
|
|
IF ( nj.EQ.0 ) THEN |
296 |
|
|
C- record unsuccessful search: |
297 |
|
|
_BEGIN_MASTER( myThid ) |
298 |
|
|
nMissFld = nMissFld + 1 |
299 |
|
|
j = MIN(nMissFld,sizFldList) |
300 |
|
|
fldMiss(j) = fldName |
301 |
|
|
_END_MASTER( myThid ) |
302 |
|
|
IF ( debugLevel.GE.debLevA ) THEN |
303 |
|
|
iL = ILNBLNK(mFldsFile) |
304 |
|
|
iL = MIN(iL,MAX_LEN_MBUF-54-20) |
305 |
|
|
WRITE(msgBuf,'(5A)') 'READ_MFLDS_3D_RL: ', |
306 |
|
|
& 'field: "',fldName,'" missing in file: ',mFldsFile(1:iL) |
307 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
308 |
|
|
ENDIF |
309 |
|
|
ELSE |
310 |
|
|
C- convert from field Number to record number (if mix of 3D & 2D flds) |
311 |
|
|
j = nj |
312 |
|
|
IF ( nj.GT.nFl3D ) nj = nj + nFl3D*(thirdDim-1) |
313 |
|
|
IF ( debugLevel.GE.debLevA ) THEN |
314 |
|
|
WRITE(msgBuf,'(3A,2(A,I4))') 'READ_MFLDS_3D_RL: ', |
315 |
|
|
& 'read field: "',fldName,'", #',j,' in fldList, rec=',nj |
316 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
317 |
|
|
ENDIF |
318 |
|
|
ENDIF |
319 |
|
|
ELSEIF ( nj.GE.0 ) THEN |
320 |
|
|
C- increment record number |
321 |
|
|
nj = nj + 1 |
322 |
|
|
IF ( debugLevel.GE.debLevA ) THEN |
323 |
|
|
WRITE(msgBuf,'(3A,2(A,I4))') 'READ_MFLDS_3D_RL: ', |
324 |
|
|
& 'no fldList, try to read field "',fldName, '", rec=',nj |
325 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
326 |
|
|
ENDIF |
327 |
|
|
ENDIF |
328 |
|
|
|
329 |
|
|
IF ( nj.GE.1 ) THEN |
330 |
|
|
C-- read in array "field" |
331 |
|
|
fName = mFldsFile |
332 |
|
|
fType = 'RL' |
333 |
|
|
#ifdef ALLOW_MDSIO |
334 |
|
|
CALL MDSREADFIELD( fName, fPrec, fType, |
335 |
|
|
& nNz, field, nj, myThid ) |
336 |
|
|
#endif |
337 |
|
|
c CALL READ_REC_3D_RL( fName, fPrec, nNz, field, nj, myIter, myThid ) |
338 |
|
|
ENDIF |
339 |
|
|
|
340 |
|
|
RETURN |
341 |
|
|
END |
342 |
|
|
|
343 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
344 |
|
|
CBOP |
345 |
|
|
C !ROUTINE: READ_MFLDS_CHECK |
346 |
|
|
C !INTERFACE: |
347 |
|
|
SUBROUTINE READ_MFLDS_CHECK( |
348 |
|
|
O errList, |
349 |
|
|
U nbErr, |
350 |
|
|
I myIter, myThid ) |
351 |
|
|
|
352 |
|
|
C !DESCRIPTION: |
353 |
|
|
C After reading a Multi-Fields binary file, check (and report) |
354 |
|
|
C for missing fields (attempted to read but not found). |
355 |
|
|
C |
356 |
|
|
C Note: If missing fields, print error msg but take no action (no stop) |
357 |
|
|
C but return number of missing fields (+ list, if nbErr_inputArg > 0) |
358 |
|
|
C Depending on the calling context, may choose to stop or to continue |
359 |
|
|
|
360 |
|
|
C !USES: |
361 |
|
|
IMPLICIT NONE |
362 |
|
|
#include "SIZE.h" |
363 |
|
|
#include "EEPARAMS.h" |
364 |
|
|
#include "PARAMS.h" |
365 |
|
|
#include "RW_MFLDS.h" |
366 |
|
|
|
367 |
|
|
C !INPUT PARAMETERS: |
368 |
|
|
C nbErr :: max size of array errList |
369 |
|
|
C myIter :: Iteration number |
370 |
|
|
C myThid :: My Thread Id number |
371 |
|
|
C !OUTPUT PARAMETERS: |
372 |
|
|
C errList :: List of missing fields (attempted to read but not found) |
373 |
|
|
C nbErr :: Number of missing fields (attempted to read but not found) |
374 |
|
|
CHARACTER*(8) errList(*) |
375 |
|
|
INTEGER nbErr |
376 |
|
|
INTEGER myIter |
377 |
|
|
INTEGER myThid |
378 |
|
|
CEOP |
379 |
|
|
|
380 |
|
|
C !FUNCTIONS |
381 |
|
|
INTEGER ILNBLNK |
382 |
|
|
EXTERNAL ILNBLNK |
383 |
|
|
|
384 |
|
|
C !LOCAL VARIABLES: |
385 |
|
|
INTEGER i, j, nj, iL, ioUnit |
386 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
387 |
|
|
|
388 |
|
|
C----- |
389 |
|
|
|
390 |
|
|
iL = ILNBLNK(mFldsFile) |
391 |
|
|
#ifdef RW_SAFE_MFLDS |
392 |
|
|
IF ( iL.EQ.0 ) THEN |
393 |
|
|
WRITE(msgBuf,'(2A,I4)') 'READ_MFLDS_CHECK: ', |
394 |
|
|
& 'empty MFLDS file-name' |
395 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
396 |
|
|
STOP 'ABNORMAL END: S/R READ_MFLDS_CHECK (fileName)' |
397 |
|
|
ENDIF |
398 |
|
|
#endif /* RW_SAFE_MFLDS */ |
399 |
|
|
|
400 |
|
|
C-- Initialise output arguments |
401 |
|
|
DO j=1,nbErr |
402 |
|
|
errList(j) = ' ' |
403 |
|
|
ENDDO |
404 |
|
|
|
405 |
|
|
IF ( nMissFld.GE.1 ) THEN |
406 |
|
|
C-- Attempted to read some fields that were not in the current MFLDS file |
407 |
|
|
C => report by printing Error Msg: |
408 |
|
|
ioUnit = errorMessageUnit |
409 |
|
|
WRITE(msgBuf,'(3A)') 'READ_MFLDS_CHECK: ', |
410 |
|
|
& 'reading from file: ', mFldsFile(1:iL) |
411 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
412 |
|
|
WRITE(msgBuf,'(2A,I4,A)') 'READ_MFLDS_CHECK: ', |
413 |
|
|
& 'which contains ', nFlds, ' fields :' |
414 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
415 |
|
|
DO j=1,nFlds,20 |
416 |
|
|
WRITE(msgBuf,'(20(A2,A8,A))') |
417 |
|
|
& (' >', fldList(i), '<', i=j,MIN(j+19,nFlds) ) |
418 |
|
|
CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
419 |
|
|
ENDDO |
420 |
|
|
WRITE(msgBuf,'(A,I4,A)') 'READ_MFLDS_CHECK: ', |
421 |
|
|
& nMissFld, ' field(s) is/are missing :' |
422 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
423 |
|
|
nj = MIN( nMissFld, sizFldList ) |
424 |
|
|
DO j=1,nj,20 |
425 |
|
|
WRITE(msgBuf,'(20(A2,A8,A))') |
426 |
|
|
& (' >', fldMiss(i), '<', i=j,MIN(j+19,nj) ) |
427 |
|
|
CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
428 |
|
|
ENDDO |
429 |
|
|
|
430 |
|
|
C- Size problem: |
431 |
|
|
IF ( nMissFld.GT.sizFldList ) THEN |
432 |
|
|
WRITE(msgBuf,'(2A,I4)') 'READ_MFLDS_CHECK: ', |
433 |
|
|
& 'missing fields list has been truncated to', sizFldList |
434 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
435 |
|
|
STOP 'ABNORMAL END: S/R READ_MFLDS_CHECK (list-size Pb)' |
436 |
|
|
ENDIF |
437 |
|
|
|
438 |
|
|
C- Fill the error output list (up to the Max size: nbErr) |
439 |
|
|
nj = MIN( nMissFld, nbErr ) |
440 |
|
|
DO j=1,nj |
441 |
|
|
errList(j) = fldMiss(j) |
442 |
|
|
ENDDO |
443 |
|
|
ELSE |
444 |
|
|
C-- Normal end : print msg before resetting "mFldsFile" |
445 |
|
|
ioUnit = standardMessageUnit |
446 |
|
|
IF ( debugLevel .GE. debLevA ) THEN |
447 |
|
|
WRITE(msgBuf,'(3A)') 'READ_MFLDS_CHECK: ', |
448 |
|
|
c & '- end reading file: ', mFldsFile(1:iL) |
449 |
|
|
c & '- normal end ; reset mFldsFile: ', mFldsFile(1:iL) |
450 |
|
|
& '- normal end ; reset MFLDS file-name: ', mFldsFile(1:iL) |
451 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
452 |
|
|
ENDIF |
453 |
|
|
|
454 |
|
|
ENDIF |
455 |
|
|
|
456 |
|
|
C- Return the number of missing fields |
457 |
|
|
nbErr = nMissFld |
458 |
|
|
|
459 |
|
|
#ifdef RW_SAFE_MFLDS |
460 |
|
|
_BARRIER |
461 |
|
|
_BEGIN_MASTER( myThid ) |
462 |
|
|
C-- Reset MFLDS file name: |
463 |
|
|
mFldsFile = ' ' |
464 |
|
|
_END_MASTER( myThid ) |
465 |
|
|
_BARRIER |
466 |
|
|
#endif /* RW_SAFE_MFLDS */ |
467 |
|
|
|
468 |
|
|
RETURN |
469 |
|
|
END |