99
1010import symfem
1111from symfem .functions import (
12- AnyFunction ,
12+ Function ,
1313 FunctionInput ,
1414 ScalarFunction ,
1515 SympyFormat ,
2222__all__ = ["BasisFunction" , "SubbedBasisFunction" ]
2323
2424
25- class BasisFunction (AnyFunction ):
25+ class BasisFunction (Function ):
2626 """A basis function of a finite element.
2727
2828 This basis function can be used before the element's basis functions have been computed. When
@@ -40,15 +40,15 @@ def __init__(self, scalar=False, vector=False, matrix=False):
4040 super ().__init__ (scalar = scalar , vector = vector , matrix = matrix )
4141
4242 @abstractmethod
43- def get_function (self ) -> AnyFunction :
43+ def get_function (self ) -> Function :
4444 """Get the actual basis function.
4545
4646 Returns:
4747 The basis function
4848 """
4949 pass
5050
51- def __add__ (self , other : typing .Any ) -> AnyFunction :
51+ def __add__ (self , other : typing .Any ) -> Function :
5252 """Add.
5353
5454 Args:
@@ -59,7 +59,7 @@ def __add__(self, other: typing.Any) -> AnyFunction:
5959 """
6060 return self .get_function ().__add__ (other )
6161
62- def __radd__ (self , other : typing .Any ) -> AnyFunction :
62+ def __radd__ (self , other : typing .Any ) -> Function :
6363 """Add.
6464
6565 Args:
@@ -70,7 +70,7 @@ def __radd__(self, other: typing.Any) -> AnyFunction:
7070 """
7171 return self .get_function ().__radd__ (other )
7272
73- def __sub__ (self , other : typing .Any ) -> AnyFunction :
73+ def __sub__ (self , other : typing .Any ) -> Function :
7474 """Subtract.
7575
7676 Args:
@@ -81,7 +81,7 @@ def __sub__(self, other: typing.Any) -> AnyFunction:
8181 """
8282 return self .get_function ().__sub__ (other )
8383
84- def __rsub__ (self , other : typing .Any ) -> AnyFunction :
84+ def __rsub__ (self , other : typing .Any ) -> Function :
8585 """Subtract.
8686
8787 Args:
@@ -92,15 +92,15 @@ def __rsub__(self, other: typing.Any) -> AnyFunction:
9292 """
9393 return self .get_function ().__rsub__ (other )
9494
95- def __neg__ (self ) -> AnyFunction :
95+ def __neg__ (self ) -> Function :
9696 """Negate.
9797
9898 Returns:
9999 Negated function
100100 """
101101 return self .get_function ().__neg__ ()
102102
103- def __truediv__ (self , other : typing .Any ) -> AnyFunction :
103+ def __truediv__ (self , other : typing .Any ) -> Function :
104104 """Divide.
105105
106106 Args:
@@ -111,7 +111,7 @@ def __truediv__(self, other: typing.Any) -> AnyFunction:
111111 """
112112 return self .get_function ().__truediv__ (other )
113113
114- def __rtruediv__ (self , other : typing .Any ) -> AnyFunction :
114+ def __rtruediv__ (self , other : typing .Any ) -> Function :
115115 """Divide.
116116
117117 Args:
@@ -122,7 +122,7 @@ def __rtruediv__(self, other: typing.Any) -> AnyFunction:
122122 """
123123 return self .get_function ().__rtruediv__ (other )
124124
125- def __mul__ (self , other : typing .Any ) -> AnyFunction :
125+ def __mul__ (self , other : typing .Any ) -> Function :
126126 """Multiply.
127127
128128 Args:
@@ -133,7 +133,7 @@ def __mul__(self, other: typing.Any) -> AnyFunction:
133133 """
134134 return self .get_function ().__mul__ (other )
135135
136- def __rmul__ (self , other : typing .Any ) -> AnyFunction :
136+ def __rmul__ (self , other : typing .Any ) -> Function :
137137 """Multiply.
138138
139139 Args:
@@ -144,7 +144,7 @@ def __rmul__(self, other: typing.Any) -> AnyFunction:
144144 """
145145 return self .get_function ().__rmul__ (other )
146146
147- def __matmul__ (self , other : typing .Any ) -> AnyFunction :
147+ def __matmul__ (self , other : typing .Any ) -> Function :
148148 """Multiply.
149149
150150 Args:
@@ -155,7 +155,7 @@ def __matmul__(self, other: typing.Any) -> AnyFunction:
155155 """
156156 return self .get_function ().__matmul__ (other )
157157
158- def __rmatmul__ (self , other : typing .Any ) -> AnyFunction :
158+ def __rmatmul__ (self , other : typing .Any ) -> Function :
159159 """Multiply.
160160
161161 Args:
@@ -166,7 +166,7 @@ def __rmatmul__(self, other: typing.Any) -> AnyFunction:
166166 """
167167 return self .get_function ().__rmatmul__ (other )
168168
169- def __pow__ (self , other : typing .Any ) -> AnyFunction :
169+ def __pow__ (self , other : typing .Any ) -> Function :
170170 """Raise to a power.
171171
172172 Args:
@@ -193,7 +193,7 @@ def as_tex(self) -> str:
193193 """
194194 return self .get_function ().as_tex ()
195195
196- def diff (self , variable : sympy .core .symbol .Symbol ) -> AnyFunction :
196+ def diff (self , variable : sympy .core .symbol .Symbol ) -> Function :
197197 """Differentiate the function.
198198
199199 Args:
@@ -204,7 +204,7 @@ def diff(self, variable: sympy.core.symbol.Symbol) -> AnyFunction:
204204 """
205205 return self .get_function ().diff (variable )
206206
207- def directional_derivative (self , direction : PointType ) -> AnyFunction :
207+ def directional_derivative (self , direction : PointType ) -> Function :
208208 """Compute a directional derivative.
209209
210210 Args:
@@ -215,7 +215,7 @@ def directional_derivative(self, direction: PointType) -> AnyFunction:
215215 """
216216 return self .get_function ().directional_derivative (direction )
217217
218- def jacobian_component (self , component : typing .Tuple [int , int ]) -> AnyFunction :
218+ def jacobian_component (self , component : typing .Tuple [int , int ]) -> Function :
219219 """Compute a component of the jacobian.
220220
221221 Args:
@@ -226,7 +226,7 @@ def jacobian_component(self, component: typing.Tuple[int, int]) -> AnyFunction:
226226 """
227227 return self .get_function ().jacobian_component (component )
228228
229- def jacobian (self , dim : int ) -> AnyFunction :
229+ def jacobian (self , dim : int ) -> Function :
230230 """Compute the jacobian.
231231
232232 Args:
@@ -237,7 +237,7 @@ def jacobian(self, dim: int) -> AnyFunction:
237237 """
238238 return self .get_function ().jacobian (dim )
239239
240- def dot (self , other_in : FunctionInput ) -> AnyFunction :
240+ def dot (self , other_in : FunctionInput ) -> Function :
241241 """Compute the dot product with another function.
242242
243243 Args:
@@ -248,7 +248,7 @@ def dot(self, other_in: FunctionInput) -> AnyFunction:
248248 """
249249 return self .get_function ().dot (other_in )
250250
251- def cross (self , other_in : FunctionInput ) -> AnyFunction :
251+ def cross (self , other_in : FunctionInput ) -> Function :
252252 """Compute the cross product with another function.
253253
254254 Args:
@@ -259,23 +259,23 @@ def cross(self, other_in: FunctionInput) -> AnyFunction:
259259 """
260260 return self .get_function ().cross (other_in )
261261
262- def div (self ) -> AnyFunction :
262+ def div (self ) -> Function :
263263 """Compute the divergence of the function.
264264
265265 Returns:
266266 The divergence
267267 """
268268 return self .get_function ().div ()
269269
270- def grad (self , dim : int ) -> AnyFunction :
270+ def grad (self , dim : int ) -> Function :
271271 """Compute the gradient of the function.
272272
273273 Returns:
274274 The gradient
275275 """
276276 return self .get_function ().grad (dim )
277277
278- def curl (self ) -> AnyFunction :
278+ def curl (self ) -> Function :
279279 """Compute the curl of the function.
280280
281281 Returns:
@@ -296,7 +296,7 @@ def integral(
296296 domain : Reference ,
297297 vars : AxisVariablesNotSingle = x ,
298298 dummy_vars : AxisVariablesNotSingle = t ,
299- ) -> ScalarFunction :
299+ ) -> Function :
300300 """Compute the integral of the function.
301301
302302 Args:
@@ -321,7 +321,7 @@ def subs(self, vars: AxisVariables, values: ValuesToSubstitute) -> BasisFunction
321321 """
322322 return SubbedBasisFunction (self , vars , values )
323323
324- def __getitem__ (self , key ) -> AnyFunction :
324+ def __getitem__ (self , key ) -> Function :
325325 """Forward all other function calls to symbolic function."""
326326 return self .get_function ().__getitem__ (key )
327327
@@ -353,15 +353,15 @@ def transpose(self) -> ScalarFunction:
353353 raise AttributeError (f"'{ self .__class__ .__name__ } ' object has no attribute 'transpose'" )
354354 return self .get_function ().transpose ()
355355
356- def with_floats (self ) -> AnyFunction :
356+ def with_floats (self ) -> Function :
357357 """Return a version the function with floats as coefficients.
358358
359359 Returns:
360360 The function with floats as coefficients
361361 """
362362 return self .get_function ().with_floats ()
363363
364- def __iter__ (self ) -> typing .Iterator [AnyFunction ]:
364+ def __iter__ (self ) -> typing .Iterator [Function ]:
365365 """Iterate through components of vector function."""
366366 f = self .get_function ()
367367 return f .__iter__ ()
@@ -397,7 +397,7 @@ def __init__(self, f: BasisFunction, vars: AxisVariables, values: ValuesToSubsti
397397 self ._vars = vars
398398 self ._values = values
399399
400- def get_function (self ) -> AnyFunction :
400+ def get_function (self ) -> Function :
401401 """Return the symbolic function.
402402
403403 Returns:
0 commit comments