 SUBROUTINE read_mesh(calc,nzone,zone)
!=========================== DOCUMENTATION ============================= 
!DOCDEBh*    UTI/PRE/read_mesh *
!
!    NOM
! read_mesh(calc)
!    DESCRIPTION  
!*
! Lecture du Bloc MESH du fichier de donnees *.inp
! Reading the MESH block from the *.inp data file
!*
! 
!    ENTREES / INPUT
!    calc  objet calcul initial / initial calcul object
!
!    SORTIES / OUTPUT
!    calc  objet calcul mis a jour / updated calcul object
!    nzone  nombre de zone de maillage / number of mesh zones
!    zone   parametres de maillage / mesh parameters
!
!    SOURCE
! Ce logiciel est regi par la licence [CeCILL-B]
! This software is governed by the [CeCILL-B] license
!=========================== DEBUT DES DECLARATIONS ==================== 
!.1-----  Implicit, Use
  use num
  IMPLICIT NONE
!.2-----  Declaration
  type(calcul), intent(inout)                                     :: calc !! Objet calcul / Calcul object
  integer,allocatable,dimension(:,:), intent(inout)               :: nzone !! parametres de maillage/ mesh parameters
  real(kind=kind(0.d0)),allocatable,dimension(:,:), intent(inout) :: zone !! parametres de maillage/ mesh parameters
  
  character(4)                                                    :: para
  integer                                                         :: i,j,nzra
  real(kind=kind(0.d0))                                           :: arg
!=========================== DEBUT DU CODE EXECUTABLE ==================
  write(*,*)
  write(*,*)achar(27)//'[34m================================================'
  write(*,*)'Reading Mesh parameters : block MESH'
  write(*,*)'================================================'//achar(27)//'[0m'
  write(*,*)
  

199 read(33,'(a4,f20.0)',err=200,end=200)para,arg

  SELECT CASE (para)
      CASE('NBDS')
          calc%nbds=idint(arg)
          write(*,*)'MESH-Info  Number of domains                :',calc%nbds
      CASE('MARL')
          calc%nrma=idint(arg)
          write(*,*)'MESH-Info  Maximal refinement level         :',calc%nrma
      CASE('COPA')
          calc%vcde=arg
          write(*,*)'MESH-Info  Mesh coarsening parameter        :',calc%vcde
      CASE('REPA')
          calc%vcra=arg
          write(*,*)'MESH-Info  Mesh refinement parameter        :',calc%vcra
      CASE('FDRA')
          write(*,*)'MESH-Info  Function number                  :',idint(arg)
          allocate(nzone(4,1),zone(6,1))
          nzone(1,1)=-idint(arg)
          zone=0.d0
      CASE('NZRA')
          nzra=idint(arg)
          write(*,*)'MESH-Info  Number of zones to be refined    :',nzra
          allocate(nzone(4,nzra),zone(6,nzra))
          nzone=1
          zone=0.d0
          DO i=1,nzra
              read(33,*)nzone(1,i),(zone(j,i),j=1,6)
              if(nzone(1,i).gt.calc%nrma)then
                calc%nrma=nzone(1,i)
                call print_avert('READ_MESH',' Maximal refinement level has been adjusted')
              endif
          END DO                            
      CASE default
          GOTO 200
  END select
  GOTO 199
200 continue       
!===========================   FIN DE LA ROUTINE    ====================
END SUBROUTINE read_mesh
!DOCFIN