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
3 changes: 3 additions & 0 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ jobs:
--extra-index-url https://download.pytorch.org/whl/cpu \
"$(echo ./firedrake-repo/dist/firedrake-*.tar.gz)[ci]"

: # UNDO ME
pip install git+https://github.com/firedrakeproject/fiat.git@connorjward/handle-real -v --no-deps --ignore-installed

firedrake-clean
pip list

Expand Down
3 changes: 3 additions & 0 deletions firedrake/functionspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def make_scalar_element(mesh, family, degree, vfamily, vdegree, variant, quad_sc
if isinstance(family, finat.ufl.FiniteElementBase):
return family.reconstruct(cell=cell)

if family in {"R", "Real"} and degree is None:
degree = 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pbrubeck under what circumstances do we allow degree to be None? I shoved this hack in but it is gross and likely should live in FIAT/FInAT/finat.ufl

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Degree being None means the lowest order for which this element still makes sense

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A common mistake is to not pass the degree when creating the R space. I think we should enable degree=None for DG in FIAT to mean degree=0, and similarly for other spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'll open a precursor PR then that does that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should live in fiat/discontinuous_lagrange.py. Just make degree a kwarg in the constructor.


if isinstance(cell, ufl.TensorProductCell) \
and vfamily is not None and vdegree is not None:
la = finat.ufl.FiniteElement(family,
Expand Down
5 changes: 0 additions & 5 deletions tests/firedrake/vertexonly/test_interpolation_from_parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,6 @@ def test_scalar_real_interpolation(parentmesh, vertexcoords):
vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour="ignore")
W = FunctionSpace(vm, "DG", 0)
V = FunctionSpace(parentmesh, "Real", 0)
# Remove below when interpolating constant onto Real works for extruded
if type(parentmesh.topology) is mesh.ExtrudedMeshTopology:
with pytest.raises(ValueError):
assemble(interpolate(Constant(1), V))
return
v = assemble(interpolate(Constant(1), V))
w_v = assemble(interpolate(v, W))
assert np.allclose(w_v.dat.data_ro, 1.)
Expand Down
5 changes: 0 additions & 5 deletions tsfc/fem.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,11 +743,6 @@ def translate_constant_value(terminal, mt, ctx):
def translate_coefficient(terminal, mt, ctx):
domain = extract_unique_domain(terminal)
vec = ctx.coefficient(terminal, mt.restriction)

if terminal.ufl_element().family() == 'Real':
assert mt.local_derivatives == 0
return vec

element = ctx.create_element(terminal.ufl_element(), restriction=mt.restriction)

# Collect FInAT tabulation for all entities
Expand Down
10 changes: 1 addition & 9 deletions tsfc/kernel_interface/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ def coefficient(self, ufl_coefficient, restriction):
kernel_arg = self.coefficient_map[ufl_coefficient]
domain = extract_unique_domain(ufl_coefficient)
assert self._domain_integral_type_map[domain] is not None
if ufl_coefficient.ufl_element().family() == 'Real':
return kernel_arg
elif not self._domain_integral_type_map[domain].startswith("interior_facet"):
if not self._domain_integral_type_map[domain].startswith("interior_facet"):
return kernel_arg
else:
return kernel_arg[{'+': 0, '-': 1}[restriction]]
Expand Down Expand Up @@ -495,12 +493,6 @@ def prepare_coefficient(coefficient, name, domain_integral_type_map):
GEM expression referring to the Coefficient values.

"""
if coefficient.ufl_element().family() == 'Real':
# Constant
value_size = coefficient.ufl_function_space().value_size
expression = gem.reshape(gem.Variable(name, (value_size,)),
coefficient.ufl_shape)
return expression
finat_element = create_element(coefficient.ufl_element())
shape = finat_element.index_shape
size = numpy.prod(shape, dtype=int)
Expand Down
Loading