cad-to-dagmc 0.6.2__tar.gz → 0.7.1__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.

Potentially problematic release.


This version of cad-to-dagmc might be problematic. Click here for more details.

Files changed (62) hide show
  1. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/.github/workflows/black.yml +3 -3
  2. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/.github/workflows/ci_with_benchmarks.yml +4 -4
  3. cad_to_dagmc-0.6.2/.github/workflows/ci_with_install.yml → cad_to_dagmc-0.7.1/.github/workflows/ci_with_conda_install.yml +12 -8
  4. cad_to_dagmc-0.7.1/.github/workflows/ci_with_pip_install.yml +61 -0
  5. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/.gitignore +1 -0
  6. cad_to_dagmc-0.7.1/CITATION.cff +10 -0
  7. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/PKG-INFO +37 -44
  8. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/README.md +34 -43
  9. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/examples/surface_mesh/cadquery_assembly.py +3 -4
  10. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/examples/surface_mesh/cadquery_compound.py +2 -2
  11. cad_to_dagmc-0.7.1/examples/surface_mesh/cadquery_object_and_stp_file.py +28 -0
  12. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/examples/surface_mesh/cadquery_text.py +8 -6
  13. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +4 -2
  14. cad_to_dagmc-0.7.1/examples/surface_mesh/from_gmsh_mesh_file.py +55 -0
  15. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/examples/surface_mesh/multiple_cadquery_objects.py +3 -3
  16. cad_to_dagmc-0.7.1/examples/surface_mesh/multiple_stp_files.py +30 -0
  17. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/examples/surface_mesh/single_cadquery_object.py +2 -2
  18. cad_to_dagmc-0.7.1/examples/surface_mesh/single_stp_file.py +24 -0
  19. cad_to_dagmc-0.7.1/examples/surface_mesh/single_stp_file_multiple_volumes.py +16 -0
  20. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +2 -2
  21. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -2
  22. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/pyproject.toml +2 -0
  23. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/src/_version.py +2 -2
  24. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/src/cad_to_dagmc/core.py +217 -76
  25. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/src/cad_to_dagmc.egg-info/PKG-INFO +37 -44
  26. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/src/cad_to_dagmc.egg-info/SOURCES.txt +3 -6
  27. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/src/cad_to_dagmc.egg-info/requires.txt +2 -0
  28. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/test_file_creation.py +29 -16
  29. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/test_h5m_in_transport.py +19 -16
  30. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/test_python_api.py +37 -10
  31. cad_to_dagmc-0.6.2/.github/workflows/anaconda-publish.yml +0 -30
  32. cad_to_dagmc-0.6.2/.github/workflows/ci_with_pip_install.yml +0 -67
  33. cad_to_dagmc-0.6.2/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -16
  34. cad_to_dagmc-0.6.2/examples/surface_mesh/create_stp_files_for_examples.py +0 -90
  35. cad_to_dagmc-0.6.2/examples/surface_mesh/multiple_stp_files.py +0 -12
  36. cad_to_dagmc-0.6.2/examples/surface_mesh/single_stp_file.py +0 -5
  37. cad_to_dagmc-0.6.2/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -6
  38. cad_to_dagmc-0.6.2/tests/create_brep_file_for_testing.py +0 -56
  39. cad_to_dagmc-0.6.2/tests/extrude_rectangle.step +0 -0
  40. cad_to_dagmc-0.6.2/tests/single_cube.step +0 -0
  41. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/.github/workflows/python-publish.yml +0 -0
  42. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/LICENSE +0 -0
  43. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/setup.cfg +0 -0
  44. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/src/cad_to_dagmc/__init__.py +0 -0
  45. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
  46. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
  47. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
  48. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/ball_reactor.brep +0 -0
  49. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/curved_extrude.stp +0 -0
  50. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/extrude_rectangle.stp +0 -0
  51. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/multi_volume_cylinders.stp +0 -0
  52. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/one_cube.brep +0 -0
  53. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/single_cube.stp +0 -0
  54. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/single_volume_thin.stp +0 -0
  55. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/single_volume_thin.vtk +0 -0
  56. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/test_brep_file.brep +0 -0
  57. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/test_loading_from_file_vs_shape_object.py +0 -0
  58. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/test_two_joined_cubes.brep +0 -0
  59. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/test_two_sep_cubes.brep +0 -0
  60. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/test_version.py +0 -0
  61. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/two_connected_cubes.stp +0 -0
  62. {cad_to_dagmc-0.6.2 → cad_to_dagmc-0.7.1}/tests/two_disconnected_cubes.stp +0 -0
