Skip to content
Snippets Groups Projects
Commit 16b089f2 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Extend DestructuringBindingsForFieldClass to enable arguments per value

parent ba82e6a3
Branches textures
Tags
No related merge requests found
Pipeline #19205 failed
...@@ -35,6 +35,7 @@ class DestructuringBindingsForFieldClass(Node): ...@@ -35,6 +35,7 @@ class DestructuringBindingsForFieldClass(Node):
FieldStrideSymbol: "stride[{dim}]" FieldStrideSymbol: "stride[{dim}]"
} }
CLASS_NAME_TEMPLATE = "PyStencilsField<{dtype}, {ndim}>" CLASS_NAME_TEMPLATE = "PyStencilsField<{dtype}, {ndim}>"
ARGS_AS_REFERENCE = True
@property @property
def fields_accessed(self) -> Set['ResolvedFieldAccess']: def fields_accessed(self) -> Set['ResolvedFieldAccess']:
...@@ -70,7 +71,11 @@ class DestructuringBindingsForFieldClass(Node): ...@@ -70,7 +71,11 @@ class DestructuringBindingsForFieldClass(Node):
undefined_field_symbols = self.symbols_defined undefined_field_symbols = self.symbols_defined
corresponding_field_names = {s.field_name for s in undefined_field_symbols if hasattr(s, 'field_name')} corresponding_field_names = {s.field_name for s in undefined_field_symbols if hasattr(s, 'field_name')}
corresponding_field_names |= {s.field_names[0] for s in undefined_field_symbols if hasattr(s, 'field_names')} corresponding_field_names |= {s.field_names[0] for s in undefined_field_symbols if hasattr(s, 'field_names')}
return {TypedSymbol(f, self.CLASS_NAME_TEMPLATE.format(dtype=field_map[f].dtype, ndim=field_map[f].ndim) + '&') return {TypedSymbol(f,
self.CLASS_NAME_TEMPLATE.format(dtype=field_map[f].dtype,
ndim=field_map[f].ndim) + ('&'
if self.ARGS_AS_REFERENCE
else ''))
for f in corresponding_field_names} | (self.body.undefined_symbols - undefined_field_symbols) for f in corresponding_field_names} | (self.body.undefined_symbols - undefined_field_symbols)
def subs(self, subs_dict) -> None: def subs(self, subs_dict) -> None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment