cfsem 2.3.1__tar.gz → 2.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. cfsem-2.3.1/.github/workflows/CI.yml → cfsem-2.4.3/.github/workflows/release_python.yml +10 -6
  2. cfsem-2.4.3/.github/workflows/release_rust.yml +29 -0
  3. cfsem-2.4.3/.github/workflows/test_python.yml +50 -0
  4. cfsem-2.4.3/.github/workflows/test_rust.yml +29 -0
  5. cfsem-2.3.1/CHANGELOG.md → cfsem-2.4.3/CHANGELOG_PYTHON.md +27 -0
  6. cfsem-2.4.3/CHANGELOG_RUST.md +82 -0
  7. cfsem-2.4.3/Cargo.lock +917 -0
  8. cfsem-2.4.3/Cargo.toml +56 -0
  9. {cfsem-2.3.1 → cfsem-2.4.3}/LICENSE +1 -1
  10. {cfsem-2.3.1 → cfsem-2.4.3}/PKG-INFO +29 -8
  11. {cfsem-2.3.1 → cfsem-2.4.3}/README.md +24 -6
  12. cfsem-2.4.3/benches/circular_filament.rs +242 -0
  13. cfsem-2.4.3/benches/linear_filament.rs +189 -0
  14. {cfsem-2.3.1 → cfsem-2.4.3}/cfsem/__init__.py +29 -52
  15. {cfsem-2.3.1 → cfsem-2.4.3}/cfsem/bindings.py +35 -43
  16. cfsem-2.4.3/cfsem/types.py +7 -0
  17. cfsem-2.4.3/katex-header.html +18 -0
  18. {cfsem-2.3.1 → cfsem-2.4.3}/pyproject.toml +22 -5
  19. cfsem-2.4.3/src/lib.rs +87 -0
  20. cfsem-2.4.3/src/math.rs +139 -0
  21. cfsem-2.4.3/src/mesh.rs +320 -0
  22. cfsem-2.4.3/src/physics/biotsavart.rs +7 -0
  23. cfsem-2.4.3/src/physics/circular_filament.rs +1312 -0
  24. cfsem-2.4.3/src/physics/gradshafranov.rs +243 -0
  25. cfsem-2.4.3/src/physics/linear_filament.rs +896 -0
  26. cfsem-2.4.3/src/physics/mesh_filament.rs +153 -0
  27. cfsem-2.4.3/src/physics/mod.rs +11 -0
  28. cfsem-2.4.3/src/physics/point_source.rs +205 -0
  29. cfsem-2.3.1/src/lib.rs → cfsem-2.4.3/src/python.rs +2 -5
  30. cfsem-2.4.3/src/testing.rs +183 -0
  31. cfsem-2.4.3/uv.lock +2070 -0
  32. cfsem-2.3.1/.github/workflows/actions.yml +0 -64
  33. cfsem-2.3.1/Cargo.lock +0 -428
  34. cfsem-2.3.1/Cargo.toml +0 -27
  35. cfsem-2.3.1/cfsem/types.py +0 -7
  36. {cfsem-2.3.1 → cfsem-2.4.3}/.cargo/config.toml +0 -0
  37. {cfsem-2.3.1 → cfsem-2.4.3}/.gitignore +0 -0
  38. {cfsem-2.3.1 → cfsem-2.4.3}/.readthedocs.yml +0 -0
  39. {cfsem-2.3.1 → cfsem-2.4.3}/CONTRIBUTING.md +0 -0
  40. {cfsem-2.3.1 → cfsem-2.4.3}/build_docs.sh +0 -0
  41. {cfsem-2.3.1 → cfsem-2.4.3}/cfsem/py.typed +0 -0
  42. {cfsem-2.3.1 → cfsem-2.4.3}/docs/assets/logo.svg +0 -0
  43. {cfsem-2.3.1 → cfsem-2.4.3}/docs/index.md +0 -0
  44. {cfsem-2.3.1 → cfsem-2.4.3}/docs/javascripts/mathjax.js +0 -0
  45. {cfsem-2.3.1 → cfsem-2.4.3}/docs/python/example_outputs/.placeholder +0 -0
  46. {cfsem-2.3.1 → cfsem-2.4.3}/docs/python/examples.md +0 -0
  47. {cfsem-2.3.1 → cfsem-2.4.3}/docs/python/filament.md +0 -0
  48. {cfsem-2.3.1 → cfsem-2.4.3}/docs/python/flux_density.md +0 -0
  49. {cfsem-2.3.1 → cfsem-2.4.3}/docs/python/force.md +0 -0
  50. {cfsem-2.3.1 → cfsem-2.4.3}/docs/python/grad_shafranov.md +0 -0
  51. {cfsem-2.3.1 → cfsem-2.4.3}/docs/python/inductance.md +0 -0
  52. {cfsem-2.3.1 → cfsem-2.4.3}/docs/python/math.md +0 -0
  53. {cfsem-2.3.1 → cfsem-2.4.3}/docs/python/types.md +0 -0
  54. {cfsem-2.3.1 → cfsem-2.4.3}/docs/python/vector_potential.md +0 -0
  55. {cfsem-2.3.1 → cfsem-2.4.3}/docs/requirements.txt +0 -0
  56. {cfsem-2.3.1 → cfsem-2.4.3}/docs/stylesheets/extra.css +0 -0
  57. {cfsem-2.3.1 → cfsem-2.4.3}/examples/helmholtz.py +0 -0
  58. {cfsem-2.3.1 → cfsem-2.4.3}/examples/inductance.py +0 -0
  59. {cfsem-2.3.1 → cfsem-2.4.3}/mkdocs.yml +0 -0
  60. {cfsem-2.3.1 → cfsem-2.4.3}/test/__init__.py +0 -0
  61. {cfsem-2.3.1 → cfsem-2.4.3}/test/test_electromagnetics.py +0 -0
  62. {cfsem-2.3.1 → cfsem-2.4.3}/test/test_examples.py +0 -0
  63. {cfsem-2.3.1 → cfsem-2.4.3}/test/test_filaments.py +0 -0
  64. {cfsem-2.3.1 → cfsem-2.4.3}/test/test_funcs.py +0 -0
  65. {cfsem-2.3.1 → cfsem-2.4.3}/test/test_gradshafranov.py +0 -0
  66. {cfsem-2.3.1 → cfsem-2.4.3}/test/test_math.py +0 -0
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # maturin generate-ci github
5
5
  #
