Skip to content

Commit

Permalink
VOM: doc meshes with shifted coordinate fields
Browse files Browse the repository at this point in the history
They won't work!
Also add tests.
CF issue #2185
  • Loading branch information
ReubenHill committed Aug 26, 2021
1 parent 6c71585 commit dc0bd72
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
8 changes: 8 additions & 0 deletions firedrake/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1964,6 +1964,14 @@ def VertexOnlyMesh(mesh, vertexcoords, missing_points_behaviour=None):
Meshes created from a coordinates `firedrake.Function` and immersed
manifold meshes are not yet supported.
.. note::
This should also only be used for meshes which have not had their
coordinates field modified as, at present, this does not update the
coordinates field of the underlying DMPlex. Such meshes may cause
unexpected behavioir or hangs when running in parallel.
"""

import firedrake.functionspace as functionspace
Expand Down
7 changes: 6 additions & 1 deletion tests/vertexonly/test_interpolation_from_parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"cube",
"tetrahedron",
pytest.param("immersedsphere", marks=pytest.mark.xfail(reason="immersed parent meshes not supported")),
pytest.param("periodicrectangle", marks=pytest.mark.xfail(reason="meshes made from coordinate fields are not supported"))],
pytest.param("periodicrectangle", marks=pytest.mark.xfail(reason="meshes made from coordinate fields are not supported")),
pytest.param("shiftedmesh", marks=pytest.mark.skip(reason="meshes with modified coordinate fields are not supported"))],
ids=lambda x: f"{x}-mesh")
def parentmesh(request):
if request.param == "interval":
Expand All @@ -35,6 +36,10 @@ def parentmesh(request):
return UnitIcosahedralSphereMesh()
elif request.param == "periodicrectangle":
return PeriodicRectangleMesh(3, 3, 1, 1)
elif request.param == "shiftedmesh":
m = UnitSquareMesh(1, 1)
m.coordinates.dat.data[:] -= 0.5
return m


@pytest.fixture(params=[0, 1, 100], ids=lambda x: f"{x}-coords")
Expand Down
7 changes: 6 additions & 1 deletion tests/vertexonly/test_swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def cell_midpoints(m):
"cube",
"tetrahedron",
pytest.param("immersedsphere", marks=pytest.mark.skip(reason="immersed parent meshes not supported and will segfault PETSc when creating the DMSwarm")),
pytest.param("periodicrectangle", marks=pytest.mark.skip(reason="periodic meshes do not work properly with swarm creation"))])
pytest.param("periodicrectangle", marks=pytest.mark.skip(reason="meshes made from coordinate fields are not supported")),
pytest.param("shiftedmesh", marks=pytest.mark.skip(reason="meshes with modified coordinate fields are not supported"))])
def parentmesh(request):
if request.param == "interval":
return UnitIntervalMesh(1)
Expand All @@ -58,6 +59,10 @@ def parentmesh(request):
return UnitIcosahedralSphereMesh()
elif request.param == "periodicrectangle":
return PeriodicRectangleMesh(3, 3, 1, 1)
elif request.param == "shiftedmesh":
m = UnitSquareMesh(1, 1)
m.coordinates.dat.data[:] -= 0.5
return m


# pic swarm tests
Expand Down
7 changes: 6 additions & 1 deletion tests/vertexonly/test_vertex_only_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"cube",
"tetrahedron",
pytest.param("immersedsphere", marks=pytest.mark.xfail(reason="immersed parent meshes not supported")),
pytest.param("periodicrectangle", marks=pytest.mark.xfail(reason="meshes made from coordinate fields are not supported"))])
pytest.param("periodicrectangle", marks=pytest.mark.xfail(reason="meshes made from coordinate fields are not supported")),
pytest.param("shiftedmesh", marks=pytest.mark.skip(reason="meshes with modified coordinate fields are not supported"))])
def parentmesh(request):
if request.param == "interval":
return UnitIntervalMesh(1)
Expand All @@ -28,6 +29,10 @@ def parentmesh(request):
return UnitIcosahedralSphereMesh()
elif request.param == "periodicrectangle":
return PeriodicRectangleMesh(3, 3, 1, 1)
elif request.param == "shiftedmesh":
m = UnitSquareMesh(1, 1)
m.coordinates.dat.data[:] -= 0.5
return m


@pytest.fixture(params=[0, 1, 100], ids=lambda x: f"{x}-coords")
Expand Down
7 changes: 6 additions & 1 deletion tests/vertexonly/test_vertex_only_mesh_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def cell_midpoints(m):
"cube",
"tetrahedron",
pytest.param("immersedsphere", marks=pytest.mark.xfail(reason="immersed parent meshes not supported")),
pytest.param("periodicrectangle", marks=pytest.mark.xfail(reason="meshes made from coordinate fields are not supported"))])
pytest.param("periodicrectangle", marks=pytest.mark.xfail(reason="meshes made from coordinate fields are not supported")),
pytest.param("shiftedmesh", marks=pytest.mark.skip(reason="meshes with modified coordinate fields are not supported"))])
def parentmesh(request):
if request.param == "interval":
return UnitIntervalMesh(1)
Expand All @@ -58,6 +59,10 @@ def parentmesh(request):
return UnitIcosahedralSphereMesh()
elif request.param == "periodicrectangle":
return PeriodicRectangleMesh(3, 3, 1, 1)
elif request.param == "shiftedmesh":
m = UnitSquareMesh(1, 1)
m.coordinates.dat.data[:] -= 0.5
return m


@pytest.fixture(params=[0, 1, 100], ids=lambda x: f"{x}-coords")
Expand Down

0 comments on commit dc0bd72

Please sign in to comment.