cad-to-dagmc 0.10.0__tar.gz → 0.11.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.
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/.github/workflows/ci_with_conda_install.yml +1 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/.github/workflows/ci_with_pip_install.yml +31 -6
- cad_to_dagmc-0.11.0/.github/workflows/docs.yml +78 -0
- cad_to_dagmc-0.11.0/PKG-INFO +56 -0
- cad_to_dagmc-0.11.0/README.md +17 -0
- cad_to_dagmc-0.11.0/docs/Makefile +14 -0
- cad_to_dagmc-0.11.0/docs/_static/custom.css +67 -0
- cad_to_dagmc-0.11.0/docs/_static/logo.png +0 -0
- cad_to_dagmc-0.11.0/docs/_static/logo.xcf +0 -0
- cad_to_dagmc-0.11.0/docs/_static/root_redirect.html +10 -0
- cad_to_dagmc-0.11.0/docs/advanced.md +218 -0
- cad_to_dagmc-0.11.0/docs/api.md +51 -0
- cad_to_dagmc-0.11.0/docs/conf.py +121 -0
- cad_to_dagmc-0.11.0/docs/h5m_backends.md +104 -0
- cad_to_dagmc-0.11.0/docs/index.md +108 -0
- cad_to_dagmc-0.11.0/docs/inputs.md +136 -0
- cad_to_dagmc-0.11.0/docs/installation.md +97 -0
- cad_to_dagmc-0.11.0/docs/material_tagging.md +124 -0
- cad_to_dagmc-0.11.0/docs/meshing_backends.md +100 -0
- cad_to_dagmc-0.11.0/docs/outputs.md +148 -0
- cad_to_dagmc-0.11.0/docs/quickstart.md +162 -0
- cad_to_dagmc-0.11.0/examples/surface_mesh/cadquery_assembly_with_different_h5m_backends.py +49 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/pyproject.toml +14 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/src/_version.py +3 -3
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/src/cad_to_dagmc/__init__.py +2 -1
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/src/cad_to_dagmc/core.py +515 -10
- cad_to_dagmc-0.11.0/src/cad_to_dagmc.egg-info/PKG-INFO +56 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/src/cad_to_dagmc.egg-info/SOURCES.txt +20 -0
- cad_to_dagmc-0.11.0/src/cad_to_dagmc.egg-info/requires.txt +25 -0
- cad_to_dagmc-0.11.0/tests/conftest.py +43 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_assembly_with_materials.py +17 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_assembly_with_names.py +17 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_file_creation.py +2 -34
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_get_volumes.py +8 -1
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_mesh_to_dagmc.py +10 -1
- cad_to_dagmc-0.11.0/tests/test_python_api.py +567 -0
- cad_to_dagmc-0.11.0/tests/test_vertices_to_h5m.py +147 -0
- cad_to_dagmc-0.10.0/PKG-INFO +0 -180
- cad_to_dagmc-0.10.0/README.md +0 -154
- cad_to_dagmc-0.10.0/src/cad_to_dagmc.egg-info/PKG-INFO +0 -180
- cad_to_dagmc-0.10.0/src/cad_to_dagmc.egg-info/requires.txt +0 -11
- cad_to_dagmc-0.10.0/tests/test_python_api.py +0 -440
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/.github/workflows/ci_with_benchmarks.yml +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/.github/workflows/python-publish.yml +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/.gitignore +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/CITATION.cff +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/LICENSE +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/cadquery_assembly.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/cadquery_assembly_with_materials.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/cadquery_assembly_with_names.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/cadquery_compound.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/cadquery_text.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/different_resolution_meshes.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/from_gmsh_mesh_file.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/from_gmsh_mesh_file_with_tags.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/from_gmsh_object_with_tag.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/multiple_stp_files.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/single_cadquery_object.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/single_stp_file.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/surface_mesh/tagged_mesh.msh +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/unstrucutred_volume_mesh/different_resolution_meshes.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/setup.cfg +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/ball_reactor.brep +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/curved_extrude.stp +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/extrude_rectangle.stp +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/multi_volume_cylinders.stp +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/one_cube.brep +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/single_cube.stp +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/single_volume_thin.stp +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/single_volume_thin.vtk +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/tagged_mesh.msh +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_brep_file.brep +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_h5m_in_transport.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_invalid_material_tags_string.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_kwarg_args.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_loading_from_file_vs_shape_object.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_two_joined_cubes.brep +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_two_sep_cubes.brep +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/test_version.py +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/two_connected_cubes.stp +0 -0
- {cad_to_dagmc-0.10.0 → cad_to_dagmc-0.11.0}/tests/two_disconnected_cubes.stp +0 -0
|
@@ -69,6 +69,7 @@ jobs:
|
|
|
69
69
|
source "${HOME}/miniforge/etc/profile.d/conda.sh"
|
|
70
70
|
conda activate ci-env
|
|
71
71
|
python examples/surface_mesh/cadquery_assembly.py
|
|
72
|
+
python examples/surface_mesh/cadquery_assembly_with_different_h5m_backends.py
|
|
72
73
|
python examples/surface_mesh/cadquery_assembly_with_materials.py
|
|
73
74
|
python examples/surface_mesh/cadquery_assembly_with_names.py
|
|
74
75
|
python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
# This CI
|
|
2
|
+
# This CI tests the package with both h5py-only (for users without pymoab)
|
|
3
|
+
# and with pymoab (full functionality)
|
|
3
4
|
|
|
4
5
|
name: CI with pip install
|
|
5
6
|
|
|
@@ -32,22 +33,46 @@ jobs:
|
|
|
32
33
|
- name: Checkout repository
|
|
33
34
|
uses: actions/checkout@v4
|
|
34
35
|
|
|
35
|
-
- name:
|
|
36
|
+
- name: Install system dependencies
|
|
36
37
|
shell: bash
|
|
37
38
|
run: |
|
|
38
39
|
sudo apt-get update -y
|
|
39
40
|
sudo apt-get upgrade -y
|
|
40
41
|
sudo apt-get install -y libblas-dev liblapack-dev libgl1 libglx-mesa0 libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0 libxcursor-dev libxft2 libxinerama-dev make cmake libeigen3-dev
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
- name: Install package and openmc (without pymoab)
|
|
44
|
+
shell: bash
|
|
45
|
+
run: |
|
|
43
46
|
# install the latest cadquery master branch as it has PR https://github.com/CadQuery/cadquery/pull/1923 merged in
|
|
44
47
|
python -m pip install git+https://github.com/CadQuery/cadquery
|
|
45
|
-
|
|
48
|
+
# Install openmc without moab - openmc tests will be skipped if DAGMC not available
|
|
49
|
+
python -m pip install --extra-index-url https://shimwell.github.io/wheels openmc
|
|
46
50
|
python -m pip install .[tests]
|
|
47
|
-
python -m pip install git+https://github.com/svalinn/pydagmc
|
|
48
51
|
python -c "import cad_to_dagmc"
|
|
52
|
+
|
|
53
|
+
- name: Run tests with h5py backend only (validates package works without pymoab)
|
|
54
|
+
shell: bash
|
|
55
|
+
run: |
|
|
56
|
+
# pymoab tests will be automatically skipped by conftest.py
|
|
57
|
+
pytest -v tests
|
|
58
|
+
|
|
59
|
+
- name: Install pymoab
|
|
60
|
+
shell: bash
|
|
61
|
+
run: |
|
|
62
|
+
python -m pip install --extra-index-url https://shimwell.github.io/wheels moab
|
|
63
|
+
python -c "import pymoab"
|
|
64
|
+
python -m pip install git+https://github.com/svalinn/pydagmc
|
|
65
|
+
|
|
66
|
+
- name: Run full tests with both backends
|
|
67
|
+
shell: bash
|
|
68
|
+
run: |
|
|
49
69
|
pytest -v tests
|
|
70
|
+
|
|
71
|
+
- name: Run examples
|
|
72
|
+
shell: bash
|
|
73
|
+
run: |
|
|
50
74
|
python examples/surface_mesh/cadquery_assembly.py
|
|
75
|
+
python examples/surface_mesh/cadquery_assembly_with_different_h5m_backends.py
|
|
51
76
|
python examples/surface_mesh/cadquery_assembly_with_materials.py
|
|
52
77
|
python examples/surface_mesh/cadquery_assembly_with_names.py
|
|
53
78
|
python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
tags:
|
|
11
|
+
- '*'
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build:
|
|
18
|
+
name: Build Documentation
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Install system packages
|
|
23
|
+
run: |
|
|
24
|
+
sudo apt-get update -y
|
|
25
|
+
sudo apt-get install -y libgl1 libglx-mesa0 libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
|
|
26
|
+
|
|
27
|
+
- name: Checkout repository
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Set up Python
|
|
31
|
+
uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: "3.12"
|
|
34
|
+
|
|
35
|
+
- name: Install dependencies
|
|
36
|
+
run: |
|
|
37
|
+
python -m pip install --upgrade pip
|
|
38
|
+
python -m pip install .[docs,tests]
|
|
39
|
+
|
|
40
|
+
- name: Test documentation code snippets
|
|
41
|
+
run: |
|
|
42
|
+
pytest --codeblocks docs/ --ignore=docs/_build
|
|
43
|
+
|
|
44
|
+
- name: Build documentation (tagged version)
|
|
45
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
46
|
+
run: |
|
|
47
|
+
sphinx-build docs _build/${{ github.ref_name }}
|
|
48
|
+
# Also build as 'stable' for latest tagged release
|
|
49
|
+
sphinx-build docs _build/stable
|
|
50
|
+
|
|
51
|
+
- name: Build documentation (dev version)
|
|
52
|
+
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
|
|
53
|
+
run: |
|
|
54
|
+
sphinx-build docs _build/dev
|
|
55
|
+
|
|
56
|
+
- name: Build documentation (PR check)
|
|
57
|
+
if: github.event_name == 'pull_request'
|
|
58
|
+
run: |
|
|
59
|
+
sphinx-build docs _build/pr-${{ github.event.pull_request.number }}
|
|
60
|
+
|
|
61
|
+
- name: Check links
|
|
62
|
+
if: github.event_name == 'push' || startsWith(github.ref, 'refs/tags/')
|
|
63
|
+
run: |
|
|
64
|
+
sphinx-build -b linkcheck docs _build/linkcheck || true
|
|
65
|
+
|
|
66
|
+
- name: Add root redirect
|
|
67
|
+
if: github.event_name == 'push' || startsWith(github.ref, 'refs/tags/')
|
|
68
|
+
run: |
|
|
69
|
+
cp docs/_static/root_redirect.html _build/index.html
|
|
70
|
+
|
|
71
|
+
- name: Deploy to GitHub Pages
|
|
72
|
+
if: github.event_name == 'push' || startsWith(github.ref, 'refs/tags/')
|
|
73
|
+
uses: peaceiris/actions-gh-pages@v4
|
|
74
|
+
with:
|
|
75
|
+
publish_branch: gh-pages
|
|
76
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
77
|
+
publish_dir: _build
|
|
78
|
+
keep_files: true
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cad_to_dagmc
|
|
3
|
+
Version: 0.11.0
|
|
4
|
+
Summary: Converts CAD files to a DAGMC h5m file
|
|
5
|
+
Author-email: Jonathan Shimwell <mail@jshimwell.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/fusion-energy/cad_to_dagmc
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/fusion-energy/cad_to_dagmc/issues
|
|
8
|
+
Keywords: dagmc,geometry,plot,slice
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: trimesh
|
|
16
|
+
Requires-Dist: networkx
|
|
17
|
+
Requires-Dist: cadquery>=2.6.0
|
|
18
|
+
Requires-Dist: numpy
|
|
19
|
+
Requires-Dist: gmsh
|
|
20
|
+
Requires-Dist: h5py
|
|
21
|
+
Requires-Dist: cadquery_direct_mesh_plugin>=0.1.0
|
|
22
|
+
Provides-Extra: tests
|
|
23
|
+
Requires-Dist: pytest; extra == "tests"
|
|
24
|
+
Requires-Dist: pytest-codeblocks; extra == "tests"
|
|
25
|
+
Requires-Dist: vtk; extra == "tests"
|
|
26
|
+
Requires-Dist: assembly-mesh-plugin; extra == "tests"
|
|
27
|
+
Provides-Extra: docs
|
|
28
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
29
|
+
Requires-Dist: myst-parser; extra == "docs"
|
|
30
|
+
Requires-Dist: sphinx-book-theme; extra == "docs"
|
|
31
|
+
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
|
|
32
|
+
Requires-Dist: sphinx-design; extra == "docs"
|
|
33
|
+
Requires-Dist: sphinxcontrib-mermaid; extra == "docs"
|
|
34
|
+
Requires-Dist: sphinxcadquery; extra == "docs"
|
|
35
|
+
Requires-Dist: pyvista[jupyter]; extra == "docs"
|
|
36
|
+
Requires-Dist: panel; extra == "docs"
|
|
37
|
+
Requires-Dist: jupyter-sphinx; extra == "docs"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
[](https://www.python.org)
|
|
42
|
+
|
|
43
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_conda_install.yml) Testing package and running examples with dependencies installed via Conda
|
|
44
|
+
|
|
45
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_pip_install.yml) Testing package and running examples with dependencies installed via pip
|
|
46
|
+
|
|
47
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml) Testing with [Model Benchmark Zoo](https://github.com/fusion-energy/model_benchmark_zoo)
|
|
48
|
+
|
|
49
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/python-publish.yml)
|
|
50
|
+
|
|
51
|
+
[](https://pypi.org/project/cad_to_dagmc/)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) (h5m) files, [unstructured mesh](https://docs.openmc.org/en/latest/pythonapi/generated/openmc.UnstructuredMesh.html) files (vtk) and Gmsh (msh) files ready for use in neutronics simulations.
|
|
55
|
+
|
|
56
|
+
## See the :point_right: [online documentation](https://fusion-energy.github.io/cad_to_dagmc/) :point_left: for installation options, usage recommendations and Python API details.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
[](https://www.python.org)
|
|
3
|
+
|
|
4
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_conda_install.yml) Testing package and running examples with dependencies installed via Conda
|
|
5
|
+
|
|
6
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_pip_install.yml) Testing package and running examples with dependencies installed via pip
|
|
7
|
+
|
|
8
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml) Testing with [Model Benchmark Zoo](https://github.com/fusion-energy/model_benchmark_zoo)
|
|
9
|
+
|
|
10
|
+
[](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/python-publish.yml)
|
|
11
|
+
|
|
12
|
+
[](https://pypi.org/project/cad_to_dagmc/)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
A minimal package that converts CAD geometry to [DAGMC](https://github.com/svalinn/DAGMC/) (h5m) files, [unstructured mesh](https://docs.openmc.org/en/latest/pythonapi/generated/openmc.UnstructuredMesh.html) files (vtk) and Gmsh (msh) files ready for use in neutronics simulations.
|
|
16
|
+
|
|
17
|
+
## See the :point_right: [online documentation](https://fusion-energy.github.io/cad_to_dagmc/) :point_left: for installation options, usage recommendations and Python API details.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
|
|
3
|
+
SPHINXOPTS ?=
|
|
4
|
+
SPHINXBUILD ?= sphinx-build
|
|
5
|
+
SOURCEDIR = .
|
|
6
|
+
BUILDDIR = _build
|
|
7
|
+
|
|
8
|
+
help:
|
|
9
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
10
|
+
|
|
11
|
+
.PHONY: help Makefile
|
|
12
|
+
|
|
13
|
+
%: Makefile
|
|
14
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* Custom styles for cad_to_dagmc documentation */
|
|
2
|
+
|
|
3
|
+
/* Mermaid diagram styling */
|
|
4
|
+
.mermaid {
|
|
5
|
+
text-align: center;
|
|
6
|
+
margin: 1em auto;
|
|
7
|
+
padding: 0.5em;
|
|
8
|
+
background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
|
|
9
|
+
border-radius: 12px;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
overflow-x: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.mermaid svg {
|
|
15
|
+
max-width: 100%;
|
|
16
|
+
max-height: 280px;
|
|
17
|
+
height: auto;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Code block styling */
|
|
21
|
+
div.highlight {
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
div.highlight pre {
|
|
27
|
+
font-size: 0.875em;
|
|
28
|
+
line-height: 1.6;
|
|
29
|
+
padding: 1em;
|
|
30
|
+
margin: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Inline code */
|
|
34
|
+
code.literal {
|
|
35
|
+
background: #f1f5f9;
|
|
36
|
+
padding: 2px 6px;
|
|
37
|
+
border-radius: 4px;
|
|
38
|
+
font-size: 0.9em;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Table styling */
|
|
42
|
+
table {
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Admonition styling */
|
|
47
|
+
.admonition {
|
|
48
|
+
margin: 1.5em 0;
|
|
49
|
+
padding: 1em 1.25em;
|
|
50
|
+
border-radius: 8px;
|
|
51
|
+
border-left: 4px solid;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.admonition.note {
|
|
55
|
+
background: #eff6ff;
|
|
56
|
+
border-left-color: #3b82f6;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.admonition.warning {
|
|
60
|
+
background: #fefce8;
|
|
61
|
+
border-left-color: #eab308;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.admonition-title {
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
margin-bottom: 0.5em;
|
|
67
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Advanced Options
|
|
2
|
+
|
|
3
|
+
This page covers advanced configuration options.
|
|
4
|
+
|
|
5
|
+
## Geometry Scaling
|
|
6
|
+
|
|
7
|
+
Scale geometry using the `scale_factor` parameter. Useful when converting
|
|
8
|
+
between units (e.g., mm to cm for neutronics).
|
|
9
|
+
|
|
10
|
+
<!--pytest-codeblocks:skip-->
|
|
11
|
+
```python
|
|
12
|
+
# Scale from mm to cm (divide by 10)
|
|
13
|
+
my_model.export_dagmc_h5m_file(
|
|
14
|
+
filename="dagmc.h5m",
|
|
15
|
+
scale_factor=0.1,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
# Scale up by 2x
|
|
19
|
+
my_model.export_dagmc_h5m_file(
|
|
20
|
+
filename="dagmc.h5m",
|
|
21
|
+
scale_factor=2.0,
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Per-Volume Mesh Sizing
|
|
26
|
+
|
|
27
|
+
Set different mesh sizes for different volumes using `set_size`.
|
|
28
|
+
|
|
29
|
+
<!--pytest-codeblocks:skip-->
|
|
30
|
+
```python
|
|
31
|
+
my_model.export_dagmc_h5m_file(
|
|
32
|
+
filename="dagmc.h5m",
|
|
33
|
+
min_mesh_size=1.0,
|
|
34
|
+
max_mesh_size=10.0,
|
|
35
|
+
set_size={
|
|
36
|
+
1: 0.5, # Volume 1: fine mesh (0.5)
|
|
37
|
+
2: 5.0, # Volume 2: coarse mesh (5.0)
|
|
38
|
+
3: 1.0, # Volume 3: medium mesh (1.0)
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
:::{note}
|
|
44
|
+
`set_size` only works with the GMSH meshing backend.
|
|
45
|
+
:::
|
|
46
|
+
|
|
47
|
+
## Mesh Algorithms
|
|
48
|
+
|
|
49
|
+
GMSH provides multiple meshing algorithms. Select with `mesh_algorithm`.
|
|
50
|
+
|
|
51
|
+
<!--pytest-codeblocks:skip-->
|
|
52
|
+
```python
|
|
53
|
+
my_model.export_dagmc_h5m_file(
|
|
54
|
+
filename="dagmc.h5m",
|
|
55
|
+
mesh_algorithm=6, # Frontal-Delaunay
|
|
56
|
+
)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Available algorithms:**
|
|
60
|
+
|
|
61
|
+
- `1`: MeshAdapt (default)
|
|
62
|
+
- `2`: Automatic
|
|
63
|
+
- `5`: Delaunay
|
|
64
|
+
- `6`: Frontal-Delaunay
|
|
65
|
+
- `7`: BAMG
|
|
66
|
+
- `8`: Frontal-Delaunay for Quads
|
|
67
|
+
- `9`: Packing of Parallelograms
|
|
68
|
+
|
|
69
|
+
See [GMSH documentation](https://gmsh.info/doc/texinfo/gmsh.html#Mesh-options)
|
|
70
|
+
for details.
|
|
71
|
+
|
|
72
|
+
## Imprinting Control
|
|
73
|
+
|
|
74
|
+
Imprinting ensures shared surfaces between adjacent volumes are meshed consistently.
|
|
75
|
+
It's enabled by default but can be disabled for geometries that don't need it.
|
|
76
|
+
|
|
77
|
+
<!--pytest-codeblocks:skip-->
|
|
78
|
+
```python
|
|
79
|
+
my_model.export_dagmc_h5m_file(
|
|
80
|
+
filename="dagmc.h5m",
|
|
81
|
+
imprint=False, # Disable imprinting
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
:::{warning}
|
|
86
|
+
Disabling imprinting may cause mesh inconsistencies at volume interfaces.
|
|
87
|
+
Only disable if you know your geometry doesn't require it.
|
|
88
|
+
:::
|
|
89
|
+
|
|
90
|
+
## CAD Transfer Method
|
|
91
|
+
|
|
92
|
+
Control how CAD geometry is transferred to GMSH.
|
|
93
|
+
|
|
94
|
+
<!--pytest-codeblocks:skip-->
|
|
95
|
+
```python
|
|
96
|
+
my_model.export_dagmc_h5m_file(
|
|
97
|
+
filename="dagmc.h5m",
|
|
98
|
+
method="file", # Write to temp file (default, more compatible)
|
|
99
|
+
# or
|
|
100
|
+
method="inMemory", # Direct transfer (faster, requires matching OCC versions)
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**File method (default):**
|
|
105
|
+
|
|
106
|
+
- More compatible across installations
|
|
107
|
+
- Works with pip-installed packages
|
|
108
|
+
- Slightly slower due to file I/O
|
|
109
|
+
|
|
110
|
+
**In-memory method:**
|
|
111
|
+
|
|
112
|
+
- Faster for large geometries
|
|
113
|
+
- Requires matching OpenCASCADE versions between CadQuery and GMSH
|
|
114
|
+
- Works reliably with Conda installations
|
|
115
|
+
|
|
116
|
+
## Implicit Complement Material
|
|
117
|
+
|
|
118
|
+
Set a material tag for DAGMC's implicit complement (the void space).
|
|
119
|
+
|
|
120
|
+
<!--pytest-codeblocks:skip-->
|
|
121
|
+
```python
|
|
122
|
+
my_model.export_dagmc_h5m_file(
|
|
123
|
+
filename="dagmc.h5m",
|
|
124
|
+
implicit_complement_material_tag="void",
|
|
125
|
+
)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Accessing the GMSH Object
|
|
129
|
+
|
|
130
|
+
For advanced mesh control, access the GMSH object directly.
|
|
131
|
+
|
|
132
|
+
<!--pytest-codeblocks:skip-->
|
|
133
|
+
```python
|
|
134
|
+
import gmsh
|
|
135
|
+
import cad_to_dagmc
|
|
136
|
+
|
|
137
|
+
# Initialize GMSH
|
|
138
|
+
gmsh_obj = cad_to_dagmc.init_gmsh()
|
|
139
|
+
|
|
140
|
+
# ... add geometry and configure mesh ...
|
|
141
|
+
|
|
142
|
+
# Set advanced GMSH options
|
|
143
|
+
gmsh.option.setNumber("Mesh.OptimizeNetgen", 1)
|
|
144
|
+
gmsh.option.setNumber("Mesh.Smoothing", 5)
|
|
145
|
+
|
|
146
|
+
# Generate mesh
|
|
147
|
+
gmsh.model.mesh.generate(2)
|
|
148
|
+
|
|
149
|
+
# Export
|
|
150
|
+
cad_to_dagmc.export_gmsh_object_to_dagmc_h5m_file(filename="dagmc.h5m")
|
|
151
|
+
|
|
152
|
+
gmsh.finalize()
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Parallel Processing
|
|
156
|
+
|
|
157
|
+
Both CadQuery and GMSH use parallel processing for operations like imprinting and meshing.
|
|
158
|
+
By default, they use all available CPU cores. On shared servers or when memory is limited,
|
|
159
|
+
you may want to restrict the number of threads.
|
|
160
|
+
|
|
161
|
+
### Limiting CadQuery Threads
|
|
162
|
+
|
|
163
|
+
CadQuery provides a `setThreads` function to control the number of threads used for
|
|
164
|
+
boolean operations and imprinting:
|
|
165
|
+
|
|
166
|
+
<!--pytest-codeblocks:skip-->
|
|
167
|
+
```python
|
|
168
|
+
from cadquery.occ_impl.shapes import setThreads
|
|
169
|
+
|
|
170
|
+
setThreads(4) # Limit to 4 threads
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
This can be called at any point before your geometry operations.
|
|
174
|
+
|
|
175
|
+
Alternatively, you can configure the thread pool before importing CadQuery:
|
|
176
|
+
|
|
177
|
+
<!--pytest-codeblocks:skip-->
|
|
178
|
+
```python
|
|
179
|
+
import OCP
|
|
180
|
+
OCP.OSD.OSD_ThreadPool.DefaultPool_s(4) # Limit to 4 threads
|
|
181
|
+
|
|
182
|
+
import cadquery as cq
|
|
183
|
+
from cad_to_dagmc import CadToDagmc
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Or use the `OMP_NUM_THREADS` environment variable:
|
|
187
|
+
|
|
188
|
+
<!--pytest-codeblocks:skip-->
|
|
189
|
+
```bash
|
|
190
|
+
export OMP_NUM_THREADS=4
|
|
191
|
+
python my_script.py
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Limiting GMSH Threads
|
|
195
|
+
|
|
196
|
+
GMSH parallelism is controlled through its own options:
|
|
197
|
+
|
|
198
|
+
<!--pytest-codeblocks:skip-->
|
|
199
|
+
```python
|
|
200
|
+
import gmsh
|
|
201
|
+
import cad_to_dagmc
|
|
202
|
+
|
|
203
|
+
gmsh_obj = cad_to_dagmc.init_gmsh()
|
|
204
|
+
|
|
205
|
+
# Limit parallel meshing to 4 threads
|
|
206
|
+
gmsh.option.setNumber("General.NumThreads", 4)
|
|
207
|
+
gmsh.option.setNumber("Mesh.MaxNumThreads1D", 4)
|
|
208
|
+
gmsh.option.setNumber("Mesh.MaxNumThreads2D", 4)
|
|
209
|
+
gmsh.option.setNumber("Mesh.MaxNumThreads3D", 4)
|
|
210
|
+
|
|
211
|
+
# ... continue with meshing ...
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### When to Limit Threads
|
|
215
|
+
|
|
216
|
+
- **Shared servers**: Avoid monopolizing all cores
|
|
217
|
+
- **Memory constraints**: Each thread requires memory; fewer threads = lower peak memory
|
|
218
|
+
- **Debugging**: Single-threaded execution can make errors easier to diagnose
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Python API Reference
|
|
2
|
+
|
|
3
|
+
## Main Class
|
|
4
|
+
|
|
5
|
+
```{eval-rst}
|
|
6
|
+
.. autoclass:: cad_to_dagmc.CadToDagmc
|
|
7
|
+
:members:
|
|
8
|
+
:undoc-members:
|
|
9
|
+
:show-inheritance:
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Standalone Functions
|
|
13
|
+
|
|
14
|
+
### GMSH to DAGMC Conversion
|
|
15
|
+
|
|
16
|
+
```{eval-rst}
|
|
17
|
+
.. autofunction:: cad_to_dagmc.export_gmsh_file_to_dagmc_h5m_file
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```{eval-rst}
|
|
21
|
+
.. autofunction:: cad_to_dagmc.export_gmsh_object_to_dagmc_h5m_file
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Low-Level Functions
|
|
25
|
+
|
|
26
|
+
```{eval-rst}
|
|
27
|
+
.. autofunction:: cad_to_dagmc.vertices_to_h5m
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```{eval-rst}
|
|
31
|
+
.. autofunction:: cad_to_dagmc.init_gmsh
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```{eval-rst}
|
|
35
|
+
.. autofunction:: cad_to_dagmc.get_volumes
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```{eval-rst}
|
|
39
|
+
.. autofunction:: cad_to_dagmc.set_sizes_for_mesh
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```{eval-rst}
|
|
43
|
+
.. autofunction:: cad_to_dagmc.mesh_to_vertices_and_triangles
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Exceptions
|
|
47
|
+
|
|
48
|
+
```{eval-rst}
|
|
49
|
+
.. autoexception:: cad_to_dagmc.PyMoabNotFoundError
|
|
50
|
+
:show-inheritance:
|
|
51
|
+
```
|