WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 5464cce

Browse files
committed
extra test
1 parent 3a0ffb5 commit 5464cce

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tests/firedrake/regression/test_interp_dual.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from firedrake import *
44
from firedrake.utils import complex_mode
55
from firedrake.matrix import MatrixBase
6-
from firedrake.matrix import MatrixBase
76
import ufl
87

98

tests/firedrake/regression/test_interpolation_operators.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
)
66
from firedrake.matrix import ImplicitMatrix, Matrix
77
import pytest
8+
import numpy as np
89

910

1011
def params():
@@ -45,6 +46,7 @@ def test_same_mesh_mattype(value_shape, mat_type, mode):
4546
elif mode == "adjoint":
4647
v1 = TestFunction(V1)
4748
exact = assemble(inner(1, sum(v1) if value_shape == "vector" else v1) * dx)
49+
forward_interp = interpolate(TrialFunction(V1), V2) # V1 x V2^* -> R
4850
interp = interpolate(TestFunction(V1), TrialFunction(V2.dual())) # V2^* x V1 -> R
4951
v2 = TestFunction(V2)
5052
f = inner(1, sum(v2) if value_shape == "vector" else v2) * dx
@@ -66,6 +68,11 @@ def test_same_mesh_mattype(value_shape, mat_type, mode):
6668
res = assemble(action(I_mat, f))
6769
assert np.allclose(res.dat.data, exact.dat.data)
6870

71+
if mode == "adjoint":
72+
forward_I_mat = assemble(forward_interp, mat_type=mat_type)
73+
res2 = assemble(action(adjoint(forward_I_mat), f))
74+
assert np.allclose(res2.dat.data, exact.dat.data)
75+
6976
with pytest.raises(NotImplementedError):
7077
# MatNest only implemented for interpolation between MixedFunctionSpaces
7178
assemble(interp, mat_type="nest")

0 commit comments

Comments
 (0)