      SUBROUTINE INITIAL(IPARA)
C
      PARAMETER(NBSUF=13)
      INCLUDE 'com_options.f'
      INCLUDE 'com_faces.f'
      CHARACTER*128 BIDON
      CHARACTER*80  KINFO
      CHARACTER*64  CHEZMOI
      CHARACTER*32  CCDOT
      CHARACTER*8   SUF(NBSUF)
      INTEGER       LSUF(NBSUF)
      LOGICAL*4     LA,LA2
      DATA SUF / 'deformee','avoir3D ','avoir2D ','exagere '
     &         , 'nopo    ','c3d     ','xyz     ','pbm     '
     &         , 'pgm     ','amdba   ','am      ','am_fmt  '
     &         , 'msh     '
     &         /
      DATA LSUF /    8,7,7,7
     &          ,    4,3,3,3
     &          ,    3,5,2,6
     &          ,    3
     &          /
      DATA CHEZMOI / ' ' /
      DATA LCHEZMOI / 1 /
      DATA CCDOT / ' ...............................' /
C
      BMIDX   = 0.
      BMIDY   = 0.
      BMIDZ   = 0.
      IANG(1) = -180
      IANG(2) = -90
      IANG(3) = -45
      IANG(4) = -20
      IANG(5) = -10
      IANG(6) = -5
      IANG(7) = -2
      IANG(8) = -1
      IANG(9) =  1
      IANG(10) =  2
      IANG(11) =  5
      IANG(12) = 10
      IANG(13) = 20
      IANG(14) = 45
      IANG(15) = 90
      IANG(16) = 180
      ICENTR  = 0
      ICENTRISO  = 0
c      ICTFLE  = 1
c      ICTFLE  = 15
      ICTFLE  = 13
      ITYPFL  = 4
      ICOUPSU = 0
      ISOCOUP = 0
      IDFICH  = 0
      IDDEPL  = 0
      IDISO   = 0
      IDVIT   = 0
      IEPISO  = 0
      IFAC    = 31
      IFAC2   = 32
      IFC     = 1
      IFISO   = 0
      IFVISO  = 0
      IFVIT   = 0
      IINFO   = 1 
      IMAILL  = 1
      INUMER  = 0
      ISHRINK = 1
      IPCOUP  = 0
      IPOST   = 1
      IPREFC  = 1
      IPS2D   = 0
      ISHPRO  = 1
      IF (IPARA.GE.0) THEN
        ISO = 0
      ELSE
        IPARA = -IPARA
      ENDIF
      ISOFRO  = 0
      ITITAV  = 1
      IVALMAR = 0
      IVFIXE  = 0
      NPSUR   = 0
      NSSUR   = 0
      NSURF   = -1
      VITCOUL = .FALSE.
      FACDIO  = 1000.*(1.336613 - 1.)
      FACEXAX = 1.
      FACEXAY = 1.
      FACEXAZ = 1.
      FACEXA  = 0.
      FACLEG  = 1.
      FACVIT  = 1.
      HXA4    = 19.
      HYA4A   = 27.7
      HYA4B   = 23.5
      NBPG    = 0
      IF (IPARA.EQ.0) THEN
        FACLEG  = 1.
        IANGLE  = 15
        IAXES   = 4
        ICARRE  = 1
        ICT     = 3
        ICTFAC  = 0
        ICTFON  = 0
        ICTLEG  = 7
        IEPBOR2 = 2
        ISENS   = 1
        ISLEG   = 0
        HYA4    = HYA4B
        IDEFPS  = 1
        IDSEUL  = 0
        CALL DEFPS(IDEFPS,SIG,ANGPS,ICADPS,HELPPS,IDSEUL,0,ILANG)
        IPERSP  = -2
        DATE = KINFO('DATE')
        MOI  = KINFO('UTILISATEUR')
        MEMO = DATE(5:6)//'/'//DATE(3:4)//'/'//DATE(1:2)//'  '//MOI
      ELSE
        DO J=1,3
          DO I=1,3
            ROTLOC(I,J) = ROTA(I,J)
          ENDDO
        ENDDO
      ENDIF
      ROTA(1,1) = 1.
      ROTA(2,1) = 0.
      ROTA(3,1) = 0.
      ROTA(1,2) = 0.
      ROTA(2,2) = 1.
      ROTA(3,2) = 0.
      ROTA(1,3) = 0.
      ROTA(2,3) = 0.
      ROTA(3,3) = 1.
