aggregator_t Derived Type

type, public, abstract :: aggregator_t

The aggregator_t type is an abstract base type for performing time aggregations on source data arrays. Support for different data types and array ranks is provided through extensions of this type.


Components

Type Visibility Attributes Name Initial
integer, public :: counter = 0

The number of times the source data has been accumulated.

procedure(accumulate_data), public, pointer :: accumulate

A procedure pointer to the accumulation method used to compute the time aggregated quantity. The specific method (e.g., mean, sum, min, max) is set by the set_method procedure.

procedure(reset_data), public, pointer :: reset

A procedure pointer to the reset method used to reset the aggregated data. The specific method (e.g., mean, sum, min, max) is set by the set_method procedure.


Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

  • private subroutine aggregator_init(this, method)

    Initialise the aggregator by allocating the aggregated data array and its aggregation method. The values in the aggregated data array are reset according to the specified aggregation method.

    Arguments

    Type IntentOptional Attributes Name
    class(aggregator_t), intent(inout) :: this
    character(len=*), intent(in) :: method

    The aggregation method to use (e.g., "mean", "sum", "point", "min", "max").

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

  • private function aggregator_type(this)

    Return a string identifier of the aggregator type (e.g., "int32", "real32", "real64").

    Arguments

    Type IntentOptional Attributes Name
    class(aggregator_t), intent(in) :: this

    Return Value character(len=16)

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

  • private function aggregator_rank(this)

    Return the rank of the aggregator.

    Arguments

    Type IntentOptional Attributes Name
    class(aggregator_t), intent(in) :: this

    Return Value integer

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

  • private function aggregator_shape(this) result(agg_shape)

    Return the shape of the aggregator.

    Arguments

    Type IntentOptional Attributes Name
    class(aggregator_t), intent(in) :: this

    Return Value integer, allocatable, (:)

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

  • private subroutine aggregator_scale(this, scale)

    Scale the aggregated data by a specified factor.

    Arguments

    Type IntentOptional Attributes Name
    class(aggregator_t), intent(inout) :: this
    real, intent(in) :: scale

    The factor by which to scale the aggregated data.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

  • private subroutine aggregator_div(this, div)

    Divide the aggregated data by a specified factor.

    Arguments

    Type IntentOptional Attributes Name
    class(aggregator_t), intent(inout) :: this
    real, intent(in) :: div

    The factor by which to divide the aggregated data.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

  • private subroutine aggregator_offset(this, offset)

    Offset the aggregated data by a specified value.

    Arguments

    Type IntentOptional Attributes Name
    class(aggregator_t), intent(inout) :: this
    real, intent(in) :: offset

    The value by which to offset the aggregated data.

procedure, private :: set_method => aggregator_set_method

Set the aggregation method.

  • private subroutine aggregator_set_method(this, method)

    Set the aggregation method for the aggregator by assigning the appropriate accumulation and reset procedures based on the specified method.

    Arguments

    Type IntentOptional Attributes Name
    class(aggregator_t), intent(inout) :: this
    character(len=*), intent(in) :: method

    The aggregation method to use (e.g., "mean", "sum", "point", "min", "max").