diff --git a/.github/workflows/create_legacy_checkpoint.yml b/.github/workflows/create_legacy_checkpoint.yml index f67a96d..a758f32 100644 --- a/.github/workflows/create_legacy_checkpoint.yml +++ b/.github/workflows/create_legacy_checkpoint.yml @@ -15,7 +15,7 @@ jobs: adios4dolfinx_version: "0.7.1" runs-on: "ubuntu-latest" container: ghcr.io/fenics/dolfinx/dolfinx:v0.7.3 - + steps: - uses: actions/checkout@v6 diff --git a/.github/workflows/create_legacy_data.yml b/.github/workflows/create_legacy_data.yml index af36d07..c4e4c36 100644 --- a/.github/workflows/create_legacy_data.yml +++ b/.github/workflows/create_legacy_data.yml @@ -13,7 +13,7 @@ jobs: create-dolfin-data: env: data_dir: "legacy" - + runs-on: "ubuntu-latest" container: ghcr.io/scientificcomputing/fenics:2024-02-19 steps: diff --git a/.github/workflows/test_dolfinx_versions.yml b/.github/workflows/test_dolfinx_versions.yml index 1dbe3cf..56441dd 100644 --- a/.github/workflows/test_dolfinx_versions.yml +++ b/.github/workflows/test_dolfinx_versions.yml @@ -27,8 +27,8 @@ jobs: fail-fast: false matrix: tag: ["nightly", "stable"] - + # Call the reusable workflow uses: ./.github/workflows/test_workflow.yml with: - dolfinx_tag: ${{ matrix.tag }} \ No newline at end of file + dolfinx_tag: ${{ matrix.tag }} diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index baa73db..c7cccb0 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -67,4 +67,4 @@ jobs: with: name: code-coverage-report-${{ inputs.dolfinx_tag }} path: htmlcov - if-no-files-found: error \ No newline at end of file + if-no-files-found: error diff --git a/.gitignore b/.gitignore index 48d236f..ba7da21 100644 --- a/.gitignore +++ b/.gitignore @@ -139,4 +139,4 @@ output/ *.xdmf *.bp/ *.pvd -*.vtu \ No newline at end of file +*.vtu diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 938c77a..7682e24 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,17 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + args: ['--maxkb=3000'] + - id: check-docstring-first + - id: debug-statements + - id: check-toml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: 'v0.15.16' diff --git a/README.md b/README.md index 928f719..caa28ed 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ For scalability, the code uses [MPI Neighbourhood collectives](https://www.mpi-f ### Mesh IO (Import/Export) Most meshing formats supports associating data with the nodes of the mesh (the mesh can be higher order) and the cells of the mesh. The node data can be read in as P-th order Lagrange functions (where P is the order of the grid), while the cell data can be read in as piecewise constant (DG-0) functions. -- [VTKHDF](./docs/backends/vtkhdf.rst): The new scalable format from VTK, called [VTKHDF](https://docs.vtk.org/en/latest/vtk_file_formats/vtkhdf_file_format/index.html) is supported by the `vtkhdf` backend. +- [VTKHDF](./docs/backends/vtkhdf.rst): The new scalable format from VTK, called [VTKHDF](https://docs.vtk.org/en/latest/vtk_file_formats/vtkhdf_file_format/index.html) is supported by the `vtkhdf` backend. - [XDMF](./docs/backends/xdmf.rst) (eXtensible Model Data Format): `.xdmf`. The `xdmf` backend supports the `HDF5` encoding, to ensure performance in parallel. - [PyVista](./docs/backends/pyvista.rst) (IO backend is meshio): The [pyvista](https://pyvista.org/) backend uses {py:func}`pyvista.read` to read in meshes, point data and cell data. `pyvista` relies on [meshio](https://github.com/nschloe/meshio) for most reading operations (including the XDMF ascii format). @@ -107,4 +107,4 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc ## LICENSE -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. \ No newline at end of file +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. diff --git a/_toc.yml b/_toc.yml index b20837e..c79c054 100644 --- a/_toc.yml +++ b/_toc.yml @@ -10,7 +10,7 @@ parts: - file: "docs/migration_guide" - file: "docs/testing.md" - file: "docs/reading_legacy_data" - + - caption: Introduction to IPyParallel chapters: - file: "docs/ipyparallel_intro" @@ -39,4 +39,4 @@ parts: - caption: Contributing chapters: - - file: "CONTRIBUTING" \ No newline at end of file + - file: "CONTRIBUTING" diff --git a/build-requirements.txt b/build-requirements.txt index 24a31bb..a58cd3b 100644 --- a/build-requirements.txt +++ b/build-requirements.txt @@ -2,4 +2,4 @@ scikit-build-core[pyproject]>=0.11.0 nanobind>=1.3.2 setuptools>=77.0.3 packaging>=24.2 -pkgconfig \ No newline at end of file +pkgconfig diff --git a/docs/adding_backend.md b/docs/adding_backend.md index f64349d..e90be76 100644 --- a/docs/adding_backend.md +++ b/docs/adding_backend.md @@ -98,4 +98,4 @@ def write_mesh(filename: Path | str, comm: MPI.Intracomm, mesh: MeshData, pass # ... Implement all other methods defined in IOBackend ... -``` \ No newline at end of file +``` diff --git a/docs/backends/adios2.rst b/docs/backends/adios2.rst index 6c601a4..606c92b 100644 --- a/docs/backends/adios2.rst +++ b/docs/backends/adios2.rst @@ -11,4 +11,4 @@ Therefore `ADIOS2` should not be install through PYPI/pip, but has to be install .. automodule:: io4dolfinx.backends.adios2.backend :members: - :exclude-members: read_point_data \ No newline at end of file + :exclude-members: read_point_data diff --git a/docs/backends/h5py.rst b/docs/backends/h5py.rst index 28bb08b..770b554 100644 --- a/docs/backends/h5py.rst +++ b/docs/backends/h5py.rst @@ -34,4 +34,4 @@ Note that this code block does not install DOLFINx, it just illustrates how to g .. automodule:: io4dolfinx.backends.h5py.backend :members: - :exclude-members: read_point_data \ No newline at end of file + :exclude-members: read_point_data diff --git a/docs/backends/pyvista.rst b/docs/backends/pyvista.rst index c7d6f93..08c0f77 100644 --- a/docs/backends/pyvista.rst +++ b/docs/backends/pyvista.rst @@ -5,4 +5,4 @@ PyVista-backend .. automodule:: io4dolfinx.backends.pyvista.backend :members: - :exclude-members: read_attributes, read_timestamps, write_attributes, write_mesh, write_meshtags, read_meshtags_data, read_dofmap, read_dofs, read_cell_perms, write_function, read_legacy_mesh, snapshot_checkpoint, read_hdf5_array \ No newline at end of file + :exclude-members: read_attributes, read_timestamps, write_attributes, write_mesh, write_meshtags, read_meshtags_data, read_dofmap, read_dofs, read_cell_perms, write_function, read_legacy_mesh, snapshot_checkpoint, read_hdf5_array diff --git a/docs/backends/vtkhdf.rst b/docs/backends/vtkhdf.rst index 5728a62..be309b6 100644 --- a/docs/backends/vtkhdf.rst +++ b/docs/backends/vtkhdf.rst @@ -8,4 +8,4 @@ See that backend for detailed installation instructions. .. automodule:: io4dolfinx.backends.vtkhdf.backend :members: - :exclude-members: read_attributes, read_timestamps, write_attributes, write_mesh, write_meshtags, read_meshtags_data, read_dofmap, read_dofs, read_cell_perms, write_function, read_legacy_mesh, snapshot_checkpoint, read_hdf5_array \ No newline at end of file + :exclude-members: read_attributes, read_timestamps, write_attributes, write_mesh, write_meshtags, read_meshtags_data, read_dofmap, read_dofs, read_cell_perms, write_function, read_legacy_mesh, snapshot_checkpoint, read_hdf5_array diff --git a/docs/backends/xdmf.rst b/docs/backends/xdmf.rst index 3902a75..7b3af16 100644 --- a/docs/backends/xdmf.rst +++ b/docs/backends/xdmf.rst @@ -8,4 +8,4 @@ See that backend for detailed installation instructions. .. automodule:: io4dolfinx.backends.xdmf.backend :members: - :exclude-members: read_attributes, read_timestamps, write_attributes, write_mesh, write_meshtags, read_meshtags_data, read_dofmap, read_dofs, read_cell_perms, write_function, read_legacy_mesh, snapshot_checkpoint, read_hdf5_array \ No newline at end of file + :exclude-members: read_attributes, read_timestamps, write_attributes, write_mesh, write_meshtags, read_meshtags_data, read_dofmap, read_dofs, read_cell_perms, write_function, read_legacy_mesh, snapshot_checkpoint, read_hdf5_array diff --git a/docs/migration_guide.md b/docs/migration_guide.md index acd3dc9..2b66b1b 100644 --- a/docs/migration_guide.md +++ b/docs/migration_guide.md @@ -80,5 +80,3 @@ io4dolfinx.write_function("solution.bp", u, time=0.0, backend="h5py") ``` ```` ````` - - diff --git a/docs/quickstart.md b/docs/quickstart.md index 95fc293..c7e7bad 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -171,5 +171,3 @@ the `backend` argument to most functions. 5. **`xdmf`**: Basic support for reading XDMF data. - - diff --git a/docs/reading_legacy_data.md b/docs/reading_legacy_data.md index 201fdfb..2fff517 100644 --- a/docs/reading_legacy_data.md +++ b/docs/reading_legacy_data.md @@ -66,7 +66,7 @@ filename = "legacy_data.h5" mesh = io4dolfinx.read_mesh_from_legacy_h5(filename, comm, group="/mesh") ``` -#### Create the appropriate FunctionSpace +#### Create the appropriate FunctionSpace You must know the element family and degree used in the legacy simulation ```python V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1)) diff --git a/docs/testing.md b/docs/testing.md index bedcda7..7751c05 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -110,4 +110,4 @@ To ensure broad support, specific workflows test against different configuration ### 3. Documentation (`build_docs.yml`) Ensures the documentation builds correctly with `jupyter-book` on every push and -pull request, preventing documentation regressions. \ No newline at end of file +pull request, preventing documentation regressions. diff --git a/pyproject.toml b/pyproject.toml index 178ad65..d0f5111 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ name = "io4dolfinx" version = "1.2.0" description = "Checkpointing functionality for DOLFINx meshes/functions with ADIOS2" authors = [ - { name = "Jørgen S. Dokken", email = "dokken@simula.no" }, + { name = "Jørgen S. Dokken", email = "dokken@simula.no" }, { name = "Henrik N.T. Finsberg", email = "henriknf@simula.no" } ] license = { file = "LICENSE" } @@ -15,11 +15,11 @@ dependencies = ["fenics-dolfinx>=0.10.0", "packaging"] [project.optional-dependencies] test = [ - "pytest", - "coverage", - "ipyparallel", - "io4dolfinx[h5py]", - "io4dolfinx[pyvista]", + "pytest", + "coverage", + "ipyparallel", + "io4dolfinx[h5py]", + "io4dolfinx[pyvista]", "io4dolfinx[xdmf]" ] dev = ["pdbpp", "ipython", "mypy", "ruff"] diff --git a/src/io4dolfinx/comm_helpers.py b/src/io4dolfinx/comm_helpers.py index 6a4e2f3..d41b070 100644 --- a/src/io4dolfinx/comm_helpers.py +++ b/src/io4dolfinx/comm_helpers.py @@ -1,3 +1,7 @@ +""" +Helpers for sending and receiving values for checkpointing +""" + from __future__ import annotations from mpi4py import MPI @@ -13,9 +17,6 @@ "send_dofs_and_recv_values", "numpy_to_mpi", ] -""" -Helpers for sending and receiving values for checkpointing -""" numpy_to_mpi = { np.float64: MPI.DOUBLE, diff --git a/src/io4dolfinx/structures.py b/src/io4dolfinx/structures.py index bffac13..5d33f72 100644 --- a/src/io4dolfinx/structures.py +++ b/src/io4dolfinx/structures.py @@ -1,3 +1,4 @@ +"""Internal library classes for storing mesh and function data""" # Copyright (C) 2024 Jørgen Schartum Dokken # # This file is part of io4dolfinx @@ -12,7 +13,6 @@ import numpy.typing as npt from dolfinx.graph import AdjacencyList -"""Internal library classes for storing mesh and function data""" __all__ = ["MeshData", "FunctionData", "ReadMeshData", "MeshTagsData"]