@@ -13,11 +13,11 @@ jobs:
13
13
  black:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
- - uses: actions/checkout@v3
16
+ - uses: actions/checkout@v4
17
17
  with:
18
18
  ref: ${{ github.head_ref }}
19
19
  - name: Setup Python
20
- uses: actions/setup-python@v2
20
+ uses: actions/setup-python@v5
21
21
  with:
22
22
  python-version: 3.x
23
23
  - name: Install black
@@ -27,6 +27,6 @@ jobs:
27
27
  - name: Run black
28
28
  run: |
29
29
  black --line-length 100 .
30
- - uses: stefanzweifel/git-auto-commit-action@v4
30
+ - uses: stefanzweifel/git-auto-commit-action@v5
31
31
  with:
32
32
  commit_message: "[skip ci] Apply formatting changes"
@@ -35,11 +35,11 @@ jobs:
35
35
  sudo apt-get --allow-releaseinfo-change update
36
36
  sudo apt-get update -y
37
37
  sudo apt-get upgrade -y
38
- sudo apt-get install -y libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
38
+ 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
39
39
  mamba activate
40
- mamba install -y -c conda-forge "openmc=0.14.0=dagmc*nompi*" moab>=5.3.0 gmsh python-gmsh
41
- python -m pip install --upgrade pip
42
- python -m pip install .
40
+ mamba install -y -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh
41
+ python -m ensurepip --upgrade
42
+ python -m pip install . --no-deps
43
43
  python -m pip install openmc_data_downloader
44
44
  openmc_data_downloader -l ENDFB-7.1-NNDC -i Fe56 Be9
45
45
  git clone --single-branch -b main --depth 1 https://github.com/fusion-energy/model_benchmark_zoo.git
@@ -1,7 +1,7 @@
1
1
 
2
2
  # This CI does includes particle transport tests as openmc is installed
3
3
 
4
- name: CI with install
4
+ name: CI with Conda install
5
5
 
6
6
  on:
7
7
  pull_request:
@@ -21,6 +21,9 @@ on:
21
21
  jobs:
22
22
  testing:
23
23
  runs-on: ubuntu-latest
24
+ strategy:
25
+ matrix:
26
+ python-version: ["3.10", "3.11", "3.12"]
24
27
  steps:
25
28
  - name: Checkout repository
26
29
  uses: actions/checkout@v4
@@ -35,17 +38,17 @@ jobs:
35
38
  sudo apt-get --allow-releaseinfo-change update
36
39
  sudo apt-get update -y
37
40
  sudo apt-get upgrade -y
38
- sudo apt-get install -y libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev libarchive-dev libpangocairo-1.0-0
41
+ 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
39
42
  mamba activate
40
- mamba create -y --name cad_to_dagmc python=3.10
43
+ mamba create -y --name cad_to_dagmc python=${{ matrix.python-version }}
41
44
  mamba activate cad_to_dagmc
42
- mamba install -y -c conda-forge "openmc=0.14.0=dagmc*nompi*" gmsh python-gmsh
43
- python -m pip install --upgrade pip
44
- python -m pip install .
45
+ mamba install -y -c conda-forge "openmc=0.15.0=dagmc*nompi*" trimesh networkx cadquery gmsh python-gmsh
46
+ python -m ensurepip --upgrade
47
+ python -m pip install . --no-deps
45
48
  python -c "import cad_to_dagmc"
