Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Nov 13, 2024
1 parent 4aa725f commit b76ee5e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion firedrake/formmanipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def argument(self, o):
args += [a_[j] for j in numpy.ndindex(a_.ufl_shape)]
else:
args += [Zero()
for j in numpy.ndindex(V_is[i].block_size)]
for j in numpy.ndindex(V_is[i].value_shape)]
return self._arg_cache.setdefault(o, as_vector(args))


Expand Down
2 changes: 1 addition & 1 deletion firedrake/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ def at(self, arg, *args, **kwargs):
raise NotImplementedError("Point evaluation not implemented for variable layers")

# Validate geometric dimension
gdim = mesh.ufl_cell().geometric_dimension()
gdim = mesh.geometric_dimension()
if arg.shape[-1] == gdim:
pass
elif len(arg.shape) == 1 and gdim == 1:
Expand Down
2 changes: 1 addition & 1 deletion firedrake/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2920,7 +2920,7 @@ def make_vom_from_vom_topology(topology, name, tolerance=0.5):
gdim = topology.topology_dm.getCoordinateDim()
cell = topology.ufl_cell()
element = finat.ufl.VectorElement("DG", cell, 0, dim=gdim)
vmesh = MeshGeometry.__new__(MeshGeometry, element)
vmesh = MeshGeometry.__new__(MeshGeometry, element, topology.comm)
vmesh._init_topology(topology)
# Save vertex reference coordinate (within reference cell) in function
parent_tdim = topology._parent_mesh.ufl_cell().topological_dimension()
Expand Down
5 changes: 2 additions & 3 deletions tests/output/test_io_backward_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _get_mesh_and_V(params):
def _get_expr(V):
mesh = V.mesh()
dim = mesh.geometric_dimension()
shape = V.ufl_element().value_shape
shape = V.value_shape
if dim == 2:
x, y = SpatialCoordinate(mesh)
z = x + y
Expand Down Expand Up @@ -240,9 +240,8 @@ def test_io_backward_compat_base_load(version, params):

def _get_expr_timestepping(V, i):
mesh = V.mesh()
element = V.ufl_element()
x, y = SpatialCoordinate(mesh)
shape = element.value_shape
shape = V.value_shape
if shape == (4, ):
return as_vector([x + i, y + i, x * y + i, i * i])
else:
Expand Down
8 changes: 4 additions & 4 deletions tests/regression/test_2dcohomology.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_betti0(space, mesh):

L = assemble(inner(nabla_grad(u), nabla_grad(v))*dx)

bc0 = DirichletBC(V0, Constant(0.0), 9)
bc0 = DirichletBC(V0, 0, 9)
L0 = assemble(inner(nabla_grad(u), nabla_grad(v))*dx, bcs=[bc0])

u, s, v = linalg.svd(L.M.values)
Expand Down Expand Up @@ -94,8 +94,8 @@ def test_betti1(space, mesh):
L = assemble((inner(sigma, tau) - inner(u, rot(tau)) + inner(rot(sigma), v)
+ inner(div(u), div(v))) * dx)

bc0 = DirichletBC(W.sub(0), Constant(0.0), 9)
bc1 = DirichletBC(W.sub(1), Constant((0.0, 0.0)), 9)
bc0 = DirichletBC(W.sub(0), 0, 9)
bc1 = DirichletBC(W.sub(1), 0, 9)
L0 = assemble((inner(sigma, tau) - inner(u, rot(tau)) + inner(rot(sigma), v)
+ inner(div(u), div(v))) * dx, bcs=[bc0, bc1])

Expand Down Expand Up @@ -155,7 +155,7 @@ def test_betti2(space, mesh):

L = assemble((inner(sigma, tau) - inner(u, div(tau)) + inner(div(sigma), v))*dx)

bc1 = DirichletBC(W.sub(0), Constant((0.0, 0.0)), 9)
bc1 = DirichletBC(W.sub(0), 0, 9)
L0 = assemble((inner(sigma, tau) - inner(u, div(tau)) + inner(div(sigma), v))*dx, bcs=[bc1])

dV1 = V1.dof_count
Expand Down
6 changes: 3 additions & 3 deletions tests/submesh/test_submesh_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def _get_expr(V):
x, y, z = SpatialCoordinate(m)
else:
raise NotImplementedError("Not implemented")
if V.ufl_element().value_shape == ():
if V.value_shape == ():
return cos(x) + x * exp(y) + sin(z)
elif V.ufl_element().value_shape == (2, ):
elif V.value_shape == (2, ):
return as_vector([cos(x), sin(y)])


Expand All @@ -50,7 +50,7 @@ def _test_submesh_interpolate_cell_cell(mesh, subdomain_cond, fe_fesub):
# if there is no ambiguity on the subdomain boundary.
# For testing, the following suffices.
g.interpolate(f)
temp = Constant(999.) if V.ufl_element().value_shape == () else as_vector([Constant(999.)] * np.prod(V.ufl_element().value_shape, dtype=int))
temp = Constant(999.*np.ones(V.value_shape))
g.interpolate(temp, subset=mesh.topology.cell_subset(label_value)) # pollute the data
g.interpolate(gsub, subset=mesh.topology.cell_subset(label_value))
assert assemble(inner(g - f, g - f) * dx(label_value)).real < 1e-14
Expand Down

0 comments on commit b76ee5e

Please sign in to comment.