aggregator_mod Module

This module defines the aggregator_t type and its extensions, which are used to perform various types of time aggregations (e.g., mean, sum, min, max) on source data arrays.

Aggregators are utilised by first initialising an aggregator via new_aggregator which accepts as its argument a source data array to be sampled. The source data array argument is then associated with a pointer which is used to sample the source data array to compute the time aggregated value. The source data array argument must be an allocated pointer or allocatable array. The source data array argument is typically a CABLE working variable whos memory remains allocated throughout the duration of the simulation. Aggregator instances can be represented using a polymorphic aggregator_t type or a concrete type corresponding to the data type and rank of the source data array (e.g., aggregator_real32_2d_t for a 2D 32-bit real source data array). For example:

real(kind=real32), dimension(:,:), allocatable :: source_data_array
class(aggregator_t), allocatable :: aggregator_polymorphic
type(aggregator_real32_2d_t) :: aggregator_concrete

allocate(source_data_array(42, 42))

aggregator_polymorphic = new_aggregator(source_data_array)
aggregator_concrete = new_aggregator(source_data_array)

Aggregator instances must then be initialised by calling their init method, which will allocate the necessary memory for the aggregated data and set the accumulation and reset methods according to the specified aggregation method (e.g., mean, sum, min, max). For example:

call aggregator_polymorphic%init('mean')
call aggregator_concrete%init('sum')

Once initialised, the aggregator can be accumulated any number of times throughout a simulation by calling its accumulate method, which will update the aggregated data from the source data using the appropriate aggregation method. Once the aggregator has accumulated enough values over the time interval of interest, the aggregated data can then be accessed via the aggregated_data component of the specific aggregator type (e.g., aggregator_real32_2d_t%aggregated_data). To reset the aggregator back to its initial state for the next time interval, the reset method can be called, which will reset the aggregator according to the specified aggregation method.

Resources allocated by the aggregator on initialisation will automatically be deallocated when the aggregator instance goes out of scope.



Interfaces

public interface new_aggregator

Factory interface for creating new aggregator instances. The specific type of aggregator created is determined by the type of the source data array provided.

  • private function new_aggregator_int32_0d_t(source_data) result(agg)

    Create a new 0D integer aggregator.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(inout), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_int32_0d_t)

  • private function new_aggregator_int32_1d_t(source_data) result(agg)

    Create a new 1D integer aggregator.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(inout), dimension(:), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_int32_1d_t)

  • private function new_aggregator_int32_2d_t(source_data) result(agg)

    Create a new 2D integer aggregator.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(inout), dimension(:,:), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_int32_2d_t)

  • private function new_aggregator_int32_3d_t(source_data) result(agg)

    Create a new 3D integer aggregator.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(inout), dimension(:,:,:), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_int32_3d_t)

  • private function new_aggregator_real32_0d(source_data) result(agg)

    Create a new 0D 32-bit real aggregator.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(inout), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_real32_0d_t)

  • private function new_aggregator_real32_1d(source_data) result(agg)

    Create a new 1D 32-bit real aggregator.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(inout), dimension(:), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_real32_1d_t)

  • private function new_aggregator_real32_2d(source_data) result(agg)

    Create a new 2D 32-bit real aggregator.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(inout), dimension(:,:), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_real32_2d_t)

  • private function new_aggregator_real32_3d(source_data) result(agg)

    Create a new 3D 32-bit real aggregator.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(inout), dimension(:,:,:), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_real32_3d_t)

  • private function new_aggregator_real64_0d(source_data) result(agg)

    Create a new 0D 64-bit real aggregator.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(inout), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_real64_0d_t)

  • private function new_aggregator_real64_1d(source_data) result(agg)

    Create a new 1D 64-bit real aggregator.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(inout), dimension(:), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_real64_1d_t)

  • private function new_aggregator_real64_2d(source_data) result(agg)

    Create a new 2D 64-bit real aggregator.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(inout), dimension(:,:), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_real64_2d_t)

  • private function new_aggregator_real64_3d(source_data) result(agg)

    Create a new 3D 64-bit real aggregator.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(inout), dimension(:,:,:), target :: source_data

    The source data array to be sampled by the aggregator.

    Return Value type(aggregator_real64_3d_t)


Abstract Interfaces

abstract interface

