Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion firedrake/cofunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def interpolate(self,
block on the Pyadjoint tape.
**kwargs
Any extra kwargs are passed on to the interpolate function.
For details see `firedrake.interpolation.interpolate`.
For details see :func:`firedrake.interpolation.interpolate`.

Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion firedrake/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def interpolate(self,
block on the Pyadjoint tape.
**kwargs
Any extra kwargs are passed on to the interpolate function.
For details see `firedrake.interpolation.interpolate`.
For details see :func:`firedrake.interpolation.interpolate`.

Returns
-------
Expand Down
45 changes: 30 additions & 15 deletions firedrake/functionspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


@PETSc.Log.EventDecorator()
def make_scalar_element(mesh, family, degree, vfamily, vdegree, variant):
def make_scalar_element(mesh, family, degree, vfamily, vdegree, variant, quad_scheme):
"""Build a scalar :class:`finat.ufl.finiteelement.FiniteElement`.

Parameters
Expand All @@ -31,14 +31,16 @@ def make_scalar_element(mesh, family, degree, vfamily, vdegree, variant):
The finite element family.
degree :
The degree of the finite element.
variant :
The variant of the finite element.
vfamily :
The finite element in the vertical dimension (extruded meshes
only).
vdegree :
The degree of the element in the vertical dimension (extruded
meshes only).
variant :
The variant of the finite element.
quad_scheme :
The quadrature scheme used to evaluate degrees of freedom.

Notes
-----
Expand All @@ -59,20 +61,24 @@ def make_scalar_element(mesh, family, degree, vfamily, vdegree, variant):
and vfamily is not None and vdegree is not None:
la = finat.ufl.FiniteElement(family,
cell=cell.sub_cells()[0],
degree=degree, variant=variant)
degree=degree,
variant=variant,
quad_scheme=quad_scheme)
# If second element was passed in, use it
lb = finat.ufl.FiniteElement(vfamily,
cell=ufl.interval,
degree=vdegree, variant=variant)
degree=vdegree,
variant=variant,
quad_scheme=quad_scheme)
# Now make the TensorProductElement
return finat.ufl.TensorProductElement(la, lb)
else:
return finat.ufl.FiniteElement(family, cell=cell, degree=degree, variant=variant)
return finat.ufl.FiniteElement(family, cell=cell, degree=degree, variant=variant, quad_scheme=quad_scheme)


@PETSc.Log.EventDecorator("CreateFunctionSpace")
def FunctionSpace(mesh, family, degree=None, name=None,
vfamily=None, vdegree=None, variant=None):
vfamily=None, vdegree=None, variant=None, quad_scheme=None):
"""Create a :class:`.FunctionSpace`.

Parameters
Expand All @@ -93,6 +99,9 @@ def FunctionSpace(mesh, family, degree=None, name=None,
meshes only).
variant :
The variant of the finite element.
quad_scheme :
The quadrature scheme used to evaluate degrees of freedom.


Notes
-----
Expand All @@ -101,13 +110,13 @@ def FunctionSpace(mesh, family, degree=None, name=None,
are ignored and the appropriate :class:`.FunctionSpace` is returned.

"""
element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant)
element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant, quad_scheme)
return impl.WithGeometry.make_function_space(mesh, element, name=name)


@PETSc.Log.EventDecorator()
def DualSpace(mesh, family, degree=None, name=None,
vfamily=None, vdegree=None, variant=None):
vfamily=None, vdegree=None, variant=None, quad_scheme=None):
"""Create a :class:`.FunctionSpace`.

Parameters
Expand All @@ -128,6 +137,8 @@ def DualSpace(mesh, family, degree=None, name=None,
meshes only).
variant :
The variant of the finite element.
quad_scheme :
The quadrature scheme used to evaluate degrees of freedom.

Notes
-----
Expand All @@ -136,13 +147,13 @@ def DualSpace(mesh, family, degree=None, name=None,
other arguments are ignored and the appropriate :class:`.FunctionSpace` is
returned.
"""
element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant)
element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant, quad_scheme)
return impl.FiredrakeDualSpace.make_function_space(mesh, element, name=name)


@PETSc.Log.EventDecorator()
def VectorFunctionSpace(mesh, family, degree=None, dim=None,
name=None, vfamily=None, vdegree=None, variant=None):
def VectorFunctionSpace(mesh, family, degree=None, dim=None, name=None,
vfamily=None, vdegree=None, variant=None, quad_scheme=None):
"""Create a rank-1 :class:`.FunctionSpace`.

Parameters
Expand All @@ -166,6 +177,8 @@ def VectorFunctionSpace(mesh, family, degree=None, dim=None,
meshes only).
variant :
The variant of the finite element.
quad_scheme :
The quadrature scheme used to evaluate degrees of freedom.

Notes
-----
Expand All @@ -178,7 +191,7 @@ def VectorFunctionSpace(mesh, family, degree=None, dim=None,
pass it to :class:`.FunctionSpace` directly instead.

"""
sub_element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant)
sub_element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant, quad_scheme)
if dim is None:
dim = mesh.geometric_dimension()
if not isinstance(dim, numbers.Integral) and dim > 0:
Expand All @@ -190,7 +203,7 @@ def VectorFunctionSpace(mesh, family, degree=None, dim=None,
@PETSc.Log.EventDecorator()
def TensorFunctionSpace(mesh, family, degree=None, shape=None,
symmetry=None, name=None, vfamily=None,
vdegree=None, variant=None):
vdegree=None, variant=None, quad_scheme=None):
"""Create a rank-2 FunctionSpace.

Parameters
Expand All @@ -217,6 +230,8 @@ def TensorFunctionSpace(mesh, family, degree=None, shape=None,
meshes only).
variant :
The variant of the finite element.
quad_scheme :
The quadrature scheme used to evaluate degrees of freedom.

Notes
-----
Expand All @@ -230,7 +245,7 @@ def TensorFunctionSpace(mesh, family, degree=None, shape=None,
`FunctionSpace` directly instead.

"""
sub_element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant)
sub_element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant, quad_scheme)
if shape is None:
shape = (mesh.geometric_dimension(),) * 2
element = finat.ufl.TensorElement(sub_element, shape=shape, symmetry=symmetry)
Expand Down