cfsem 2.2.0__tar.gz → 2.4.2__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 (65) hide show
  1. cfsem-2.2.0/.github/workflows/CI.yml → cfsem-2.4.2/.github/workflows/release_python.yml +14 -10
  2. cfsem-2.4.2/.github/workflows/release_rust.yml +29 -0
  3. cfsem-2.4.2/.github/workflows/test_python.yml +50 -0
  4. cfsem-2.4.2/.github/workflows/test_rust.yml +29 -0
  5. cfsem-2.2.0/CHANGELOG.md → cfsem-2.4.2/CHANGELOG_PYTHON.md +33 -0
  6. cfsem-2.4.2/CHANGELOG_RUST.md +76 -0
  7. cfsem-2.4.2/Cargo.lock +917 -0
  8. cfsem-2.4.2/Cargo.toml +56 -0
  9. {cfsem-2.2.0 → cfsem-2.4.2}/LICENSE +1 -1
  10. {cfsem-2.2.0 → cfsem-2.4.2}/PKG-INFO +31 -10
  11. {cfsem-2.2.0 → cfsem-2.4.2}/README.md +24 -6
  12. cfsem-2.4.2/benches/circular_filament.rs +242 -0
  13. cfsem-2.4.2/benches/linear_filament.rs +189 -0
  14. {cfsem-2.2.0 → cfsem-2.4.2}/cfsem/__init__.py +1 -1
  15. {cfsem-2.2.0 → cfsem-2.4.2}/cfsem/bindings.py +21 -21
  16. cfsem-2.4.2/katex-header.html +18 -0
  17. {cfsem-2.2.0 → cfsem-2.4.2}/pyproject.toml +6 -6
  18. cfsem-2.4.2/src/lib.rs +87 -0
  19. cfsem-2.4.2/src/math.rs +139 -0
  20. cfsem-2.4.2/src/mesh.rs +320 -0
  21. cfsem-2.4.2/src/physics/biotsavart.rs +7 -0
  22. cfsem-2.4.2/src/physics/circular_filament.rs +1312 -0
  23. cfsem-2.4.2/src/physics/gradshafranov.rs +243 -0
  24. cfsem-2.4.2/src/physics/linear_filament.rs +896 -0
  25. cfsem-2.4.2/src/physics/mesh_filament.rs +153 -0
  26. cfsem-2.4.2/src/physics/mod.rs +11 -0
  27. cfsem-2.4.2/src/physics/point_source.rs +205 -0
  28. cfsem-2.2.0/src/lib.rs → cfsem-2.4.2/src/python.rs +2 -5
  29. cfsem-2.4.2/src/testing.rs +183 -0
  30. cfsem-2.4.2/uv.lock +2070 -0
  31. cfsem-2.2.0/.github/workflows/actions.yml +0 -64
  32. cfsem-2.2.0/Cargo.lock +0 -427
  33. cfsem-2.2.0/Cargo.toml +0 -27
  34. {cfsem-2.2.0 → cfsem-2.4.2}/.cargo/config.toml +0 -0
  35. {cfsem-2.2.0 → cfsem-2.4.2}/.gitignore +0 -0
  36. {cfsem-2.2.0 → cfsem-2.4.2}/.readthedocs.yml +0 -0
  37. {cfsem-2.2.0 → cfsem-2.4.2}/CONTRIBUTING.md +0 -0
  38. {cfsem-2.2.0 → cfsem-2.4.2}/build_docs.sh +0 -0
  39. {cfsem-2.2.0 → cfsem-2.4.2}/cfsem/py.typed +0 -0
  40. {cfsem-2.2.0 → cfsem-2.4.2}/cfsem/types.py +0 -0
  41. {cfsem-2.2.0 → cfsem-2.4.2}/docs/assets/logo.svg +0 -0
  42. {cfsem-2.2.0 → cfsem-2.4.2}/docs/index.md +0 -0
  43. {cfsem-2.2.0 → cfsem-2.4.2}/docs/javascripts/mathjax.js +0 -0
  44. {cfsem-2.2.0 → cfsem-2.4.2}/docs/python/example_outputs/.placeholder +0 -0
  45. {cfsem-2.2.0 → cfsem-2.4.2}/docs/python/examples.md +0 -0
  46. {cfsem-2.2.0 → cfsem-2.4.2}/docs/python/filament.md +0 -0
  47. {cfsem-2.2.0 → cfsem-2.4.2}/docs/python/flux_density.md +0 -0
  48. {cfsem-2.2.0 → cfsem-2.4.2}/docs/python/force.md +0 -0
  49. {cfsem-2.2.0 → cfsem-2.4.2}/docs/python/grad_shafranov.md +0 -0
  50. {cfsem-2.2.0 → cfsem-2.4.2}/docs/python/inductance.md +0 -0
  51. {cfsem-2.2.0 → cfsem-2.4.2}/docs/python/math.md +0 -0
  52. {cfsem-2.2.0 → cfsem-2.4.2}/docs/python/types.md +0 -0
  53. {cfsem-2.2.0 → cfsem-2.4.2}/docs/python/vector_potential.md +0 -0
  54. {cfsem-2.2.0 → cfsem-2.4.2}/docs/requirements.txt +0 -0
  55. {cfsem-2.2.0 → cfsem-2.4.2}/docs/stylesheets/extra.css +0 -0
  56. {cfsem-2.2.0 → cfsem-2.4.2}/examples/helmholtz.py +0 -0
  57. {cfsem-2.2.0 → cfsem-2.4.2}/examples/inductance.py +0 -0
  58. {cfsem-2.2.0 → cfsem-2.4.2}/mkdocs.yml +0 -0
  59. {cfsem-2.2.0 → cfsem-2.4.2}/test/__init__.py +0 -0
  60. {cfsem-2.2.0 → cfsem-2.4.2}/test/test_electromagnetics.py +0 -0
  61. {cfsem-2.2.0 → cfsem-2.4.2}/test/test_examples.py +0 -0
  62. {cfsem-2.2.0 → cfsem-2.4.2}/test/test_filaments.py +0 -0
  63. {cfsem-2.2.0 → cfsem-2.4.2}/test/test_funcs.py +0 -0
  64. {cfsem-2.2.0 → cfsem-2.4.2}/test/test_gradshafranov.py +0 -0
  65. {cfsem-2.2.0 → cfsem-2.4.2}/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,11 +15,15 @@ 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:
