Skip to content

Commit

Permalink
Adapt to UFL changes in subdomain_id (#297)
Browse files Browse the repository at this point in the history
* Adapt to UFL changes in subdomain_id
* Give kernels a simpler name
  • Loading branch information
connorjward authored Sep 12, 2023
1 parent 6f72c9c commit bad6191
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gem/coffee.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def optimise_monomials(monomials, linear_indices):
:returns: an iterable of factorised :class:`Monomials`s
"""
assert len(set(frozenset(m.sum_indices) for m in monomials)) <= 1,\
assert len(set(frozenset(m.sum_indices) for m in monomials)) <= 1, \
"All monomials required to have same sum indices for factorisation"

result = [m for m in monomials if not m.atomics] # skipped monomials
Expand Down
4 changes: 2 additions & 2 deletions gem/gem.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def __init__(self, array):
self.array = array.astype(complex)

def is_equal(self, other):
if type(self) != type(other):
if type(self) is not type(other):
return False
if self.shape != other.shape:
return False
Expand Down Expand Up @@ -748,7 +748,7 @@ def __repr__(self):

def is_equal(self, other):
"""Common subexpression eliminating equality predicate."""
if type(self) != type(other):
if type(self) is not type(other):
return False
if (self.array == other.array).all():
self.array = other.array
Expand Down
2 changes: 1 addition & 1 deletion gem/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def is_equal(self, other):
This is the method to potentially override in derived classes,
not :meth:`__eq__` or :meth:`__ne__`.
"""
if type(self) != type(other):
if type(self) is not type(other):
return False
self_consargs = self._cons_args(self.children)
other_consargs = other._cons_args(other.children)
Expand Down
4 changes: 1 addition & 3 deletions tsfc/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ def compile_integral(integral_data, form_data, prefix, parameters, interface, *,
raise NotImplementedError("Sorry, we can't assemble the diagonal of a form for interior facet integrals")
mesh = integral_data.domain
arguments = form_data.preprocessed_form.arguments()
kernel_name = "%s_%s_integral_%s" % (prefix, integral_type, integral_data.subdomain_id)
# Handle negative subdomain_id
kernel_name = kernel_name.replace("-", "_")
kernel_name = f"{prefix}_{integral_type}_integral"
# Dict mapping domains to index in original_form.ufl_domains()
domain_numbering = form_data.original_form.domain_numbering()
domain_number = domain_numbering[integral_data.domain]
Expand Down

0 comments on commit bad6191

Please sign in to comment.