loki.transformations.transpile.fortran_c
Classes
  | 
Transformation to apply/insert Dereference = * and Reference/address-of = & operators.  | 
  | 
Fortran-to-C transformation that translates the given routine into C and generates the corresponding ISO-C wrappers.  | 
- class FortranCTransformation(inline_elementals=True, use_c_ptr=False, path=None)
 Bases:
TransformationFortran-to-C transformation that translates the given routine into C and generates the corresponding ISO-C wrappers.
- Parameters:
 inline_elementals (bool, optional) – Inline known elemental function via expression substitution. Default is
True.use_c_ptr (bool, optional) – Use
c_ptrfor array declarations in the F2C wrapper andc_loc(...)to pass the corresponding argument. Default isFalse.path (str, optional) – Path to generate C sources.
- transform_module(module, **kwargs)
 Defines the transformation to apply to
Moduleitems.For transformations that modify
Moduleobjects, this method should be implemented. It gets called via the dispatch methodapply().- Parameters:
 module (
Module) – The module to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- transform_subroutine(routine, **kwargs)
 Defines the transformation to apply to
Subroutineitems.For transformations that modify
Subroutineobjects, this method should be implemented. It gets called via the dispatch methodapply().- Parameters:
 routine (
Subroutine) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- c_struct_typedef(derived)
 Create the
TypeDeffor the C-wrapped struct definition.
- iso_c_intrinsic_import(scope)
 
- iso_c_intrinsic_kind(_type, scope, **kwargs)
 
- static c_intrinsic_kind(_type, scope)
 
- generate_iso_c_wrapper_routine(routine, c_structs, bind_name=None)
 
- generate_iso_c_wrapper_module(module)
 Generate the ISO-C wrapper module for a raw Fortran module.
Note, we only create getter functions for module variables here, since certain type definitions cannot be used in ISO-C interfaces due to pointer variables, etc.
- generate_iso_c_interface(routine, bind_name, c_structs, scope)
 Generate the ISO-C subroutine interface
- generate_c_header(module, **kwargs)
 Re-generate the C header as a module with all pertinent nodes, but not Fortran-specific intrinsics (eg. implicit none or save).
- static apply_de_reference(routine)
 Utility method to apply/insert Dereference = * and Reference/address-of = & operators.
- generate_c_kernel(routine)
 Re-generate the C kernel and insert wrapper-specific peculiarities, such as the explicit getter calls for imported module-level variables.