@@ -73,7 +73,7 @@ def petsc_entry(self, petscinfo):
7373 funcs = [
7474 petsc_return_variable_dict [f ].name for f in petscinfo .function_list
7575 ]
76- values = tuple ( getattr (petscinfo , c ) for c in funcs )
76+ values = [ getattr (petscinfo , c ) for c in funcs ]
7777 return PetscEntry (** {k : v for k , v in zip (funcs , values )})
7878
7979 def _add_properties (self ):
@@ -140,7 +140,7 @@ def __init__(self, name, pname, petsc_option_mapper, sobjs, section_mapper,
140140 self .section_mapper = section_mapper
141141 self .inject_solve = inject_solve
142142 self .function_list = function_list
143- self .formatted_prefix = inject_solve .expr .rhs . formatted_prefix
143+ self .solve_expr = inject_solve .expr .rhs
144144
145145 pfields = []
146146
@@ -160,19 +160,20 @@ def __init__(self, name, pname, petsc_option_mapper, sobjs, section_mapper,
160160 def fields (self ):
161161 return self ._fields
162162
163+ @property
164+ def prefix (self ):
165+ # If users provide an options prefix, use it in the summary;
166+ # otherwise, use the default one generated by Devito
167+ return self .solve_expr .user_prefix or self .solve_expr .formatted_prefix
168+
163169 @property
164170 def section (self ):
165171 section = self .section_mapper .items ()
166172 return next ((k [0 ].name for k , v in section if self .inject_solve in v ), None )
167173
168174 @property
169175 def summary_key (self ):
170- # If users provide an options prefix, use it in the summary;
171- # otherwise, use the default one generated by Devito
172- user_prefix = self .inject_solve .expr .rhs .user_prefix
173- if user_prefix is None :
174- user_prefix = self .formatted_prefix
175- return (self .section , user_prefix )
176+ return (self .section , self .prefix )
176177
177178 def __getattr__ (self , attr ):
178179 if attr not in self .petsc_option_mapper :
@@ -181,10 +182,10 @@ def __getattr__(self, attr):
181182 # Maps the petsc_option to its generated variable name e.g {'its': its0}
182183 obj_mapper = self .petsc_option_mapper [attr ]
183184
184- # Decode the value if it is a bytes object
185- def decode_if_bytes (val ):
185+ def get_val (val ):
186+ val = getattr (self .value ._obj , val .name )
187+ # Decode the val if it is a bytes object
186188 return str (os .fsdecode (val )) if isinstance (val , bytes ) else val
187- get_val = lambda v : decode_if_bytes (getattr (self .value ._obj , v .name ))
188189
189190 # - If the function returns a single value (e.g., KSPGetIterationNumber),
190191 # return that value directly.
0 commit comments