21
25
  matrix:
22
- python-version: ['3.9', '3.10', '3.11', '3.12']
26
+ python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
23
27
  platform:
24
28
  - runner: ubuntu-22.04
25
29
  target: x86_64
@@ -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
@@ -55,7 +59,7 @@ jobs:
55
59
  runs-on: ${{ matrix.platform.runner }}
56
60
  strategy:
57
61
  matrix:
58
- python-version: ['3.9', '3.10', '3.11', '3.12']
62
+ python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
59
63
  platform:
60
64
  - runner: ubuntu-22.04
61
65
  target: x86_64
@@ -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
@@ -87,7 +91,7 @@ jobs:
87
91
  runs-on: ${{ matrix.platform.runner }}
88
92
  strategy:
89
93
  matrix:
90
- python-version: ['3.9', '3.10', '3.11', '3.12']
94
+ python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
91
95
  platform:
92
96
  - runner: windows-latest
93
97
  target: x64
@@ -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
@@ -115,7 +119,7 @@ jobs:
115
119
  runs-on: ${{ matrix.platform.runner }}
116
120
  strategy:
117
121
  matrix:
118
- python-version: ['3.9', '3.10', '3.11', '3.12']
122
+ python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
119
123
  platform:
120
124
  - runner: macos-13
121
125
  target: x86_64
@@ -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,38 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.2 2025-06-16
4
+
5
+ ### Changed
6
+
7
+ * Include pyo3 extension-module feature to resolve build issues on linux
8
+
9
+ ## 2.4.1 2025-06-16
10
+
11
+ ### Changed
12
+
13
+ * Update release workflow
14
+
15
+ ## 2.4.0 2025-06-13
16
+
17
+ ### Changed
18
+
19
+ * Merge with rust library
20
+ * Update type hints for symmetric bindings
21
+ * Synchronize rust and python library versions
22
+
23
+ ## 2.3.1 2025-03-19
24
+
25
+ ### Changed
26
+
27
+ * Update rust to 2024 edition
28
+ * Update pyo3 rust dep version to resolve conditional compilation issue in build for linux arm/aarch64
29
+
30
+ ## 2.3.0 2025-03-19
31
+
32
+ ### Added
33
+
34
+ * Add support for python 3.13
35
+
3
36
  ## 2.2.0 2025-02-03
