Skip to content

Commit

Permalink
Suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: David A. Ham <david.ham@imperial.ac.uk>
  • Loading branch information
JDBetteridge and dham committed Jun 8, 2023
1 parent 17a81db commit 485af36
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion firedrake/adjoint/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def wrapper(*args, **kwargs):
even when the user calls the lower-level :py:data:`solve(A, x, b)`.
"""
ad_block_tag = kwargs.pop("ad_block_tag", None)
# ~ breakpoint()
annotate = annotate_tape(kwargs)
with stop_annotating():
output = assemble(*args, **kwargs)
Expand Down
4 changes: 3 additions & 1 deletion firedrake/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,9 @@ def iter_active_coefficients(form, kinfo):
yield form.coefficients()[idx].subfunctions[subidx]

@staticmethod
def iter_constants(form, kinfo): # FIXME kinfo not currently needed
def iter_constants(form, kinfo):
"""Yield the form constants"""
# Is kinfo really needed?
from tsfc.ufl_utils import extract_firedrake_constants
if isinstance(form, slate.TensorBase):
for const in form.constants():
Expand Down
4 changes: 2 additions & 2 deletions firedrake/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,11 @@ def assign(self, expr, subset=None):
"""
if expr == 0:
self.dat.zero(subset=subset)
#
# Assign literal collections to vector and tensor valued functions in R.
elif (isinstance(expr, collections.abc.Container)
and self.ufl_element().family() == "Real"):
try:
self.dat.data = expr
self.dat.data_wo[...] = expr
return self
except (DataTypeError, DataValueError) as e:
raise ValueError(e)
Expand Down
2 changes: 1 addition & 1 deletion firedrake/slate/slac/kernel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def shape(self, tensor):
return tensor.shape

def extent(self, argument):
""" Calculation of the range of a constant or coefficient."""
""" Calculation of the value size of a constant or coefficient."""
if isinstance(argument, Constant):
return (argument.dat.cdim, )
else:
Expand Down
1 change: 1 addition & 0 deletions firedrake/ufl_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def derivative(form, u, du=None, coefficient_derivatives=None):
V = firedrake.FunctionSpace(mesh, "Real", 0)
x = ufl.Coefficient(V, n + 1)
n += 1
# TODO: Update this line when https://github.com/FEniCS/ufl/issues/171 is fixed
form = ufl.replace(form, {u: x})
u = x
else:
Expand Down
3 changes: 0 additions & 3 deletions tests/regression/test_solver_error_checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ def test_invalid_solution_type(a, L, c):
solve(a == L, c)


# TODO: Check with a Constant with a domain (ie: add check for vector lengths)


def test_invalid_lhs_type(L, f):
with pytest.raises(TypeError):
solve(f == L, f)
Expand Down

0 comments on commit 485af36

Please sign in to comment.