psyclone.domain.lfric.kernel.field_arg_metadata

Module containing the FieldArgMetadata class which captures the metadata associated with a field argument. Supports the creation, modification and Fortran output of a Field argument.

Classes

  • FieldArgMetadata: Class to capture LFRic kernel metadata information for a field

class psyclone.domain.lfric.kernel.field_arg_metadata.FieldArgMetadata(datatype, access, function_space, stencil=None)

Class to capture LFRic kernel metadata information for a field argument.

Parameters:
  • datatype (str) – the datatype of this field (GH_INTEGER, …).

  • access (str) – the way the kernel accesses this field (GH_WRITE, …).

  • function_space (str) – the function space that this field is on (W0, …).

  • stencil (Optional[str]) – the type of stencil used by the kernel when accessing this field.

Inheritance

Inheritance diagram of FieldArgMetadata
static check_access(value)
Parameters:

value (str) – the access descriptor to validate.

static check_datatype(value)
Parameters:

value (str) – the datatype to check for validity.

Raises:

ValueError – if the provided value is not a valid datatype descriptor.

fortran_string()
Returns:

the metadata represented by this class as Fortran.

Return type:

str

property function_space
Returns:

the function space for this field argument.

Return type:

str

classmethod get_stencil(fparser2_tree)

Retrieves the stencil metadata value found within the supplied fparser2 tree (if there is one) and checks that it is valid.

Parameters:

fparser2_tree (fparser.two.Fortran2003.Part_Ref) – fparser2 tree capturing the required metadata.

Returns:

the stencil value extracted from the fparser2 tree if there is one, or None if not.

Return type:

Optional[str]

Raises:

TypeError – if the stencil metadata is not in the expected form.

property stencil
Returns:

the stencil for this field argument, or None if there isn’t one.

Return type:

Optional[str]