Skip to content

Commit e464470

Browse files
committed
FunctionSpace: pass kwargs to finat.ufl.FiniteElement
1 parent 8b54083 commit e464470

File tree

3 files changed

+29
-24
lines changed

3 files changed

+29
-24
lines changed

firedrake/cofunction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def interpolate(self,
324324
block on the Pyadjoint tape.
325325
**kwargs
326326
Any extra kwargs are passed on to the interpolate function.
327-
For details see `firedrake.interpolation.interpolate`.
327+
For details see :func:`firedrake.interpolation.interpolate`.
328328
329329
Returns
330330
-------

firedrake/function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def interpolate(self,
375375
block on the Pyadjoint tape.
376376
**kwargs
377377
Any extra kwargs are passed on to the interpolate function.
378-
For details see `firedrake.interpolation.interpolate`.
378+
For details see :func:`firedrake.interpolation.interpolate`.
379379
380380
Returns
381381
-------

firedrake/functionspace.py

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
@PETSc.Log.EventDecorator()
23-
def make_scalar_element(mesh, family, degree, vfamily, vdegree, variant):
23+
def make_scalar_element(mesh, family, degree, vfamily, vdegree, **kwargs):
2424
"""Build a scalar :class:`finat.ufl.finiteelement.FiniteElement`.
2525
2626
Parameters
@@ -31,14 +31,15 @@ def make_scalar_element(mesh, family, degree, vfamily, vdegree, variant):
3131
The finite element family.
3232
degree :
3333
The degree of the finite element.
34-
variant :
35-
The variant of the finite element.
3634
vfamily :
3735
The finite element in the vertical dimension (extruded meshes
3836
only).
3937
vdegree :
4038
The degree of the element in the vertical dimension (extruded
4139
meshes only).
40+
**kwargs :
41+
Any extra kwargs are passed on to the FiniteElement constructor.
42+
For details see :class:`finat.ufl.FiniteElement`.
4243
4344
Notes
4445
-----
@@ -59,20 +60,20 @@ def make_scalar_element(mesh, family, degree, vfamily, vdegree, variant):
5960
and vfamily is not None and vdegree is not None:
6061
la = finat.ufl.FiniteElement(family,
6162
cell=cell.sub_cells()[0],
62-
degree=degree, variant=variant)
63+
degree=degree, **kwargs)
6364
# If second element was passed in, use it
6465
lb = finat.ufl.FiniteElement(vfamily,
6566
cell=ufl.interval,
66-
degree=vdegree, variant=variant)
67+
degree=vdegree, **kwargs)
6768
# Now make the TensorProductElement
6869
return finat.ufl.TensorProductElement(la, lb)
6970
else:
70-
return finat.ufl.FiniteElement(family, cell=cell, degree=degree, variant=variant)
71+
return finat.ufl.FiniteElement(family, cell=cell, degree=degree, **kwargs)
7172

7273

7374
@PETSc.Log.EventDecorator("CreateFunctionSpace")
7475
def FunctionSpace(mesh, family, degree=None, name=None,
75-
vfamily=None, vdegree=None, variant=None):
76+
vfamily=None, vdegree=None, **kwargs):
7677
"""Create a :class:`.FunctionSpace`.
7778
7879
Parameters
@@ -91,8 +92,9 @@ def FunctionSpace(mesh, family, degree=None, name=None,
9192
vdegree :
9293
The degree of the element in the vertical dimension (extruded
9394
meshes only).
94-
variant :
95-
The variant of the finite element.
95+
**kwargs :
96+
Any extra kwargs are passed on to the FiniteElement constructor.
97+
For details see :class:`finat.ufl.FiniteElement`.
9698
9799
Notes
98100
-----
@@ -101,13 +103,13 @@ def FunctionSpace(mesh, family, degree=None, name=None,
101103
are ignored and the appropriate :class:`.FunctionSpace` is returned.
102104
103105
"""
104-
element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant)
106+
element = make_scalar_element(mesh, family, degree, vfamily, vdegree, **kwargs)
105107
return impl.WithGeometry.make_function_space(mesh, element, name=name)
106108

107109

108110
@PETSc.Log.EventDecorator()
109111
def DualSpace(mesh, family, degree=None, name=None,
110-
vfamily=None, vdegree=None, variant=None):
112+
vfamily=None, vdegree=None, **kwargs):
111113
"""Create a :class:`.FunctionSpace`.
112114
113115
Parameters
@@ -126,8 +128,9 @@ def DualSpace(mesh, family, degree=None, name=None,
126128
vdegree :
127129
The degree of the element in the vertical dimension (extruded
128130
meshes only).
129-
variant :
130-
The variant of the finite element.
131+
**kwargs :
132+
Any extra kwargs are passed on to the FiniteElement constructor.
133+
For details see :class:`finat.ufl.FiniteElement`.
131134
132135
Notes
133136
-----
@@ -136,13 +139,13 @@ def DualSpace(mesh, family, degree=None, name=None,
136139
other arguments are ignored and the appropriate :class:`.FunctionSpace` is
137140
returned.
138141
"""
139-
element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant)
142+
element = make_scalar_element(mesh, family, degree, vfamily, vdegree, **kwargs)
140143
return impl.FiredrakeDualSpace.make_function_space(mesh, element, name=name)
141144

142145

143146
@PETSc.Log.EventDecorator()
144147
def VectorFunctionSpace(mesh, family, degree=None, dim=None,
145-
name=None, vfamily=None, vdegree=None, variant=None):
148+
name=None, vfamily=None, vdegree=None, **kwargs):
146149
"""Create a rank-1 :class:`.FunctionSpace`.
147150
148151
Parameters
@@ -164,8 +167,9 @@ def VectorFunctionSpace(mesh, family, degree=None, dim=None,
164167
vdegree :
165168
The degree of the element in the vertical dimension (extruded
166169
meshes only).
167-
variant :
168-
The variant of the finite element.
170+
**kwargs :
171+
Any extra kwargs are passed on to the FiniteElement constructor.
172+
For details see :class:`finat.ufl.FiniteElement`.
169173
170174
Notes
171175
-----
@@ -178,7 +182,7 @@ def VectorFunctionSpace(mesh, family, degree=None, dim=None,
178182
pass it to :class:`.FunctionSpace` directly instead.
179183
180184
"""
181-
sub_element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant)
185+
sub_element = make_scalar_element(mesh, family, degree, vfamily, vdegree, **kwargs)
182186
if dim is None:
183187
dim = mesh.geometric_dimension()
184188
if not isinstance(dim, numbers.Integral) and dim > 0:
@@ -190,7 +194,7 @@ def VectorFunctionSpace(mesh, family, degree=None, dim=None,
190194
@PETSc.Log.EventDecorator()
191195
def TensorFunctionSpace(mesh, family, degree=None, shape=None,
192196
symmetry=None, name=None, vfamily=None,
193-
vdegree=None, variant=None):
197+
vdegree=None, **kwargs):
194198
"""Create a rank-2 FunctionSpace.
195199
196200
Parameters
@@ -215,8 +219,9 @@ def TensorFunctionSpace(mesh, family, degree=None, shape=None,
215219
vdegree :
216220
The degree of the element in the vertical dimension (extruded
217221
meshes only).
218-
variant :
219-
The variant of the finite element.
222+
**kwargs :
223+
Any extra kwargs are passed on to the FiniteElement constructor.
224+
For details see :class:`finat.ufl.FiniteElement`.
220225
221226
Notes
222227
-----
@@ -230,7 +235,7 @@ def TensorFunctionSpace(mesh, family, degree=None, shape=None,
230235
`FunctionSpace` directly instead.
231236
232237
"""
233-
sub_element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant)
238+
sub_element = make_scalar_element(mesh, family, degree, vfamily, vdegree, **kwargs)
234239
if shape is None:
235240
shape = (mesh.geometric_dimension(),) * 2
236241
element = finat.ufl.TensorElement(sub_element, shape=shape, symmetry=symmetry)

0 commit comments

Comments
 (0)