@@ -46,9 +46,9 @@ def __init__(self, **kwargs):
4646 self ._user_struct_callback = None
4747 # TODO: Test pickling. The mutability of these lists
4848 # could cause issues when pickling?
49- self ._matvecs = []
50- self ._formfuncs = []
51- self ._formrhs = []
49+ self ._J_efuncs = []
50+ self ._F_efuncs = []
51+ self ._b_efuncs = []
5252 self ._initialguesses = []
5353
5454 self ._make_core ()
@@ -73,23 +73,23 @@ def main_matvec_callback(self):
7373 is set in the main kernel via
7474 `PetscCall(MatShellSetOperation(J,MATOP_MULT,(void (*)(void))...));`
7575 """
76- return self ._matvecs [0 ]
76+ return self ._J_efuncs [0 ]
7777
7878 @property
7979 def main_formfunc_callback (self ):
80- return self ._formfuncs [0 ]
80+ return self ._F_efuncs [0 ]
8181
8282 @property
83- def matvecs (self ):
84- return self ._matvecs
83+ def J_efuncs (self ):
84+ return self ._J_efuncs
8585
8686 @property
87- def formfuncs (self ):
88- return self ._formfuncs
87+ def F_efuncs (self ):
88+ return self ._F_efuncs
8989
9090 @property
91- def formrhs (self ):
92- return self ._formrhs
91+ def b_efuncs (self ):
92+ return self ._b_efuncs
9393
9494 @property
9595 def initialguesses (self ):
@@ -122,27 +122,27 @@ def _make_core(self):
122122 self ._make_matvec (self .fielddata .jacobian )
123123 self ._make_formfunc ()
124124 self ._make_formrhs ()
125- if self .fielddata .initialguess .eqs :
125+ if self .fielddata .initialguess .exprs :
126126 self ._make_initialguess ()
127127 self ._make_user_struct_callback ()
128128
129129 def _make_matvec (self , jacobian , prefix = 'MatMult' ):
130130 # Compile matvec `eqns` into an IET via recursive compilation
131131 matvecs = jacobian .matvecs
132- irs_matvec , _ = self .rcompile (matvecs ,
132+ irs , _ = self .rcompile (matvecs ,
133133 options = {'mpi' : False }, sregistry = self .sregistry ,
134134 concretize_mapper = self .concretize_mapper )
135- body_matvec = self ._create_matvec_body (List (body = irs_matvec .uiet .body ),
135+ body = self ._create_matvec_body (List (body = irs .uiet .body ),
136136 jacobian )
137137
138138 objs = self .objs
139139 cb = PETScCallable (
140140 self .sregistry .make_name (prefix = prefix ),
141- body_matvec ,
141+ body ,
142142 retval = objs ['err' ],
143143 parameters = (objs ['J' ], objs ['X' ], objs ['Y' ])
144144 )
145- self ._matvecs .append (cb )
145+ self ._J_efuncs .append (cb )
146146 self ._efuncs [cb .name ] = cb
147147
148148 def _create_matvec_body (self , body , jacobian ):
@@ -260,7 +260,7 @@ def _create_matvec_body(self, body, jacobian):
260260 # Dereference function data in struct
261261 derefs = self .dereference_funcs (ctx , fields )
262262
263- matvec_body = CallableBody (
263+ body = CallableBody (
264264 List (body = body ),
265265 init = (objs ['begin_user' ],),
266266 stacks = stacks + derefs ,
@@ -269,20 +269,20 @@ def _create_matvec_body(self, body, jacobian):
269269
270270 # Replace non-function data with pointer to data in struct
271271 subs = {i ._C_symbol : FieldFromPointer (i ._C_symbol , ctx ) for i in fields }
272- matvec_body = Uxreplace (subs ).visit (matvec_body )
272+ body = Uxreplace (subs ).visit (body )
273273
274274 self ._struct_params .extend (fields )
275- return matvec_body
275+ return body
276276
277277 def _make_formfunc (self ):
278- formfuncs = self .fielddata .residual .formfuncs
279- # Compile formfunc `eqns ` into an IET via recursive compilation
280- irs_formfunc , _ = self .rcompile (
281- formfuncs , options = {'mpi' : False }, sregistry = self .sregistry ,
278+ F_exprs = self .fielddata .residual .F_exprs
279+ # Compile `F_exprs ` into an IET via recursive compilation
280+ irs , _ = self .rcompile (
281+ F_exprs , options = {'mpi' : False }, sregistry = self .sregistry ,
282282 concretize_mapper = self .concretize_mapper
283283 )
284284 body_formfunc = self ._create_formfunc_body (
285- List (body = irs_formfunc .uiet .body )
285+ List (body = irs .uiet .body )
286286 )
287287 objs = self .objs
288288 cb = PETScCallable (
@@ -291,7 +291,7 @@ def _make_formfunc(self):
291291 retval = objs ['err' ],
292292 parameters = (objs ['snes' ], objs ['X' ], objs ['F' ], objs ['dummyptr' ])
293293 )
294- self ._formfuncs .append (cb )
294+ self ._F_efuncs .append (cb )
295295 self ._efuncs [cb .name ] = cb
296296
297297 def _create_formfunc_body (self , body ):
@@ -399,7 +399,7 @@ def _create_formfunc_body(self, body):
399399 # Dereference function data in struct
400400 derefs = self .dereference_funcs (ctx , fields )
401401
402- formfunc_body = CallableBody (
402+ body = CallableBody (
403403 List (body = body ),
404404 init = (objs ['begin_user' ],),
405405 stacks = stacks + derefs ,
@@ -408,28 +408,28 @@ def _create_formfunc_body(self, body):
408408 # Replace non-function data with pointer to data in struct
409409 subs = {i ._C_symbol : FieldFromPointer (i ._C_symbol , ctx ) for i in fields }
410410
411- return Uxreplace (subs ).visit (formfunc_body )
411+ return Uxreplace (subs ).visit (body )
412412
413413 def _make_formrhs (self ):
414- formrhs = self .fielddata .residual .formrhs
414+ b_exprs = self .fielddata .residual .b_exprs
415415 sobjs = self .solver_objs
416416
417- # Compile formrhs `eqns ` into an IET via recursive compilation
418- irs_formrhs , _ = self .rcompile (
419- formrhs , options = {'mpi' : False }, sregistry = self .sregistry ,
417+ # Compile `b_exprs ` into an IET via recursive compilation
418+ irs , _ = self .rcompile (
419+ b_exprs , options = {'mpi' : False }, sregistry = self .sregistry ,
420420 concretize_mapper = self .concretize_mapper
421421 )
422- body_formrhs = self ._create_form_rhs_body (
423- List (body = irs_formrhs .uiet .body )
422+ body = self ._create_form_rhs_body (
423+ List (body = irs .uiet .body )
424424 )
425425 objs = self .objs
426426 cb = PETScCallable (
427427 self .sregistry .make_name (prefix = 'FormRHS' ),
428- body_formrhs ,
428+ body ,
429429 retval = objs ['err' ],
430430 parameters = (sobjs ['callbackdm' ], objs ['B' ])
431431 )
432- self ._formrhs .append (cb )
432+ self ._b_efuncs .append (cb )
433433 self ._efuncs [cb .name ] = cb
434434
435435 def _create_form_rhs_body (self , body ):
@@ -509,7 +509,7 @@ def _create_form_rhs_body(self, body):
509509 # Dereference function data in struct
510510 derefs = self .dereference_funcs (ctx , fields )
511511
512- formrhs_body = CallableBody (
512+ body = CallableBody (
513513 List (body = [body ]),
514514 init = (objs ['begin_user' ],),
515515 stacks = stacks + derefs ,
@@ -520,24 +520,24 @@ def _create_form_rhs_body(self, body):
520520 subs = {i ._C_symbol : FieldFromPointer (i ._C_symbol , ctx ) for
521521 i in fields if not isinstance (i .function , AbstractFunction )}
522522
523- return Uxreplace (subs ).visit (formrhs_body )
523+ return Uxreplace (subs ).visit (body )
524524
525525 def _make_initialguess (self ):
526- initguess = self .fielddata .initialguess .eqs
526+ exprs = self .fielddata .initialguess .exprs
527527 sobjs = self .solver_objs
528528
529529 # Compile initital guess `eqns` into an IET via recursive compilation
530530 irs , _ = self .rcompile (
531- initguess , options = {'mpi' : False }, sregistry = self .sregistry ,
531+ exprs , options = {'mpi' : False }, sregistry = self .sregistry ,
532532 concretize_mapper = self .concretize_mapper
533533 )
534- body_init_guess = self ._create_initial_guess_body (
534+ body = self ._create_initial_guess_body (
535535 List (body = irs .uiet .body )
536536 )
537537 objs = self .objs
538538 cb = PETScCallable (
539539 self .sregistry .make_name (prefix = 'FormInitialGuess' ),
540- body_init_guess ,
540+ body ,
541541 retval = objs ['err' ],
542542 parameters = (sobjs ['callbackdm' ], objs ['xloc' ])
543543 )
@@ -770,10 +770,10 @@ def _whole_matvec_body(self):
770770 )
771771
772772 def _make_whole_formfunc (self ):
773- formfuncs = self .fielddata .residual .formfuncs
773+ F_exprs = self .fielddata .residual .F_exprs
774774 # Compile formfunc `eqns` into an IET via recursive compilation
775775 irs_formfunc , _ = self .rcompile (
776- formfuncs , options = {'mpi' : False }, sregistry = self .sregistry ,
776+ F_exprs , options = {'mpi' : False }, sregistry = self .sregistry ,
777777 concretize_mapper = self .concretize_mapper
778778 )
779779 body_formfunc = self ._whole_formfunc_body (List (body = irs_formfunc .uiet .body ))
@@ -1024,7 +1024,7 @@ def _submat_callback_body(self):
10241024 iteration = Iteration (List (body = iter_body ), i , upper_bound )
10251025
10261026 nonzero_submats = self .jacobian .nonzero_submatrices
1027- matvec_lookup = {mv .name .split ('_' )[0 ]: mv for mv in self .matvecs }
1027+ matvec_lookup = {mv .name .split ('_' )[0 ]: mv for mv in self .J_efuncs }
10281028
10291029 matmult_op = [
10301030 petsc_call (
@@ -1616,11 +1616,11 @@ def _execute_solve(self):
16161616
16171617 struct_assignment = self .timedep .assign_time_iters (sobjs ['userctx' ])
16181618
1619- rhs_callback = self .cbbuilder .formrhs [0 ]
1619+ b_efunc = self .cbbuilder .b_efuncs [0 ]
16201620
16211621 dmda = sobjs ['dmda' ]
16221622
1623- rhs_call = petsc_call (rhs_callback .name , [sobjs ['dmda' ], sobjs ['bglobal' ]])
1623+ rhs_call = petsc_call (b_efunc .name , [sobjs ['dmda' ], sobjs ['bglobal' ]])
16241624
16251625 vec_place_array = self .timedep .place_array (target )
16261626
0 commit comments