Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character, | intent(in) | :: | name | |||
logical, | intent(in) | :: | state | |||
integer, | intent(inout) | :: | counter | |||
character, | intent(out) | :: | vars(:) | |||
integer, | intent(out) | :: | id |
subroutine output_register_var(name, state, counter, vars, id)
! Abstract subroutine of register_hydrotope/subbasin_var functions.
use utilities, only: string_index
character(*), intent(in) :: name
logical, intent(in) :: state
integer, intent(inout) :: counter
character(*), intent(out) :: vars(:)
integer, intent(out) :: id
integer vi
! make sure name hasnt been registered already
if (string_index(name, vars) > 0) &
call log_error("output_register_var", trim(name)//" has already been registered.")
! is variable requested?
vi = string_index(name, output_requested_vars)
output_registered_vars(string_index("", output_registered_vars)) = name
! increase counter if requested
if (vi > 0) then
counter = counter + 1
vars(counter) = name
id = counter
output_var_state(vi) = state
else
id = 0
end if
end subroutine output_register_var