C
    1 ICOURB = 1
      IEXAG  = 0
      IWILD  = 0
      IARCH  = 0
      INOPO  = 0
      IDEJATRADUIT = 0
      IPGM = 0
      IPBM = 0
      IF (LONG.EQ.0) THEN
        IF (ILANG.EQ.0) THEN
          CALL LIFICH
     &   ('Nom du fichier à dessiner (c3d --> surface au clavier) ?'
     &   ,0,NOM_FICH,LONG)
        ELSE
          CALL LIFICH
     &('Enter the filename (c3d --> surface described by equations) ?'
     &   ,0,NOM_FICH,LONG)
        ENDIF
      ENDIF
C
C Si on repond escape ou tab, on a la liste des fichiers valides
C
      IF (NOM_FICH(1:1).EQ.CHAR(9).OR.NOM_FICH(1:1).EQ.CHAR(27)) THEN
        CALL LISTEFICH(ILANG,SUF,LSUF,NBSUF)
        LONG = 0
        GOTO 1
      ENDIF
      NOMF0(1:LONG) = NOM_FICH(1:LONG)
      LONG0 = LONG
      IF (LONG.GT.4) THEN
        IF (NOM_FICH(LONG-3:LONG).EQ.'.c3d') THEN
          ICOURB = -1
          IEXAG  =  1
        ELSEIF(NOM_FICH(LONG-3:LONG).EQ.'.pbm'
     &      .OR.NOM_FICH(LONG-3:LONG).EQ.'.pgm') THEN
          ICOURB = -4
          IEXAG  =  1
        ELSEIF(NOM_FICH(LONG-3:LONG).EQ.'.xyz') THEN
          ICOURB = -5
          IEXAG  =  1
        ENDIF
      ELSEIF(LONG.EQ.3.AND.NOM_FICH(1:3).EQ.'c3d') THEN
        IF (ILANG.EQ.0) THEN
          CALL LIENTIER('Surface z=f(x,y) ou paramétrée (0/1) ?'
     &                 ,0,IIII)
        ELSE
          CALL LIENTIER('Surface z=f(x,y) or parameterized (0/1) ?'
     &                 ,0,IIII)
        ENDIF
        IF (IIII.EQ.0) THEN
          ICOURB = -2
          NOM_FICH = 'Surface z=f(x,y)'
          LONG = 16
        ELSE
          ICOURB = -3
          IF (ILANG.EQ.0) THEN
            NOM_FICH = 'Surface param'//CHAR(233)//'tr'//CHAR(233)//'e'
            LONG = 18
          ELSE
            NOM_FICH = 'Parameterized surface'
            LONG = 21
          ENDIF
        ENDIF
        IEXAG  =  1
        RETURN
      ENDIF
 2    INQUIRE(FILE=NOM_FICH(1:LONG),EXIST=LA)
      IF (.NOT.LA) THEN
        BIDON(1:LONG) = NOM_FICH(1:LONG)
        LONG0 = LONG
        N = 0
        LA = .FALSE.
        DO WHILE(N.LT.NBSUF.AND.(.NOT.LA))
          N = N+1
          NOM_FICH = BIDON(1:LONG0)//'.'//SUF(N)(1:LSUF(N))
          LONG = LONG0+LSUF(N)+1
          INQUIRE(FILE=NOM_FICH(1:LONG),EXIST=LA)
          IF (N.EQ.2.AND.LA) IWILD = 1
        ENDDO
        IF (LA) THEN
          IF (NOM_FICH(LONG-3:LONG).EQ.'.c3d') THEN
            ICOURB = -1
            IEXAG  =  1
          ELSEIF(NOM_FICH(LONG-3:LONG).EQ.'.pbm'
     &       .OR.NOM_FICH(LONG-3:LONG).EQ.'.pgm') THEN
            ICOURB = -4
            IEXAG  =  1
          ELSEIF(NOM_FICH(LONG-3:LONG).EQ.'.xyz') THEN
            ICOURB = -5
            IEXAG  =  1
          ENDIF
        ENDIF
      ENDIF
      IF (.NOT.LA) THEN
        IF (ILANG.EQ.0) THEN
          PRINT*,
     &         '*** Pas de fichier correspondant à votre nom ('
     &         ,BIDON(1:LONG0),')'
          PRINT*,'*** Donnez un autre nom de fichier'
          PRINT*,' '
          PRINT*,'Suffixes reconnus :'
        ELSE
          PRINT*,
     & '*** No files for your filename (',BIDON(1:LONG0),')'
          PRINT*,'*** Type another name'
          PRINT*,' '
          PRINT*,'Known extensions:'
        ENDIF
        PRINT*,(SUF(K)(1:LSUF(K))//',',K=1,NBSUF-1)
     &        ,SUF(NBSUF)(1:LSUF(NBSUF))
        LONG = 0
        CALL LISTEFICH(ILANG,SUF,LSUF,NBSUF)
        GOTO 1
      ENDIF
C
      IF (INOPO.NE.0) THEN
        IF (ISTDOUT.EQ.0) THEN
          IF (ILANG.EQ.0) THEN
            PRINT*,'Traduction OK'
          ELSE
            PRINT*,'Translation OK'
          ENDIF
        ENDIF
      ENDIF
      IF (ICOURB.EQ.-5) THEN
        IF (LONG+13.LT.50) THEN
          IF (ISTDOUT.EQ.0) THEN
            IF (ILANG.EQ.0) THEN
              PRINT*,'On a ouvert '
     &             //NOM_FICH(1:LONG)//CCDOT(1:50-LONG-12)
            ELSE
              PRINT*,NOM_FICH(1:LONG)//CCDOT(1:50-LONG-12)
     &             //' has been opened'
            ENDIF
          ENDIF
        ELSE
          IF (ISTDOUT.EQ.0) THEN
            IF (ILANG.EQ.0) THEN
              PRINT*,'On a ouvert '//NOM_FICH(1:LONG)
            ELSE
              PRINT*,NOM_FICH(1:LONG)//' has been opened'
            ENDIF
          ENDIF
        ENDIF
      ELSE
        IF (ISTDOUT.EQ.0) THEN
          IF (ILANG.EQ.0) THEN
            PRINT*,'On a ouvert '//NOM_FICH(1:LONG)
          ELSE
            PRINT*,NOM_FICH(1:LONG)//' has been opened'
          ENDIF
        ENDIF
      ENDIF
      IF (NOM_FICH(LONG-3:LONG).EQ.'.c3d'.OR.
     &    NOM_FICH(LONG-8:LONG).EQ.'.deformee'.OR.
     &    NOM_FICH(LONG-7:LONG).EQ.'.exagere'.OR.
     &    NOM_FICH(LONG-7:LONG).EQ.'.avoir3D'.OR.
     &    NOM_FICH(LONG-7:LONG).EQ.'.avoir2D') THEN
        IF (NOM_FICH(LONG-3:LONG).EQ.'.c3d') THEN
          LPREM = 8
        ELSE
          LPREM = 80
        ENDIF
        IF (ISTDOUT.EQ.0) THEN
          CALL testtypebin(IFAC,NOM_FICH(1:LONG)//CHAR(0),LPREM,IARCH
     &                    ,1-2*ILANG)
        ELSE
          CALL testtypebin(IFAC,NOM_FICH(1:LONG)//CHAR(0),LPREM,IARCH,0)
        ENDIF
        IF (IARCH.LT.0) THEN
          IF (ILANG.EQ.0) THEN
            PRINT*,
     & 'Le fichier '//NOM_FICH(1:LONG)//' existe mais il est illisible'
          ELSE
            PRINT*,
     & 'File '//NOM_FICH(1:LONG)//' is present but I cannot read it'
          ENDIF
          CALL LISTEFICH(ILANG,SUF,LSUF,NBSUF)
          LONG = 0
          GOTO 1
        ELSEIF(IARCH.EQ.0) THEN
          OPEN(IFAC,FILE=NOM_FICH(1:LONG),FORM='UNFORMATTED')
        ELSE
          CALL ouvrebin(IFAC,NOM_FICH(1:LONG)//CHAR(0),0,IRC)
        ENDIF
      ELSEIF(NOM_FICH(LONG-3:LONG).EQ.'.pgm'
     &   .OR.NOM_FICH(LONG-3:LONG).EQ.'.pbm') THEN
        OPEN(IFAC,FILE=NOM_FICH(1:LONG))
        READ(IFAC,'(A2)') BIDON(1:2)
        IF (BIDON(1:2).EQ.'P1') THEN
          IPBM = 1
        ELSEIF(BIDON(1:2).EQ.'P4') THEN
          IPBM = 2
        ELSEIF(BIDON(1:2).EQ.'P2') THEN
          IPGM = 1
        ELSEIF(BIDON(1:2).EQ.'P5') THEN
          IPGM = 2
        ELSE
          IF (ILANG.EQ.0) THEN
            PRINT*,
     &'*** Mauvais fichier pbm/pgm: bad Magic Number "'//BIDON(1:2)//'"'
          ELSE
            PRINT*,
     & '*** Bad pbm/pgm: bad Magic Number "'//BIDON(1:2)//'"'
          ENDIF
          CLOSE(IFAC)
          CALL LISTEFICH(ILANG,SUF,LSUF,NBSUF)
          LONG = 0
          GOTO 1
        ENDIF
      ELSEIF(NOM_FICH(LONG-3:LONG).EQ.'.xyz') THEN
        OPEN(IFAC,FILE=NOM_FICH(1:LONG))
      ELSEIF(NOM_FICH(LONG-4:LONG).NE.'.nopo'
     &  .AND.NOM_FICH(LONG-5:LONG).NE.'.amdba'
     &  .AND.NOM_FICH(LONG-2:LONG).NE.'.am'
     &  .AND.NOM_FICH(LONG-6:LONG).NE.'.am_fmt'
     &  .AND.NOM_FICH(LONG-3:LONG).NE.'.msh') THEN
        LPREM = 80
        IF (ISTDOUT.EQ.0) THEN
          CALL testtypebin(IFAC,NOM_FICH(1:LONG)//CHAR(0),LPREM,IARCH
     &                    ,1-2*ILANG)
        ELSE
          CALL testtypebin(IFAC,NOM_FICH(1:LONG)//CHAR(0),LPREM,IARCH,0)
        ENDIF
        IF (IARCH.LT.0) THEN
          IF (ILANG.EQ.0) THEN
            PRINT*,
     & 'Le fichier '//NOM_FICH(1:LONG)//' existe mais il est illisible'
          ELSE
            PRINT*,
     & 'File '//NOM_FICH(1:LONG)//' is present but I cannot read it'
          ENDIF
          CALL LISTEFICH(ILANG,SUF,LSUF,NBSUF)
          LONG = 0
          GOTO 1
        ELSEIF(IARCH.EQ.0) THEN
          OPEN(IFAC,FILE=NOM_FICH(1:LONG),FORM='UNFORMATTED')
        ELSE
          CALL ouvrebin(IFAC,NOM_FICH(1:LONG)//CHAR(0),0,IRC)
        ENDIF
      ENDIF
      IF (NOM_FICH(LONG-8:LONG).EQ.'.deformee') THEN
        INQUIRE(FILE=NOM_FICH(1:LONG-8)//'avoir3D',EXIST=LA)
        IF (LA) THEN
          IEXAG = 1
          IF (IARCH.EQ.1) THEN
            CALL ouvrebin(IFAC2,NOM_FICH(1:LONG-8)//'avoir3D'//CHAR(0)
     &                   ,0,IRC)
          ELSE
            OPEN(IFAC2,FILE=NOM_FICH(1:LONG-8)//'avoir3D'
     &          ,FORM='UNFORMATTED')
          ENDIF
          IF (ISTDOUT.EQ.0) THEN
            IF (ILANG.EQ.0) THEN
              PRINT*,'et aussi    '//NOM_FICH(1:LONG-8)//'avoir3D'
            ELSE
              PRINT*,'and also    '//NOM_FICH(1:LONG-8)//'avoir3D'
            ENDIF
          ENDIF
        ELSE
          INQUIRE(FILE=NOM_FICH(1:LONG-8)//'avoir2D',EXIST=LA)
          IF (LA) THEN
            IEXAG = 1
            IF (IARCH.EQ.1) THEN
              CALL ouvrebin(IFAC2,NOM_FICH(1:LONG-8)//'avoir2D'//CHAR(0)
     &                     ,0,IRC)
            ELSE
              OPEN(IFAC2,FILE=NOM_FICH(1:LONG-8)//'avoir2D'
     &            ,FORM='UNFORMATTED')
            ENDIF
            IF (ISTDOUT.EQ.0) THEN
              IF (ILANG.EQ.0) THEN
                PRINT*,'et aussi    '//NOM_FICH(1:LONG-8)//'avoir2D'
              ELSE
                PRINT*,'and also    '//NOM_FICH(1:LONG-8)//'avoir2D'
              ENDIF
            ENDIF
          ENDIF
        ENDIF
      ELSEIF(NOM_FICH(LONG-7:LONG).EQ.'.avoir3D'
     &   .OR.NOM_FICH(LONG-7:LONG).EQ.'.avoir2D') THEN
        IF (INOPO.EQ.0.AND.NODEPL.EQ.0) THEN
          OPEN(IFAC2,FILE=NOM_FICH(1:LONG-7)//'depl',STATUS='OLD'
     &              ,FORM='FORMATTED',IOSTAT=IERR)
          IF (IERR.EQ.0) THEN
            IF (NOM_FICH(LONG-1:LONG-1).EQ.'2') THEN
              IEXAG = 2
            ELSE
              IEXAG = 3
            ENDIF
            IF (ISTDOUT.EQ.0) THEN
              IF (ILANG.EQ.0) THEN
                PRINT*,'et aussi    '//NOM_FICH(1:LONG-7)//'depl'
              ELSE
                PRINT*,'and also    '//NOM_FICH(1:LONG-7)//'depl'
              ENDIF
            ENDIF
          ENDIF
        ELSEIF(IEXAG.NE.0) THEN
          IF (NOM_FICH(LONG-1:LONG-1).EQ.'2') THEN
            IEXAG = 2
          ELSE
            IEXAG = 3
          ENDIF
        ENDIF
      ELSEIF(NOM_FICH(LONG-4:LONG).EQ.'.nopo'.AND.NODEPL.EQ.0) THEN
        OPEN(IFAC2,FILE=NOM_FICH(1:LONG-4)//'depl',STATUS='OLD'
     &            ,FORM='FORMATTED',IOSTAT=IERR)
        IF (IERR.EQ.0) THEN
          IEXAG = 2
          IF (ISTDOUT.EQ.0) THEN
            IF (ILANG.EQ.0) THEN
              PRINT*,'et aussi    '//NOM_FICH(1:LONG-4)//'depl'
            ELSE
              PRINT*,'and also    '//NOM_FICH(1:LONG-4)//'depl'
            ENDIF
          ENDIF
        ENDIF
      ENDIF
      LONG2 = LONG+1
 10   LONG2 = LONG2-1
      IF (NOM_FICH(LONG2:LONG2).NE.'.'.AND.LONG2.GT.1) GOTO 10
      IF (LONG2.NE.1) THEN
        LONG2 = LONG2-1
      ELSE
        LONG2 = LONG
      ENDIF
C
C Fichiers nopo
C
      IF (NOM_FICH(LONG-4:LONG).EQ.'.nopo') THEN
        IF (ILANG.EQ.0) THEN
          WRITE(*,'(A,$)') 'Fichier nopo - Traduction du fichier...'
        ELSE
          WRITE(*,'(A,$)') 'Translation of the nopo file...'
        ENDIF
        CALL TRATMP(NOM_FICH,BIDON,LONG,LONGB)
        INQUIRE(FILE=BIDON(1:LONGB),EXIST=LA)
        IF (.NOT.LA) THEN
          IDEJATMP = 0
          CALL EXEC('/bin/cp '//NOM_FICH(1:LONG)//' '//BIDON(1:LONGB))
        ELSE
          IDEJATMP = 1
        ENDIF
        CALL PREMIER_LIBRE(IBID)
        OPEN(IBID,FILE='/tmp/bidonbidon')
        WRITE(IBID,*) BIDON(1:LONGB)
        WRITE(IBID,*) 0
        WRITE(IBID,*) 0
        CLOSE(IBID)
        INQUIRE(FILE=BIDON(1:LONGB-4)//'avoir2D',EXIST=LA)
        INQUIRE(FILE=BIDON(1:LONGB-4)//'avoir3D',EXIST=LA2)
        IF (LA.OR.LA2) THEN
          IF (ILANG.EQ.0) THEN
            PRINT*,'*** Attention, /tmp contient les fichiers :'
          ELSE
            PRINT*,'*** Warning, /tmp contains the following files :'
          ENDIF
          CALL EXEC('ls -l '//BIDON(1:LONGB-4)//'avoir?D')
          IF (ILANG.EQ.0) THEN
            PRINT*,
     &    '*** On risque de les effacer. On continue ? (1:oui ; 0:non)'
          ELSE
            PRINT*,
     &           '*** They may be deleted by xd3d. OK ? (1:yes ; 0:no)'
          ENDIF
          READ*,IOK
          IF (IOK.EQ.0) THEN
            IF (IDEJATMP.EQ.0) THEN
              CALL EXEC('/bin/rm -f /tmp/bidonbidon '//BIDON(1:LONGB))
            ELSE
              CALL EXEC('/bin/rm -f /tmp/bidonbidon')
            ENDIF
            STOP
          ENDIF
        ENDIF
        CALL EXEC(
     & CHEZMOI(1:LCHEZMOI)//'nopo_avoir < /tmp/bidonbidon > /dev/null')
        IF (IDEJATMP.EQ.0) THEN
          CALL EXEC('/bin/rm -f /tmp/bidonbidon '//BIDON(1:LONGB))
        ELSE
          CALL EXEC('/bin/rm -f /tmp/bidonbidon')
        ENDIF
        INOPO = 1
        LONG = LONGB-5
        NOM_FICH(1:LONG) = BIDON(1:LONG)
        IF (ISTDOUT.EQ.0) PRINT*,'OK --> ',NOM_FICH(1:LONG)
        GOTO 2
      ENDIF
C
C Fichiers amdba, am, am_fmt, msh
C
      DO I=10,13        
        IF (NOM_FICH(LONG-LSUF(I):LONG).EQ.'.'//SUF(I)) INOPO = I-8
      ENDDO
      IF (INOPO.GT.1.AND.IDEJATRADUIT.EQ.0) THEN
        IDEJATRADUIT = 1
        ISUF = INOPO+8
        LSU = LSUF(ISUF)
        IF (ILANG.EQ.0) THEN
          WRITE(*,'(A,$)') 'Fichier '
     &         //SUF(ISUF)(1:LSU)//' - Traduction du fichier...'
        ELSE
          WRITE(*,'(A,$)') 'Translation of the '
     &         //SUF(ISUF)(1:LSU)//' file...'
        ENDIF
        CALL FREEFEM2AVOIR(NOM_FICH,LONG,INOPO,LSU)
        IF (ISTDOUT.EQ.0) PRINT*,'OK --> '//NOM_FICH(1:LONG)
        GOTO 2
      ENDIF
C
      END
C-----------------------------------------------------------------------
      SUBROUTINE FREEFEM2AVOIR(NOM_FICH,LONG,INOPO,LSU)
      CHARACTER*128 NOM_FICH
      INCLUDE '../include/com_avoir.f'
C
      CALL TRATMP(NOM_FICH,FICH,LONG,LONGB)
      CALL EXEC('/bin/cp '//NOM_FICH(1:LONG)//' '//FICH(1:LONGB))
C
C amdba
C
      IF (INOPO.EQ.2) THEN
        OPEN(1,FILE=FICH(1:LONGB),STATUS='OLD')
        READ(1,*) NUMNP,NEL(1)
        DO I=1,NUMNP
          DO J=1,9
            IBC(J,I) = 0
          ENDDO
          XYZ(3,I) = 0.
          READ(1,*) IBID,XYZ(1,I),XYZ(2,I),IBC(4,I)
        ENDDO
        DO I=1,NEL(1)
          READ(1,*) IBID,NODE(1,I),NODE(2,I),NODE(3,I)
        ENDDO
C
C am
C
      ELSEIF(INOPO.EQ.3) THEN
        OPEN(1,FILE=FICH(1:LONGB),FORM='UNFORMATTED',STATUS='OLD')
        READ(1) NUMNP,NEL(1)
        READ(1) ((NODE(K,I),K=1,3),I=1,NEL(1))
     &         ,(XYZ(1,I),XYZ(2,I),I=1,NUMNP)
     &         ,(IBID,I=1,NEL(1))
     &         ,(IBC(4,I),I=1,NUMNP)
C
C am_fmt
C
      ELSEIF(INOPO.EQ.4) THEN
        OPEN(1,FILE=FICH(1:LONGB),STATUS='OLD')
        READ(1,*) NUMNP,NEL(1)
        READ(1,*) ((NODE(K,I),K=1,3),I=1,NEL(1))
        READ(1,*) (XYZ(1,I),XYZ(2,I),I=1,NUMNP)
        READ(1,*) (IBID,I=1,NEL(1)),(IBC(4,I),I=1,NUMNP)
        DO I=1,NUMNP
          DO J=1,9
            IF (J.NE.4) IBC(J,I) = 0
          ENDDO
          XYZ(3,I) = 0.
        ENDDO
C
C msh
C
      ELSEIF(INOPO.EQ.5) THEN
        OPEN(1,FILE=FICH(1:LONGB),STATUS='OLD')
        READ(1,*) NUMNP,NEL(1)
        DO I=1,NUMNP
          DO J=1,9
            IBC(J,I) = 0
          ENDDO
          XYZ(3,I) = 0.
          READ(1,*) XYZ(1,I),XYZ(2,I),IBC(4,I)
        ENDDO
        DO I=1,NEL(1)
          READ(1,*) NODE(1,I),NODE(2,I),NODE(3,I)
        ENDDO
      ELSE
        PRINT*,'*** ERREUR'
        STOP
      ENDIF
      CLOSE(1)
C
      NUMSD = 1
      NGROUP(1) = 1
      NTYP(1) = 1
      NDS(1) = 3
      HED = FICH(1:LONGB)//CHAR(0)
      CALL EXEC('/bin/rm -f /tmp/bidonbidon '//FICH(1:LONGB))
      FICH = FICH(1:LONGB-1-LSU)//'.avoir2D'
      LONGB = LONGB+7-LSU
      CALL ECRITAVOIR(FICH,LONGB,HED,NUMNP,NDSMAX,XYZ,IBC,NODE,NPR,NFPR
     &               ,PR,NGROUP,NTYP,NEL,NDS,NUMSD,0,ITRAD,IERR)
C
      LONG = LONGB-8
      NOM_FICH(1:LONG) = FICH(1:LONG)
      END
