Skip to content

Api changes related to: https://github.com/FEniCS/dolfinx/pull/2763 #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 23, 2023
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
14 changes: 10 additions & 4 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# Changelog

## main

- Renamed `dolfinx.graph.create_adjacencylist` to `dolfinx.graph.adjacencylist`
- Renamed `dolfinx.plot.create_vtk_mesh` to `dolfinx.plot.vtk_mesh`
- `dolfinx.geometry.BoundingBoxTree` has been changed to `dolfinx.geometry.bb_tree`
- `create_mesh` with Meshio has been modified. Note that you now need to pass dtype `np.int32` to the cell_data.
- 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.

## v0.6.0

- Remove `ipygany` and `pythreejs` as plotting backends. Using `panel`.
- Add gif-output to [chapter2/diffusion_code] and [chapter2/hyperelasticity].
- Replace `dolfinx.fem.Function.geometric_dimension` with `len(dolfinx.fem.Function)`
- Improve [chapter2/ns_code2] to have better splitting scheme and density.
- Improve mesh quality in [chapter3/em].
- `jit_params` and `form_compiler_params` renamed to `*_options`.


## v0.5.0

- Using new GMSH interface in DOLFINx (`dolfinx.io.gmshio`) in all demos using GMSH
- Added a section on custom Newton-solvers, see [chapter4/newton-solver].
- 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]`.
Expand All @@ -23,9 +27,11 @@
- Add example of how to use `DOLFINx` in complex mode, see [chapter1/complex_mode].

## 0.4.1

- No changes

## 0.4.0 (05.02.2021)

- All `pyvista` plotting has been rewritten to use `ipygany` and `pythreejs` as well as using a cleaner interface.
- `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`.
- `dolfinx.fem.Function.compute_point_values` has been deprecated. Interpolation into a CG-1 is now the way of getting vertex values.
Expand All @@ -36,14 +42,14 @@
- Various API changes relating to the import structure of DOLFINx

## 0.3.0 (09.09.2021)

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



## 0.1.0 (11.05.2021)
- First tagged release of DOLFINx Tutorial, compatible with [DOLFINx 0.1.0](https://github.com/FEniCS/dolfinx/releases/tag/0.1.0).

- First tagged release of DOLFINx Tutorial, compatible with [DOLFINx 0.1.0](https://github.com/FEniCS/dolfinx/releases/tag/0.1.0).
571 changes: 26 additions & 545 deletions chapter1/complex_mode.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions chapter1/complex_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@

import pyvista
pyvista.start_xvfb()
p_mesh = pyvista.UnstructuredGrid(*dolfinx.plot.create_vtk_mesh(mesh, mesh.topology.dim))
pyvista_cells, cell_types, geometry = dolfinx.plot.create_vtk_mesh(V)
p_mesh = pyvista.UnstructuredGrid(*dolfinx.plot.vtk_mesh(mesh, mesh.topology.dim))
pyvista_cells, cell_types, geometry = dolfinx.plot.vtk_mesh(V)
grid = pyvista.UnstructuredGrid(pyvista_cells, cell_types, geometry)
grid.point_data["u_real"] = uh.x.array.real
grid.point_data["u_imag"] = uh.x.array.imag
Expand Down
8 changes: 4 additions & 4 deletions chapter1/fundamentals_code.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@
"## Plotting the mesh using pyvista\n",
"We will visualizing the mesh using [pyvista](https://docs.pyvista.org/), an interface to the VTK toolkit.\n",
"We start by converting the mesh to a format that can be used with `pyvista`.\n",
"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",
"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",
"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)`"
]
},
Expand Down Expand Up @@ -453,7 +453,7 @@
"source": [
"from dolfinx import plot\n",
"pyvista.start_xvfb()\n",
"topology, cell_types, geometry = plot.create_vtk_mesh(domain, tdim)\n",
"topology, cell_types, geometry = plot.vtk_mesh(domain, tdim)\n",
"grid = pyvista.UnstructuredGrid(topology, cell_types, geometry)"
]
},
Expand Down Expand Up @@ -1231,7 +1231,7 @@
"metadata": {},
"source": [
"## Plotting a function using pyvista\n",
"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."
"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."
]
},
{
Expand All @@ -1245,7 +1245,7 @@
},
"outputs": [],
"source": [
"u_topology, u_cell_types, u_geometry = plot.create_vtk_mesh(V)"
"u_topology, u_cell_types, u_geometry = plot.vtk_mesh(V)"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions chapter1/fundamentals_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
# ## Plotting the mesh using pyvista
# We will visualizing the mesh using [pyvista](https://docs.pyvista.org/), an interface to the VTK toolkit.
# We start by converting the mesh to a format that can be used with `pyvista`.
# 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`.
# 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`.
# 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)`

import pyvista
Expand All @@ -232,7 +232,7 @@
# + vscode={"languageId": "python"}
from dolfinx import plot
pyvista.start_xvfb()
topology, cell_types, geometry = plot.create_vtk_mesh(domain, tdim)
topology, cell_types, geometry = plot.vtk_mesh(domain, tdim)
grid = pyvista.UnstructuredGrid(topology, cell_types, geometry)
# -

Expand All @@ -252,10 +252,10 @@
# -

# ## Plotting a function using pyvista
# 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.
# 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.

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

# Next, we create the `pyvista.UnstructuredGrid` and add the dof-values to the mesh.
Expand Down
6 changes: 3 additions & 3 deletions chapter1/membrane_code.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1013,12 +1013,12 @@
}
],
"source": [
"from dolfinx.plot import create_vtk_mesh\n",
"from dolfinx.plot import vtk_mesh\n",
"import pyvista\n",
"pyvista.start_xvfb()\n",
"\n",
"# Extract topology from mesh and create pyvista mesh\n",
"topology, cell_types, x = create_vtk_mesh(V)\n",
"topology, cell_types, x = vtk_mesh(V)\n",
"grid = pyvista.UnstructuredGrid(topology, cell_types, x)\n",
"\n",
"# Set deflection values and add it to plotter\n",
Expand Down Expand Up @@ -1136,7 +1136,7 @@
],
"source": [
"load_plotter = pyvista.Plotter()\n",
"p_grid = pyvista.UnstructuredGrid(*create_vtk_mesh(Q))\n",
"p_grid = pyvista.UnstructuredGrid(*vtk_mesh(Q))\n",
"p_grid.point_data[\"p\"] = pressure.x.array.real\n",
"warped_p = p_grid.warp_by_scalar(\"p\", factor=0.5)\n",
"warped_p.set_active_scalars(\"p\")\n",
Expand Down
6 changes: 3 additions & 3 deletions chapter1/membrane_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ def on_boundary(x):
# We first plot the deflection $u_h$ over the domain $\Omega$.

# +
from dolfinx.plot import create_vtk_mesh
from dolfinx.plot import vtk_mesh
import pyvista
pyvista.start_xvfb()

# Extract topology from mesh and create pyvista mesh
topology, cell_types, x = create_vtk_mesh(V)
topology, cell_types, x = vtk_mesh(V)
grid = pyvista.UnstructuredGrid(topology, cell_types, x)

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

load_plotter = pyvista.Plotter()
p_grid = pyvista.UnstructuredGrid(*create_vtk_mesh(Q))
p_grid = pyvista.UnstructuredGrid(*vtk_mesh(Q))
p_grid.point_data["p"] = pressure.x.array.real
warped_p = p_grid.warp_by_scalar("p", factor=0.5)
warped_p.set_active_scalars("p")
Expand Down
2 changes: 1 addition & 1 deletion chapter1/nitsche.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@
"import pyvista\n",
"pyvista.start_xvfb()\n",
"\n",
"grid = pyvista.UnstructuredGrid(*plot.create_vtk_mesh(V))\n",
"grid = pyvista.UnstructuredGrid(*plot.vtk_mesh(V))\n",
"grid.point_data[\"u\"] = uh.x.array.real\n",
"grid.set_active_scalars(\"u\")\n",
"plotter = pyvista.Plotter()\n",
Expand Down
2 changes: 1 addition & 1 deletion chapter1/nitsche.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
import pyvista
pyvista.start_xvfb()

grid = pyvista.UnstructuredGrid(*plot.create_vtk_mesh(V))
grid = pyvista.UnstructuredGrid(*plot.vtk_mesh(V))
grid.point_data["u"] = uh.x.array.real
grid.set_active_scalars("u")
plotter = pyvista.Plotter()
Expand Down
2 changes: 1 addition & 1 deletion chapter2/diffusion_code.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
"import matplotlib as mpl\n",
"pyvista.start_xvfb()\n",
"\n",
"grid = pyvista.UnstructuredGrid(*plot.create_vtk_mesh(V))\n",
"grid = pyvista.UnstructuredGrid(*plot.vtk_mesh(V))\n",
"\n",
"plotter = pyvista.Plotter()\n",
"plotter.open_gif(\"u_time.gif\", fps=10)\n",
Expand Down
2 changes: 1 addition & 1 deletion chapter2/diffusion_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def initial_condition(x, a=5):
import matplotlib as mpl
pyvista.start_xvfb()

grid = pyvista.UnstructuredGrid(*plot.create_vtk_mesh(V))
grid = pyvista.UnstructuredGrid(*plot.vtk_mesh(V))

plotter = pyvista.Plotter()
plotter.open_gif("u_time.gif", fps=10)
Expand Down
Loading