Skip to content

Commit 043b6bf

Browse files
authored
Update for dolfinx main (#11)
* kw args for function plotting * topology creation * update actions --------- Co-authored-by: nate-sime <>
1 parent 22645a7 commit 043b6bf

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.github/workflows/run_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v3
1414

1515
- name: Install dependencies
16-
run: python3 -m pip install pyvista
16+
run: python3 -m pip install --break-system-packages pyvista
1717

1818
- name: Run unit tests
1919
run: python3 -m pytest test/

febug/plot.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
@functools.singledispatch
1616
def _to_pyvista_grid(mesh: dolfinx.mesh.Mesh, tdim: int,
1717
entities=None):
18+
mesh.topology.create_connectivity(0, tdim)
19+
mesh.topology.create_connectivity(tdim, mesh.topology.dim)
1820
return pyvista.UnstructuredGrid(*dolfinx.plot.vtk_mesh(
1921
mesh, tdim, entities))
2022

@@ -110,7 +112,7 @@ def create_plottable_ufl_expression(
110112

111113

112114
def plot_function(u: dolfinx.fem.function.Function,
113-
plotter: pyvista.Plotter=None):
115+
plotter: pyvista.Plotter=None, **pv_args):
114116
if plotter is None:
115117
plotter = pyvista.Plotter()
116118

@@ -122,7 +124,8 @@ def plot_function(u: dolfinx.fem.function.Function,
122124
# No data on process
123125
return plotter
124126

125-
plotter.add_mesh(grid, scalars=u.name, show_scalar_bar=True)
127+
pv_args.setdefault("show_scalar_bar", True)
128+
plotter.add_mesh(grid, scalars=u.name, **pv_args)
126129

127130
if mesh.geometry.dim == 2:
128131
plotter.enable_parallel_projection()

0 commit comments

Comments
 (0)