bief_open_files.f

Go to the documentation of this file.
00001 C:\opentelemac\v7p0\sources\utils\bief\bief_open_files.f
00002 !
00082                      SUBROUTINE BIEF_OPEN_FILES
00083 !                    **************************
00084 !
00085      &(CODE,FILES,NFILES,PATH,NCAR,FLOT,IFLOT,ICODE)
00086 !
00087 !***********************************************************************
00088 ! BIEF   V7P0                                   26/12/2013
00089 !***********************************************************************
00090 !
00091 !
00092 !
00093 !
00094 !
00095 !
00096 !
00097 !
00098 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00099 !| CODE           |-->| NAME OF CALLING PROGRAMME
00100 !| FILES          |-->| STRUCTURES OF CODE FILES
00101 !| FLOT           |-->| LOGICAL, IF YES LOGICAL UNITS DECIDED BY
00102 !|                |   | THIS SUBROUTINE, IF NO, TAKEN IN SUBMIT
00103 !| ICODE          |---| NUMERO DU CODE EN CAS DE COUPLAGE
00104 !| IFLOT          |-->| IF FLOT=YES, START NEW LOGICAL UNIT NUMBERS
00105 !|                |   | AT IFLOT+1
00106 !| NCAR           |-->| NUMBER OF CHARACTERS IN THE PATH
00107 !| NFILES         |-->| NUMBER OF FILES
00108 !| PATH           |-->| FULL NAME OF THE PATH WHERE THE CASE IS
00109 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00110 !
00111       USE BIEF, EX_BIEF_OPEN_FILES => BIEF_OPEN_FILES
00112       USE DECLARATIONS_TELEMAC
00113       USE M_MED
00114 !
00115       IMPLICIT NONE
00116       INTEGER     LNG,LU
00117       COMMON/INFO/LNG,LU
00118 !
00119 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00120 !
00121       INTEGER           , INTENT(IN)    :: NFILES
00122       CHARACTER(LEN=24) , INTENT(IN)    :: CODE
00123       TYPE(BIEF_FILE)   , INTENT(INOUT) :: FILES(NFILES)
00124       CHARACTER(LEN=250), INTENT(IN)    :: PATH
00125       INTEGER           , INTENT(IN)    :: NCAR,ICODE
00126       INTEGER           , INTENT(INOUT) :: IFLOT
00127       LOGICAL           , INTENT(IN)    :: FLOT
00128 !
00129 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00130 !
00131       INTEGER I
00132       CHARACTER(LEN=80) :: TITLE
00133 !
00134       CHARACTER(LEN=11) :: FORME,EXTENS
00135       EXTERNAL EXTENS
00136 !
00137 !-----------------------------------------------------------------------
00138 !
00139 !     MESSAGE
00140 !
00141       IF(LNG.EQ.1) WRITE(LU,*) 'OUVERTURE DES FICHIERS POUR ',CODE
00142       IF(LNG.EQ.2) WRITE(LU,*) 'OPENING FILES FOR ',CODE
00143 !
00144 !
00145 !     DECODES THE SUBMIT STRING FOR THE FILES IN THE STEERING FILE
00146 !
00147       DO I=1,NFILES
00148 !
00149         IF(FILES(I)%NAME(1:1).NE.' ') THEN
00150 !
00151 !         LOGICAL UNIT MODIFIED WHEN COUPLING
00152 !
00153           IF(FLOT) THEN
00154             IFLOT=IFLOT+1
00155 !           2 AND 3 SKIPPED (DICTIONARY AND STEERING FILES)
00156             IF(IFLOT.EQ.2) IFLOT=4
00157 !           5 AND 6 SKIPPED (STANDARD INPUT AND OUTPUT)
00158             IF(IFLOT.EQ.5) IFLOT=7
00159             FILES(I)%LU=IFLOT
00160           ENDIF
00161 !
00162           IF(FILES(I)%BINASC.EQ.'ASC') THEN
00163             FORME='FORMATTED  '
00164           ELSE
00165             FORME='UNFORMATTED'
00166           ENDIF
00167 !
00168 !         OPENS THE FILE
00169 !
00170           IF(FILES(I)%FMT.EQ.'MED     ') THEN
00171 !
00172             IF(NCSIZE.LE.1) THEN
00173               CALL OPEN_FILE_MED(FILES(I)%TELNAME,FILES(I)%LU,
00174      &                           FILES(I)%ACTION)
00175             ELSE
00176 !             PARALLEL MODE, FILE TYPE: SCAL
00177               IF(FILES(I)%TYPE(1:4).EQ.'SCAL') THEN
00178                 IF(IPID.EQ.0.OR.FILES(I)%ACTION(1:5).NE.'WRITE') THEN
00179                   CALL OPEN_FILE_MED(
00180      &                PATH(1:NCAR)//TRIM(FILES(I)%TELNAME),
00181      &                FILES(I)%LU,FILES(I)%ACTION)
00182                 ENDIF
00183 !             PARALLEL MODE, OTHER FILE TYPE
00184               ELSE
00185                 CALL OPEN_FILE_MED(
00186      &               PATH(1:NCAR)//TRIM(FILES(I)%TELNAME)
00187      &               //EXTENS(NCSIZE-1,IPID),FILES(I)%LU,
00188      &               FILES(I)%ACTION)
00189               ENDIF
00190             ENDIF
00191 !
00192           ELSE
00193 !
00194             IF(NCSIZE.LE.1) THEN
00195 !             SCALAR
00196               OPEN(FILES(I)%LU,FILE=FILES(I)%TELNAME,
00197      &             FORM=FORME,ACTION=FILES(I)%ACTION)
00198             ELSE
00199 !             PARALLEL, FILE TYPE: SCAL
00200 !             ALL PROCESSORS CANNOT OPEN THE SAME FILE FOR WRITING
00201 !             IN THIS CASE, ONLY PROCESSOR 0 MAY OPEN AND WRITE
00202               IF(FILES(I)%TYPE(1:4).EQ.'SCAL') THEN
00203                 IF(IPID.EQ.0.OR.FILES(I)%ACTION(1:5).NE.'WRITE') THEN
00204                   OPEN(FILES(I)%LU,
00205      &                 FILE=PATH(1:NCAR)//TRIM(FILES(I)%TELNAME),
00206      &                 FORM=FORME,ACTION=FILES(I)%ACTION)
00207                 ENDIF
00208 !             PARALLEL, OTHER FILE TYPE
00209               ELSE
00210                 OPEN(FILES(I)%LU,
00211      &               FILE=PATH(1:NCAR)//TRIM(FILES(I)%TELNAME)
00212      &               //EXTENS(NCSIZE-1,IPID),
00213      &               FORM=FORME,ACTION=FILES(I)%ACTION)
00214               ENDIF
00215             ENDIF
00216 !
00217 !           ALREADY EXISTING FILE, CHECKING THE FORMAT
00218 !           WHEN IT IS WRITTEN IN THE TITLE
00219 !
00220             IF(FILES(I)%FMT(1:7).EQ.'SERAFIN'.AND.
00221      &         FILES(I)%ACTION(1:5).EQ.'READ ') THEN
00222               READ(FILES(I)%LU) TITLE
00223               IF(TITLE(73:79).EQ.'SERAFIN') THEN
00224                 IF(FILES(I)%FMT(8:8).NE.TITLE(80:80)) THEN
00225                   IF(LNG.EQ.1) THEN
00226                     WRITE(LU,*) 'FICHIER : ',FILES(I)%NAME
00227                     WRITE(LU,*) 'FORMAT ANNONCE : ',FILES(I)%FMT
00228                     WRITE(LU,*) 'FORMAT REEL : ',TITLE(73:80)
00229                   ENDIF
00230                   IF(LNG.EQ.2) THEN
00231                     WRITE(LU,*) 'FILE: ',FILES(I)%NAME
00232                     WRITE(LU,*) 'DECLARED FORMAT: ',FILES(I)%FMT
00233                     WRITE(LU,*) 'REAL FORMAT: ',TITLE(73:80)
00234                   ENDIF
00235                   CALL PLANTE(1)
00236                   STOP
00237                 ENDIF
00238               ENDIF
00239               REWIND(FILES(I)%LU)
00240             ENDIF
00241 !
00242           ENDIF
00243 !
00244         ENDIF
00245 !
00246       ENDDO
00247 !
00248 !     SETS AND STORES THE CODE NAME
00249 !
00250       NAMECODE = CODE
00251       NNAMECODE(ICODE) = CODE
00252 !
00253 !-----------------------------------------------------------------------
00254 !
00255       RETURN
00256       END

Generated on Fri Aug 31 2013 18:12:58 by S.E.Bourban (HRW) using doxygen 1.7.0