Skip to content

Commit 6b66ea8

Browse files
committed
misc: Change name from function_list to query_functions
1 parent d3aaa07 commit 6b66ea8

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

devito/petsc/iet/logging.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PetscLogger:
1515
"""
1616
def __init__(self, level, get_info=[], **kwargs):
1717

18-
self.function_list = get_info
18+
self.query_functions = get_info
1919
self.sobjs = kwargs.get('solver_objs')
2020
self.sreg = kwargs.get('sregistry')
2121
self.section_mapper = kwargs.get('section_mapper', {})
@@ -32,8 +32,8 @@ def __init__(self, level, get_info=[], **kwargs):
3232
# SNES specific
3333
'snesgetiterationnumber',
3434
]
35-
self.function_list.extend(
36-
[f for f in funcs if f not in self.function_list]
35+
self.query_functions.extend(
36+
[f for f in funcs if f not in self.query_functions]
3737
)
3838

3939
# TODO: To be extended with if level <= DEBUG: ...
@@ -44,19 +44,19 @@ def __init__(self, level, get_info=[], **kwargs):
4444
self.statstruct = PetscInfo(
4545
name, pname, self.petsc_option_mapper, self.sobjs,
4646
self.section_mapper, self.inject_solve,
47-
self.function_list
47+
self.query_functions
4848
)
4949

5050
@cached_property
5151
def petsc_option_mapper(self):
5252
"""
53-
For each function in `self.function_list`, look up its metadata in
53+
For each function in `self.query_functions`, look up its metadata in
5454
`petsc_return_variable_dict` and instantiate the corresponding PETSc logging
5555
variables with names from the symbol registry.
5656
5757
Example:
5858
--------
59-
>>> self.function_list
59+
>>> self.query_functions
6060
['kspgetiterationnumber', 'snesgetiterationnumber', 'kspgettolerances']
6161
6262
>>> self.petsc_option_mapper
@@ -66,7 +66,7 @@ def petsc_option_mapper(self):
6666
}
6767
"""
6868
opts = {}
69-
for func_name in self.function_list:
69+
for func_name in self.query_functions:
7070
info = petsc_return_variable_dict[func_name]
7171
opts[info.name] = {}
7272
for vtype, out in zip(info.variable_type, info.output_param, strict=True):
@@ -81,7 +81,7 @@ def calls(self):
8181
"""
8282
struct = self.statstruct
8383
calls = []
84-
for func_name in self.function_list:
84+
for func_name in self.query_functions:
8585
return_variable = petsc_return_variable_dict[func_name]
8686

8787
input = self.sobjs[return_variable.input_params]

devito/petsc/logging.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self, params, *args, **kwargs):
4343
self._functions = list(dict.fromkeys(
4444
petsc_return_variable_dict[key].name
4545
for struct in self.petscinfos
46-
for key in struct.function_list
46+
for key in struct.query_functions
4747
))
4848
self._property_name_map = {}
4949
# Dynamically create a property on this class for each PETSc function
@@ -71,7 +71,7 @@ def petsc_entry(self, petscinfo):
7171
# Collect the function names associated with this PetscInfo
7272
# instance (i.e., for a single PETScSolve).
7373
funcs = [
74-
petsc_return_variable_dict[f].name for f in petscinfo.function_list
74+
petsc_return_variable_dict[f].name for f in petscinfo.query_functions
7575
]
7676
values = [getattr(petscinfo, c) for c in funcs]
7777
return PetscEntry(**{k: v for k, v in zip(funcs, values)})
@@ -130,16 +130,16 @@ def __getitem__(self, key):
130130
class PetscInfo(CompositeObject):
131131

132132
__rargs__ = ('name', 'pname', 'petsc_option_mapper', 'sobjs', 'section_mapper',
133-
'inject_solve', 'function_list')
133+
'inject_solve', 'query_functions')
134134

135135
def __init__(self, name, pname, petsc_option_mapper, sobjs, section_mapper,
136-
inject_solve, function_list):
136+
inject_solve, query_functions):
137137

138138
self.petsc_option_mapper = petsc_option_mapper
139139
self.sobjs = sobjs
140140
self.section_mapper = section_mapper
141141
self.inject_solve = inject_solve
142-
self.function_list = function_list
142+
self.query_functions = query_functions
143143
self.solve_expr = inject_solve.expr.rhs
144144

145145
pfields = []

0 commit comments

Comments
 (0)