4
37
 
5
38
  ### Added
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ ## 2.4.2 2025-06-16
4
+
5
+ ### Changed
6
+
7
+ * Include pyo3 extension-module feature to resolve build issues on linux
8
+
9
+ ## 2.4.1 2025-06-16
10
+
11
+ ### Changed
12
+
13
+ * Update release workflow
14
+
15
+ ## 2.4.0 2025-06-13
16
+
17
+ ### Changed
18
+
19
+ * Merge library with python bindings by adding `python` feature gate in front of bindings module
20
+ * Synchronize rust and python library versions
21
+ * Update license to MIT only for compatibility with combined Python library
22
+ * Update release workflow to use cargo-semver-checks action directly
23
+
24
+ ## 2.0.0 2025-02-03
25
+
26
+ ### Added
27
+
28
+ * Add libm dep for reproducible trig functions
29
+ * Rust std/core defers to libc or other platform-dependent math libraries for trig functions, which can cause platform-dependent results
30
+ * 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
31
+ * Add scalar calculations of vector potential, magnetic field, and poloidal flux of a circular filament extracted from vector loop
32
+ * Scalar calculations now used as the inner function in the vector loops
33
+ * This produces no performance regression, and some improvements in a few cases, while improving readability by separating physics from array handling
34
+ * Add `mutual_inductance_circular_to_linear` family of functions for calculating mutual inductance between circular filaments and piecewise-linear paths
35
+ * Add `flux_density_circular_filament_cartesian` family of functions for calculating B-field from circular filaments to points in cartesian coordinates
36
+ * Add `cartesian_to_cylindrical` and `cylindrical_to_cartesian` conversion functions
37
+ * Add `decompose_filament` function for converting the start and end points of a filament to the midpoint and length vector
38
+ * Add `body_force_density_linear_filament` and `body_force_density_circular_filament_cartesian` families of functions for calculating JxB force density
39
+ * Add `mesh_filament` module and `mesh_edge_inductance` function for calculating full inductance matrix over a collection of disjoint segments
40
+ * Same throughput perf as linear filament inductance for a given input geometry, but allocates for the full NxM output matrix
41
+ * doc(hidden) for now, as the API is likely to change in the near future to avoid reallocating input data
42
+ * Add `point_source` module with dipole field
43
+ * Add (internal) `testing` module with array-handling utilities for tests
44
+ * Add (internal) macros for checking slice lengths
45
+
46
+ ### Changed
47
+
48
+ * Use `Slice::fill(0.0)` instead of manually zeroing output arrays
49
+ * Use macro for checking array lengths to reduce repeated code
50
+ * !Consolidate function signatures of circular filament calcs to reduce number of args and group args by physical association
51
+
52
+ # Changelog
53
+
54
+ ## 1.1.0 2024-08-20
55
+
56
+ ### Added
57
+
58
+ * Add vector potential calcs for linear and circular filaments w/ parallel variants
59
+ * Add parallel variants of circular filament flux and flux density calcs
60
+ * Add tests of serial and parallel variants to make sure they produce the same result
61
+ * Add tests of equivalence between flux/inductance, flux density, and vector potential calcs
62
+
63
+ ### Changed
64
+
65
+ * Move Biot-Savart calcs to linear filament module and rename appropriately
66
+ * Leave use-as references to prevent breaking change to API
67
+ * Eliminate small allocations from parallel variant of Biot-Savart to reduce overhead when running with a large number of cores
68
+ * 40%-100% speedup for small numbers of observation points
69
+ * Defensively zero-out output slices
70
+ * Convert some `#[inline(always)]` directives to plain `#[inline]`
71
+
72
+ ## 1.0.0 2024-07-09
73
+
74
+ ### Added
75
+
76
+ * Initial release