m_load.F90 737 Bytes
module m_load
contains
subroutine load(fname,sol)
   use mod_dimensions
   use mod_states
   implicit none
   type(states), intent(out) :: sol(ndim)
   character(len=*), intent(in) :: fname
   integer len,k,i
   logical ex

   inquire(iolength=len)kdim,ndim,sol
   inquire(file=fname,exist=ex)
   if (.not.ex) then
      print *,'The file does not exist',fname
      stop
   endif
   open(10,file=fname,status='old',form='unformatted',access='direct',recl=len)
      read(10,rec=1)k,i
      if ((k==kdim).and.(i==ndim)) then
         read(10,rec=1)k,i,sol
      else
         print *,'load: dimensions in file are wrong:',fname
         print *,'load:',k,kdim,i,ndim
         stop
      endif
   close(10)
end subroutine load
end module