Skip to content

Commit 92645d1

Browse files
committed
test -> trial
test -> trial fix hypre-ads
1 parent 85e3800 commit 92645d1

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

firedrake/preconditioners/hypre_ads.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from firedrake.preconditioners.base import PCBase
22
from firedrake.petsc import PETSc
33
from firedrake.function import Function
4-
from firedrake.ufl_expr import TestFunction
4+
from firedrake.ufl_expr import TrialFunction
55
from firedrake.dmhooks import get_function_space
66
from firedrake.preconditioners.hypre_ams import chop
77
from firedrake.interpolation import interpolate
@@ -31,12 +31,12 @@ def initialize(self, obj):
3131
NC1 = V.reconstruct(family="N1curl" if mesh.ufl_cell().is_simplex() else "NCE", degree=1)
3232
G_callback = appctx.get("get_gradient", None)
3333
if G_callback is None:
34-
G = chop(assemble(interpolate(grad(TestFunction(P1)), NC1)).petscmat)
34+
G = chop(assemble(interpolate(grad(TrialFunction(P1)), NC1)).petscmat)
3535
else:
3636
G = G_callback(P1, NC1)
3737
C_callback = appctx.get("get_curl", None)
3838
if C_callback is None:
39-
C = chop(assemble(interpolate(curl(TestFunction(NC1)), V)).petscmat)
39+
C = chop(assemble(interpolate(curl(TrialFunction(NC1)), V)).petscmat)
4040
else:
4141
C = C_callback(NC1, V)
4242

firedrake/preconditioners/hypre_ams.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from firedrake.preconditioners.base import PCBase
22
from firedrake.petsc import PETSc
33
from firedrake.function import Function
4-
from firedrake.ufl_expr import TestFunction
4+
from firedrake.ufl_expr import TrialFunction
55
from firedrake.dmhooks import get_function_space
66
from firedrake.utils import complex_mode
77
from firedrake.interpolation import interpolate
@@ -51,7 +51,7 @@ def initialize(self, obj):
5151
P1 = V.reconstruct(family="Lagrange", degree=1)
5252
G_callback = appctx.get("get_gradient", None)
5353
if G_callback is None:
54-
G = chop(assemble(interpolate(grad(TestFunction(P1)), V)).petscmat)
54+
G = chop(assemble(interpolate(grad(TrialFunction(P1)), V)).petscmat)
5555
else:
5656
G = G_callback(P1, V)
5757

tests/firedrake/regression/test_interpolate_cross_mesh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,14 +661,14 @@ def test_interpolate_matrix_cross_mesh():
661661
vom = VertexOnlyMesh(source_mesh, X.dat.data_ro, redundant=False)
662662
P0DG = FunctionSpace(vom, "DG", 0)
663663
# We get the interpolation matrix U -> P0DG which performs point evaluation
664-
A = assemble(interpolate(TestFunction(U), P0DG))
664+
A = assemble(interpolate(TrialFunction(U), P0DG))
665665
f_at_points = assemble(A @ f)
666666
f_at_points2 = assemble(interpolate(f, P0DG))
667667
assert np.allclose(f_at_points.dat.data_ro, f_at_points2.dat.data_ro)
668668
# To get the points in the correct order in V we interpolate into vom.input_ordering
669669
# We pass matfree=False which constructs the permutation matrix instead of using SFs
670670
P0DG_io = FunctionSpace(vom.input_ordering, "DG", 0)
671-
B = assemble(interpolate(TestFunction(P0DG), P0DG_io, matfree=False))
671+
B = assemble(interpolate(TrialFunction(P0DG), P0DG_io, matfree=False))
672672
f_at_points_correct_order = assemble(B @ f_at_points)
673673
f_at_points_correct_order2 = assemble(interpolate(f_at_points, P0DG_io))
674674
assert np.allclose(f_at_points_correct_order.dat.data_ro, f_at_points_correct_order2.dat.data_ro)

tests/firedrake/vertexonly/test_vertex_only_fs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def functionspace_tests(vm, petsc_raises):
121121
assert np.allclose(h.dat.data_ro_with_halos[idxs_to_include], np.prod(vm.input_ordering.coordinates.dat.data_ro_with_halos[idxs_to_include].reshape(-1, vm.input_ordering.geometric_dimension()), axis=1))
122122
assert np.all(h.dat.data_ro_with_halos[~idxs_to_include] == -1)
123123
# Using permutation matrix
124-
perm_mat = assemble(interpolate(TestFunction(V), W, matfree=False))
124+
perm_mat = assemble(interpolate(TrialFunction(V), W, matfree=False))
125125
h2 = assemble(perm_mat @ g)
126126
assert np.allclose(h2.dat.data_ro_with_halos[idxs_to_include], h.dat.data_ro_with_halos[idxs_to_include])
127127
h2 = assemble(interpolate(g, W))
@@ -216,7 +216,7 @@ def vectorfunctionspace_tests(vm, petsc_raises):
216216
assert np.allclose(h.dat.data_ro[idxs_to_include], 2*vm.input_ordering.coordinates.dat.data_ro_with_halos[idxs_to_include])
217217
assert np.all(h.dat.data_ro_with_halos[~idxs_to_include] == -1)
218218
# Using permutation matrix
219-
perm_mat = assemble(interpolate(TestFunction(V), W, matfree=False))
219+
perm_mat = assemble(interpolate(TrialFunction(V), W, matfree=False))
220220
h2 = assemble(perm_mat @ g)
221221
assert np.allclose(h2.dat.data_ro_with_halos[idxs_to_include], h.dat.data_ro_with_halos[idxs_to_include])
222222
# check other interpolation APIs work identically
@@ -373,9 +373,9 @@ def test_tensorfs_permutation(tensorfs_and_expr):
373373
f = Function(V)
374374
f.interpolate(expr)
375375
f_in_W = assemble(interpolate(f, W))
376-
python_mat = assemble(interpolate(TestFunction(V), W, matfree=False))
376+
python_mat = assemble(interpolate(TrialFunction(V), W, matfree=False))
377377
f_in_W_2 = assemble(python_mat @ f)
378378
assert np.allclose(f_in_W.dat.data_ro, f_in_W_2.dat.data_ro)
379-
petsc_mat = assemble(interpolate(TestFunction(V), W, matfree=True))
379+
petsc_mat = assemble(interpolate(TrialFunction(V), W, matfree=True))
380380
f_in_W_petsc = assemble(petsc_mat @ f)
381381
assert np.allclose(f_in_W.dat.data_ro, f_in_W_petsc.dat.data_ro)

0 commit comments

Comments
 (0)