Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for block sparsity fix #3073

Merged
Merged
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
21 changes: 21 additions & 0 deletions tests/regression/test_facets.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,27 @@ def test_bilinear_exterior_facet_integral(dg_trial_test):
assert np.allclose(outer_facet, 0.0)


def test_vector_bilinear_exterior_facet_integral():
mesh = IntervalMesh(5, 5)
V = VectorFunctionSpace(mesh, "CG", 1, dim=2)
u = TrialFunction(V)
v = TestFunction(V)
a = inner(u, v) * ds
A = assemble(a)
values = A.M.values

# Only the first and last vertices should contain nonzeros. Since these are
# blocked that means that the first two entries and the last two entries
# should be nonzero.
nonzeros = [[0, 0], [1, 1], [-2, -2], [-1, -1]]
assert all(np.allclose(values[row, col], 1.0) for row, col in nonzeros)

# the remaining entries should all be zero
for row, col in nonzeros:
values[row, col] = 0.0
assert np.allclose(values, 0.0)


@pytest.mark.parametrize('restrictions',
# ((trial space restrictions), (test space restrictions))
[(('+', ), ('+', )),
Expand Down