Read Residual file: res_control.md
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(filetype), | intent(in) | :: | files | |||
type(controltype), | intent(inout) | :: | control |
subroutine read_Res_list(files, control)
!< Read Residual file: res_control.md
implicit none
type(filetype), intent(in) :: files
type(controltype), intent(inout) :: control
integer :: i
integer :: skip
logical :: ok
open(files%RES_CONTROL_FILE_UNIT, file=files%res_control_file, status='old', action='read')
call get_count_within_braces(files%RES_CONTROL_FILE_UNIT, control%Res_count)
!call close_file(files%RES_CONTROL_FILE_UNIT)
inquire(files%RES_CONTROL_FILE_UNIT, opened=ok)
if(ok) close(files%RES_CONTROL_FILE_UNIT)
open(files%RES_CONTROL_FILE_UNIT, file=files%res_control_file, status='old', action='read')
! skipping line
skip = get_number_of_line('{',files%RES_CONTROL_FILE_UNIT)
!reading vaules
if(control%Res_count==0)then
allocate(control%Res_list(1:2))
control%Res_count=2
control%Res_list(1)="Mass_abs"
control%Res_list(2)="Resnorm_abs"
else
allocate(control%Res_list(1:control%Res_count))
end if
do i = 1,control%Res_count
read(files%RES_CONTROL_FILE_UNIT, *) control%Res_list(i)
end do
close(files%RES_CONTROL_FILE_UNIT)
end subroutine read_Res_list