Read output_contorl.md file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(filetype), | intent(in) | :: | files | |||
type(controltype), | intent(inout) | :: | control |
subroutine read_output_control(files, control)
!< Read output_contorl.md file
implicit none
type(filetype), intent(in) :: files
type(controltype), intent(inout) :: control
integer :: i
character(len=64) :: buf
integer :: ios
logical :: ok
call get_rw_count(files, control)
inquire(files%OUTIN_FILE_UNIT, opened=ok)
if(ok) close(files%OUTIN_FILE_UNIT)
!call close_file(files%OUTIN_FILE_UNIT)
open(files%OUTIN_FILE_UNIT, file=files%outin_file, status='old', action='read')
! variables to write
do while(.true.)
read(files%OUTIN_FILE_UNIT, *, iostat=ios) buf
if(trim(buf)=='{') EXIT
if(is_iostat_end(ios)) EXIT
end do
do i = 1,control%w_count
read(files%OUTIN_FILE_UNIT, *) buf
read(buf,*) control%w_list(i)
end do
! restart variables to read
do while(.true.)
read(files%OUTIN_FILE_UNIT, *, iostat=ios) buf
if(trim(buf)=='{') EXIT
if(is_iostat_end(ios)) EXIT
end do
do i = 1,control%r_count
read(files%OUTIN_FILE_UNIT, *) buf
read(buf,*) control%r_list(i)
end do
if(control%r_count==0) control%r_list=control%w_list
close(files%OUTIN_FILE_UNIT)
end subroutine read_output_control