loki.transformations.transpile.fortran_python

Classes

FortranPythonTransformation(**kwargs)

A transformer class to convert Fortran to Python or DaCe.

class FortranPythonTransformation(**kwargs)

Bases: Transformation

A transformer class to convert Fortran to Python or DaCe.

This Transformation will generate Python code from a given Fortran routine, and if configured, annotate it with DaCe dataflow pragmas.

Parameters:
  • with_dace (bool) – Generate DaCe-specific Python code via dacegen backend. This option implies inverted array indexing; default: False

  • invert_indices (bool) – Switch to C-style indexing (row-major) with fastest loop indices being used rightmost; default: False

  • suffix (str) – Optional suffix to append to converted routine names.

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.