Skip to content

Commit b6a4436

Browse files
committed
misc: Change name from to
1 parent 9bc1584 commit b6a4436

19 files changed

Lines changed: 155 additions & 156 deletions

devito/petsc/iet/nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ def petsc_call(specific_call, call_args):
3636

3737

3838
# Mapping special Eq operations to their corresponding IET Expression subclass types.
39-
# These operations correspond to subclasses of Eq utilised within PETScSolve.
39+
# These operations correspond to subclasses of `Eq`` utilised within `petscsolve``.
4040
petsc_iet_mapper = {OpPetsc: PetscMetaData}

devito/petsc/iet/passes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
@iet_pass
3333
def lower_petsc(iet, **kwargs):
34-
# Check if PETScSolve was used
34+
# Check if `petscsolve` was used
3535
inject_solve_mapper = MapNodes(Iteration, PetscMetaData,
3636
'groupby').visit(iet)
3737

@@ -55,19 +55,19 @@ def lower_petsc(iet, **kwargs):
5555
unique_grids = {i.expr.rhs.grid for (i,) in inject_solve_mapper.values()}
5656
# Assumption is that all solves are on the same grid
5757
if len(unique_grids) > 1:
58-
raise ValueError("All PETScSolves must use the same Grid, but multiple found.")
58+
raise ValueError("All `petscsolve` calls must use the same grid, but multiple grids were found.")
5959
grid = unique_grids.pop()
6060
devito_mpi = kwargs['options'].get('mpi', False)
6161
comm = grid.distributor._obj_comm if devito_mpi else 'PETSC_COMM_WORLD'
6262

63-
# Create core PETSc calls (not specific to each PETScSolve)
63+
# Create core PETSc calls (not specific to each `petscsolve`)
6464
core = make_core_petsc_calls(objs, comm)
6565

6666
setup = []
6767
subs = {}
6868
efuncs = {}
6969

70-
# Map PETScSolve to its Section (for logging)
70+
# Map each `PetscMetaData`` to its Section (for logging)
7171
section_mapper = MapNodes(Section, PetscMetaData, 'groupby').visit(iet)
7272

7373
# Prefixes within the same `Operator` should not be duplicated
@@ -78,7 +78,7 @@ def lower_petsc(iet, **kwargs):
7878
dup_list = ", ".join(repr(p) for p in sorted(duplicates))
7979
raise ValueError(
8080
f"The following `options_prefix` values are duplicated "
81-
f"among your PETScSolves. Ensure each one is unique: {dup_list}"
81+
f"among your `petscsolve` calls. Ensure each one is unique: {dup_list}"
8282
)
8383

8484
# List of `Call`s to clear options from the global PETSc options database,

