File indexing completed on 2018-03-02 18:43:07 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
8be8fc53ab Jean*0001 #include "RW_OPTIONS.h"
0002
0003
0004
0005
0006
0007
79bad69582 Jean*0008
5bc5177bde Jean*0009
8be8fc53ab Jean*0010
1596008957 Jean*0011
8be8fc53ab Jean*0012
0013
0014
0015
0016
0017 SUBROUTINE READ_MFLDS_INIT(
0018 I myThid )
0019
0020
0021
0022
0023
0024 IMPLICIT NONE
0025
0026 #include "EEPARAMS.h"
0027 #include "RW_MFLDS.h"
0028
0029
0030
0031 INTEGER myThid
0032
0033
0034
0035
0036 INTEGER i
0037
0038
0039
0040
0041
0042 thirdDim = 0
0043 nFl3D = 0
0044 nFlds = 0
0045 nMissFld = 0
0046 mFldsFile = ' '
0047 DO i=1,sizFldList
0048 fldList(i) = ' '
0049 fldMiss(i) = ' '
0050 ENDDO
0051
0052 RETURN
0053 END
0054
0055
0056
0057
0058
0059 SUBROUTINE READ_MFLDS_SET(
0060 I fName,
0061 O nbFields, filePrec,
0062 I fileDim3, myIter, myThid )
0063
0064
0065
0066
0067
0068
0069
59b782c2b9 Jean*0070
0071
0072
8be8fc53ab Jean*0073
0074 IMPLICIT NONE
0075 #include "SIZE.h"
0076 #include "EEPARAMS.h"
0077 #include "PARAMS.h"
0078 #include "RW_MFLDS.h"
0079
0080
0081
0082
0083
0084
0085
0086
0087 CHARACTER*(MAX_LEN_FNAM) fName
0088 INTEGER nbFields
0089 INTEGER filePrec
0090 INTEGER fileDim3
0091 INTEGER myIter
0092 INTEGER myThid
0093
0094
0095
0096 INTEGER ILNBLNK
0097 EXTERNAL ILNBLNK
0098
0099
0100
0101 LOGICAL useCurrentDir
0102
0103 INTEGER nSizD, nSizT
0104 PARAMETER( nSizD = 5 , nSizT = 20 )
0105 CHARACTER*(MAX_LEN_PREC/2) simulName
0106 CHARACTER*(MAX_LEN_MBUF/2) titleLine
0107 INTEGER nDims, nTimRec
0108 INTEGER dimList(3,nSizD)
0109 _RL timList(nSizT)
115890d202 Jean*0110 _RL misVal
8be8fc53ab Jean*0111 INTEGER nRecords, fileIter
0112
0113 INTEGER i, j, ioUnit
0114 CHARACTER*(MAX_LEN_MBUF) msgBuf
0115
0116
59b782c2b9 Jean*0117
0118 nbFields = 0
0119 filePrec = 0
0120
8be8fc53ab Jean*0121 #ifdef RW_SAFE_MFLDS
0122 i = ILNBLNK(mFldsFile)
0123 IF ( i.NE.0 ) THEN
0124 i = MIN(i, MAX_LEN_MBUF-48-34 )
0125 WRITE(msgBuf,'(4A)') 'READ_MFLDS_SET: ',
0126 & 'MFLDS file-name already set to: ',mFldsFile(1:i)
0127 CALL PRINT_ERROR( msgBuf, myThid )
b445337786 Jean*0128 CALL ALL_PROC_DIE( myThid )
8be8fc53ab Jean*0129 STOP 'ABNORMAL END: S/R READ_MFLDS_SET (fileName)'
0130 ENDIF
0131 _BARRIER
0132 #endif /* RW_SAFE_MFLDS */
0133 _BEGIN_MASTER( myThid )
0134
0135
0136 thirdDim = fileDim3
0137 nFl3D = 0
0138 nFlds = 0
0139 nMissFld = 0
0140 mFldsFile = fName
0141 DO i=1,sizFldList
0142 fldList(i) = ' '
0143 fldMiss(i) = ' '
0144 ENDDO
0145
0146 #ifdef ALLOW_MDSIO
0147 useCurrentDir = .FALSE.
0148 nDims = nSizD
0149 nFlds = sizFldList
0150 nTimRec = nSizT
0151 CALL MDS_READ_META(
0152 I fName,
0153 O simulName,
0154 O titleLine,
0155 O filePrec,
0156 U nDims, nFlds, nTimRec,
0157 O dimList, fldList, timList,
115890d202 Jean*0158 O misVal, nRecords, fileIter,
8be8fc53ab Jean*0159 I useCurrentDir, myThid )
0160 #endif /* ALLOW_MDSIO */
0161
0162
0163 nFl3D = 0
0164 IF ( nFlds.GE.1 ) THEN
0165 IF ( nDims.EQ.2 .AND. thirdDim.GT.1
0166 & .AND. nFlds.LT.nRecords ) THEN
0167 IF ( MOD( nRecords-nFlds , thirdDim-1 ) .EQ. 0 )
0168 & nFl3D = (nRecords-nFlds)/(thirdDim-1)
0169 ENDIF
0170 IF ( nFlds.NE.nRecords .AND. nFl3D.EQ.0 ) THEN
0171
0172 WRITE(msgBuf,'(A,I5,A,I4,A)')
0173 & 'READ_MFLDS_SET: Pb with Nb of records=', nRecords,
0174 & ' (3rd-Dim=', thirdDim,')'
0175 CALL PRINT_ERROR( msgBuf, myThid )
0176 WRITE(msgBuf,'(A,I5,A,I4,A)')
0177 & ' does not match Nb of flds=', nFlds
0178 CALL PRINT_ERROR( msgBuf, myThid )
b445337786 Jean*0179 CALL ALL_PROC_DIE( 0 )
8be8fc53ab Jean*0180 STOP 'ABNORMAL END: S/R READ_MFLDS_SET (Nb-records Pb)'
0181 ENDIF
0182
0183 ENDIF
0184
0185
0186 IF ( debugLevel.GE.debLevA ) THEN
0187 ioUnit = standardMessageUnit
0188 i = ILNBLNK(simulName)
0189 IF ( i.GE.1 ) THEN
0190 WRITE(msgBuf,'(3A)') ' simulName=>', simulName(1:i), '<'
0191 CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0192 ENDIF
0193 i = ILNBLNK(titleLine)
0194 IF ( i.GE.1 ) THEN
0195 WRITE(msgBuf,'(3A)') ' titleLine=>', titleLine(1:i), '<'
0196 CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0197 ENDIF
0198 WRITE(msgBuf,'(2(A,I4),A,I10)')
0199 & ' nRecords =', nRecords, ' ; filePrec =', filePrec,
0200 & ' ; fileIter =', fileIter
0201 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0202 WRITE(msgBuf,'(A,I4,A)') ' nDims =', nDims, ' , dims:'
0203 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0204 DO j=1,nDims
0205 WRITE(msgBuf,'(I4,A,3I4)') j,':',(dimList(i,j),i=1,3)
0206 CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0207 ENDDO
0208 WRITE(msgBuf,'(3(A,I4))')
0209 & ' nFlds =', nFlds, ' , nFl3D =', nFl3D, ' , fields:'
0210 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0211 DO j=1,nFlds,20
0212 WRITE(msgBuf,'(20(A2,A8,A))')
0213 & (' >', fldList(i), '<', i=j,MIN(j+19,nFlds) )
0214 CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0215 ENDDO
5bc5177bde Jean*0216 WRITE(msgBuf,'(A,1PE22.14,A,I4,A)') 'missingVal=', misVal,
115890d202 Jean*0217 & ' ; nTimRec =',nTimRec,' , timeList:'
8be8fc53ab Jean*0218 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0219 IF ( nTimRec.GE.1 ) THEN
0220 WRITE(msgBuf,'(1P20E20.12)') (timList(i),i=1,nTimRec)
0221 CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0222 ENDIF
0223 ENDIF
0224
0225 _END_MASTER( myThid )
0226 _BARRIER
0227
59b782c2b9 Jean*0228
0229 nbFields = nFlds
0230
8be8fc53ab Jean*0231 RETURN
0232 END
0233
0234
0235
0236
0237
0238 SUBROUTINE READ_MFLDS_3D_RL(
0239 I fldName,
0240 O field,
0241 U nj,
0242 I fPrec, nNz, myIter, myThid )
0243
0244
0245
0246
0247
0248
0249
0250
0251 IMPLICIT NONE
0252 #include "SIZE.h"
0253 #include "EEPARAMS.h"
0254 #include "PARAMS.h"
0255 #include "RW_MFLDS.h"
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266 CHARACTER*(8) fldName
0267 _RL field(*)
0268 INTEGER nj
0269 INTEGER fPrec
0270 INTEGER nNz
0271 INTEGER myIter
0272 INTEGER myThid
0273
0274
0275
0276 INTEGER ILNBLNK
0277 EXTERNAL ILNBLNK
0278
0279
0280 INTEGER j, iL, ioUnit
b445337786 Jean*0281 LOGICAL prtMsg
db485ffb38 Jean*0282 LOGICAL useCurrentDir
1ab8368700 Jean*0283 _RS dummyRS(1)
8be8fc53ab Jean*0284 CHARACTER*(2) fType
0285 CHARACTER*(MAX_LEN_FNAM) fName
0286 CHARACTER*(MAX_LEN_MBUF) msgBuf
0287
0288
0289 iL = ILNBLNK(mFldsFile)
0290 #ifdef RW_SAFE_MFLDS
0291 IF ( iL.EQ.0 ) THEN
0292 WRITE(msgBuf,'(2A,I4)') 'READ_MFLDS_3D_RL: ',
0293 & 'empty MFLDS file-name'
0294 CALL PRINT_ERROR( msgBuf, myThid )
b445337786 Jean*0295 CALL ALL_PROC_DIE( myThid )
8be8fc53ab Jean*0296 STOP 'ABNORMAL END: S/R READ_MFLDS_3D_RL (fileName)'
0297 ENDIF
0298 #endif /* RW_SAFE_MFLDS */
0299
0300 ioUnit = standardMessageUnit
b445337786 Jean*0301 prtMsg = debugLevel.GE.debLevA .AND. myThid.EQ.1
8be8fc53ab Jean*0302 IF ( nFlds.GE.1 ) THEN
0303
0304 nj = 0
0305 DO j=1,nFlds
0306 IF ( fldName.EQ.fldList(j) .AND. nj.EQ.0 ) nj = j
0307 ENDDO
0308 IF ( nj.EQ.0 ) THEN
0309
0310 _BEGIN_MASTER( myThid )
0311 nMissFld = nMissFld + 1
0312 j = MIN(nMissFld,sizFldList)
0313 fldMiss(j) = fldName
0314 _END_MASTER( myThid )
b445337786 Jean*0315 IF ( prtMsg ) THEN
8be8fc53ab Jean*0316 iL = ILNBLNK(mFldsFile)
0317 iL = MIN(iL,MAX_LEN_MBUF-54-20)
0318 WRITE(msgBuf,'(5A)') 'READ_MFLDS_3D_RL: ',
0319 & 'field: "',fldName,'" missing in file: ',mFldsFile(1:iL)
0320 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0321 ENDIF
0322 ELSE
0323
0324 j = nj
0325 IF ( nj.GT.nFl3D ) nj = nj + nFl3D*(thirdDim-1)
b445337786 Jean*0326 IF ( prtMsg ) THEN
8be8fc53ab Jean*0327 WRITE(msgBuf,'(3A,2(A,I4))') 'READ_MFLDS_3D_RL: ',
0328 & 'read field: "',fldName,'", #',j,' in fldList, rec=',nj
0329 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0330 ENDIF
0331 ENDIF
0332 ELSEIF ( nj.GE.0 ) THEN
0333
0334 nj = nj + 1
b445337786 Jean*0335 IF ( prtMsg ) THEN
8be8fc53ab Jean*0336 WRITE(msgBuf,'(3A,2(A,I4))') 'READ_MFLDS_3D_RL: ',
0337 & 'no fldList, try to read field "',fldName, '", rec=',nj
0338 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0339 ENDIF
0340 ENDIF
0341
0342 IF ( nj.GE.1 ) THEN
0343
0344 fName = mFldsFile
db485ffb38 Jean*0345 useCurrentDir = .FALSE.
8be8fc53ab Jean*0346 fType = 'RL'
0347 #ifdef ALLOW_MDSIO
db485ffb38 Jean*0348 CALL MDS_READ_FIELD(
0349 I fName, fPrec, useCurrentDir,
0350 I fType, nNz, 1, nNz,
1ab8368700 Jean*0351 O field, dummyRS,
db485ffb38 Jean*0352 I nj, myThid )
0353
8be8fc53ab Jean*0354 #endif
0355 ENDIF
0356
0357 RETURN
0358 END
0359
0360
0361
79bad69582 Jean*0362
0363
0364 SUBROUTINE READ_MFLDS_LEV_RL(
0365 I fldName,
0366 O field,
0367 U nj,
0368 I fPrec, kSiz, kLo, kHi, myIter, myThid )
0369
0370
0371
5bc5177bde Jean*0372
79bad69582 Jean*0373
0374
5bc5177bde Jean*0375
79bad69582 Jean*0376
0377
0378 IMPLICIT NONE
0379 #include "SIZE.h"
0380 #include "EEPARAMS.h"
0381 #include "PARAMS.h"
0382 #include "RW_MFLDS.h"
0383
0384
0385
5bc5177bde Jean*0386
79bad69582 Jean*0387
0388
0389
0390
0391
0392
0393
0394
0395 CHARACTER*(8) fldName
0396 _RL field(*)
0397 INTEGER nj
0398 INTEGER fPrec
0399 INTEGER kSiz, kLo, kHi
0400 INTEGER myIter
0401 INTEGER myThid
0402
0403
0404
0405 INTEGER ILNBLNK
0406 EXTERNAL ILNBLNK
0407
0408
0409 INTEGER j, iL, ioUnit
b445337786 Jean*0410 LOGICAL prtMsg
79bad69582 Jean*0411 LOGICAL useCurrentDir
1ab8368700 Jean*0412 _RS dummyRS(1)
79bad69582 Jean*0413 CHARACTER*(2) fType
0414 CHARACTER*(MAX_LEN_FNAM) fName
0415 CHARACTER*(MAX_LEN_MBUF) msgBuf
0416
0417
0418 iL = ILNBLNK(mFldsFile)
0419 #ifdef RW_SAFE_MFLDS
0420 IF ( iL.EQ.0 ) THEN
0421 WRITE(msgBuf,'(2A,I4)') 'READ_MFLDS_LEV_RL: ',
0422 & 'empty MFLDS file-name'
0423 CALL PRINT_ERROR( msgBuf, myThid )
b445337786 Jean*0424 CALL ALL_PROC_DIE( myThid )
79bad69582 Jean*0425 STOP 'ABNORMAL END: S/R READ_MFLDS_LEV_RL (fileName)'
0426 ENDIF
0427 #endif /* RW_SAFE_MFLDS */
0428
0429 ioUnit = standardMessageUnit
b445337786 Jean*0430 prtMsg = debugLevel.GE.debLevA .AND. myThid.EQ.1
79bad69582 Jean*0431 IF ( nFlds.GE.1 ) THEN
0432
0433 nj = 0
0434 DO j=1,nFlds
0435 IF ( fldName.EQ.fldList(j) .AND. nj.EQ.0 ) nj = j
0436 ENDDO
0437 IF ( nj.EQ.0 ) THEN
0438
0439 _BEGIN_MASTER( myThid )
0440 nMissFld = nMissFld + 1
0441 j = MIN(nMissFld,sizFldList)
0442 fldMiss(j) = fldName
0443 _END_MASTER( myThid )
b445337786 Jean*0444 IF ( prtMsg ) THEN
79bad69582 Jean*0445 iL = ILNBLNK(mFldsFile)
0446 iL = MIN(iL,MAX_LEN_MBUF-54-20)
0447 WRITE(msgBuf,'(5A)') 'READ_MFLDS_LEV_RL: ',
0448 & 'field: "',fldName,'" missing in file: ',mFldsFile(1:iL)
0449 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0450 ENDIF
0451 ELSE
0452
0453 j = nj
0454 IF ( nj.GT.nFl3D ) nj = nj + nFl3D*(thirdDim-1)
b445337786 Jean*0455 IF ( prtMsg ) THEN
79bad69582 Jean*0456 WRITE(msgBuf,'(3A,2(A,I4))') 'READ_MFLDS_LEV_RL: ',
0457 & 'read field: "',fldName,'", #',j,' in fldList, rec=',nj
0458 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0459 ENDIF
0460 ENDIF
0461 ELSEIF ( nj.GE.0 ) THEN
0462
0463 nj = nj + 1
b445337786 Jean*0464 IF ( prtMsg ) THEN
79bad69582 Jean*0465 WRITE(msgBuf,'(3A,2(A,I4))') 'READ_MFLDS_LEV_RL: ',
0466 & 'no fldList, try to read field "',fldName, '", rec=',nj
0467 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0468 ENDIF
0469 ENDIF
0470
0471 IF ( nj.GE.1 ) THEN
0472
0473 fName = mFldsFile
0474 useCurrentDir = .FALSE.
0475 fType = 'RL'
0476 #ifdef ALLOW_MDSIO
0477 CALL MDS_READ_FIELD(
0478 I fName, fPrec, useCurrentDir,
0479 I fType, kSiz, kLo, kHi,
1ab8368700 Jean*0480 O field, dummyRS,
79bad69582 Jean*0481 I nj, myThid )
5bc5177bde Jean*0482
0483 #endif
0484 ENDIF
0485
0486 RETURN
0487 END
0488
0489
0490
0491
0492
0493 SUBROUTINE READ_MFLDS_LEV_RS(
0494 I fldName,
0495 O field,
0496 U nj,
0497 I fPrec, kSiz, kLo, kHi, myIter, myThid )
0498
0499
0500
0501
0502
0503
0504
0505
0506
0507 IMPLICIT NONE
0508 #include "SIZE.h"
0509 #include "EEPARAMS.h"
0510 #include "PARAMS.h"
0511 #include "RW_MFLDS.h"
0512
0513
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524 CHARACTER*(8) fldName
0525 _RS field(*)
0526 INTEGER nj
0527 INTEGER fPrec
0528 INTEGER kSiz, kLo, kHi
0529 INTEGER myIter
0530 INTEGER myThid
0531
0532
0533
0534 INTEGER ILNBLNK
0535 EXTERNAL ILNBLNK
0536
0537
0538 INTEGER j, iL, ioUnit
0539 LOGICAL prtMsg
0540 LOGICAL useCurrentDir
0541 _RL dummyRL(1)
0542 CHARACTER*(2) fType
0543 CHARACTER*(MAX_LEN_FNAM) fName
0544 CHARACTER*(MAX_LEN_MBUF) msgBuf
0545
0546
0547 iL = ILNBLNK(mFldsFile)
0548 #ifdef RW_SAFE_MFLDS
0549 IF ( iL.EQ.0 ) THEN
0550 WRITE(msgBuf,'(2A,I4)') 'READ_MFLDS_LEV_RS: ',
0551 & 'empty MFLDS file-name'
0552 CALL PRINT_ERROR( msgBuf, myThid )
0553 CALL ALL_PROC_DIE( myThid )
0554 STOP 'ABNORMAL END: S/R READ_MFLDS_LEV_RS (fileName)'
0555 ENDIF
0556 #endif /* RW_SAFE_MFLDS */
0557
0558 ioUnit = standardMessageUnit
0559 prtMsg = debugLevel.GE.debLevA .AND. myThid.EQ.1
0560 IF ( nFlds.GE.1 ) THEN
0561
0562 nj = 0
0563 DO j=1,nFlds
0564 IF ( fldName.EQ.fldList(j) .AND. nj.EQ.0 ) nj = j
0565 ENDDO
0566 IF ( nj.EQ.0 ) THEN
0567
0568 _BEGIN_MASTER( myThid )
0569 nMissFld = nMissFld + 1
0570 j = MIN(nMissFld,sizFldList)
0571 fldMiss(j) = fldName
0572 _END_MASTER( myThid )
0573 IF ( prtMsg ) THEN
0574 iL = ILNBLNK(mFldsFile)
0575 iL = MIN(iL,MAX_LEN_MBUF-54-20)
0576 WRITE(msgBuf,'(5A)') 'READ_MFLDS_LEV_RS: ',
0577 & 'field: "',fldName,'" missing in file: ',mFldsFile(1:iL)
0578 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0579 ENDIF
0580 ELSE
0581
0582 j = nj
0583 IF ( nj.GT.nFl3D ) nj = nj + nFl3D*(thirdDim-1)
0584 IF ( prtMsg ) THEN
0585 WRITE(msgBuf,'(3A,2(A,I4))') 'READ_MFLDS_LEV_RS: ',
0586 & 'read field: "',fldName,'", #',j,' in fldList, rec=',nj
0587 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0588 ENDIF
0589 ENDIF
0590 ELSEIF ( nj.GE.0 ) THEN
0591
0592 nj = nj + 1
0593 IF ( prtMsg ) THEN
0594 WRITE(msgBuf,'(3A,2(A,I4))') 'READ_MFLDS_LEV_RS: ',
0595 & 'no fldList, try to read field "',fldName, '", rec=',nj
0596 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0597 ENDIF
0598 ENDIF
0599
0600 IF ( nj.GE.1 ) THEN
0601
0602 fName = mFldsFile
0603 useCurrentDir = .FALSE.
0604 fType = 'RS'
0605 #ifdef ALLOW_MDSIO
0606 CALL MDS_READ_FIELD(
0607 I fName, fPrec, useCurrentDir,
0608 I fType, kSiz, kLo, kHi,
0609 O dummyRL, field,
0610 I nj, myThid )
79bad69582 Jean*0611
0612 #endif
0613 ENDIF
0614
0615 RETURN
0616 END
0617
0618
0619
8be8fc53ab Jean*0620
0621
0622 SUBROUTINE READ_MFLDS_CHECK(
0623 O errList,
0624 U nbErr,
0625 I myIter, myThid )
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636 IMPLICIT NONE
0637 #include "SIZE.h"
0638 #include "EEPARAMS.h"
0639 #include "PARAMS.h"
0640 #include "RW_MFLDS.h"
0641
0642
0643
0644
0645
0646
0647
0648
0649 CHARACTER*(8) errList(*)
0650 INTEGER nbErr
0651 INTEGER myIter
0652 INTEGER myThid
0653
0654
0655
0656 INTEGER ILNBLNK
0657 EXTERNAL ILNBLNK
0658
0659
0660 INTEGER i, j, nj, iL, ioUnit
b445337786 Jean*0661 LOGICAL prtMsg
8be8fc53ab Jean*0662 CHARACTER*(MAX_LEN_MBUF) msgBuf
0663
0664
0665 iL = ILNBLNK(mFldsFile)
0666 #ifdef RW_SAFE_MFLDS
0667 IF ( iL.EQ.0 ) THEN
0668 WRITE(msgBuf,'(2A,I4)') 'READ_MFLDS_CHECK: ',
0669 & 'empty MFLDS file-name'
0670 CALL PRINT_ERROR( msgBuf, myThid )
b445337786 Jean*0671 CALL ALL_PROC_DIE( myThid )
8be8fc53ab Jean*0672 STOP 'ABNORMAL END: S/R READ_MFLDS_CHECK (fileName)'
0673 ENDIF
0674 #endif /* RW_SAFE_MFLDS */
0675
0676
0677 DO j=1,nbErr
0678 errList(j) = ' '
0679 ENDDO
0680
79bad69582 Jean*0681
0682
0683 _BARRIER
0684
8be8fc53ab Jean*0685 IF ( nMissFld.GE.1 ) THEN
0686
0687
0688 ioUnit = errorMessageUnit
b445337786 Jean*0689 _BEGIN_MASTER( myThid )
8be8fc53ab Jean*0690 WRITE(msgBuf,'(3A)') 'READ_MFLDS_CHECK: ',
0691 & 'reading from file: ', mFldsFile(1:iL)
0692 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0693 WRITE(msgBuf,'(2A,I4,A)') 'READ_MFLDS_CHECK: ',
0694 & 'which contains ', nFlds, ' fields :'
0695 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0696 DO j=1,nFlds,20
0697 WRITE(msgBuf,'(20(A2,A8,A))')
0698 & (' >', fldList(i), '<', i=j,MIN(j+19,nFlds) )
0699 CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0700 ENDDO
0701 WRITE(msgBuf,'(A,I4,A)') 'READ_MFLDS_CHECK: ',
0702 & nMissFld, ' field(s) is/are missing :'
0703 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0704 nj = MIN( nMissFld, sizFldList )
0705 DO j=1,nj,20
0706 WRITE(msgBuf,'(20(A2,A8,A))')
0707 & (' >', fldMiss(i), '<', i=j,MIN(j+19,nj) )
0708 CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0709 ENDDO
b445337786 Jean*0710 _END_MASTER( myThid )
8be8fc53ab Jean*0711
0712
0713 IF ( nMissFld.GT.sizFldList ) THEN
0714 WRITE(msgBuf,'(2A,I4)') 'READ_MFLDS_CHECK: ',
0715 & 'missing fields list has been truncated to', sizFldList
0716 CALL PRINT_ERROR( msgBuf, myThid )
b445337786 Jean*0717 CALL ALL_PROC_DIE( myThid )
8be8fc53ab Jean*0718 STOP 'ABNORMAL END: S/R READ_MFLDS_CHECK (list-size Pb)'
0719 ENDIF
0720
0721
0722 nj = MIN( nMissFld, nbErr )
0723 DO j=1,nj
0724 errList(j) = fldMiss(j)
0725 ENDDO
0726 ELSE
0727
0728 ioUnit = standardMessageUnit
b445337786 Jean*0729 prtMsg = debugLevel.GE.debLevA .AND. myThid.EQ.1
0730 IF ( prtMsg ) THEN
8be8fc53ab Jean*0731 WRITE(msgBuf,'(3A)') 'READ_MFLDS_CHECK: ',
0732 & '- normal end ; reset MFLDS file-name: ', mFldsFile(1:iL)
0733 CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
0734 ENDIF
0735
0736 ENDIF
0737
0738
0739 nbErr = nMissFld
0740
0741 #ifdef RW_SAFE_MFLDS
0742 _BARRIER
0743 _BEGIN_MASTER( myThid )
0744
0745 mFldsFile = ' '
0746 _END_MASTER( myThid )
0747 _BARRIER
0748 #endif /* RW_SAFE_MFLDS */
0749
0750 RETURN
0751 END
1596008957 Jean*0752
0753
0754
0755
0756
0757 SUBROUTINE READ_MFLDS_RENAME(
0758 I fldName, newName,
0759 O errCode,
0760 I myThid )
0761
0762
0763
0764
0765
0766 IMPLICIT NONE
0767
0768 #include "EEPARAMS.h"
0769 #include "RW_MFLDS.h"
0770
0771
0772
0773
0774
0775
0776
0777 CHARACTER*(8) fldName
0778 CHARACTER*(8) newName
0779 INTEGER errCode
0780 INTEGER myThid
0781
0782
0783
0784
0785 INTEGER i , j
0786
0787
0788
0789 errCode = 1
0790
0791
0792 j = 0
0793 DO i=1,nFlds
0794 IF ( fldList(i) .EQ. fldName ) THEN
0795 IF ( j.EQ.0 ) THEN
0796 errCode = 0
0797 j = i
0798 ELSE
0799
0800 errCode = 3
0801 ENDIF
0802 ENDIF
0803 ENDDO
0804
0805 IF ( errCode.EQ.0 ) THEN
0806
0807 DO i=1,nFlds
0808 IF ( fldList(i).EQ.newName ) errCode = 2
0809 ENDDO
0810 ENDIF
0811
0812 IF ( errCode.EQ.0 ) THEN
694f6da5b8 Jean*0813 _BARRIER
1596008957 Jean*0814 _BEGIN_MASTER( myThid )
0815 fldList(j) = newName
0816 _END_MASTER( myThid )
0817 _BARRIER
0818 ENDIF
0819
0820 RETURN
0821 END