output_initialise_storage_index Subroutine

public subroutine output_initialise_storage_index()

Uses

  • proc~~output_initialise_storage_index~~UsesGraph proc~output_initialise_storage_index output_initialise_storage_index module~utilities utilities proc~output_initialise_storage_index->module~utilities

Arguments

None

Calls

proc~~output_initialise_storage_index~~CallsGraph proc~output_initialise_storage_index output_initialise_storage_index proc~indeces_in_array indeces_in_array proc~output_initialise_storage_index->proc~indeces_in_array proc~string_index string_index proc~indeces_in_array->proc~string_index

Called by

proc~~output_initialise_storage_index~~CalledByGraph proc~output_initialise_storage_index output_initialise_storage_index proc~output_initialise_storage output_initialise_storage proc~output_initialise_storage->proc~output_initialise_storage_index proc~output_initialise output_initialise proc~output_initialise->proc~output_initialise_storage proc~initialise initialise proc~initialise->proc~output_initialise program~swim swim program~swim->proc~initialise

Contents


Source Code

  subroutine output_initialise_storage_index
    use utilities, only: string_index, indeces_in_array
    integer fi, sp, i, cumsum(output_nvars)
    type(output_file) :: fl

    do fi = 1, output_nfiles
      fl = output_files(fi)
      sp = fl%space
      if (sp > 3) sp = sp - 3
      cumsum = 0
      do i = 1, output_nvars
        cumsum(i) = sum(output_is_requested(:i, sp, fl%time))
      end do
      output_storage_index(fi, :fl%nvars) = cumsum(fl%variable_ix(:fl%nvars))
    end do
    ! hydrotope/subbasin storage indeces
    allocate(output_hydrotope_var_ix(output_nvars))
    output_hydrotope_var_ix = 0
    allocate(output_subbasin_var_ix(output_nvars))
    output_subbasin_var_ix = 0
    allocate(output_hydrotope_requested_ix(sum(output_is_requested(:, 1, 1))))
    output_hydrotope_requested_ix = 0

    ! Hydrotope/subbasin indeces
    output_hydrotope_requested_ix = indeces_in_array( &
      pack(output_requested_vars(:output_nvars), output_is_requested(:, 1, 1) == 1), &
      output_hydrotope_vars)
    output_hydrotope_var_ix = indeces_in_array( &
      output_requested_vars(:output_nvars), output_hydrotope_vars)
    output_subbasin_var_ix = indeces_in_array(&
      output_requested_vars(:output_nvars), output_subbasin_vars)

  end subroutine output_initialise_storage_index