Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a replacement for Fortran PRESENT(X) #85

Open
1 task
FlorianDeconinck opened this issue Aug 27, 2024 · 0 comments
Open
1 task

Implement a replacement for Fortran PRESENT(X) #85

FlorianDeconinck opened this issue Aug 27, 2024 · 0 comments

Comments

@FlorianDeconinck
Copy link
Collaborator

Fortran has the concept of a PRESENT(X) to test if argument X was passed to a function. Functionally it's the Optional[type] or the None of Python, which cannot be processed by GT4Py.

The usage would be:

def my_stencil(
  a_field: FloatField
  b_optional_value: Optional[float]
):
  if b_optional_value is None:
    a_field = 10
  else:
    a_field = 20

Code generation in C could be a duplicate of the flag into a do_X and value_X with resolution at compile time?

The workaround for this right now is to use an __external__ to be able to flip some code BUT it only works on compile-time defined flags.

Parent: #36


  • Optional[float] is a supported feature, with potential restrictions documented and feedback cleanly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant