Skip to content

Commit 11f61fd

Browse files
committed
https://github.com/FEniCS/dolfinx/pull/2763
1 parent dd30b8a commit 11f61fd

32 files changed

+350
-2061
lines changed

Changelog.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# Changelog
22

33
## main
4+
5+
- Renamed `dolfinx.graph.create_adjacencylist` to `dolfinx.graph.adjacencylist`
6+
- Renamed `dolfinx.plot.create_vtk_mesh` to `dolfinx.plot.vtk_mesh`
47
- `dolfinx.geometry.BoundingBoxTree` has been changed to `dolfinx.geometry.bb_tree`
58
- `create_mesh` with Meshio has been modified. Note that you now need to pass dtype `np.int32` to the cell_data.
69
- Update dolfinx petsc API. Now one needs to explicitly import `dolfinx.fem.petsc` and `dolfinx.fem.nls`, as PETSc is no longer a strict requirement. Replace `petsc4py.PETSc.ScalarType` with `dolfinx.default_scalar_type` in demos where we do not use `petsc4py` explicitly.
710

811
## v0.6.0
12+
913
- Remove `ipygany` and `pythreejs` as plotting backends. Using `panel`.
1014
- Add gif-output to [chapter2/diffusion_code] and [chapter2/hyperelasticity].
1115
- Replace `dolfinx.fem.Function.geometric_dimension` with `len(dolfinx.fem.Function)`
1216
- Improve [chapter2/ns_code2] to have better splitting scheme and density.
1317
- Improve mesh quality in [chapter3/em].
1418
- `jit_params` and `form_compiler_params` renamed to `*_options`.
1519

16-
1720
## v0.5.0
21+
1822
- Using new GMSH interface in DOLFINx (`dolfinx.io.gmshio`) in all demos using GMSH
1923
- Added a section on custom Newton-solvers, see [chapter4/newton-solver].
2024
- Various minor DOLFINx API updates. `dolfinx.mesh.compute_boundary_facets` -> `dolfinx.mesh.exterior_facet_indices` with slightly different functionality. Use `dolfinx.mesh.MeshTagsMetaClass.find` instead of `mt.indices[mt.values==value]`.
@@ -23,9 +27,11 @@
2327
- Add example of how to use `DOLFINx` in complex mode, see [chapter1/complex_mode].
2428

2529
## 0.4.1
30+
2631
- No changes
2732

2833
## 0.4.0 (05.02.2021)
34+
2935
- All `pyvista` plotting has been rewritten to use `ipygany` and `pythreejs` as well as using a cleaner interface.
3036
- `dolfinx.plot.create_vtk_topology` has been renamed to `dolfinx.plot.create_vtk_mesh` and can now be directly used as input to `pyvista.UnstructuredGrid`.
3137
- `dolfinx.fem.Function.compute_point_values` has been deprecated. Interpolation into a CG-1 is now the way of getting vertex values.
@@ -36,14 +42,14 @@
3642
- Various API changes relating to the import structure of DOLFINx
3743