46
- python -m pip install .[tests]
49
+ mamba install -y -c conda-forge pytest vtk
50
+ python -m pip install .[tests] --no-deps
47
51
  pytest -v tests
48
- python examples/surface_mesh/create_stp_files_for_examples.py
49
52
  python examples/surface_mesh/cadquery_assembly.py
50
53
  python examples/surface_mesh/cadquery_compound.py
51
54
  python examples/surface_mesh/cadquery_object_and_stp_file.py
@@ -56,5 +59,6 @@ jobs:
56
59
  python examples/surface_mesh/single_stp_file_multiple_volumes.py
57
60
  python examples/surface_mesh/single_cadquery_object.py
58
61
  python examples/surface_mesh/single_stp_file.py
62
+ python examples/surface_mesh/from_gmsh_mesh_file.py
59
63
  python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
60
64
  python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
@@ -0,0 +1,61 @@
1
+
2
+ # This CI does not currently include particle transport tests as openmc is not installed
3
+
4
+ name: CI with pip install
5
+
6
+ on:
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ paths-ignore:
11
+ - 'docs/**'
12
+ - '.gitignore'
13
+ - '*.md'
14
+ - 'CITATION.cff'
15
+ - 'LICENSE.txt'
16
+ - 'readthedocs.yml'
17
+ push:
18
+ branches:
19
+ - main
20
+
21
+ jobs:
22
+ testing:
23
+ runs-on: ubuntu-latest
24
+ container:
25
+ image: openmc/openmc:develop-dagmc
26
+ steps:
27
+ - name: Checkout repository
28
+ uses: actions/checkout@v4
29
+
30
+ - name: install non pypi dependencies
31
+ shell: bash
32
+ run: |
33
+ apt-get --allow-releaseinfo-change update
34
+ apt-get update -y
35
+ apt-get upgrade -y
36
+ apt-get install -y libhdf5-dev 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
37
+ apt install python3
38
+ apt install python3-pip
39
+ python -m pip install --upgrade pip
40
+ git clone --single-branch -b master --depth 1 https://bitbucket.org/fathomteam/moab/
41
+ cd moab
42
+ git checkout faf7e989c0fd0be4a19f61c1d4713afc5397c8a7
43
+ python -m pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
44
+ cd ..
45
+ python -c "import pymoab"
46
+ python -m pip install .[tests]
47
+ python -c "import cad_to_dagmc"
48
+ pytest -v tests
49
+ python examples/surface_mesh/cadquery_assembly.py
50
+ python examples/surface_mesh/cadquery_compound.py
51
+ python examples/surface_mesh/cadquery_object_and_stp_file.py
52
+ python examples/surface_mesh/cadquery_text.py
53
+ python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
54
+ python examples/surface_mesh/multiple_cadquery_objects.py
55
+ python examples/surface_mesh/multiple_stp_files.py
56
+ python examples/surface_mesh/single_stp_file_multiple_volumes.py
57
+ python examples/surface_mesh/single_cadquery_object.py
58
+ python examples/surface_mesh/single_stp_file.py
59
+ python examples/surface_mesh/from_gmsh_mesh_file.py
60
+ python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
61
+ python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
@@ -137,3 +137,4 @@ dmypy.json
137
137
  *.stp
138
138
  src/_version.py
139
139
  *.msh
140
+ *.step
@@ -0,0 +1,10 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ authors:
4
+ - family-names: "Shimwell"
5
+ given-names: "Jonathan"
6
+ orcid: "https://orcid.org/0000-0001-6909-0946"
7
+ title: "CAD to DAGMC. Convert CAD geometry (STP files) or Cadquery assemblies to DAGMC h5m files"
8
+ version: 0.7.0
9
+ date-released: 2024-4-14
10
+ url: "https://github.com/fusion-energy/cad_to_dagmc"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cad_to_dagmc
3
- Version: 0.6.2
3
+ Version: 0.7.1
4
4
  Summary: Converts CAD files to a DAGMC h5m file
5
5
  Author-email: Jonathan Shimwell <mail@jshimwell.com>
