OpenMagneticsVirtualBuilder 1.0.0__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.
- openmagneticsvirtualbuilder-1.0.0/.github/workflows/publish.yml +163 -0
- openmagneticsvirtualbuilder-1.0.0/.gitignore +40 -0
- openmagneticsvirtualbuilder-1.0.0/AGENTS.md +148 -0
- openmagneticsvirtualbuilder-1.0.0/CMakeLists.txt +492 -0
- openmagneticsvirtualbuilder-1.0.0/PKG-INFO +360 -0
- openmagneticsvirtualbuilder-1.0.0/PLAN.md +105 -0
- openmagneticsvirtualbuilder-1.0.0/README.md +345 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/python/.gitignore +3 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/python/mvbpp_python.cpp +640 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/python/tests/ETD49_N87_10uH_5T.json +1540 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/python/tests/concentric_basic.json +92 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/python/tests/conftest.py +1 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/python/tests/test_mvbpp.py +361 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/wasm/.gitignore +4 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/wasm/CMakeLists.txt +319 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/wasm/MvbMeshWasm.cmake +114 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/wasm/mmg_wasm_patch.cmake +17 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/wasm/mvbpp_wasm.cpp +1163 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/wasm/tests/mesh_magnetic_node.js +24 -0
- openmagneticsvirtualbuilder-1.0.0/bindings/wasm/tests/test_mvbpp.js +499 -0
- openmagneticsvirtualbuilder-1.0.0/cmake/BuildRev.cmake +46 -0
- openmagneticsvirtualbuilder-1.0.0/cmake/MkfCheckout.cmake +34 -0
- openmagneticsvirtualbuilder-1.0.0/cmake/MvbMesh.cmake +171 -0
- openmagneticsvirtualbuilder-1.0.0/cmake/msvc_windows_macros.h +27 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/BaseBuilder.h +70 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/BobbinBuilder.h +40 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/ConductorBuilder.h +383 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/FR4Builder.h +45 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/MagneticBuilder.h +390 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/NamedShape.h +103 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/PinBuilder.h +46 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/PortPlane.h +65 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/ProjectionDrawing.h +64 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/SectionBuilder.h +51 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/SectionDrawing.h +78 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/ShuntBuilder.h +75 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/SpacerBuilder.h +56 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/StepExporter.h +61 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/Symmetry.h +116 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/TerminalFillet.h +100 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/TurnBuilder.h +95 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/Utils.h +147 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/WireAssembler.h +323 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/mesh/Mesh2d.h +20 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/mesh/Mesh3d.h +19 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/mesh/MeshOptions.h +60 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/mesh/MeshRecipe.h +49 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/mesh/MeshSupport.h +66 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/mesh/Mesher.h +140 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/mesh/SizeField.h +167 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/mesh/StepAudit.h +32 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeBuilder.h +67 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeC.h +11 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeDrum.h +21 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeDrumRing.h +24 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeDrumSemishielded.h +33 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeE.h +17 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeEc.h +14 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeEp.h +25 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeEpx.h +15 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeEr.h +18 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeLp.h +14 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeMolded.h +36 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeP.h +21 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapePQ.h +14 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapePm.h +20 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeRM.h +14 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeSlab.h +44 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeT.h +17 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeU.h +20 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeUr.h +21 -0
- openmagneticsvirtualbuilder-1.0.0/include/mvb/shapes/ShapeUt.h +18 -0
- openmagneticsvirtualbuilder-1.0.0/pyproject.toml +94 -0
- openmagneticsvirtualbuilder-1.0.0/scripts/batch_generate_steps.py +101 -0
- openmagneticsvirtualbuilder-1.0.0/scripts/generate_mvb_bobbins.py +97 -0
- openmagneticsvirtualbuilder-1.0.0/scripts/sweep_real_steps.sh +180 -0
- openmagneticsvirtualbuilder-1.0.0/src/BaseBuilder.cpp +196 -0
- openmagneticsvirtualbuilder-1.0.0/src/BobbinBuilder.cpp +348 -0
- openmagneticsvirtualbuilder-1.0.0/src/ConductorBuilder.cpp +18624 -0
- openmagneticsvirtualbuilder-1.0.0/src/FR4Builder.cpp +230 -0
- openmagneticsvirtualbuilder-1.0.0/src/MagneticBuilder.cpp +1774 -0
- openmagneticsvirtualbuilder-1.0.0/src/PinBuilder.cpp +125 -0
- openmagneticsvirtualbuilder-1.0.0/src/ProjectionDrawing.cpp +156 -0
- openmagneticsvirtualbuilder-1.0.0/src/SectionBuilder.cpp +341 -0
- openmagneticsvirtualbuilder-1.0.0/src/SectionDrawing.cpp +1039 -0
- openmagneticsvirtualbuilder-1.0.0/src/ShuntBuilder.cpp +263 -0
- openmagneticsvirtualbuilder-1.0.0/src/SpacerBuilder.cpp +122 -0
- openmagneticsvirtualbuilder-1.0.0/src/StepExporter.cpp +696 -0
- openmagneticsvirtualbuilder-1.0.0/src/Symmetry.cpp +441 -0
- openmagneticsvirtualbuilder-1.0.0/src/TerminalFillet.cpp +1134 -0
- openmagneticsvirtualbuilder-1.0.0/src/TurnBuilder.cpp +1246 -0
- openmagneticsvirtualbuilder-1.0.0/src/Utils.cpp +636 -0
- openmagneticsvirtualbuilder-1.0.0/src/WireAssembler.cpp +5230 -0
- openmagneticsvirtualbuilder-1.0.0/src/mesh/Mesh2d.cpp +930 -0
- openmagneticsvirtualbuilder-1.0.0/src/mesh/Mesh3d.cpp +2768 -0
- openmagneticsvirtualbuilder-1.0.0/src/mesh/MeshIO.cpp +947 -0
- openmagneticsvirtualbuilder-1.0.0/src/mesh/MeshParts.cpp +203 -0
- openmagneticsvirtualbuilder-1.0.0/src/mesh/MeshRecipe.cpp +175 -0
- openmagneticsvirtualbuilder-1.0.0/src/mesh/MeshSupport.cpp +320 -0
- openmagneticsvirtualbuilder-1.0.0/src/mesh/Mesher.cpp +213 -0
- openmagneticsvirtualbuilder-1.0.0/src/mesh/SizeField.cpp +639 -0
- openmagneticsvirtualbuilder-1.0.0/src/mesh/StepAudit.cpp +587 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/Factory.cpp +122 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeBuilder.cpp +141 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeDrum.cpp +83 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeDrumRing.cpp +46 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeDrumSemishielded.cpp +55 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeE.cpp +182 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeEc.cpp +36 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeEp.cpp +119 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeEpx.cpp +102 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeEr.cpp +99 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeLp.cpp +26 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeMolded.cpp +86 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeP.cpp +121 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapePQ.cpp +136 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapePm.cpp +95 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeRM.cpp +125 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeSlab.cpp +96 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeT.cpp +36 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeU.cpp +99 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeUr.cpp +182 -0
- openmagneticsvirtualbuilder-1.0.0/src/shapes/ShapeUt.cpp +74 -0
- openmagneticsvirtualbuilder-1.0.0/tools/dump_turns.cpp +53 -0
- openmagneticsvirtualbuilder-1.0.0/tools/generate_mvbpp_bobbins.cpp +184 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_anisotest.cpp +79 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_cadbench.cpp +233 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_faceknots.cpp +150 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_fitprobe.cpp +128 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_foilspike.cpp +111 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_mesh_diff.cpp +33 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_mesh_export.cpp +81 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_mesh_magnetic.cpp +83 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_mesh_roundtrip.cpp +123 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_meshheal.cpp +149 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_meshslice.cpp +83 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_mmgadapt.cpp +174 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_paint2d.cpp +131 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_pathprobe.cpp +116 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_section.cpp +113 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_selfint_probe.cpp +262 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_skinlayer.cpp +833 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_solidstats.cpp +193 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_step_generator.cpp +394 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_step_intersect.cpp +75 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_step_probe.cpp +239 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_stepcheck.cpp +1371 -0
- openmagneticsvirtualbuilder-1.0.0/tools/mvbpp_stepheal.cpp +518 -0
- openmagneticsvirtualbuilder-1.0.0/tools/omfem_follow_mvbpp.sh +119 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
name: Build and publish the Python package
|
|
2
|
+
|
|
3
|
+
# Builds the ONE Python package of MVB++ (PyPI: OpenMagneticsVirtualBuilder, module `mvbpp`)
|
|
4
|
+
# for Linux, Windows and macOS, and publishes it.
|
|
5
|
+
# - a pushed tag vX.Y.Z -> PyPI (the tag must equal pyproject's version)
|
|
6
|
+
# - workflow_dispatch -> TestPyPI, unless publish_to_pypi is ticked
|
|
7
|
+
# Needs the secrets PYPI_API_TOKEN / TEST_PYPI_API_TOKEN, scoped to OpenMagneticsVirtualBuilder.
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
push:
|
|
11
|
+
tags: ['v*']
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
inputs:
|
|
14
|
+
publish_to_pypi:
|
|
15
|
+
description: 'Publish to the real PyPI instead of TestPyPI'
|
|
16
|
+
required: false
|
|
17
|
+
default: false
|
|
18
|
+
type: boolean
|
|
19
|
+
os:
|
|
20
|
+
description: 'Build wheels only on this runner (to re-test one platform without paying for the others)'
|
|
21
|
+
required: false
|
|
22
|
+
default: 'all'
|
|
23
|
+
type: choice
|
|
24
|
+
options: [all, ubuntu-22.04, windows-2022, macos-15]
|
|
25
|
+
|
|
26
|
+
env:
|
|
27
|
+
GIT_LFS_SKIP_SMUDGE: 1
|
|
28
|
+
OCCT_CACHE_KEY: occt-7.9.3-static-v1
|
|
29
|
+
|
|
30
|
+
jobs:
|
|
31
|
+
check_version:
|
|
32
|
+
name: Tag matches pyproject version
|
|
33
|
+
runs-on: ubuntu-22.04
|
|
34
|
+
if: github.event_name != 'workflow_dispatch'
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: actions/setup-python@v5 # tomllib needs Python >= 3.11; the runner's system Python is 3.10
|
|
38
|
+
with:
|
|
39
|
+
python-version: '3.12'
|
|
40
|
+
- name: Compare
|
|
41
|
+
shell: bash
|
|
42
|
+
run: |
|
|
43
|
+
tag="${GITHUB_REF_NAME#v}"
|
|
44
|
+
ver=$(python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
45
|
+
if [ "$tag" != "$ver" ]; then
|
|
46
|
+
echo "::error::tag v$tag does not match pyproject version $ver"; exit 1
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# One job per OS builds every CPython version in turn, so OCCT (~20+ min) is built once per job
|
|
50
|
+
# and reused by every version (CMake reuses a complete OCCT install). On Windows and macOS the install is also
|
|
51
|
+
# cached across runs; on Linux it lives inside the manylinux container, which cibuildwheel does
|
|
52
|
+
# not copy back to the runner, so Linux builds it once per run.
|
|
53
|
+
build_wheels:
|
|
54
|
+
name: Wheels on ${{ matrix.os }}
|
|
55
|
+
runs-on: ${{ matrix.os }}
|
|
56
|
+
timeout-minutes: 360
|
|
57
|
+
strategy:
|
|
58
|
+
fail-fast: false
|
|
59
|
+
matrix:
|
|
60
|
+
os: ${{ fromJSON((github.event_name == 'workflow_dispatch' && inputs.os != 'all') && format('["{0}"]', inputs.os) || '["ubuntu-22.04","windows-2022","macos-15"]') }}
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
|
|
64
|
+
- name: Free disk space (Linux)
|
|
65
|
+
if: runner.os == 'Linux'
|
|
66
|
+
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
|
|
67
|
+
|
|
68
|
+
- uses: actions/setup-python@v5
|
|
69
|
+
with:
|
|
70
|
+
python-version: '3.12'
|
|
71
|
+
|
|
72
|
+
# MKF fetches Kirchhoff, whose PSMA submodules (RAS, SAS, TAS, AAS, ...) have SSH URLs; the
|
|
73
|
+
# runners have no SSH key, so clone them over HTTPS. (The Linux container sets the same
|
|
74
|
+
# rewrite in its before-all, since it does not see the runner's git config.)
|
|
75
|
+
- name: Clone GitHub submodules over HTTPS
|
|
76
|
+
shell: bash
|
|
77
|
+
run: git config --global url."https://github.com/".insteadOf "git@github.com:"
|
|
78
|
+
|
|
79
|
+
- uses: actions/setup-node@v4
|
|
80
|
+
with:
|
|
81
|
+
node-version: '20'
|
|
82
|
+
|
|
83
|
+
# Restore and save are separate steps so a built OCCT is saved even when a later step fails
|
|
84
|
+
# (actions/cache saves only on job success, so every failed Windows job rebuilt OCCT, ~40 min).
|
|
85
|
+
- name: Restore OCCT install
|
|
86
|
+
id: occt_cache
|
|
87
|
+
if: runner.os != 'Linux'
|
|
88
|
+
uses: actions/cache/restore@v4
|
|
89
|
+
with:
|
|
90
|
+
path: .occt-install
|
|
91
|
+
key: ${{ env.OCCT_CACHE_KEY }}-${{ runner.os }}
|
|
92
|
+
|
|
93
|
+
- name: Point the build at the OCCT install
|
|
94
|
+
shell: bash
|
|
95
|
+
run: |
|
|
96
|
+
ws=$(python -c "import os;print(os.environ['GITHUB_WORKSPACE'].replace('\\\\','/'))")
|
|
97
|
+
echo "CIBW_ENVIRONMENT_LINUX=CMAKE_BUILD_PARALLEL_LEVEL=2 SKBUILD_CMAKE_DEFINE=\"OCCT_PREFIX=/opt/occt-install\"" >> "$GITHUB_ENV"
|
|
98
|
+
echo "CIBW_ENVIRONMENT_MACOS=MACOSX_DEPLOYMENT_TARGET=14.0 CMAKE_BUILD_PARALLEL_LEVEL=3 SKBUILD_CMAKE_DEFINE=\"OCCT_PREFIX=$ws/.occt-install\"" >> "$GITHUB_ENV"
|
|
99
|
+
echo "CIBW_ENVIRONMENT_WINDOWS=CMAKE_BUILD_PARALLEL_LEVEL=1 SKBUILD_CMAKE_DEFINE=\"OCCT_PREFIX=$ws/.occt-install\"" >> "$GITHUB_ENV"
|
|
100
|
+
|
|
101
|
+
- name: Build and test wheels
|
|
102
|
+
run: |
|
|
103
|
+
python -m pip install cibuildwheel==4.2.0
|
|
104
|
+
python -m cibuildwheel --output-dir wheelhouse
|
|
105
|
+
|
|
106
|
+
- name: Save OCCT install
|
|
107
|
+
# Only a complete install (the last toolkit in OCCT_ESSENTIAL_LIBS present), only on a cache miss.
|
|
108
|
+
if: always() && runner.os != 'Linux' && steps.occt_cache.outputs.cache-hit != 'true' && hashFiles('.occt-install/lib/*TKDEVRML*') != ''
|
|
109
|
+
uses: actions/cache/save@v4
|
|
110
|
+
with:
|
|
111
|
+
path: .occt-install
|
|
112
|
+
key: ${{ env.OCCT_CACHE_KEY }}-${{ runner.os }}
|
|
113
|
+
|
|
114
|
+
- uses: actions/upload-artifact@v4
|
|
115
|
+
with:
|
|
116
|
+
name: wheels-${{ matrix.os }}
|
|
117
|
+
path: wheelhouse/*.whl
|
|
118
|
+
|
|
119
|
+
build_sdist:
|
|
120
|
+
name: Source distribution
|
|
121
|
+
runs-on: ubuntu-22.04
|
|
122
|
+
steps:
|
|
123
|
+
- uses: actions/checkout@v4
|
|
124
|
+
- uses: actions/setup-python@v5
|
|
125
|
+
with:
|
|
126
|
+
python-version: '3.12'
|
|
127
|
+
- run: |
|
|
128
|
+
python -m pip install build
|
|
129
|
+
python -m build --sdist
|
|
130
|
+
- uses: actions/upload-artifact@v4
|
|
131
|
+
with:
|
|
132
|
+
name: sdist
|
|
133
|
+
path: dist/*.tar.gz
|
|
134
|
+
|
|
135
|
+
publish:
|
|
136
|
+
name: Publish
|
|
137
|
+
needs: [check_version, build_wheels, build_sdist]
|
|
138
|
+
# check_version is skipped on workflow_dispatch; a skipped need still lets this run.
|
|
139
|
+
# A single-platform manual run never publishes: the release must carry every wheel.
|
|
140
|
+
if: always() && needs.build_wheels.result == 'success' && needs.build_sdist.result == 'success' && needs.check_version.result != 'failure' && (github.event_name != 'workflow_dispatch' || inputs.os == 'all')
|
|
141
|
+
runs-on: ubuntu-22.04
|
|
142
|
+
steps:
|
|
143
|
+
- uses: actions/download-artifact@v4
|
|
144
|
+
with:
|
|
145
|
+
path: dist
|
|
146
|
+
merge-multiple: true
|
|
147
|
+
|
|
148
|
+
- name: Publish to PyPI
|
|
149
|
+
if: github.event_name != 'workflow_dispatch' || inputs.publish_to_pypi
|
|
150
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
151
|
+
with:
|
|
152
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
153
|
+
skip-existing: true
|
|
154
|
+
packages-dir: dist/
|
|
155
|
+
|
|
156
|
+
- name: Publish to TestPyPI
|
|
157
|
+
if: github.event_name == 'workflow_dispatch' && !inputs.publish_to_pypi
|
|
158
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
159
|
+
with:
|
|
160
|
+
repository-url: https://test.pypi.org/legacy/
|
|
161
|
+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
162
|
+
skip-existing: true
|
|
163
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Build outputs
|
|
2
|
+
build/
|
|
3
|
+
Testing/
|
|
4
|
+
|
|
5
|
+
# Tool/editor caches
|
|
6
|
+
.cache/
|
|
7
|
+
.claude/
|
|
8
|
+
|
|
9
|
+
# Generated artifacts
|
|
10
|
+
mas_example_steps/
|
|
11
|
+
mas_example_steps_py/
|
|
12
|
+
bobbin_comparison/
|
|
13
|
+
*.step
|
|
14
|
+
*.stl
|
|
15
|
+
*.svg
|
|
16
|
+
*.png
|
|
17
|
+
# ...but keep the test reference fixtures
|
|
18
|
+
!tests/reference_steps/
|
|
19
|
+
!tests/reference_steps/*
|
|
20
|
+
|
|
21
|
+
# Local broken dir from an accidental `mkdir --help`
|
|
22
|
+
--help/
|
|
23
|
+
|
|
24
|
+
# External symlink (MVB's testData)
|
|
25
|
+
/testData
|
|
26
|
+
|
|
27
|
+
# Misc
|
|
28
|
+
gmon.out
|
|
29
|
+
|
|
30
|
+
__pycache__/
|
|
31
|
+
*.pyc
|
|
32
|
+
|
|
33
|
+
# Generated geometry galleries / demo renders (STEP+PNG+SVG, ~100 MB) -- outputs, not sources.
|
|
34
|
+
mas_step_gallery/
|
|
35
|
+
real_winding_demo/
|
|
36
|
+
|
|
37
|
+
# Python wheel build trees (pyproject build-dir)
|
|
38
|
+
build_python/
|
|
39
|
+
.occt-install/
|
|
40
|
+
wheelhouse/
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# AGENTS.md — MVB++
|
|
2
|
+
|
|
3
|
+
## What this is
|
|
4
|
+
|
|
5
|
+
C++23 library that builds 3D magnetic component geometry (cores, bobbins, turns) from MAS JSON using OpenCASCADE 7.9.3. Produces STEP/STL files and SVG dimensioned drawings. Has Python (pybind11) and WASM (Emscripten) bindings.
|
|
6
|
+
|
|
7
|
+
## Build
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Configure (fetches OCCT, MKF, MAS, nlohmann/json, Catch2 automatically)
|
|
11
|
+
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release
|
|
12
|
+
|
|
13
|
+
# Build library
|
|
14
|
+
cmake --build build --target mvb++ -j$(nproc)
|
|
15
|
+
|
|
16
|
+
# Build and run tests
|
|
17
|
+
cmake --build build --target mvb_tests -j$(nproc)
|
|
18
|
+
cd build && LD_LIBRARY_PATH=$PWD/occt-install/lib:$LD_LIBRARY_PATH ./mvb_tests
|
|
19
|
+
|
|
20
|
+
# Run specific test tags
|
|
21
|
+
./mvb_tests "[step][e]" # E core STEP comparison
|
|
22
|
+
./mvb_tests "[assembly][json]" # Full assembly tests
|
|
23
|
+
./mvb_tests "[symmetry]" # Symmetry analysis (can be slow)
|
|
24
|
+
./mvb_tests "[all_shapes]" # All MAS core shapes
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
First build takes ~10min (OCCT builds from source). Subsequent builds are fast.
|
|
28
|
+
|
|
29
|
+
### Python bindings
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install -e . # scikit-build-core + pybind11
|
|
33
|
+
pytest bindings/python/tests/ -v # requires installed mvbpp wheel
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### WASM bindings
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cd bindings/wasm
|
|
40
|
+
npm run build # requires emsdk (source ~/emsdk/emsdk_env.sh)
|
|
41
|
+
npm test
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Architecture
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
include/mvb/ Public headers (MagneticBuilder, Utils, Symmetry, StepExporter, etc.)
|
|
48
|
+
src/ Library implementation
|
|
49
|
+
src/shapes/ One builder per core shape family (ShapeE, ShapeT, ShapeEr, etc.)
|
|
50
|
+
tests/ Catch2 tests + reference STEPs
|
|
51
|
+
tools/ CLI utilities (step_generator, section, bobbin_generator)
|
|
52
|
+
bindings/python/ pybind11 Python module
|
|
53
|
+
bindings/wasm/ Emscripten WASM module
|
|
54
|
+
testData/ JSON test fixtures (MAS format)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Key types:
|
|
58
|
+
- `mvb::MagneticBuilder` — main entry point, builds core/bobbin/turns geometry
|
|
59
|
+
- `mvb::NamedShape` — shape + string name (survives symmetry cuts, STEP export)
|
|
60
|
+
- `mvb::StepExporter` — STEP/STL export with mm scaling
|
|
61
|
+
- `mvb::Symmetry` — symmetry plane detection and cutting
|
|
62
|
+
- `MAS::Magnetic` — deserialized MAS JSON (generated from schema)
|
|
63
|
+
- `OpenMagnetics::Magnetic` — MKF-enriched magnetic (has geometricalDescription)
|
|
64
|
+
|
|
65
|
+
## Coordinate conventions
|
|
66
|
+
|
|
67
|
+
- **Concentric cores** (E, T, U, etc.): profile in XY, extruded along Z, rotated -90° around X → column axis aligns with Y.
|
|
68
|
+
- **Toroidal cores**: profile in XY, extruded along Z, origin at toroid center.
|
|
69
|
+
- **Meters internally** — scale to mm only at STEP export (Python MVB exports in mm).
|
|
70
|
+
|
|
71
|
+
## Dependencies
|
|
72
|
+
|
|
73
|
+
All fetched via CMake FetchContent (no manual install needed):
|
|
74
|
+
- **OCCT 7.9.3** — built from source as ExternalProject (static)
|
|
75
|
+
- **MKF** — `OpenMagnetics::magnetic_autocomplete` enriches raw MAS JSON
|
|
76
|
+
- **MAS** — auto-generated C++ types from JSON schema
|
|
77
|
+
- **nlohmann/json v3.11.3**, **Catch2 v3.8.0**, **pybind11 v2.13.6**
|
|
78
|
+
|
|
79
|
+
MKF has submodules (`cci_coords`, `CAS`, `EAS`) that are auto-initialized during CMake configure.
|
|
80
|
+
|
|
81
|
+
## Code conventions
|
|
82
|
+
|
|
83
|
+
- C++23 required (`std::numbers::pi`, `std::optional`, etc.)
|
|
84
|
+
- `get_supported_families()` in `Utils.cpp` is implemented in `shapes/Factory.cpp` — derives from the factory switch, don't maintain a parallel list
|
|
85
|
+
- OCCT boolean ops (`BRepAlgoAPI_Cut`, `BRepAlgoAPI_Fuse`) must check `IsDone()` before calling `.Shape()` — null shapes propagate silently
|
|
86
|
+
- `MagneticBuilder::buildAllNamed(MAS::Magnetic)` skips MKF autocomplete when `geometricalDescription` is already present — use this for pre-enriched data
|
|
87
|
+
- `DrawConfig` struct in `MagneticBuilder.h` is the unified config for all bindings — prefer it over positional parameters
|
|
88
|
+
- `magnetic_autocomplete_safe` logs failures to `stderr` (not silent `catch(...)`) — check stderr when debugging enrichment issues
|
|
89
|
+
|
|
90
|
+
## Gotchas
|
|
91
|
+
|
|
92
|
+
### LD_LIBRARY_PATH required for tests
|
|
93
|
+
OCCT builds both static and shared libs. The test binary links shared by default:
|
|
94
|
+
```bash
|
|
95
|
+
LD_LIBRARY_PATH=build/occt-install/lib:$LD_LIBRARY_PATH ./mvb_tests
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### MAS schema enum casing (MAS 1.0)
|
|
99
|
+
MAS 1.0 changed all enum values to camelCase/lowercase. If you see `"Input JSON does not conform to schema!"`, check:
|
|
100
|
+
- `"two-piece set"` → `"twoPieceSet"` (CoreType)
|
|
101
|
+
- `"Wound"` → `"wound"` (WiringTechnology)
|
|
102
|
+
- `"inner or top"` → `"innerOrTop"` (CoilAlignment)
|
|
103
|
+
- `"outer or bottom"` → `"outerOrBottom"` (CoilAlignment)
|
|
104
|
+
|
|
105
|
+
Use `python3 MAS/scripts/migrate-to-1.0.py <file-or-dir>` to fix old JSON files.
|
|
106
|
+
|
|
107
|
+
### MKF SHARED→STATIC patching
|
|
108
|
+
CMakeLists.txt patches MKF's `add_library(MKF SHARED` → `STATIC` via string replace. If upstream MKF changes this string, the patch silently fails and you get link errors.
|
|
109
|
+
|
|
110
|
+
### MKF submodules
|
|
111
|
+
MKF needs `cci_coords`, `CAS`, `EAS` submodules. CMake auto-initializes them, but if you see `CAS.hpp: No such file or directory`, the submodule init failed. Run manually:
|
|
112
|
+
```bash
|
|
113
|
+
cd build/_deps/mkf-src && git submodule update --init cci_coords CAS EAS
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Symmetry/gapping tests can be slow
|
|
117
|
+
Boolean operations on complex shapes (PQ3230, distributed gapping) can take >2min and may timeout. The gapping tests iterate ~461 shapes through MKF. Run separately:
|
|
118
|
+
```bash
|
|
119
|
+
./mvb_tests "[symmetry]" # ~3min
|
|
120
|
+
./mvb_tests "[gapping]" # ~5min, iterates all MAS shapes
|
|
121
|
+
./mvb_tests "[step]" # fast, ~10s
|
|
122
|
+
./mvb_tests "[stl]" # fast, ~10s
|
|
123
|
+
./mvb_tests "[assembly]" # fast, ~30s
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### WASM build/test
|
|
127
|
+
```bash
|
|
128
|
+
cd bindings/wasm && npm run build # requires emsdk: source ~/emsdk/emsdk_env.sh
|
|
129
|
+
node tests/test_mvbpp.js # 27 tests, all pass
|
|
130
|
+
```
|
|
131
|
+
The embind surface is the `draw*` family: `drawMagnetic`, `drawCore`, `drawCorePiece`, `drawBobbin`, `drawTurns`, `drawWinding`, `drawSpacer`, `drawBoard`, `drawView`, plus `*ToPath` variants and the test helper `_enrichMagnetic`. All take the trailing 9-arg config pack `(mode, plane, offset, format, scale, polygonSegments, symmetry, side)` documented in `bindings/wasm/mvbpp_wasm.cpp`.
|
|
132
|
+
Module-level switches (no arity change): `mvbppSetSkipChecks(bool)`, and `mvbppSetWeldMode("off"|"auto"|"all")` / `mvbppGetWeldMode()` -- how real-winding conductors are welded (`mvb::WeldMode`; C++: `DrawConfig::weld` or `MagneticBuilder::setWeldMode`).
|
|
133
|
+
|
|
134
|
+
## Test data
|
|
135
|
+
|
|
136
|
+
- `testData/` — MAS JSON fixtures for MVB++ tests
|
|
137
|
+
- `tests/reference_steps/` — reference STEP/STL files for comparison tests
|
|
138
|
+
- `MAS/examples/` — MAS example files (fetched via FetchContent)
|
|
139
|
+
- `MAS/samples/` — MAS sample files (fetched via FetchContent)
|
|
140
|
+
|
|
141
|
+
Test data must conform to MAS 1.0 schema. Run `python3 MAS/scripts/migrate-to-1.0.py testData/` after schema changes.
|
|
142
|
+
|
|
143
|
+
## Current status
|
|
144
|
+
|
|
145
|
+
- Core shapes, bobbin, turns, sections/projections, symmetry, spacers, FR4 all implemented
|
|
146
|
+
- C++ tests: `[step]/[stl]/[assembly]/[shapes]/[json]/[topview]/[symmetry]/[gapping]` all pass; `[battery]` is slow (>15min) but functional
|
|
147
|
+
- Python (pybind11) and WASM (Emscripten) bindings: all tests pass
|
|
148
|
+
- See `PLAN.md` for detailed status and open performance/docs items
|