6
- name: CI
6
+ name: release_python
7
7
 
8
8
  on:
9
9
  push:
@@ -15,6 +15,10 @@ permissions:
15
15
  contents: read
16
16
 
17
17
  jobs:
18
+
19
+ test:
20
+ uses: ./.github/workflows/test_python.yml
21
+
18
22
  linux:
19
23
  runs-on: ${{ matrix.platform.runner }}
20
24
  strategy:
@@ -42,7 +46,7 @@ jobs:
42
46
  uses: PyO3/maturin-action@v1
43
47
  with:
44
48
  target: ${{ matrix.platform.target }}
45
- args: --release --out dist --find-interpreter
49
+ args: --release --out dist --find-interpreter --features=python
46
50
  sccache: 'true'
47
51
  manylinux: auto
48
52
  - name: Upload wheels
@@ -74,7 +78,7 @@ jobs:
74
78
  uses: PyO3/maturin-action@v1
75
79
  with:
76
80
  target: ${{ matrix.platform.target }}
77
- args: --release --out dist --find-interpreter
81
+ args: --release --out dist --find-interpreter --features=python
78
82
  sccache: 'true'
79
83
  manylinux: musllinux_1_2
80
84
  - name: Upload wheels
@@ -103,7 +107,7 @@ jobs:
103
107
  uses: PyO3/maturin-action@v1
104
108
  with:
105
109
  target: ${{ matrix.platform.target }}
106
- args: --release --out dist --find-interpreter
110
+ args: --release --out dist --find-interpreter --features=python
107
111
  sccache: 'true'
108
112
  - name: Upload wheels
109
113
  uses: actions/upload-artifact@v4
@@ -130,7 +134,7 @@ jobs:
130
134
  uses: PyO3/maturin-action@v1