3844
## 0.3.0 (09.09.2021)
45+
3946
- Major improvements in [Form compiler parameters](chapter4/compiler_parameters), using pandas and seaborn for visualization of speed-ups gained using form compiler parameters.
4047
- API change: `dolfinx.cpp.la.scatter_forward(u.x)` -> `u.x.scatter_forward`
4148
- Various plotting updates due to new version of pyvista.
4249
- Updating of the [Hyperelasticity demo](chapter2/hyperelasticity), now using DOLFINx wrappers to create the non-linear problem
4350
- Internal updates due to bumping of jupyter-book versions
4451
- Various typos and capitalizations fixed by @mscroggs in [PR 35](https://github.com/jorgensd/dolfinx-tutorial/pull/35).
4552

46-
47-
4853
## 0.1.0 (11.05.2021)
49-
- First tagged release of DOLFINx Tutorial, compatible with [DOLFINx 0.1.0](https://github.com/FEniCS/dolfinx/releases/tag/0.1.0).
54+
55+
- First tagged release of DOLFINx Tutorial, compatible with [DOLFINx 0.1.0](https://github.com/FEniCS/dolfinx/releases/tag/0.1.0).

chapter1/complex_mode.ipynb

+26-545
Large diffs are not rendered by default.

chapter1/complex_mode.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@
119119

120120
import pyvista
121121
pyvista.start_xvfb()
122-
p_mesh = pyvista.UnstructuredGrid(*dolfinx.plot.create_vtk_mesh(mesh, mesh.topology.dim))
123-
pyvista_cells, cell_types, geometry = dolfinx.plot.create_vtk_mesh(V)
122+
p_mesh = pyvista.UnstructuredGrid(*dolfinx.plot.vtk_mesh(mesh, mesh.topology.dim))
123+
pyvista_cells, cell_types, geometry = dolfinx.plot.vtk_mesh(V)
124124
grid = pyvista.UnstructuredGrid(pyvista_cells, cell_types, geometry)
125125
grid.point_data["u_real"] = uh.x.array.real
126126
grid.point_data["u_imag"] = uh.x.array.imag

chapter1/fundamentals_code.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@
417417
"## Plotting the mesh using pyvista\n",
418418
"We will visualizing the mesh using [pyvista](https://docs.pyvista.org/), an interface to the VTK toolkit.\n",
419419
"We start by converting the mesh to a format that can be used with `pyvista`.\n",
420-
"To do this we use the function `dolfinx.plot.create_vtk_mesh`. The first step is to create an unstructured grid that can be used by `pyvista`.\n",
420+
"To do this we use the function `dolfinx.plot.vtk_mesh`. The first step is to create an unstructured grid that can be used by `pyvista`.\n",
421421
"We need to start a virtual framebuffer for plotting through docker containers. You can print the current backend and change it with `pyvista.set_jupyter_backend(backend)`"
422422
]
423423
},
@@ -453,7 +453,7 @@
453453
"source": [
454454
"from dolfinx import plot\n",
455455
"pyvista.start_xvfb()\n",
456-
"topology, cell_types, geometry = plot.create_vtk_mesh(domain, tdim)\n",
456+
"topology, cell_types, geometry = plot.vtk_mesh(domain, tdim)\n",
457457
"grid = pyvista.UnstructuredGrid(topology, cell_types, geometry)"
458458
]
459459
},
@@ -1231,7 +1231,7 @@
12311231
"metadata": {},
12321232
"source": [
12331233
"## Plotting a function using pyvista\n",
1234-
"We want to plot the solution `uh`. As the function space used to defined the mesh is disconnected from the function space defining the mesh, we create a mesh based on the dof coordinates for the function space `V`. We use `dolfinx.plot.create_vtk_mesh` with the function space as input to create a mesh with mesh geometry based on the dof coordinates."
1234+
"We want to plot the solution `uh`. As the function space used to defined the mesh is disconnected from the function space defining the mesh, we create a mesh based on the dof coordinates for the function space `V`. We use `dolfinx.plot.vtk_mesh` with the function space as input to create a mesh with mesh geometry based on the dof coordinates."
12351235
]
12361236
},
12371237
{
@@ -1245,7 +1245,7 @@
12451245
},
12461246
"outputs": [],
12471247
"source": [
1248-
"u_topology, u_cell_types, u_geometry = plot.create_vtk_mesh(V)"
1248+
"u_topology, u_cell_types, u_geometry = plot.vtk_mesh(V)"
12491249
]
12501250
},
12511251
{

chapter1/fundamentals_code.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
# ## Plotting the mesh using pyvista
224224
# We will visualizing the mesh using [pyvista](https://docs.pyvista.org/), an interface to the VTK toolkit.
225225
# We start by converting the mesh to a format that can be used with `pyvista`.
226-
# To do this we use the function `dolfinx.plot.create_vtk_mesh`. The first step is to create an unstructured grid that can be used by `pyvista`.
226+
# To do this we use the function `dolfinx.plot.vtk_mesh`. The first step is to create an unstructured grid that can be used by `pyvista`.
227227
# We need to start a virtual framebuffer for plotting through docker containers. You can print the current backend and change it with `pyvista.set_jupyter_backend(backend)`
228228

229229
import pyvista
@@ -232,7 +232,7 @@
232232
# + vscode={"languageId": "python"}
233233
from dolfinx import plot
234234
pyvista.start_xvfb()
235-
topology, cell_types, geometry = plot.create_vtk_mesh(domain, tdim)
235+
topology, cell_types, geometry = plot.vtk_mesh(domain, tdim)
236236
grid = pyvista.UnstructuredGrid(topology, cell_types, geometry)
237237
# -
238238

@@ -252,10 +252,10 @@
252252
# -
253253

254254
# ## Plotting a function using pyvista
255-
# We want to plot the solution `uh`. As the function space used to defined the mesh is disconnected from the function space defining the mesh, we create a mesh based on the dof coordinates for the function space `V`. We use `dolfinx.plot.create_vtk_mesh` with the function space as input to create a mesh with mesh geometry based on the dof coordinates.
255+
# We want to plot the solution `uh`. As the function space used to defined the mesh is disconnected from the function space defining the mesh, we create a mesh based on the dof coordinates for the function space `V`. We use `dolfinx.plot.vtk_mesh` with the function space as input to create a mesh with mesh geometry based on the dof coordinates.
256256

257257
# + vscode={"languageId": "python"}
258-
u_topology, u_cell_types, u_geometry = plot.create_vtk_mesh(V)
258+
u_topology, u_cell_types, u_geometry = plot.vtk_mesh(V)
259259
# -
260260

261261
# Next, we create the `pyvista.UnstructuredGrid` and add the dof-values to the mesh.

chapter1/membrane_code.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1013,12 +1013,12 @@
10131013
}
10141014
],
10151015
"source": [
1016-
"from dolfinx.plot import create_vtk_mesh\n",
1016+
"from dolfinx.plot import vtk_mesh\n",
10171017
"import pyvista\n",
10181018
"pyvista.start_xvfb()\n",
10191019
"\n",
10201020
"# Extract topology from mesh and create pyvista mesh\n",
1021-
"topology, cell_types, x = create_vtk_mesh(V)\n",
1021+
"topology, cell_types, x = vtk_mesh(V)\n",
10221022
"grid = pyvista.UnstructuredGrid(topology, cell_types, x)\n",
10231023
"\n",
10241024
"# Set deflection values and add it to plotter\n",
@@ -1136,7 +1136,7 @@
11361136
],
11371137
"source": [
11381138
"load_plotter = pyvista.Plotter()\n",
1139-
"p_grid = pyvista.UnstructuredGrid(*create_vtk_mesh(Q))\n",
1139+
"p_grid = pyvista.UnstructuredGrid(*vtk_mesh(Q))\n",
11401140
"p_grid.point_data[\"p\"] = pressure.x.array.real\n",
11411141
"warped_p = p_grid.warp_by_scalar(\"p\", factor=0.5)\n",
11421142
"warped_p.set_active_scalars(\"p\")\n",

chapter1/membrane_code.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ def on_boundary(x):
118118
# We first plot the deflection $u_h$ over the domain $\Omega$.
119119

120120
# +
121-
from dolfinx.plot import create_vtk_mesh
121+
from dolfinx.plot import vtk_mesh
122122
import pyvista
123123
pyvista.start_xvfb()
124124

125125
# Extract topology from mesh and create pyvista mesh
126-
topology, cell_types, x = create_vtk_mesh(V)
126+
topology, cell_types, x = vtk_mesh(V)
127127
grid = pyvista.UnstructuredGrid(topology, cell_types, x)
128128

129129
# Set deflection values and add it to plotter
@@ -141,7 +141,7 @@ def on_boundary(x):
141141
# We next plot the load on the domain
142142

143143
load_plotter = pyvista.Plotter()
144-
p_grid = pyvista.UnstructuredGrid(*create_vtk_mesh(Q))
144+
p_grid = pyvista.UnstructuredGrid(*vtk_mesh(Q))
145145
p_grid.point_data["p"] = pressure.x.array.real
146146
warped_p = p_grid.warp_by_scalar("p", factor=0.5)
147147
warped_p.set_active_scalars("p")

chapter1/nitsche.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@
924924
"import pyvista\n",
925925
"pyvista.start_xvfb()\n",
926926
"\n",
927-
"grid = pyvista.UnstructuredGrid(*plot.create_vtk_mesh(V))\n",
927+
"grid = pyvista.UnstructuredGrid(*plot.vtk_mesh(V))\n",
928928
"grid.point_data[\"u\"] = uh.x.array.real\n",
929929
"grid.set_active_scalars(\"u\")\n",
930930
"plotter = pyvista.Plotter()\n",

chapter1/nitsche.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
import pyvista
9797
pyvista.start_xvfb()
9898

99-
grid = pyvista.UnstructuredGrid(*plot.create_vtk_mesh(V))
99+
grid = pyvista.UnstructuredGrid(*plot.vtk_mesh(V))
100100
grid.point_data["u"] = uh.x.array.real
101101
grid.set_active_scalars("u")
102102
plotter = pyvista.Plotter()

chapter2/diffusion_code.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
"import matplotlib as mpl\n",
199199
"pyvista.start_xvfb()\n",
200200
"\n",
201-
"grid = pyvista.UnstructuredGrid(*plot.create_vtk_mesh(V))\n",
201+
"grid = pyvista.UnstructuredGrid(*plot.vtk_mesh(V))\n",
202202
"\n",
203203
"plotter = pyvista.Plotter()\n",
204204
"plotter.open_gif(\"u_time.gif\", fps=10)\n",

chapter2/diffusion_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def initial_condition(x, a=5):
123123
import matplotlib as mpl
124124
pyvista.start_xvfb()
125125

126-
grid = pyvista.UnstructuredGrid(*plot.create_vtk_mesh(V))
126+
grid = pyvista.UnstructuredGrid(*plot.vtk_mesh(V))
127127

128128
plotter = pyvista.Plotter()
129129
plotter.open_gif("u_time.gif", fps=10)

0 commit comments

Comments
 (0)