athena__metrics Module

Module containing functions to compute the accuracy of a model

This module contains a derived type for storing and handling metric data


Uses

    • coreutils

Derived Types

type, public ::  metric_dict_type

Type for storing and handling metric data

Components

Type Visibility Attributes Name Initial
logical, public :: active

Flag to indicate if the metric is active

real(kind=real32), public, allocatable, dimension(:) :: history

History of the metric

character(len=10), public :: key

Key for the metric

integer, public :: num_entries

Number of entries in the history

real(kind=real32), public :: threshold

Threshold for the metric

real(kind=real32), public :: val

Value of the metric

integer, public :: window_width

Window width for checking convergence

Type-Bound Procedures

procedure, public :: add_t_t => metric_dict_add

Add two metric_dict_type together

procedure, public :: append => append_value

Append a value to the history of the metric

procedure, public :: check => metric_dict_check

Check if the metric has converged

generic, public :: operator(+) => add_t_t

Overload the addition operator


Functions

private elemental function metric_dict_add(a, b) result(output)

Operation to add two metric_dict_type together

Arguments

Type IntentOptional Attributes Name
class(metric_dict_type), intent(in) :: a

Instances of metric data

class(metric_dict_type), intent(in) :: b

Instances of metric data

Return Value type(metric_dict_type)

Sum of the metric data


Subroutines

public subroutine metric_dict_alloc(input, source, length)

Allocate memory for a metric_dict_type

Arguments

Type IntentOptional Attributes Name
type(metric_dict_type), intent(out), dimension(:) :: input

Instance of metric data

type(metric_dict_type), intent(in), optional, dimension(:) :: source

Source of the metric data to copy

integer, intent(in), optional :: length

Length of the metric data

private subroutine append_value(this, value)

Append a value to the history of the metric

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

private subroutine metric_dict_check(this, plateau_threshold, converged)

Check if the metric has converged

Arguments

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

Instance of metric data

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

Threshold for plateau

integer, intent(out) :: converged

Boolean whether the metric has converged