Interfaces for the procedure pointers in the aggregator_t type to be implemented by the specific aggregation methods (e.g., mean, sum, min, max).

  • private subroutine accumulate_data(this, scale, div, offset)

    Accumulate the aggregated data from the source data.

    Arguments

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

    An optional scaling factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

    real, intent(in), optional :: div

    An optional division factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

    real, intent(in), optional :: offset

    An optional offset to add to the source data before accumulation. Defaults to 0.0 if not provided.

abstract interface

Interfaces for the procedure pointers in the aggregator_t type to be implemented by the specific aggregation methods (e.g., mean, sum, min, max).

  • private subroutine reset_data(this)

    Reset the aggregated data to its initial state.

    Arguments

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

Derived Types

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.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

procedure, private :: set_method => aggregator_set_method

Set the aggregation method.

type, public, extends(aggregator_t) ::  aggregator_int32_0d_t

An aggregator for 0-dimensional (scalar) 32-bit integer data.

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.

integer(kind=int32), public, allocatable :: aggregated_data
integer(kind=int32), public, pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_int32_1d_t

An aggregator for 1-dimensional 32-bit integer data.

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.

integer(kind=int32), public, dimension(:), allocatable :: aggregated_data
integer(kind=int32), public, dimension(:), pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_int32_2d_t

An aggregator for 2-dimensional 32-bit integer data.

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.

integer(kind=int32), public, dimension(:,:), allocatable :: aggregated_data
integer(kind=int32), public, dimension(:,:), pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_int32_3d_t

An aggregator for 3-dimensional 32-bit integer data.

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.

integer(kind=int32), public, dimension(:,:,:), allocatable :: aggregated_data
integer(kind=int32), public, dimension(:,:,:), pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_real32_0d_t

An aggregator for 0-dimensional (scalar) 32-bit real data.

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.

real(kind=real32), public, allocatable :: aggregated_data
real(kind=real32), public, pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_real32_1d_t

An aggregator for 1-dimensional 32-bit real data.

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.

real(kind=real32), public, dimension(:), allocatable :: aggregated_data
real(kind=real32), public, dimension(:), pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_real32_2d_t

An aggregator for 2-dimensional 32-bit real data.

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.

real(kind=real32), public, dimension(:,:), allocatable :: aggregated_data
real(kind=real32), public, dimension(:,:), pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_real32_3d_t

An aggregator for 3-dimensional 32-bit real data.

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.

real(kind=real32), public, dimension(:,:,:), allocatable :: aggregated_data
real(kind=real32), public, dimension(:,:,:), pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_real64_0d_t

An aggregator for 0-dimensional (scalar) 64-bit real data.

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.

real(kind=real32), public, allocatable :: aggregated_data
real(kind=real64), public, allocatable :: aggregated_data
real(kind=real64), public, pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_real64_1d_t

An aggregator for 1-dimensional 64-bit real data.

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.

real(kind=real32), public, dimension(:), allocatable :: aggregated_data
real(kind=real64), public, dimension(:), allocatable :: aggregated_data
real(kind=real64), public, dimension(:), pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_real64_2d_t

An aggregator for 2-dimensional 64-bit real data.

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.

real(kind=real32), public, dimension(:,:), allocatable :: aggregated_data
real(kind=real64), public, dimension(:,:), allocatable :: aggregated_data
real(kind=real64), public, dimension(:,:), pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.

type, public, extends(aggregator_t) ::  aggregator_real64_3d_t

An aggregator for 3-dimensional 64-bit real data.

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.

real(kind=real32), public, dimension(:,:,:), allocatable :: aggregated_data
real(kind=real64), public, dimension(:,:,:), allocatable :: aggregated_data
real(kind=real64), public, dimension(:,:,:), pointer :: source_data => null()

Type-Bound Procedures

procedure, public :: init => aggregator_init

Initialise the aggregator.

procedure, public :: type => aggregator_type

Return a string identifier of the aggregator type.

procedure, public :: rank => aggregator_rank

Return the rank of the aggregator.

procedure, public :: shape => aggregator_shape

Return the shape of the aggregator.

procedure, public :: scale => aggregator_scale

Scale the aggregated data by a specified factor.

procedure, public :: div => aggregator_div

Divide the aggregated data by a specified factor.

procedure, public :: offset => aggregator_offset

Add a specified offset to the aggregated data.


Functions

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)

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

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, (:)

private function new_aggregator_int32_0d_t(source_data) result(agg)

Create a new 0D integer aggregator.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_int32_0d_t)

