Skip to content
Closed
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: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ jobs:
--no-binary h5py \
--extra-index-url https://download.pytorch.org/whl/cpu \
'./firedrake-repo[ci]'
pip install -I "fenics-ufl @ git+https://github.com/firedrakeproject/ufl.git@pbrubeck/remove-component-tensors"
pip install -I "fenics-fiat @ git+https://github.com/firedrakeproject/fiat.git@pbrubeck/simplify-indexed"
firedrake-clean
pip list

Expand Down
4 changes: 2 additions & 2 deletions tests/firedrake/regression/test_vfs_component_bcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ def test_component_full_bcs(V):
A_cmp = assemble(a, bcs=bcs_cmp, mat_type="aij")
A_mixed = assemble(a, bcs=bcs_mixed, mat_type="aij")

assert A_full.petscmat.equal(A_cmp.petscmat)
assert A_mixed.petscmat.equal(A_full.petscmat)
assert A_full.petscmat.equal(A_cmp.petscmat), str((A_full.petscmat[:, :]-A_cmp.petscmat[:, :]).tolist())
assert A_mixed.petscmat.equal(A_full.petscmat), str((A_full.petscmat[:, :]-A_mixed.petscmat[:, :]).tolist())


def test_component_full_bcs_overlap(V):
Expand Down
11 changes: 6 additions & 5 deletions tsfc/fem.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,15 +641,13 @@ def fiat_to_ufl(fiat_dict, order):

@translate.register(Argument)
def translate_argument(terminal, mt, ctx):
argument_multiindex = ctx.argument_multiindices[terminal.number()]
sigma = tuple(gem.Index(extent=d) for d in mt.expr.ufl_shape)
element = ctx.create_element(terminal.ufl_element(), restriction=mt.restriction)

def callback(entity_id):
finat_dict = ctx.basis_evaluation(element, mt, entity_id)
# Filter out irrelevant derivatives
filtered_dict = {alpha: table
for alpha, table in finat_dict.items()
filtered_dict = {alpha: finat_dict[alpha]
for alpha in finat_dict
if sum(alpha) == mt.local_derivatives}

# Change from FIAT to UFL arrangement
Expand All @@ -658,13 +656,16 @@ def callback(entity_id):
# A numerical hack that FFC used to apply on FIAT tables still
# lives on after ditching FFC and switching to FInAT.
return ffc_rounding(square, ctx.epsilon)

table = ctx.entity_selector(callback, mt.restriction)
if ctx.use_canonical_quadrature_point_ordering:
quad_multiindex = ctx.quadrature_rule.point_set.indices
quad_multiindex_permuted = _make_quad_multiindex_permuted(mt, ctx)
mapper = gem.node.MemoizerArg(gem.optimise.filtered_replace_indices)
table = mapper(table, tuple(zip(quad_multiindex, quad_multiindex_permuted)))
return gem.ComponentTensor(gem.Indexed(table, argument_multiindex + sigma), sigma)

argument_multiindex = ctx.argument_multiindices[terminal.number()]
return gem.partial_indexed(table, argument_multiindex)


@translate.register(TSFCConstantMixin)
Expand Down
Loading