Skip to content

Commit

Permalink
Update for dolfinx main (#11)
Browse files Browse the repository at this point in the history
* kw args for function plotting

* topology creation

* update actions

---------

Co-authored-by: nate-sime <>
  • Loading branch information
nate-sime authored May 20, 2024
1 parent 22645a7 commit 043b6bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3

- name: Install dependencies
run: python3 -m pip install pyvista
run: python3 -m pip install --break-system-packages pyvista

- name: Run unit tests
run: python3 -m pytest test/
7 changes: 5 additions & 2 deletions febug/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
@functools.singledispatch
def _to_pyvista_grid(mesh: dolfinx.mesh.Mesh, tdim: int,
entities=None):
mesh.topology.create_connectivity(0, tdim)
mesh.topology.create_connectivity(tdim, mesh.topology.dim)
return pyvista.UnstructuredGrid(*dolfinx.plot.vtk_mesh(
mesh, tdim, entities))

Expand Down Expand Up @@ -110,7 +112,7 @@ def create_plottable_ufl_expression(


def plot_function(u: dolfinx.fem.function.Function,
plotter: pyvista.Plotter=None):
plotter: pyvista.Plotter=None, **pv_args):
if plotter is None:
plotter = pyvista.Plotter()

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

plotter.add_mesh(grid, scalars=u.name, show_scalar_bar=True)
pv_args.setdefault("show_scalar_bar", True)
plotter.add_mesh(grid, scalars=u.name, **pv_args)

if mesh.geometry.dim == 2:
plotter.enable_parallel_projection()
Expand Down

0 comments on commit 043b6bf

Please sign in to comment.