private function new_aggregator_int32_1d_t(source_data) result(agg)

Create a new 1D integer aggregator.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout), dimension(:), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_int32_1d_t)

private function new_aggregator_int32_2d_t(source_data) result(agg)

Create a new 2D integer aggregator.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout), dimension(:,:), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_int32_2d_t)

private function new_aggregator_int32_3d_t(source_data) result(agg)

Create a new 3D integer aggregator.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout), dimension(:,:,:), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_int32_3d_t)

private function new_aggregator_real32_0d(source_data) result(agg)

Create a new 0D 32-bit real aggregator.

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(inout), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_real32_0d_t)

private function new_aggregator_real32_1d(source_data) result(agg)

Create a new 1D 32-bit real aggregator.

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(inout), dimension(:), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_real32_1d_t)

private function new_aggregator_real32_2d(source_data) result(agg)

Create a new 2D 32-bit real aggregator.

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(inout), dimension(:,:), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_real32_2d_t)

private function new_aggregator_real32_3d(source_data) result(agg)

Create a new 3D 32-bit real aggregator.

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(inout), dimension(:,:,:), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_real32_3d_t)

private function new_aggregator_real64_0d(source_data) result(agg)

Create a new 0D 64-bit real aggregator.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(inout), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_real64_0d_t)

private function new_aggregator_real64_1d(source_data) result(agg)

Create a new 1D 64-bit real aggregator.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(inout), dimension(:), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_real64_1d_t)

private function new_aggregator_real64_2d(source_data) result(agg)

Create a new 2D 64-bit real aggregator.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(inout), dimension(:,:), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_real64_2d_t)

private function new_aggregator_real64_3d(source_data) result(agg)

Create a new 3D 64-bit real aggregator.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(inout), dimension(:,:,:), target :: source_data

The source data array to be sampled by the aggregator.

Return Value type(aggregator_real64_3d_t)


Subroutines

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").

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").

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.

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.

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.

private subroutine get_accumulate_args(scale, div, offset, scale_out, div_out, offset_out)

Helper subroutine to get initialise optional scale, div, and offset arguments for accumulate procedures.

Arguments

Type IntentOptional Attributes Name
real, intent(in), optional :: scale

An optional scaling factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: div

An optional division factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: offset

An optional offset to add to the source data before accumulation. Defaults to 0.0 if not provided.

real :: scale_out
real :: div_out
real :: offset_out

private subroutine mean_accumulate(this, scale, div, offset)

Accumulate the aggregated data from the source data using the mean aggregation method.

Arguments

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

An optional scaling factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: div

An optional division factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: offset

An optional offset to add to the source data before accumulation. Defaults to 0.0 if not provided.

private subroutine sum_accumulate(this, scale, div, offset)

Accumulate the aggregated data from the source data using the sum aggregation method.

Arguments

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

An optional scaling factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: div

An optional division factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: offset

An optional offset to add to the source data before accumulation. Defaults to 0.0 if not provided.

private subroutine point_accumulate(this, scale, div, offset)

Accumulate the aggregated data from the source data using the point aggregation method.

Arguments

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

An optional scaling factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: div

An optional division factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: offset

An optional offset to add to the source data before accumulation. Defaults to 0.0 if not provided.

private subroutine min_accumulate(this, scale, div, offset)

Accumulate the aggregated data from the source data using the min aggregation method.

Arguments

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

An optional scaling factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: div

An optional division factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: offset

An optional offset to add to the source data before accumulation. Defaults to 0.0 if not provided.

private subroutine max_accumulate(this, scale, div, offset)

Accumulate the aggregated data from the source data using the max aggregation method.

Arguments

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

An optional scaling factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: div

An optional division factor to apply to the source data before accumulation. Defaults to 1.0 if not provided.

real, intent(in), optional :: offset

An optional offset to add to the source data before accumulation. Defaults to 0.0 if not provided.

private subroutine point_reset(this)

Reset the aggregated data for the point aggregation method. This is a no-op since point aggregation always takes the value of the most recent data point.

Arguments

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

private subroutine min_reset(this)

Reset the aggregated data for the min aggregation method.

Arguments

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

private subroutine max_reset(this)

Reset the aggregated data for the max aggregation method.

Arguments

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

private subroutine other_reset(this)

Reset the aggregated data for aggregation methods other than point, min, and max.

Arguments

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