append_value Subroutine

private subroutine append_value(this, value)

Append a value to the history of the metric

Type Bound

metric_dict_type

Arguments

Type IntentOptional Attributes Name
class(metric_dict_type), intent(inout) :: this

Instance of metric data

real(kind=real32), intent(in) :: value

Value to append


Source Code

  subroutine append_value(this, value)
    !! Append a value to the history of the metric
    implicit none

    ! Arguments
    class(metric_dict_type), intent(inout) :: this
    !! Instance of metric data
    real(real32), intent(in) :: value
    !! Value to append

    ! Local variables
    integer :: new_size

    this%val = value
    if(.not.allocated(this%history))then
       allocate(this%history(this%window_width), source = -huge(1._real32))
       this%history(this%window_width) = value
       this%num_entries = 0
    elseif(this%num_entries .lt. this%window_width)then
       this%history(this%num_entries) = value
    else
       this%history = [ this%history, value ]
    end if
    this%num_entries = this%num_entries + 1

  end subroutine append_value