55 BlankLine , Callable , Iteration , PointerCast , Definition
66)
77from devito .symbolics import (
8- Byref , FieldFromPointer , IntDiv , Deref , Mod , String , Null , VOID
8+ Byref , FieldFromPointer , IntDiv , Deref , Mod , String , Null , VOID , Cast
99)
1010from devito .symbolics .unevaluation import Mul
1111from devito .types .basic import AbstractFunction
1717from devito .petsc .iet .type_builder import objs
1818from devito .petsc .types .macros import petsc_func_begin_user
1919from devito .petsc .types .modes import InsertMode
20- from devito .petsc .types .object import TempSymb
20+ from devito .petsc .types .object import Counter
2121
2222
2323class BaseCallbackBuilder :
@@ -693,10 +693,6 @@ def _create_count_bc_body(self, body):
693693 ctx = objs ['dummyctx' ]
694694
695695
696- dm_get_local_info = petsc_call (
697- 'DMDAGetLocalInfo' , [dmda , Byref (linsolve_expr .localinfo )]
698- )
699-
700696 body = self .time_dependence .uxreplace_time (body )
701697
702698 fields = get_user_struct_fields (body )
@@ -710,21 +706,24 @@ def _create_count_bc_body(self, body):
710706
711707 # body = body._rebuild(body=body.body)
712708
713- body = body ._rebuild (body .body )
714-
715- stacks = (
716- dm_get_local_info ,
717- )
718-
719709 # Dereference function data in struct
720- derefs = dereference_funcs (ctx , fields )
710+ # derefs = dereference_funcs(ctx, fields)
711+
712+ # OBVS change names
713+ deref_ptr = DummyExpr (Counter , Deref (sobjs ['numBCPtr' ]))
714+ move_ptr = DummyExpr (Deref (sobjs ['numBCPtr' ]), Counter )
715+
716+ # from IPython import embed; embed()
721717
722718 # Force the struct definition to appear at the very start, since
723719 # stacks, allocs etc may rely on its information
724720 struct_definition = [Definition (ctx ), dm_get_app_context ]
725721
722+
723+ body = body ._rebuild (body .body + (move_ptr ,))
724+
726725 body = self ._make_callable_body (
727- body , standalones = struct_definition , stacks = stacks + derefs
726+ body , standalones = struct_definition , stacks = ( deref_ptr ,)
728727 )
729728
730729 # Replace non-function data with pointer to data in struct
@@ -734,7 +733,7 @@ def _create_count_bc_body(self, body):
734733 # subs[]
735734 # subs[self.target] = sobjs['numBC']
736735
737- subs [TempSymb ._C_symbol ] = sobjs ['numBCPtr' ]._C_symbol
736+ # subs[Counter ._C_symbol] = Cast(Deref( sobjs['numBCPtr']._C_symbol))
738737
739738 # from IPython import embed; embed()
740739
@@ -785,7 +784,7 @@ def _create_set_point_bc_body(self, body):
785784 i in fields if not isinstance (i .function , AbstractFunction )}
786785
787786
788- subs [TempSymb ._C_symbol ] = sobjs ['bcPointsArr' ].indexed [sobjs ['k_iter' ]]
787+ subs [Counter ._C_symbol ] = sobjs ['bcPointsArr' ].indexed [sobjs ['k_iter' ]]
789788
790789 return Uxreplace (subs ).visit (body )
791790
0 commit comments