loki.transformations.sanitise.sequence_associations

Functions

check_if_scalar_syntax(arg, dummy)

Check if an array argument, arg, is passed to an array dummy argument, dummy, using scalar syntax.

do_resolve_sequence_association(routine)

Housekeeping routine to replace scalar syntax when passing arrays as arguments For example, a call like

Classes

SequenceAssociationTransformation([...])

Transformation that resolves sequence association patterns in CallStatement nodes.

SequenceAssociationTransformer([mapper, ...])

Transformer that resolves sequence association patterns in CallStatement nodes.

class SequenceAssociationTransformation(resolve_sequence_associations=True)

Bases: Transformation

Transformation that resolves sequence association patterns in CallStatement nodes.

Parameters:

resolve_sequence_associations (bool) – Flag to trigger or suppress resolution of sequence associations

transform_subroutine(routine, **kwargs)

Defines the transformation to apply to Subroutine items.

For transformations that modify Subroutine objects, this method should be implemented. It gets called via the dispatch method apply().

Parameters:
  • routine (Subroutine) – The subroutine to be transformed.

  • **kwargs (optional) – Keyword arguments for the transformation.

do_resolve_sequence_association(routine)

Housekeeping routine to replace scalar syntax when passing arrays as arguments For example, a call like

real :: a(m,n)

call myroutine(a(i,j))

where myroutine looks like

subroutine myroutine(a)
    real :: a(5)
end subroutine myroutine

should be changed to

call myroutine(a(i:m,j)
Parameters:

routine (Subroutine) – The subroutine where calls will be changed

class SequenceAssociationTransformer(mapper=None, invalidate_source=True, inplace=False, rebuild_scopes=False)

Bases: Transformer

Transformer that resolves sequence association patterns in CallStatement nodes.

visit_CallStatement(call, **kwargs)

Resolve sequence association patterns in arguments and return new CallStatement object if any were found.