6
6
  Project-URL: Homepage, https://github.com/fusion-energy/cad_to_dagmc
@@ -15,6 +15,8 @@ License-File: LICENSE
15
15
  Requires-Dist: trimesh
16
16
  Requires-Dist: networkx
17
17
  Requires-Dist: cadquery>=2.4.0
18
+ Requires-Dist: numpy<=1.23.5
19
+ Requires-Dist: gmsh
18
20
  Provides-Extra: tests
19
21
  Requires-Dist: pytest; extra == "tests"
20
22
  Requires-Dist: vtk; extra == "tests"
@@ -51,12 +53,11 @@ Also checkout these other software projects that also create DAGMC geometry [CAD
51
53
 
52
54
  # Installation options
53
55
 
54
- - Install using Mamba and pip
55
- - Install using Conda and pip
56
+ - Install using Mamba
57
+ - Install using Conda
56
58
  - Install using pip and source compilations
57
59
 
58
-
59
- ## Install using Mamba and pip
60
+ ## Install using Mamba
60
61
 
61
62
  In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
62
63
  - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
@@ -65,7 +66,7 @@ In principle, installing any Conda/Mamba distribution will work. A few Conda/Mam
65
66
 
66
67
  This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
67
68
 
68
- Create a new conda environment, I've chosen Python 3.10 here but newer versions are
69
+ Create a new environment, I've chosen Python 3.10 here but newer versions are
69
70
  also supported.
70
71
  ```bash
71
72
  mamba create --name new_env python=3.10 -y
@@ -76,27 +77,20 @@ Activate the environment
76
77
  mamba activate new_env
77
78
  ```
78
79
 
79
- Install the dependencies
80
+ Then you can install the cad_to_dagmc package
80
81
  ```bash
81
- mamba install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
82
+ mamba install -y -c conda-forge cad_to_dagmc
82
83
  ```
83
84
 
84
- Then you can install the cad_to_dagmc package with ```pip```
85
- ```bash
86
- pip install cad_to_dagmc
87
- ```
88
-
89
-
90
- ## Install using Conda and pip
85
+ ## Install using Conda
91
86
 
92
87
  In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
93
88
  - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
94
89
  - [Anaconda](https://www.anaconda.com/download)
95
90
  - [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
96
91
 
97
- This example uses Conda to install some dependencies that are not available via PyPi.
98
-
99
- Create a new conda environment
92
+ Create a new environment, I've chosen Python 3.10 here but newer versions are
93
+ also supported.
100
94
  ```bash
101
95
  conda create --name new_env python=3.10 -y
102
96
  ```
@@ -106,23 +100,37 @@ Activate the environment
106
100
  conda activate new_env
107
101
  ```
108
102
 
109
- Install the dependencies
103
+ Then you can install the cad_to_dagmc package
110
104
  ```bash
111
- conda install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
105
+ conda install -y -c conda-forge cad_to_dagmc
112
106
  ```
113
107
 
114
- Then you can install the cad_to_dagmc package with ```pip```
115
- ```bash
116
- pip install cad_to_dagmc
108
+ ## Install using pip and source compilations
109
+
110
+ It is also possible to avoid the use of conda/mamba and installing using pip.
111
+
112
+ First ensure hdf5 is installed as this is needed by MOAB pip install command
113
+
114
+ ```
115
+ sudo apt-get install libhdf5-dev
117
116
  ```
118
117
 
119
- ## Install using pip and source compilations
118
+ Then clone the latest version of MOAB and cd into the moab directory.
120
119
 
121
- It should possible to avoid the use of conda and installing using pip and compiling from source.
120
+ ```
121
+ git clone master https://bitbucket.org/fathomteam/moab/
122
+ cd moab
123
+ ```
122
124
 
123
- First compile MOAB (and install Pymoab) from source
125
+ Ensure pip is up to date as a new version is needed
126
+ ```
127
+ python -m pip install --upgrade pip
128
+ ```
124
129
 
125
- Then install gmsh from source (installing from pip appears to cause conflicts with the open cascade used in ocp and cadquery)
130
+ Run the pip install command with cmake arguments.
131
+ ```
132
+ pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
133
+ ```
126
134
 
127
135
  Then you can install the cad_to_dagmc package with ```pip```
128
136
 
@@ -130,7 +138,7 @@ Then you can install the cad_to_dagmc package with ```pip```
130
138
  pip install cad_to_dagmc
131
139
  ```
132
140
 
133
- ## Install with transport code (e.g OpenMC)
141
+ ## Install with OpenMC or other particle transport codes
134
142
 
135
143
  You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others [link to DAGMC documentation](https://svalinn.github.io/DAGMC/).
136
144
 
@@ -144,28 +152,13 @@ It might not be possible to install OpenMC and cad-to-dagmc in the same conda/ma
144
152
  Another option would be to [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which would also need compiling with MOAB and DAGMC options.
145
153
 
146
154
 
147
-
148
155
  # Known incompatibilities
149
156
 
150
157
  The package requires newer versions of Linux. For example the package does not work on Ubuntu 18.04 or older.
151
158
 
152
159
  The package requires newer versions of pip. It is recommended to ensure that your version of pip is up to date. This can be done with ```python -m pip install --upgrade pip```
153
160
 
154
- Installing one of the package dependancies (gmsh) with pip appears to result in occational errors when passing cad objects between cadquery / ocp and gmsh. The conda install gmsh appears to work fine.
155
-
156
- # Usage - with OpenMC
157
-
158
- You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others supported by [DAGMC](https://svalinn.github.io/DAGMC/).
159
-
160
- You can run ```mamba install -c conda-forge openmc``` however this may choose to install OpenMC without DAGMC included.
161
-
162
- You can be more specific with conda/mamba commands to make sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
163
- ```bash
164
- mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
165
- ```
166
-
167
- You could also [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which might be prefered as it can be tricky for the conda enviroment to get resolved.
168
-
161
+ Installing one of the package dependancies (gmsh) with pip appears to result in errors when passing cad objects in memory between cadquery / ocp and gmsh. The default method of passing cad objects is via file so this should not impact most users. The conda install gmsh appears to work fine with in memory passing of cad objects as the version of OCP matches between Gmsh and CadQuery.
169
162
 
170
163
 
171
164
  # Usage - creation of DAGMC h5m files
@@ -30,12 +30,11 @@ Also checkout these other software projects that also create DAGMC geometry [CAD
30
30
 
31
31
  # Installation options
32
32
 
33
- - Install using Mamba and pip
34
- - Install using Conda and pip
33
+ - Install using Mamba
34
+ - Install using Conda
35
35
  - Install using pip and source compilations
36
36
 
37
-
38
- ## Install using Mamba and pip
37
+ ## Install using Mamba
39
38
 
40
39
  In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
41
40
  - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
@@ -44,7 +43,7 @@ In principle, installing any Conda/Mamba distribution will work. A few Conda/Mam
44
43
 
45
44
  This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
46
45
 
47
- Create a new conda environment, I've chosen Python 3.10 here but newer versions are
46
+ Create a new environment, I've chosen Python 3.10 here but newer versions are
48
47
  also supported.
49
48
  ```bash
50
49
  mamba create --name new_env python=3.10 -y
@@ -55,27 +54,20 @@ Activate the environment
55
54
  mamba activate new_env
56
55
  ```
57
56
 
58
- Install the dependencies
57
+ Then you can install the cad_to_dagmc package
59
58
  ```bash
60
- mamba install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
59
+ mamba install -y -c conda-forge cad_to_dagmc
61
60
  ```
62
61
 
63
- Then you can install the cad_to_dagmc package with ```pip```
64
- ```bash
65
- pip install cad_to_dagmc
66
- ```
67
-
68
-
69
- ## Install using Conda and pip
62
+ ## Install using Conda
70
63
 
71
64
  In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
72
65
  - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
73
66
  - [Anaconda](https://www.anaconda.com/download)
74
67
  - [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
75
68
 
76
- This example uses Conda to install some dependencies that are not available via PyPi.
77
-
78
- Create a new conda environment
69
+ Create a new environment, I've chosen Python 3.10 here but newer versions are
70
+ also supported.
79
71
  ```bash
80
72
  conda create --name new_env python=3.10 -y
81
73
  ```
@@ -85,23 +77,37 @@ Activate the environment
85
77
  conda activate new_env
86
78
  ```
87
79
 
88
- Install the dependencies
80
+ Then you can install the cad_to_dagmc package
89
81
  ```bash
90
- conda install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
82
+ conda install -y -c conda-forge cad_to_dagmc
91
83
  ```
92
84
 
93
- Then you can install the cad_to_dagmc package with ```pip```
94
- ```bash
95
- pip install cad_to_dagmc
85
+ ## Install using pip and source compilations
86
+
87
+ It is also possible to avoid the use of conda/mamba and installing using pip.
88
+
89
+ First ensure hdf5 is installed as this is needed by MOAB pip install command
90
+
91
+ ```
92
+ sudo apt-get install libhdf5-dev
96
93
  ```
97
94
 
98
- ## Install using pip and source compilations
95
+ Then clone the latest version of MOAB and cd into the moab directory.
99
96
 
100
- It should possible to avoid the use of conda and installing using pip and compiling from source.
97
+ ```
98
+ git clone master https://bitbucket.org/fathomteam/moab/
99
+ cd moab
100
+ ```
101
101
 
102
- First compile MOAB (and install Pymoab) from source
102
+ Ensure pip is up to date as a new version is needed
103
+ ```
104
+ python -m pip install --upgrade pip
105
+ ```
103
106
 
104
- Then install gmsh from source (installing from pip appears to cause conflicts with the open cascade used in ocp and cadquery)
107
+ Run the pip install command with cmake arguments.
108
+ ```
109
+ pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
110
+ ```
105
111
 
106
112
  Then you can install the cad_to_dagmc package with ```pip```
107
113
 
@@ -109,7 +115,7 @@ Then you can install the cad_to_dagmc package with ```pip```
109
115
  pip install cad_to_dagmc
110
116
  ```
111
117
 
112
- ## Install with transport code (e.g OpenMC)
118
+ ## Install with OpenMC or other particle transport codes
113
119
 
114
120
  You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others [link to DAGMC documentation](https://svalinn.github.io/DAGMC/).
115
121
 
@@ -123,28 +129,13 @@ It might not be possible to install OpenMC and cad-to-dagmc in the same conda/ma
123
129
  Another option would be to [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which would also need compiling with MOAB and DAGMC options.
124
130
 
125
131
 
126
-
127
132
  # Known incompatibilities
128
133
 
129
134
  The package requires newer versions of Linux. For example the package does not work on Ubuntu 18.04 or older.
130
135
 
131
136
  The package requires newer versions of pip. It is recommended to ensure that your version of pip is up to date. This can be done with ```python -m pip install --upgrade pip```
132
137
 
133
- Installing one of the package dependancies (gmsh) with pip appears to result in occational errors when passing cad objects between cadquery / ocp and gmsh. The conda install gmsh appears to work fine.
134
-
135
- # Usage - with OpenMC
136
-
137
- You may also want to install OpenMC with DAGMC to make use of the h5m geometry files produced in simulations. However you could also use other supported particle transport codes such as MCNP, FLUKA and others supported by [DAGMC](https://svalinn.github.io/DAGMC/).
138
-
139
- You can run ```mamba install -c conda-forge openmc``` however this may choose to install OpenMC without DAGMC included.
140
-
141
- You can be more specific with conda/mamba commands to make sure the latest version of OpenMC which contains DAGMC is chosen by conda / mamba
142
- ```bash
143
- mamba install -c conda-forge -y "openmc=0.14.0=dagmc*nompi*"
144
- ```
145
-
146
- You could also [install OpenMC from source](https://docs.openmc.org/en/stable/quickinstall.html) which might be prefered as it can be tricky for the conda enviroment to get resolved.
147
-
138
+ Installing one of the package dependancies (gmsh) with pip appears to result in errors when passing cad objects in memory between cadquery / ocp and gmsh. The default method of passing cad objects is via file so this should not impact most users. The conda install gmsh appears to work fine with in memory passing of cad objects as the version of OCP matches between Gmsh and CadQuery.
148
139
 
149
140
 
150
141
  # Usage - creation of DAGMC h5m files
@@ -1,14 +1,13 @@
1
1
  import cadquery as cq
2
- from cadquery import Assembly
3
2
  from cad_to_dagmc import CadToDagmc
4
3
 
5
4
  result = cq.Workplane().sphere(5)
6
5
  result2 = cq.Workplane().moveTo(10, 0).sphere(2)
7
6
 
8
- assembly = Assembly()
7
+ assembly = cq.Assembly()
9
8
  assembly.add(result)
10
9
  assembly.add(result2)
11
10
 
12
11
  my_model = CadToDagmc()
13
- my_model.add_cadquery_object(assembly)
14
- my_model.export_dagmc_h5m_file(min_mesh_size=0.5, max_mesh_size=1.0, material_tags=["mat1", "mat2"])
12
+ my_model.add_cadquery_object(cadquery_object=assembly, material_tags=["mat1", "mat2"])
13
+ my_model.export_dagmc_h5m_file(min_mesh_size=0.5, max_mesh_size=1.0)
@@ -24,5 +24,5 @@ cq_shape_2 = r2.extrude(1)
24
24
  compound_of_shapes = cq.Compound.makeCompound([cq_shape_1.val(), cq_shape_2.val()])
25
25
 
26
26
  my_model = CadToDagmc()
27
- my_model.add_cadquery_object(object=compound_of_shapes)
28
- my_model.export_dagmc_h5m_file(max_mesh_size=0.2, min_mesh_size=0.1, material_tags=["mat1", "mat2"])
27
+ my_model.add_cadquery_object(cadquery_object=compound_of_shapes, material_tags=["mat1", "mat2"])
28
+ my_model.export_dagmc_h5m_file(max_mesh_size=0.2, min_mesh_size=0.1)
@@ -0,0 +1,28 @@
1
+ from cad_to_dagmc import CadToDagmc
2
+ import cadquery as cq
3
+
4
+ result = cq.Workplane("XY").moveTo(10, 0).box(3, 3, 0.5).edges("|Z").fillet(0.125)
5
+
6
+ result2 = cq.Workplane("XY").box(1.0, 1.0, 1.0)
7
+ assembly = cq.Assembly()
8
+ assembly.add(result2)
9
+ assembly.save("single_cube.stp", exportType="STEP")
10
+
11
+
12
+ my_model = CadToDagmc()
13
+
14
+ my_model.add_cadquery_object(
15
+ cadquery_object=result,
16
+ material_tags=["mat1"],
17
+ )
18
+
19
+ my_model.add_stp_file(
20
+ filename="single_cube.stp",
21
+ scale_factor=0.1,
22
+ material_tags=["mat2"],
23
+ )
24
+
25
+ my_model.export_dagmc_h5m_file(
26
+ max_mesh_size=0.2,
27
+ min_mesh_size=0.1,
28
+ )
@@ -5,12 +5,8 @@ text = cq.Workplane().text(txt="DAGMC", fontsize=10, distance=1)
5
5
 
6
6
 
7
7
  my_model = CadToDagmc()
8
- my_model.add_cadquery_object(object=text)
9
-
10
- my_model.export_dagmc_h5m_file(
11
- filename="cadquery_text.h5m",
12
- max_mesh_size=0.2,
13
- min_mesh_size=0.1,
8
+ my_model.add_cadquery_object(
9
+ cadquery_object=text,
14
10
  material_tags=[
15
11
  "mat1",
16
12
  "mat2",
@@ -19,3 +15,9 @@ my_model.export_dagmc_h5m_file(
19
15
  "mat5",
20
16
  ], # 5 volumes one for each letter
21
17
  )
18
+
19
+ my_model.export_dagmc_h5m_file(
20
+ filename="cadquery_text.h5m",
21
+ max_mesh_size=0.2,
22
+ min_mesh_size=0.1,
23
+ )
@@ -39,11 +39,13 @@ result = (
39
39
 
40
40
  my_model = CadToDagmc()
41
41
 
42
- my_model.add_cadquery_object(result)
42
+ my_model.add_cadquery_object(
43
+ cadquery_object=result,
44
+ material_tags=["mat1"],
45
+ )
43
46
 
44
47
  my_model.export_dagmc_h5m_file(
45
48
  filename="cadquery_objects_and_stp_files.h5m",
46
49
  max_mesh_size=1,
47
50
  min_mesh_size=0.1,
48
- material_tags=["mat1"],
49
51
  )
@@ -0,0 +1,55 @@
1
+ # this file makes a GMESH mesh file from a Step file
2
+ # then loads up the GMESH file and converts it to a DAGMC file
3
+
4
+
5
+ # making the GMESH file
6
+ from cad_to_dagmc import CadToDagmc
7
+ import cadquery as cq
8
+
9
+ result1 = cq.Workplane("XY").box(10.0, 10.0, 5.0)
10
+ result2 = cq.Workplane("XY").moveTo(10, 0).box(10.0, 10.0, 5.0)
11
+ assembly = cq.Assembly()
12
+ assembly.add(result1)
13
+ assembly.add(result2)
14
+ assembly.save("two_connected_cubes.stp", exportType="STEP")
15
+
16
+ geometry = CadToDagmc()
17
+ geometry.add_stp_file("two_connected_cubes.stp")
18
+ geometry.export_gmsh_mesh_file(filename="example_gmsh_mesh.msh")
19
+
20
+ # converting the mesh file to a DAGMC file
21
+ from cad_to_dagmc import MeshToDagmc
22
+
23
+ mesh = MeshToDagmc(filename="example_gmsh_mesh.msh")
24
+
25
+ mesh.export_dagmc_h5m_file(
26
+ material_tags=["mat1", "mat2"],
27
+ filename="dagmc.h5m",
28
+ )
29
+
30
+ # making use of the DAGMC file in OpenMC
31
+ import openmc
32
+
33
+ openmc.config["cross_sections"] = "cross_sections.xml"
34
+
35
+ mat1 = openmc.Material(name="mat1")
36
+ mat1.add_nuclide("H1", 1, percent_type="ao")
37
+ mat1.set_density("g/cm3", 0.001)
38
+
39
+ mat2 = openmc.Material(name="mat2")
40
+ mat2.add_nuclide("H1", 1, percent_type="ao")
41
+ mat2.set_density("g/cm3", 0.002)
42
+
43
+ materials = openmc.Materials([mat1, mat2])
44
+
45
+ universe = openmc.DAGMCUniverse("dagmc.h5m").bounded_universe()
46
+ geometry = openmc.Geometry(universe)
47
+
48
+ my_settings = openmc.Settings()
49
+ my_settings.batches = 10
50
+ my_settings.inactive = 0
51
+ my_settings.particles = 500
52
+ my_settings.run_mode = "fixed source"
53
+
54
+ model = openmc.Model(geometry=geometry, materials=materials, settings=my_settings)
55
+ model.run()
@@ -7,6 +7,6 @@ box = cq.Workplane("XY").moveTo(2, 0).box(2, 2, 2)
7
7
  box_with_round_corners = cq.Workplane("XY").box(2, 1, 1)
8
8
 
9
9
  my_model = CadToDagmc()
10
- my_model.add_cadquery_object(box)
11
- my_model.add_cadquery_object(box_with_round_corners)
12
- my_model.export_dagmc_h5m_file(material_tags=["mat1", "mat2"])
10
+ my_model.add_cadquery_object(cadquery_object=box, material_tags=["mat1"])
11
+ my_model.add_cadquery_object(cadquery_object=box_with_round_corners, material_tags=["mat2"])
12
+ my_model.export_dagmc_h5m_file()