131
135
  with:
132
136
  target: ${{ matrix.platform.target }}
133
- args: --release --out dist --find-interpreter
137
+ args: --release --out dist --find-interpreter --features=python
134
138
  sccache: 'true'
135
139
  - name: Upload wheels
136
140
  uses: actions/upload-artifact@v4
@@ -157,7 +161,7 @@ jobs:
157
161
  name: Release
158
162
  runs-on: ubuntu-latest
159
163
  #if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
160
- needs: [linux, musllinux, windows, macos, sdist]
164
+ needs: [linux, musllinux, windows, macos, sdist, test]
161
165
  permissions:
162
166
  # Use to sign the release artifacts
163
167
  id-token: write
@@ -0,0 +1,29 @@
1
+ name: release_rust
2
+
3
+ permissions:
4
+ pull-requests: write
5
+ contents: write
6
+
7
+ on:
8
+ push:
9
+ branches:
10
+ - release
11
+
12
+ jobs:
13
+
14
+ test:
15
+ uses: ./.github/workflows/test_rust.yml
16
+
17
+ release:
18
+ name: Release
19
+ runs-on: ubuntu-latest
20
+ needs: [test]
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@v4
24
+ - name: Check semver
25
+ uses: obi1kenobi/cargo-semver-checks-action@v2
26
+ - name: Publish
27
+ env:
28
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
29
+ run: cargo publish
@@ -0,0 +1,50 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
+
4
+ name: test_python
5
+
6
+ on:
7
+ # push: [] # Save time on actions
8
+ pull_request: []
9
+ workflow_dispatch:
10
+ tag: "Manual Run"
11
+ workflow_call:
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-22.04
16
+ timeout-minutes: 15
17
+ strategy:
18
+ matrix:
19
+ python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
20
+
21
+ steps:
22
+
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Install Rust toolchain
26
+ uses: dtolnay/rust-toolchain@stable
27
+
28
+ - name: Install uv
29
+ uses: astral-sh/setup-uv@v5
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+
33
+ - name: Test
34
+ run: |
35
+ # Install with dev deps
36
+ uv venv
37
+ source .venv/bin/activate
38
+
39
+ uv pip install maturin
40
+ # uv run --locked maturin develop --features=python
41
+ uv pip install .[dev]
42
+
43
+ # Python lint, test, and coverage
44
+ uv run --locked ruff check ./cfsem
45
+ uv run --locked pyright ./cfsem --pythonversion 3.11
46
+ uv run --locked coverage run --source=./cfsem -m pytest ./test/
47
+ uv run --locked coverage report
48
+
49
+ # Build docs
50
+ sh build_docs.sh
@@ -0,0 +1,29 @@
1
+ name: test_rust
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [ "*" ]
6
+ push:
7
+ branches: [ "main", "develop", "release" ]
8
+ workflow_call:
9
+
10
+ env:
11
+ CARGO_TERM_COLOR: always
12
+
13
+ jobs:
14
+ build:
15
+
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - name: Install Rust toolchain
21
+ uses: dtolnay/rust-toolchain@stable
22
+ - name: Format
23
+ run: cargo fmt --check --verbose
24
+ - name: Lint
25
+ run: cargo clippy
26
+ - name: Build
27
+ run: cargo build --verbose
28
+ - name: Run tests
29
+ run: cargo test --verbose
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.3 2025-07-07
4
+
5
+ ### Changed
6
+
7
+ * Configure linter to be slightly more strict
8
+ * Format and resolve new lints
9
+
10
+ ## 2.4.2 2025-06-16
11
+
12
+ ### Changed
13
+
14
+ * Include pyo3 extension-module feature to resolve build issues on linux
15
+
16
+ ## 2.4.1 2025-06-16
17
+
18
+ ### Changed
19
+
20
+ * Update release workflow
21
+
22
+ ## 2.4.0 2025-06-13
23
+
24
+ ### Changed
25
+
26
+ * Merge with rust library
27
+ * Update type hints for symmetric bindings
28
+ * Synchronize rust and python library versions
29
+
3
30
  ## 2.3.1 2025-03-19
4
31
 
