!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!
!   Subroutine: r e a d _ m a s k
!
!   Purpose:    Reading of the hard-rock/soft-sediment/ocean mask
!               for the ISMIP HEINO runs.
!
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

      subroutine read_mask(mask)

      implicit none
      integer i, j, n
      integer unit, ios
      integer mask(81,81)
      character ch_dummy

      unit = 11

      open(unit, iostat=ios, file='mask.dat', status='old')
      if (ios.ne.0) stop ' Error when opening the mask file!'

      do n=1, 6
         read(unit,'(a)') ch_dummy   ! six comment lines in mask file
      end do

      do j=81, 1, -1
         read(unit,'(81i1)') (mask(i,j), i=1,81)
      end do

      close(unit, status='keep')

      return
      end

