This function returns the response file name when given characteristic data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | ik | |||
integer, | intent(in) | :: | is | |||
real, | intent(in) | :: | dt | |||
character(len=*), | intent(in), | optional | :: | suffix |
function get_specific_response_file_name(ik, is, dt, suffix) result(file_name)
use optionals, only: get_option_with_default
implicit none
integer, intent(in) :: ik, is
real, intent(in) :: dt
character(len = *), optional, intent(in) :: suffix
character(len = 256) :: file_name
character(len = 64) :: suffix_local
character(len = 64), parameter :: suffix_default='.response'
character(len = 14) :: dt_tmp
!Set file suffix
suffix_local = get_option_with_default(suffix, suffix_default)
!First write the time step into a temporary so that we can strip
!whitespace.
write(dt_tmp,'(E14.6E3)') dt
write(file_name,'(A,"_ik_",I0,"_is_",I0,"_dt_",A,A)') trim(response_file),ik,is,trim(adjustl(dt_tmp)),trim(suffix_local)
end function get_specific_response_file_name