Skip to content
Merged
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: 1 addition & 1 deletion firedrake/parloops.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __repr__(self):
_maps = {
'cell': {
'nodes': lambda x: x.cell_node_map(),
'itspace': lambda mesh, measure: mesh.cell_set
'itspace': lambda mesh, measure: mesh.cell_subset(measure.subdomain_id())
},
'interior_facet': {
'nodes': lambda x: x.interior_facet_node_map(),
Expand Down
17 changes: 17 additions & 0 deletions tests/regression/test_par_loops.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,23 @@ def test_cg_max_field_extruded(f_extruded):
3./4, 3./4, 3./4]).all()


@pytest.mark.parametrize("subdomain", [1, 2])
def test_cell_subdomain(subdomain):
from os.path import abspath, dirname, join
mesh = Mesh(join(abspath(dirname(__file__)), "..",
"meshes", "cell-sets.msh"))

V = FunctionSpace(mesh, "DG", 0)
expect = interpolate(as_ufl(1), V, subset=mesh.cell_subset(subdomain))

f = Function(V)
par_loop("""
for (int i=0; i<f.dofs; i++) f[i][0] = 1.0;
""", dx(subdomain), {'f': (f, WRITE)})

assert np.allclose(f.dat.data, expect.dat.data)


def test_walk_facets_rt():
m = UnitSquareMesh(3, 3)
V = FunctionSpace(m, 'RT', 1)
Expand Down