module kiomod 3,2
interface write_a_var 1
module procedure write_a_column
, write_a_real
end interface
contains
subroutine write_a_real(iunit,name,areal) 1,1
use precis
character(len=*), intent(in) :: name
integer, intent(in) :: iunit
logical iopened
real(mrl), intent(in) :: areal
inquire (unit=iunit,OPENED=iopened)
if (.not. iopened) then
write (*,*) 'unit ',iunit,' is not opened yet, why are you writing to it?'
stop
end if
write(iunit,'(a)') trim(name)
write(iunit,'(es18.8e3)') areal
end subroutine write_a_real
subroutine write_a_column(iunit,name,array) 104,1
use precis
character(len=*), intent(in) :: name
integer, intent(in) :: iunit
logical iopened
real(mrl), dimension(:), intent(in) :: array
inquire (unit=iunit,OPENED=iopened)
if (.not. iopened) then
write (*,*) 'unit ',iunit,' is not opened yet, why are you writing to it?'
stop
end if
write(iunit,'(a)') trim(name)
!write(iunit,'(es18.8e3)') array
!print *, name
write(iunit,'(es25.15e3)') array
end subroutine write_a_column
subroutine read_a_column(iunit,expect,array) 103,1
use precis
integer iunit
logical iopened
character(len=*) expect
character(len=80) name
real(mrl), dimension(:), intent(inout) :: array
inquire (unit=iunit,OPENED=iopened)
if (.not.iopened) then
write (*,*) 'unit ',iunit,' is not opened yet, why are you reading from it?'
stop
end if
read(iunit,'(a)') name
if (expect.ne.trim(name)) then
write (*,*) 'expect=',expect,' not eqaul to name=',trim(name),' stopping...'
stop
end if
!print *, name
read(iunit,*) array
end subroutine read_a_column
end module kiomod