devito/petsc/iet/time_dependence.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TimeDependent(TimeBase):
4242
This includes scenarios where the target is not directly a `TimeFunction`,
4343
but depends on other functions that are.
4444
Outline of time loop abstraction with PETSc:
45-
- At PETScSolve, time indices are replaced with temporary `Symbol` objects
45+
- At `petscsolve`, time indices are replaced with temporary `Symbol` objects
4646
via a mapper (e.g., {t: tau0, t + dt: tau1}) to prevent the time loop
4747
from being generated in the callback functions. These callbacks, needed
4848
for each `SNESSolve` at every time step, don't require the time loop, but
@@ -67,7 +67,7 @@ def time_spacing(self):
6767
@cached_property
6868
def symb_to_moddim(self):
6969
"""
70-
Maps temporary `Symbol` objects created during `PETScSolve` to their
70+
Maps temporary `Symbol` objects created during `petscsolve` to their
7171
corresponding modulo dimensions (e.g. creates {tau0: t0, tau1: t1}).
7272
"""
7373
mapper = {

devito/petsc/iet/type_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def _target_dependent(self, base_dict):
207207

208208

209209
# A static dict containing shared symbols and objects that are not
210-
# unique to each PETScSolve.
210+
# unique to each `petscsolve` call.
211211
# Many of these objects are used as arguments in callback functions to make
212212
# the C code cleaner and more modular.
213213
objs = frozendict({

devito/petsc/logging.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def __init__(self, params, *args, **kwargs):
5050
# Dynamically create a property on this class for each PETSc function
5151
self._add_properties()
5252

53-
# Initialize the summary by adding PETSc information from each PetscInfo
54-
# object (each corresponding to an individual PETScSolve)
53+
# Initialize the summary with PETSc information from each `PetscInfo`
54+
# object (each corresponding to a `petscsolve` call)
5555
for i in self.petscinfos:
5656
self.add_info(i)
5757

@@ -69,8 +69,8 @@ def petsc_entry(self, petscinfo):
6969
Create a named tuple entry for the given PetscInfo object,
7070
containing the values for each PETSc function call.
7171
"""
72-
# Collect the function names associated with this PetscInfo
73-
# instance (i.e., for a single PETScSolve).
72+
# Collect the function names from this `PetscInfo`
73+
# instance (specific to its `petscsolve` call).
7474
funcs = [
7575
petsc_return_variable_dict[f].name for f in petscinfo.query_functions
7676
]

devito/petsc/solve.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
)
1515

1616

17-
__all__ = ['PETScSolve']
17+
__all__ = ['petscsolve']
1818

1919

20-
# TODO: Rename this to petsc_solve, petscsolve?
21-
def PETScSolve(target_exprs, target=None, solver_parameters=None,
20+
def petscsolve(target_exprs, target=None, solver_parameters=None,
2221
options_prefix=None, get_info=[]):
2322
"""
2423
Returns a symbolic expression representing a linear PETSc solver,
@@ -36,13 +35,13 @@ def PETScSolve(target_exprs, target=None, solver_parameters=None,
3635
3736
- Single-field problem:
3837
Pass a single Eq or list of Eq, and specify `target` separately:
39-
PETScSolve(Eq1, target)
40-
PETScSolve([Eq1, Eq2], target)
38+
petscsolve(Eq1, target)
39+
petscsolve([Eq1, Eq2], target)
4140
4241
- Multi-field (mixed) problem:
4342
Pass a dictionary mapping each target field to its Eq(s):
44-
PETScSolve({u: Eq1, v: Eq2})
45-
PETScSolve({u: [Eq1, Eq2], v: [Eq3, Eq4]})
43+
petscsolve({u: Eq1, v: Eq2})
44+
petscsolve({u: [Eq1, Eq2], v: [Eq3, Eq4]})
4645
4746
target : Function-like
4847
The function (e.g., `Function`, `TimeFunction`) into which the linear

devito/petsc/types/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class PETScArray(ArrayBasic, Differentiable):
2020
2121
PETScArray objects represent vector objects within PETSc.
2222
They correspond to the spatial domain of a Function-like object
23-
provided by the user, which is passed to PETScSolve as the target.
23+
provided by the user, which is passed to `petscsolve` as the target.
2424
2525
TODO: Potentially re-evaluate and separate into PETScFunction(Differentiable)
2626
and then PETScArray(ArrayBasic).

devito/petsc/types/equation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class EssentialBC(Eq):
88
"""
9-
Represents an essential boundary condition for use with PETScSolve.
9+
Represents an essential boundary condition for use with `petscsolve`.
1010
1111
Due to ongoing work on PetscSection and DMDA integration (WIP),
1212
these conditions are imposed as trivial equations. The compiler
@@ -16,8 +16,8 @@ class EssentialBC(Eq):
1616
Note:
1717
- To define an essential boundary condition, use:
1818
Eq(target, boundary_value, subdomain=...),
19-
where `target` is the Function-like object passed to PETScSolve.
20-
- SubDomains used for multiple EssentialBCs must not overlap.
19+
where `target` is the Function-like object passed to `petscsolve`.
20+
- SubDomains used for multiple `EssentialBC`s must not overlap.
2121
"""
2222
pass
2323

devito/petsc/types/metadata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def space_dimensions(self):
212212
if len(space_dims) > 1:
213213
# TODO: This may not actually have to be the case, but enforcing it for now
214214
raise ValueError(
215-
"All targets within a PETScSolve have to have the same space dimensions."
215+
"All targets within a `petscsolve` call have to have the same space dimensions."
216216
)
217217
return space_dims.pop()
218218

@@ -222,7 +222,7 @@ def grid(self):
222222
grids = [t.grid for t in self.targets]
223223
if len(set(grids)) > 1:
224224
raise ValueError(
225-
"All targets within a PETScSolve have to have the same grid."
225+
"Multiple grids detected in `petscsolve`; all targets must share one grid."
226226
)
227227
return grids.pop()
228228

@@ -236,7 +236,7 @@ def space_order(self):
236236
space_orders = [t.space_order for t in self.targets]
237237
if len(set(space_orders)) > 1:
238238
raise ValueError(
239-
"All targets within a PETScSolve have to have the same space order."
239+
"All targets within a `petscsolve` call must have the same space order."
240240
)
241241
return space_orders.pop()
242242

examples/petsc/Poisson/01_poisson.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from devito import (Grid, Function, Eq, Operator, switchconfig,
55
configuration, SubDomain)
66

7-
from devito.petsc import PETScSolve, EssentialBC
7+
from devito.petsc import petscsolve, EssentialBC
88
from devito.petsc.initialize import PetscInitialize
99
configuration['compiler'] = 'custom'
1010
os.environ['CC'] = 'mpicc'
@@ -97,7 +97,7 @@ def analytical(x, y):
9797
bcs += [EssentialBC(phi, bc, subdomain=sub4)]
9898

9999
exprs = [eqn] + bcs
100-
petsc = PETScSolve(exprs, target=phi, solver_parameters={'ksp_rtol': 1e-8})
100+
petsc = petscsolve(exprs, target=phi, solver_parameters={'ksp_rtol': 1e-8})
101101

102102
with switchconfig(language='petsc'):
103103
op = Operator(petsc)

0 commit comments

Comments
 (0)