module model_io_mod

use process_types
use model_types

implicit none

integer, private :: n_bytes_io,ierr
integer, external,private :: sreed,srite,auxin

contains

subroutine read_model ( model_tag, param , model_param, model ) 

character(len=*) :: model_tag
type (tomo_param_type) param
type (model_param_type) model_param
real, dimension (:,:,:) :: model


write(0,*)'READ  model tag=',model_tag

n_bytes_io=model_param%nv_mod*model_param%nx_mod*4
if(auxin(model_tag) .lt. 0) call seperr('Model tag not found')
if(sreed(model_tag,model,n_bytes_io) .ne. n_bytes_io) then
  call seperr("Problems in reading tag model_tag ")
end if

return
end subroutine read_model

subroutine write_model ( model_tag, param , model_param, model ) 

character(len=*) :: model_tag
type (tomo_param_type) param
type (model_param_type) model_param
real, dimension (:,:,:) :: model


!write(0,*)'write  model'

n_bytes_io=model_param%nv_mod*model_param%nx_mod*4
if(srite(model_tag,model,n_bytes_io) .ne. n_bytes_io) then
  call seperr("Problems in writeing tag model_tag ")
end if

return
end subroutine write_model


end module model_io_mod
