reset_accumulator Subroutine

private pure subroutine reset_accumulator(v)

Zero (MEAN), -huge (MAX), or +huge (MIN) the accumulator — so the first accumulate step seeds correctly. Runs on device via the flat-impl shim because v%accumulator is reached through the vars(:) array-of-derived-types indirection that NVHPC can’t follow inside a do concurrent.

Arguments

Type IntentOptional Attributes Name
type(diag_var_t), intent(inout) :: v

Calls

proc~~reset_accumulator~~CallsGraph proc~reset_accumulator reset_accumulator proc~fill_buffer_impl fill_buffer_impl proc~reset_accumulator->proc~fill_buffer_impl

Called by

proc~~reset_accumulator~~CalledByGraph proc~reset_accumulator reset_accumulator proc~ocean_diag_register ocean_diag_t%ocean_diag_register proc~ocean_diag_register->proc~reset_accumulator proc~ocean_diag_step ocean_diag_t%ocean_diag_step proc~ocean_diag_step->proc~reset_accumulator proc~engine_step_finalize engine_step_finalize proc~engine_step_finalize->proc~ocean_diag_step proc~register_derived register_derived proc~register_derived->proc~ocean_diag_register proc~register_one_canonical register_one_canonical proc~register_one_canonical->proc~ocean_diag_register proc~apply_diag_selection apply_diag_selection proc~apply_diag_selection->proc~register_derived proc~register_default_diags register_default_diags proc~apply_diag_selection->proc~register_default_diags proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step_finalize proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step_finalize proc~register_default_diags->proc~register_one_canonical proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~engine_configure_diag engine_configure_diag proc~engine_configure_diag->proc~apply_diag_selection proc~engine_setup engine_setup proc~engine_setup->proc~engine_configure_diag

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: seed

Source Code

   pure subroutine reset_accumulator(v)
      !! Zero (MEAN), -huge (MAX), or +huge (MIN) the accumulator —
      !! so the first accumulate step seeds correctly.  Runs on device
      !! via the flat-impl shim because `v%accumulator` is reached
      !! through the `vars(:)` array-of-derived-types indirection that
      !! NVHPC can't follow inside a `do concurrent`.
      type(diag_var_t), intent(inout) :: v
      real(wp) :: seed
      if (.not. allocated(v%accumulator)) return
      select case (v%time_op)
      case (DIAG_OP_MAX)
         seed = -huge(0.0_wp)
      case (DIAG_OP_MIN)
         seed = huge(0.0_wp)
      case default
         seed = 0.0_wp
      end select
      call fill_buffer_impl(v%accumulator, seed)
   end subroutine reset_accumulator