5
32
  ### Changed
@@ -0,0 +1,82 @@
1
+ # Changelog
2
+
3
+ ## 2.4.3 2025-07-07
4
+
5
+ ### Changed
6
+
7
+ * No changes to rust side; version roll for lock-step versioning with python
8
+
9
+ ## 2.4.2 2025-06-16
10
+
11
+ ### Changed
12
+
13
+ * Include pyo3 extension-module feature to resolve build issues on linux
14
+
15
+ ## 2.4.1 2025-06-16
16
+
17
+ ### Changed
18
+
19
+ * Update release workflow
20
+
21
+ ## 2.4.0 2025-06-13
22
+
23
+ ### Changed
24
+
25
+ * Merge library with python bindings by adding `python` feature gate in front of bindings module
26
+ * Synchronize rust and python library versions
27
+ * Update license to MIT only for compatibility with combined Python library
28
+ * Update release workflow to use cargo-semver-checks action directly
29
+
30
+ ## 2.0.0 2025-02-03
31
+
32
+ ### Added
33
+
34
+ * Add libm dep for reproducible trig functions
35
+ * Rust std/core defers to libc or other platform-dependent math libraries for trig functions, which can cause platform-dependent results
36
+ * libm is a pure rust implementation of most functions from MUSL libm, and is platform-independent to the extent that the processor's implementation of floating point math conforms to IEEE-754
37
+ * Add scalar calculations of vector potential, magnetic field, and poloidal flux of a circular filament extracted from vector loop
38
+ * Scalar calculations now used as the inner function in the vector loops
39
+ * This produces no performance regression, and some improvements in a few cases, while improving readability by separating physics from array handling
40
+ * Add `mutual_inductance_circular_to_linear` family of functions for calculating mutual inductance between circular filaments and piecewise-linear paths
41
+ * Add `flux_density_circular_filament_cartesian` family of functions for calculating B-field from circular filaments to points in cartesian coordinates
42
+ * Add `cartesian_to_cylindrical` and `cylindrical_to_cartesian` conversion functions
43
+ * Add `decompose_filament` function for converting the start and end points of a filament to the midpoint and length vector
44
+ * Add `body_force_density_linear_filament` and `body_force_density_circular_filament_cartesian` families of functions for calculating JxB force density
45
+ * Add `mesh_filament` module and `mesh_edge_inductance` function for calculating full inductance matrix over a collection of disjoint segments
46
+ * Same throughput perf as linear filament inductance for a given input geometry, but allocates for the full NxM output matrix
47
+ * doc(hidden) for now, as the API is likely to change in the near future to avoid reallocating input data
48
+ * Add `point_source` module with dipole field
49
+ * Add (internal) `testing` module with array-handling utilities for tests
50
+ * Add (internal) macros for checking slice lengths
51
+
52
+ ### Changed
53
+
54
+ * Use `Slice::fill(0.0)` instead of manually zeroing output arrays
55
+ * Use macro for checking array lengths to reduce repeated code
56
+ * !Consolidate function signatures of circular filament calcs to reduce number of args and group args by physical association
57
+
58
+ # Changelog
59
+
60
+ ## 1.1.0 2024-08-20
61
+
62
+ ### Added
63
+
64
+ * Add vector potential calcs for linear and circular filaments w/ parallel variants
65
+ * Add parallel variants of circular filament flux and flux density calcs
66
+ * Add tests of serial and parallel variants to make sure they produce the same result
67
+ * Add tests of equivalence between flux/inductance, flux density, and vector potential calcs
68
+
69
+ ### Changed
70
+
71
+ * Move Biot-Savart calcs to linear filament module and rename appropriately
72
+ * Leave use-as references to prevent breaking change to API
73
+ * Eliminate small allocations from parallel variant of Biot-Savart to reduce overhead when running with a large number of cores
74
+ * 40%-100% speedup for small numbers of observation points
75
+ * Defensively zero-out output slices
76
+ * Convert some `#[inline(always)]` directives to plain `#[inline]`
77
+
78
+ ## 1.0.0 2024-07-09
79
+
80
+ ### Added
81
+
82
+ * Initial release