Skip to content

Commit 312f2ac

Browse files
committed
api: Define side explicitly as a kwarg in operators
1 parent d4577b2 commit 312f2ac

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

devito/finite_differences/operators.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def div(func, shift=None, order=None, method='FD', **kwargs):
1+
def div(func, shift=None, order=None, method='FD', side=None, **kwargs):
22
"""
33
Divergence of the input Function.
44
@@ -20,7 +20,6 @@ def div(func, shift=None, order=None, method='FD', **kwargs):
2020
weights/w: list, tuple, or dict, optional, default=None
2121
Custom weights for the finite difference coefficients.
2222
"""
23-
side = kwargs.get("side")
2423
w = kwargs.get('weights', kwargs.get('w'))
2524
try:
2625
return func.div(shift=shift, order=order, method=method, side=side, w=w)
@@ -45,7 +44,7 @@ def div45(func, shift=None, order=None):
4544
return div(func, shift=shift, order=order, method='RSFD')
4645

4746

48-
def grad(func, shift=None, order=None, method='FD', **kwargs):
47+
def grad(func, shift=None, order=None, method='FD', side=None, **kwargs):
4948
"""
5049
Gradient of the input Function.
5150
@@ -67,7 +66,6 @@ def grad(func, shift=None, order=None, method='FD', **kwargs):
6766
weights/w: list, tuple, or dict, optional, default=None
6867
Custom weights for the finite difference coefficients.
6968
"""
70-
side = kwargs.get("side")
7169
w = kwargs.get('weights', kwargs.get('w'))
7270
try:
7371
return func.grad(shift=shift, order=order, method=method, side=side, w=w)
@@ -92,7 +90,7 @@ def grad45(func, shift=None, order=None):
9290
return grad(func, shift=shift, order=order, method='RSFD')
9391

9492

95-
def curl(func, shift=None, order=None, method='FD', **kwargs):
93+
def curl(func, shift=None, order=None, method='FD', side=None, **kwargs):
9694
"""
9795
Curl of the input Function. Only supported for VectorFunction
9896
@@ -114,7 +112,6 @@ def curl(func, shift=None, order=None, method='FD', **kwargs):
114112
weights/w: list, tuple, or dict, optional, default=None
115113
Custom weights for the finite difference coefficients.
116114
"""
117-
side = kwargs.get("side")
118115
w = kwargs.get('weights', kwargs.get('w'))
119116
try:
120117
return func.curl(shift=shift, order=order, method=method, side=side, w=w)
@@ -140,7 +137,7 @@ def curl45(func, shift=None, order=None):
140137
return curl(func, shift=shift, order=order, method='RSFD')
141138

142139

143-
def laplace(func, shift=None, order=None, method='FD', **kwargs):
140+
def laplace(func, shift=None, order=None, method='FD', side=None, **kwargs):
144141
"""
145142
Laplacian of the input Function.
146143
@@ -161,7 +158,6 @@ def laplace(func, shift=None, order=None, method='FD', **kwargs):
161158
weights/w: list, tuple, or dict, optional, default=None
162159
Custom weights for the finite difference coefficients.
163160
"""
164-
side = kwargs.get("side")
165161
w = kwargs.get('weights', kwargs.get('w'))
166162
try:
167163
return func.laplacian(shift=shift, order=order, method=method, side=side, w=w)

0 commit comments

Comments
 (0)