Esempio n. 1
0
 def visit_FieldAccess(self, node: oir.FieldAccess, **kwargs: Any) -> gtcpp.AccessorRef:
     return gtcpp.AccessorRef(
         name=node.name,
         offset=self.visit(node.offset),
         data_index=node.data_index,
         dtype=node.dtype,
     )
Esempio n. 2
0
 def _make_scalar_accessor(name: str) -> gtcpp.AccessorRef:
     return gtcpp.AccessorRef(
         name=name,
         offset=CartesianOffset.zero(),
         kind=ExprKind.SCALAR,
         dtype=common.DataType.INT32,
     )
Esempio n. 3
0
 def visit_ScalarAccess(
         self, node: oir.ScalarAccess,
         **kwargs: Any) -> Union[gtcpp.AccessorRef, gtcpp.ScalarAccess]:
     assert "stencil_symtable" in kwargs
     if node.name in kwargs["stencil_symtable"]:
         symbol = kwargs["stencil_symtable"][node.name]
         if isinstance(symbol, oir.ScalarDecl):
             return gtcpp.AccessorRef(name=symbol.name,
                                      offset=CartesianOffset.zero(),
                                      dtype=symbol.dtype)
         assert isinstance(symbol, oir.LocalScalar)
     return gtcpp.ScalarAccess(name=node.name, dtype=node.dtype)