cad-to-dagmc 0.7.0__tar.gz → 0.7.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.

Potentially problematic release.


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

Files changed (55) hide show
  1. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/.github/workflows/ci_with_benchmarks.yml +4 -4
  2. cad_to_dagmc-0.7.0/.github/workflows/ci_with_install.yml → cad_to_dagmc-0.7.2/.github/workflows/ci_with_conda_install.yml +7 -6
  3. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/.github/workflows/ci_with_pip_install.yml +7 -15
  4. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/.gitignore +1 -0
  5. cad_to_dagmc-0.7.2/CITATION.cff +10 -0
  6. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/PKG-INFO +19 -58
  7. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/README.md +16 -57
  8. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +2 -2
  9. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/pyproject.toml +2 -0
  10. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/src/_version.py +2 -2
  11. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/src/cad_to_dagmc/core.py +92 -43
  12. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/src/cad_to_dagmc.egg-info/PKG-INFO +19 -58
  13. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/src/cad_to_dagmc.egg-info/SOURCES.txt +2 -4
  14. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/src/cad_to_dagmc.egg-info/requires.txt +2 -0
  15. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/test_python_api.py +32 -0
  16. cad_to_dagmc-0.7.0/.github/workflows/anaconda-publish.yml +0 -30
  17. cad_to_dagmc-0.7.0/tests/extrude_rectangle.step +0 -0
  18. cad_to_dagmc-0.7.0/tests/single_cube.step +0 -0
  19. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/.github/workflows/black.yml +0 -0
  20. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/.github/workflows/python-publish.yml +0 -0
  21. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/LICENSE +0 -0
  22. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/cadquery_assembly.py +0 -0
  23. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/cadquery_compound.py +0 -0
  24. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
  25. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/cadquery_text.py +0 -0
  26. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
  27. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/from_gmsh_mesh_file.py +0 -0
  28. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
  29. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/multiple_stp_files.py +0 -0
  30. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/single_cadquery_object.py +0 -0
  31. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/single_stp_file.py +0 -0
  32. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
  33. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
  34. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/setup.cfg +0 -0
  35. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/src/cad_to_dagmc/__init__.py +0 -0
  36. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
  37. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
  38. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
  39. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/ball_reactor.brep +0 -0
  40. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/curved_extrude.stp +0 -0
  41. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/extrude_rectangle.stp +0 -0
  42. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/multi_volume_cylinders.stp +0 -0
  43. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/one_cube.brep +0 -0
  44. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/single_cube.stp +0 -0
  45. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/single_volume_thin.stp +0 -0
  46. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/single_volume_thin.vtk +0 -0
  47. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/test_brep_file.brep +0 -0
  48. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/test_file_creation.py +0 -0
  49. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/test_h5m_in_transport.py +0 -0
  50. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/test_loading_from_file_vs_shape_object.py +0 -0
  51. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/test_two_joined_cubes.brep +0 -0
  52. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/test_two_sep_cubes.brep +0 -0
  53. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/test_version.py +0 -0
  54. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/two_connected_cubes.stp +0 -0
  55. {cad_to_dagmc-0.7.0 → cad_to_dagmc-0.7.2}/tests/two_disconnected_cubes.stp +0 -0
@@ -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:
@@ -38,15 +38,16 @@ jobs:
38
38
  sudo apt-get --allow-releaseinfo-change update
39
39
  sudo apt-get update -y
40
40
  sudo apt-get upgrade -y
41
- 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
42
42
  mamba activate
43
43
  mamba create -y --name cad_to_dagmc python=${{ matrix.python-version }}
44
44
  mamba activate cad_to_dagmc
45
- mamba install -y -c conda-forge "openmc=0.14.0=dagmc*nompi*" gmsh python-gmsh
46
- python -m pip install --upgrade pip
47
- 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
48
48
  python -c "import cad_to_dagmc"
49
- python -m pip install .[tests]
49
+ mamba install -y -c conda-forge pytest vtk
50
+ python -m pip install .[tests] --no-deps
50
51
  pytest -v tests
51
52
  python examples/surface_mesh/cadquery_assembly.py
52
53
  python examples/surface_mesh/cadquery_compound.py
@@ -33,26 +33,18 @@ jobs:
33
33
  apt-get --allow-releaseinfo-change update
34
34
  apt-get update -y
35
35
  apt-get upgrade -y
36
- 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 libxcursor-dev libxft2 libxinerama-dev
37
- apt-get install -y make cmake
36
+ 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
38
37
  apt install python3
39
38
  apt install python3-pip
40
39
  python -m pip install --upgrade pip
41
- mkdir MOAB
42
- cd MOAB
43
- git clone --single-branch -b 5.5.1 --depth 1 https://bitbucket.org/fathomteam/moab/
44
- mkdir build
45
- cd build
46
- apt-get install -y libeigen3-dev
47
- cmake ../moab -DENABLE_PYMOAB=ON -DENABLE_HDF5=ON -DENABLE_BLASLAPACK=OFF -DENABLE_FORTRAN=OFF
48
- make -j2
49
- make install
50
- cd ../..
51
- python -m pip install .
52
- python -c "import cad_to_dagmc"
40
+ git clone --single-branch -b master --depth 1 https://bitbucket.org/fathomteam/moab/
41
+ cd moab
42
+ python -m pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
43
+ cd ..
44
+ python -c "import pymoab"
53
45
  python -m pip install .[tests]
46
+ python -c "import cad_to_dagmc"
54
47
  pytest -v tests
55
- cd examples
56
48
  python examples/surface_mesh/cadquery_assembly.py
57
49
  python examples/surface_mesh/cadquery_compound.py
58
50
  python examples/surface_mesh/cadquery_object_and_stp_file.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.7.0
3
+ Version: 0.7.2
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.26.4
19
+ Requires-Dist: gmsh
18
20
  Provides-Extra: tests
19
21
  Requires-Dist: pytest; extra == "tests"
20
22
  Requires-Dist: vtk; extra == "tests"
@@ -22,7 +24,9 @@ Requires-Dist: vtk; extra == "tests"
22
24
 
23
25
  [![N|Python](https://www.python.org/static/community_logos/python-powered-w-100x40.png)](https://www.python.org)
24
26
 
25
- [![CI with install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml/badge.svg?branch=main)](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml) Testing package and running examples
27
+ [![CI with Conda install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_conda_install.yml/badge.svg)](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
28
+
29
+ [![CI with pip install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_pip_install.yml/badge.svg)](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_pip_install.yml) Testing package and running examples with dependencies installed vua PIP
26
30
 
27
31
  [![CI with model benchmark zoo](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml/badge.svg?branch=main)](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)
28
32
 
@@ -53,8 +57,6 @@ Also checkout these other software projects that also create DAGMC geometry [CAD
53
57
 
54
58
  - Install using Mamba
55
59
  - Install using Conda
56
- - Install using Mamba and pip
57
- - Install using Conda and pip
58
60
  - Install using pip and source compilations
59
61
 
60
62
  ## Install using Mamba
@@ -105,73 +107,32 @@ Then you can install the cad_to_dagmc package
105
107
  conda install -y -c conda-forge cad_to_dagmc
106
108
  ```
107
109
 
108
- ## Install using Mamba and pip
110
+ ## Install using pip and source compilations
109
111
 
110
- In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
111
- - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
112
- - [Anaconda](https://www.anaconda.com/download)
113
- - [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
112
+ It is also possible to avoid the use of conda/mamba and installing using pip.
114
113
 
115
- This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
114
+ First ensure hdf5 is installed as this is needed by MOAB pip install command
116
115
 
117
- Create a new environment, I've chosen Python 3.10 here but newer versions are
118
- also supported.
119
- ```bash
120
- mamba create --name new_env python=3.10 -y
121
116
  ```
122
-
123
- Activate the environment
124
- ```bash
125
- mamba activate new_env
117
+ sudo apt-get install libhdf5-dev
126
118
  ```
127
119
 
128
- Install the dependencies
129
- ```bash
130
- mamba install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
131
- ```
120
+ Then clone the latest version of MOAB and cd into the moab directory.
132
121
 
133
- Then you can install the cad_to_dagmc package
134
- ```bash
135
- pip install cad_to_dagmc
136
122
  ```
137
-
138
-
139
- ## Install using Conda and pip
140
-
141
- In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
142
- - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
143
- - [Anaconda](https://www.anaconda.com/download)
144
- - [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
145
-
146
- This example uses Conda to install some dependencies that are not available via PyPi.
147
-
148
- Create a new environment
149
- ```bash
150
- conda create --name new_env python=3.10 -y
123
+ git clone master https://bitbucket.org/fathomteam/moab/
124
+ cd moab
151
125
  ```
152
126
 
153
- Activate the environment
154
- ```bash
155
- conda activate new_env
127
+ Ensure pip is up to date as a new version is needed
156
128
  ```
157
-
158
- Install the dependencies
159
- ```bash
160
- conda install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
129
+ python -m pip install --upgrade pip
161
130
  ```
162
131
 
163
- Then you can install the cad_to_dagmc package
164
- ```bash
165
- pip install cad_to_dagmc
132
+ Run the pip install command with cmake arguments.
133
+ ```
134
+ pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
166
135
  ```
167
-
168
- ## Install using pip and source compilations
169
-
170
- It should possible to avoid the use of conda and installing using pip and compiling from source.
171
-
172
- First compile MOAB (and install Pymoab) from source
173
-
174
- Then install gmsh from source (installing from pip appears to cause conflicts with the open cascade used in ocp and cadquery)
175
136
 
176
137
  Then you can install the cad_to_dagmc package with ```pip```
177
138
 
@@ -199,7 +160,7 @@ The package requires newer versions of Linux. For example the package does not w
199
160
 
200
161
  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```
201
162
 
202
- 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.
163
+ 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.
203
164
 
204
165
 
205
166
  # Usage - creation of DAGMC h5m files
@@ -1,7 +1,9 @@
1
1
 
2
2
  [![N|Python](https://www.python.org/static/community_logos/python-powered-w-100x40.png)](https://www.python.org)
3
3
 
4
- [![CI with install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml/badge.svg?branch=main)](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml) Testing package and running examples
4
+ [![CI with Conda install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_conda_install.yml/badge.svg)](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
+ [![CI with pip install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_pip_install.yml/badge.svg)](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_pip_install.yml) Testing package and running examples with dependencies installed vua PIP
5
7
 
6
8
  [![CI with model benchmark zoo](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml/badge.svg?branch=main)](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)
7
9
 
@@ -32,8 +34,6 @@ Also checkout these other software projects that also create DAGMC geometry [CAD
32
34
 
33
35
  - Install using Mamba
34
36
  - Install using Conda
35
- - Install using Mamba and pip
36
- - Install using Conda and pip
37
37
  - Install using pip and source compilations
38
38
 
39
39
  ## Install using Mamba
@@ -84,73 +84,32 @@ Then you can install the cad_to_dagmc package
84
84
  conda install -y -c conda-forge cad_to_dagmc
85
85
  ```
86
86
 
87
- ## Install using Mamba and pip
87
+ ## Install using pip and source compilations
88
88
 
89
- In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
90
- - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
91
- - [Anaconda](https://www.anaconda.com/download)
92
- - [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
89
+ It is also possible to avoid the use of conda/mamba and installing using pip.
93
90
 
94
- This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
91
+ First ensure hdf5 is installed as this is needed by MOAB pip install command
95
92
 
96
- Create a new environment, I've chosen Python 3.10 here but newer versions are
97
- also supported.
98
- ```bash
99
- mamba create --name new_env python=3.10 -y
100
93
  ```
101
-
102
- Activate the environment
103
- ```bash
104
- mamba activate new_env
94
+ sudo apt-get install libhdf5-dev
105
95
  ```
106
96
 
107
- Install the dependencies
108
- ```bash
109
- mamba install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
110
- ```
97
+ Then clone the latest version of MOAB and cd into the moab directory.
111
98
 
112
- Then you can install the cad_to_dagmc package
113
- ```bash
114
- pip install cad_to_dagmc
115
99
  ```
116
-
117
-
118
- ## Install using Conda and pip
119
-
120
- In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
121
- - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
122
- - [Anaconda](https://www.anaconda.com/download)
123
- - [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
124
-
125
- This example uses Conda to install some dependencies that are not available via PyPi.
126
-
127
- Create a new environment
128
- ```bash
129
- conda create --name new_env python=3.10 -y
100
+ git clone master https://bitbucket.org/fathomteam/moab/
101
+ cd moab
130
102
  ```
131
103
 
132
- Activate the environment
133
- ```bash
134
- conda activate new_env
104
+ Ensure pip is up to date as a new version is needed
135
105
  ```
136
-
137
- Install the dependencies
138
- ```bash
139
- conda install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
106
+ python -m pip install --upgrade pip
140
107
  ```
141
108
 
142
- Then you can install the cad_to_dagmc package
143
- ```bash
144
- pip install cad_to_dagmc
109
+ Run the pip install command with cmake arguments.
110
+ ```
111
+ pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
145
112
  ```
146
-
147
- ## Install using pip and source compilations
148
-
149
- It should possible to avoid the use of conda and installing using pip and compiling from source.
150
-
151
- First compile MOAB (and install Pymoab) from source
152
-
153
- Then install gmsh from source (installing from pip appears to cause conflicts with the open cascade used in ocp and cadquery)
154
113
 
155
114
  Then you can install the cad_to_dagmc package with ```pip```
156
115
 
@@ -178,7 +137,7 @@ The package requires newer versions of Linux. For example the package does not w
178
137
 
179
138
  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```
180
139
 
181
- 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.
140
+ 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.
182
141
 
183
142
 
184
143
  # Usage - creation of DAGMC h5m files
@@ -56,7 +56,7 @@ assembly.save("twist_and_extrude.step")
56
56
 
57
57
  my_model = CadToDagmc()
58
58
 
59
- my_model.add_cadquery_object(result)
60
- my_model.add_cadquery_object(result2)
59
+ my_model.add_cadquery_object(result, material_tags=["mat1"])
60
+ my_model.add_cadquery_object(result2, material_tags=["mat2"])
61
61
 
62
62
  my_model.export_unstructured_mesh_file(filename="umesh.h5m", max_mesh_size=1, min_mesh_size=0.1)
@@ -21,6 +21,8 @@ dependencies = [
21
21
  "trimesh",
22
22
  "networkx",
23
23
  "cadquery>=2.4.0",
24
+ "numpy<=1.26.4",
25
+ "gmsh"
24
26
  ]
25
27
  dynamic = ["version"]
26
28
 
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.7.0'
16
- __version_tuple__ = version_tuple = (0, 7, 0)
15
+ __version__ = version = '0.7.2'
16
+ __version_tuple__ = version_tuple = (0, 7, 2)
@@ -1,13 +1,12 @@
1
- import typing
2
-
3
1
  import cadquery as cq
4
2
  import gmsh
5
3
  import numpy as np
6
- from cadquery import importers
4
+ from cadquery import importers, exporters
7
5
  from pymoab import core, types
6
+ import tempfile
8
7
 
9
8
 
10
- def _define_moab_core_and_tags() -> typing.Tuple[core.Core, dict]:
9
+ def _define_moab_core_and_tags() -> tuple[core.Core, dict]:
11
10
  """Creates a MOAB Core instance which can be built up by adding sets of
12
11
  triangles to the instance
13
12
 
@@ -62,14 +61,11 @@ def _define_moab_core_and_tags() -> typing.Tuple[core.Core, dict]:
62
61
 
63
62
 
64
63
  def _vertices_to_h5m(
65
- vertices: typing.Union[
66
- typing.Iterable[typing.Tuple[float, float, float]],
67
- typing.Iterable["cadquery.occ_impl.geom.Vector"],
68
- ],
69
- triangles_by_solid_by_face: typing.Iterable[typing.Iterable[typing.Tuple[int, int, int]]],
70
- material_tags: typing.Iterable[str],
71
- h5m_filename="dagmc.h5m",
72
- implicit_complement_material_tag=None,
64
+ vertices: list[tuple[float, float, float]] | list["cadquery.occ_impl.geom.Vector"],
65
+ triangles_by_solid_by_face: list[list[tuple[int, int, int]]],
66
+ material_tags: list[str],
67
+ h5m_filename: str = "dagmc.h5m",
68
+ implicit_complement_material_tag: str | None = None,
73
69
  ):
74
70
  """Converts vertices and triangle sets into a tagged h5m file compatible
75
71
  with DAGMC enabled neutronics simulations
@@ -194,8 +190,29 @@ def _vertices_to_h5m(
194
190
  return h5m_filename
195
191
 
196
192
 
193
+ def get_volumes(gmsh, assembly, method="file"):
194
+
195
+ if method == "in memory":
196
+ volumes = gmsh.model.occ.importShapesNativePointer(assembly.wrapped._address())
197
+ gmsh.model.occ.synchronize()
198
+ elif method == "file":
199
+ with tempfile.NamedTemporaryFile(suffix=".step") as temp_file:
200
+ exporters.export(assembly, temp_file.name)
201
+ volumes = gmsh.model.occ.importShapes(temp_file.name)
202
+ gmsh.model.occ.synchronize()
203
+
204
+ return gmsh, volumes
205
+
206
+
207
+ def init_gmsh():
208
+ gmsh.initialize()
209
+ gmsh.option.setNumber("General.Terminal", 1)
210
+ gmsh.model.add("made_with_cad_to_dagmc_package")
211
+ return gmsh
212
+
213
+
197
214
  def _mesh_brep(
198
- occ_shape: str,
215
+ gmsh,
199
216
  min_mesh_size: float = 1,
200
217
  max_mesh_size: float = 10,
201
218
  mesh_algorithm: int = 1,
@@ -219,18 +236,12 @@ def _mesh_brep(
219
236
  The resulting gmsh object and volumes
220
237
  """
221
238
 
222
- gmsh.initialize()
223
- gmsh.option.setNumber("General.Terminal", 1)
224
- gmsh.model.add("made_with_cad_to_dagmc_package")
225
- volumes = gmsh.model.occ.importShapesNativePointer(occ_shape)
226
- gmsh.model.occ.synchronize()
227
-
228
239
  gmsh.option.setNumber("Mesh.Algorithm", mesh_algorithm)
229
240
  gmsh.option.setNumber("Mesh.MeshSizeMin", min_mesh_size)
230
241
  gmsh.option.setNumber("Mesh.MeshSizeMax", max_mesh_size)
231
242
  gmsh.model.mesh.generate(dimensions)
232
243
 
233
- return gmsh, volumes
244
+ return gmsh
234
245
 
235
246
 
236
247
  def mesh_to_vertices_and_triangles(
@@ -336,18 +347,18 @@ class MeshToDagmc:
336
347
 
337
348
  def export_dagmc_h5m_file(
338
349
  self,
339
- material_tags: typing.Iterable[str],
340
- implicit_complement_material_tag: typing.Optional[str] = None,
350
+ material_tags: list[str],
351
+ implicit_complement_material_tag: str | None = None,
341
352
  filename: str = "dagmc.h5m",
342
353
  ):
343
354
  """Saves a DAGMC h5m file of the geometry
344
355
 
345
356
  Args:
346
- material_tags (typing.Iterable[str]): the names of the DAGMC
357
+ material_tags (list[str]): the names of the DAGMC
347
358
  material tags to assign. These will need to be in the same
348
359
  order as the volumes in the GMESH mesh and match the
349
360
  material tags used in the neutronics code (e.g. OpenMC).
350
- implicit_complement_material_tag (typing.Optional[str], optional):
361
+ implicit_complement_material_tag (str | None, optional):
351
362
  the name of the material tag to use for the implicit
352
363
  complement (void space). Defaults to None which is a vacuum.
353
364
  filename (str, optional): _description_. Defaults to "dagmc.h5m".
@@ -395,13 +406,13 @@ class CadToDagmc:
395
406
  self,
396
407
  filename: str,
397
408
  scale_factor: float = 1.0,
398
- material_tags: typing.Optional[typing.Iterable[str]] = None,
399
- ):
409
+ material_tags: list[str] | None = None,
410
+ ) -> int:
400
411
  """Loads the parts from stp file into the model.
401
412
 
402
413
  Args:
403
414
  filename: the filename used to save the html graph.
404
- material_tags (typing.Iterable[str]): the names of the DAGMC
415
+ material_tags (list[str]): the names of the DAGMC
405
416
  material tags to assign. These will need to be in the
406
417
  same order as the volumes in the geometry added (STP
407
418
  file and CadQuery objects) and match the material tags
@@ -410,6 +421,9 @@ class CadToDagmc:
410
421
  used to increase the size or decrease the size of the geometry.
411
422
  Useful when converting the geometry to cm for use in neutronics
412
423
  simulations.
424
+
425
+ Returns:
426
+ int: number of volumes in the stp file.
413
427
  """
414
428
  part = importers.importStep(str(filename)).val()
415
429
 
@@ -417,25 +431,28 @@ class CadToDagmc:
417
431
  scaled_part = part
418
432
  else:
419
433
  scaled_part = part.scale(scale_factor)
420
- self.add_cadquery_object(cadquery_object=scaled_part, material_tags=material_tags)
434
+ return self.add_cadquery_object(cadquery_object=scaled_part, material_tags=material_tags)
421
435
 
422
436
  def add_cadquery_object(
423
437
  self,
424
- cadquery_object: typing.Union[
425
- cq.assembly.Assembly, cq.occ_impl.shapes.Compound, cq.occ_impl.shapes.Solid
426
- ],
427
- material_tags: typing.Optional[typing.Iterable[str]] = None,
428
- ):
438
+ cadquery_object: (
439
+ cq.assembly.Assembly | cq.occ_impl.shapes.Compound | cq.occ_impl.shapes.Solid
440
+ ),
441
+ material_tags: list[str] | None,
442
+ ) -> int:
429
443
  """Loads the parts from CadQuery object into the model.
430
444
 
431
445
  Args:
432
446
  cadquery_object: the cadquery object to convert, can be a CadQuery assembly
433
447
  cadquery workplane or a cadquery solid
434
- material_tags (Optional typing.Iterable[str]): the names of the
448
+ material_tags (Optional list[str]): the names of the
435
449
  DAGMC material tags to assign. These will need to be in the
436
450
  same order as the volumes in the geometry added (STP file and
437
451
  CadQuery objects) and match the material tags used in the
438
452
  neutronics code (e.g. OpenMC).
453
+
454
+ Returns:
455
+ int: number of volumes in the stp file.
439
456
  """
440
457
 
441
458
  if isinstance(cadquery_object, cq.assembly.Assembly):
@@ -451,12 +468,15 @@ class CadToDagmc:
451
468
  self.material_tags = self.material_tags + material_tags
452
469
  self.parts = self.parts + iterable_solids
453
470
 
471
+ return len(iterable_solids)
472
+
454
473
  def export_unstructured_mesh_file(
455
474
  self,
456
475
  filename: str = "umesh.h5m",
457
476
  min_mesh_size: float = 1,
458
477
  max_mesh_size: float = 5,
459
478
  mesh_algorithm: int = 1,
479
+ method: str = "file",
460
480
  ):
461
481
 
462
482
  assembly = cq.Assembly()
@@ -465,8 +485,12 @@ class CadToDagmc:
465
485
 
466
486
  imprinted_assembly, _ = cq.occ_impl.assembly.imprint(assembly)
467
487
 
468
- gmsh, _ = _mesh_brep(
469
- occ_shape=imprinted_assembly.wrapped._address(),
488
+ gmsh = init_gmsh()
489
+
490
+ gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method)
491
+
492
+ gmsh = _mesh_brep(
493
+ gmsh=gmsh,
470
494
  min_mesh_size=min_mesh_size,
471
495
  max_mesh_size=max_mesh_size,
472
496
  mesh_algorithm=mesh_algorithm,
@@ -491,6 +515,7 @@ class CadToDagmc:
491
515
  max_mesh_size: float = 5,
492
516
  mesh_algorithm: int = 1,
493
517
  dimensions: int = 2,
518
+ method: str = "file",
494
519
  ):
495
520
  """Saves a GMesh msh file of the geometry in either 2D surface mesh or
496
521
  3D volume mesh.
@@ -502,6 +527,14 @@ class CadToDagmc:
502
527
  mesh_algorithm: the gmsh mesh algorithm to use.
503
528
  dimensions: The number of dimensions, 2 for a surface mesh 3 for a
504
529
  volume mesh. Passed to gmsh.model.mesh.generate()
530
+ method: the method to use to import the geometry into gmsh. Options
531
+ are 'file' or 'in memory'. 'file' is the default and will write
532
+ the geometry to a temporary file before importing it into gmsh.
533
+ 'in memory' will import the geometry directly into gmsh but
534
+ requires the version of OpenCASCADE used to build gmsh to be
535
+ the same as the version used by CadQuery. This is possible to
536
+ ensure when installing the package with Conda but harder when
537
+ installing from PyPI.
505
538
  """
506
539
 
507
540
  assembly = cq.Assembly()
@@ -510,8 +543,12 @@ class CadToDagmc:
510
543
 
511
544
  imprinted_assembly, _ = cq.occ_impl.assembly.imprint(assembly)
512
545
 
513
- gmsh, _ = _mesh_brep(
514
- occ_shape=imprinted_assembly.wrapped._address(),
546
+ gmsh = init_gmsh()
547
+
548
+ gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method)
549
+
550
+ gmsh = _mesh_brep(
551
+ gmsh=gmsh,
515
552
  min_mesh_size=min_mesh_size,
516
553
  max_mesh_size=max_mesh_size,
517
554
  mesh_algorithm=mesh_algorithm,
@@ -530,7 +567,8 @@ class CadToDagmc:
530
567
  min_mesh_size: float = 1,
531
568
  max_mesh_size: float = 5,
532
569
  mesh_algorithm: int = 1,
533
- implicit_complement_material_tag: typing.Optional[str] = None,
570
+ implicit_complement_material_tag: str | None = None,
571
+ method: str = "file",
534
572
  ) -> str:
535
573
  """Saves a DAGMC h5m file of the geometry
536
574
 
@@ -540,10 +578,17 @@ class CadToDagmc:
540
578
  min_mesh_size (float, optional): the minimum size of mesh elements to use. Defaults to 1.
541
579
  max_mesh_size (float, optional): the maximum size of mesh elements to use. Defaults to 5.
542
580
  mesh_algorithm (int, optional): the GMSH mesh algorithm to use.. Defaults to 1.
543
- implicit_complement_material_tag (typing.Optional[str], optional):
581
+ implicit_complement_material_tag (str | None, optional):
544
582
  the name of the material tag to use for the implicit complement
545
583
  (void space). Defaults to None which is a vacuum. Defaults to None.
546
-
584
+ method: the method to use to import the geometry into gmsh. Options
585
+ are 'file' or 'in memory'. 'file' is the default and will write
586
+ the geometry to a temporary file before importing it into gmsh.
587
+ 'in memory' will import the geometry directly into gmsh but
588
+ requires the version of OpenCASCADE used to build gmsh to be
589
+ the same as the version used by CadQuery. This is possible to
590
+ ensure when installing the package with Conda but harder when
591
+ installing from PyPI.
547
592
  Returns:
548
593
  str: the DAGMC filename saved
549
594
  """
@@ -570,8 +615,12 @@ class CadToDagmc:
570
615
 
571
616
  _check_material_tags(material_tags_in_brep_order, self.parts)
572
617
 
573
- gmsh, volumes = _mesh_brep(
574
- occ_shape=imprinted_assembly.wrapped._address(), # in memory address
618
+ gmsh = init_gmsh()
619
+
620
+ gmsh, volumes = get_volumes(gmsh, imprinted_assembly, method=method)
621
+
622
+ gmsh = _mesh_brep(
623
+ gmsh=gmsh,
575
624
  min_mesh_size=min_mesh_size,
576
625
  max_mesh_size=max_mesh_size,
577
626
  mesh_algorithm=mesh_algorithm,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cad_to_dagmc
3
- Version: 0.7.0
3
+ Version: 0.7.2
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.26.4
19
+ Requires-Dist: gmsh
18
20
  Provides-Extra: tests
19
21
  Requires-Dist: pytest; extra == "tests"
20
22
  Requires-Dist: vtk; extra == "tests"
@@ -22,7 +24,9 @@ Requires-Dist: vtk; extra == "tests"
22
24
 
23
25
  [![N|Python](https://www.python.org/static/community_logos/python-powered-w-100x40.png)](https://www.python.org)
24
26
 
25
- [![CI with install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml/badge.svg?branch=main)](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_install.yml) Testing package and running examples
27
+ [![CI with Conda install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_conda_install.yml/badge.svg)](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
28
+
29
+ [![CI with pip install](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_pip_install.yml/badge.svg)](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_pip_install.yml) Testing package and running examples with dependencies installed vua PIP
26
30
 
27
31
  [![CI with model benchmark zoo](https://github.com/fusion-energy/cad_to_dagmc/actions/workflows/ci_with_benchmarks.yml/badge.svg?branch=main)](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)
28
32
 
@@ -53,8 +57,6 @@ Also checkout these other software projects that also create DAGMC geometry [CAD
53
57
 
54
58
  - Install using Mamba
55
59
  - Install using Conda
56
- - Install using Mamba and pip
57
- - Install using Conda and pip
58
60
  - Install using pip and source compilations
59
61
 
60
62
  ## Install using Mamba
@@ -105,73 +107,32 @@ Then you can install the cad_to_dagmc package
105
107
  conda install -y -c conda-forge cad_to_dagmc
106
108
  ```
107
109
 
108
- ## Install using Mamba and pip
110
+ ## Install using pip and source compilations
109
111
 
110
- In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
111
- - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
112
- - [Anaconda](https://www.anaconda.com/download)
113
- - [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
112
+ It is also possible to avoid the use of conda/mamba and installing using pip.
114
113
 
115
- This example assumes you have installed the Miniforge option or separately have installed Mamba with ```conda install -c conda-forge mamba -y```
114
+ First ensure hdf5 is installed as this is needed by MOAB pip install command
116
115
 
117
- Create a new environment, I've chosen Python 3.10 here but newer versions are
118
- also supported.
119
- ```bash
120
- mamba create --name new_env python=3.10 -y
121
116
  ```
122
-
123
- Activate the environment
124
- ```bash
125
- mamba activate new_env
117
+ sudo apt-get install libhdf5-dev
126
118
  ```
127
119
 
128
- Install the dependencies
129
- ```bash
130
- mamba install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
131
- ```
120
+ Then clone the latest version of MOAB and cd into the moab directory.
132
121
 
133
- Then you can install the cad_to_dagmc package
134
- ```bash
135
- pip install cad_to_dagmc
136
122
  ```
137
-
138
-
139
- ## Install using Conda and pip
140
-
141
- In principle, installing any Conda/Mamba distribution will work. A few Conda/Mamba options are:
142
- - [Miniforge](https://github.com/conda-forge/miniforge) (recommended as it includes mamba)
143
- - [Anaconda](https://www.anaconda.com/download)
144
- - [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
145
-
146
- This example uses Conda to install some dependencies that are not available via PyPi.
147
-
148
- Create a new environment
149
- ```bash
150
- conda create --name new_env python=3.10 -y
123
+ git clone master https://bitbucket.org/fathomteam/moab/
124
+ cd moab
151
125
  ```
152
126
 
153
- Activate the environment
154
- ```bash
155
- conda activate new_env
127
+ Ensure pip is up to date as a new version is needed
156
128
  ```
157
-
158
- Install the dependencies
159
- ```bash
160
- conda install -y -c conda-forge "moab>=5.3.0" gmsh python-gmsh
129
+ python -m pip install --upgrade pip
161
130
  ```
162
131
 
163
- Then you can install the cad_to_dagmc package
164
- ```bash
165
- pip install cad_to_dagmc
132
+ Run the pip install command with cmake arguments.
133
+ ```
134
+ pip install . --config-settings=cmake.args=-DENABLE_HDF5=ON
166
135
  ```
167
-
168
- ## Install using pip and source compilations
169
-
170
- It should possible to avoid the use of conda and installing using pip and compiling from source.
171
-
172
- First compile MOAB (and install Pymoab) from source
173
-
174
- Then install gmsh from source (installing from pip appears to cause conflicts with the open cascade used in ocp and cadquery)
175
136
 
176
137
  Then you can install the cad_to_dagmc package with ```pip```
177
138
 
@@ -199,7 +160,7 @@ The package requires newer versions of Linux. For example the package does not w
199
160
 
200
161
  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```
201
162
 
202
- 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.
163
+ 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.
203
164
 
204
165
 
205
166
  # Usage - creation of DAGMC h5m files
@@ -1,11 +1,11 @@
1
1
  .gitignore
2
+ CITATION.cff
2
3
  LICENSE
3
4
  README.md
4
5
  pyproject.toml
5
- .github/workflows/anaconda-publish.yml
6
6
  .github/workflows/black.yml
7
7
  .github/workflows/ci_with_benchmarks.yml
8
- .github/workflows/ci_with_install.yml
8
+ .github/workflows/ci_with_conda_install.yml
9
9
  .github/workflows/ci_with_pip_install.yml
10
10
  .github/workflows/python-publish.yml
11
11
  examples/surface_mesh/cadquery_assembly.py
@@ -32,11 +32,9 @@ src/cad_to_dagmc.egg-info/top_level.txt
32
32
  tests/ENDFB-7.1-NNDC_H1.h5
33
33
  tests/ball_reactor.brep
34
34
  tests/curved_extrude.stp
35
- tests/extrude_rectangle.step
36
35
  tests/extrude_rectangle.stp
37
36
  tests/multi_volume_cylinders.stp
38
37
  tests/one_cube.brep
39
- tests/single_cube.step
40
38
  tests/single_cube.stp
41
39
  tests/single_volume_thin.stp
42
40
  tests/single_volume_thin.vtk
@@ -1,6 +1,8 @@
1
1
  trimesh
2
2
  networkx
3
3
  cadquery>=2.4.0
4
+ numpy<=1.26.4
5
+ gmsh
4
6
 
5
7
  [tests]
6
8
  pytest
@@ -106,3 +106,35 @@ def test_h5m_file_tags():
106
106
  2: "mat:mat2",
107
107
  3: "mat:mat3",
108
108
  }
109
+
110
+
111
+ def test_add_cadquery_object_returned_volumes():
112
+ """Checks that a add_cadquery_object method returns the correct number of volumes"""
113
+
114
+ sphere1 = cq.Workplane().sphere(20)
115
+ sphere2 = cq.Workplane().moveTo(100, 100).sphere(20)
116
+ sphere3 = cq.Workplane().moveTo(-100, -100).sphere(20)
117
+
118
+ c2d = CadToDagmc()
119
+ vols = c2d.add_cadquery_object(sphere1, material_tags=["mat1"])
120
+ assert vols == 1
121
+
122
+ assembly = cq.Assembly()
123
+ assembly.add(sphere1)
124
+ assembly.add(sphere2)
125
+ assembly.add(sphere3)
126
+ c2d = CadToDagmc()
127
+ vols = c2d.add_cadquery_object(assembly, material_tags=["mat1", "mat2", "mat3"])
128
+ assert vols == 3
129
+
130
+
131
+ def test_add_stp_file_returned_volumes():
132
+ """Checks that a add_stp_file method returns the correct number of volumes"""
133
+
134
+ c2d = CadToDagmc()
135
+ vols = c2d.add_stp_file("tests/curved_extrude.stp")
136
+ assert vols == 1
137
+
138
+ c2d = CadToDagmc()
139
+ vols = c2d.add_stp_file("tests/two_disconnected_cubes.stp")
140
+ assert vols == 2
@@ -1,30 +0,0 @@
1
- name: anaconda-publish
2
-
3
- on:
4
- workflow_dispatch:
5
- release:
6
- types: [published]
7
-
8
- jobs:
9
- build:
10
- runs-on: ubuntu-latest
11
- container: continuumio/miniconda3:4.12.0
12
-
13
- steps:
14
- - uses: actions/checkout@v3
15
-
16
- - name: Set up conda
17
- run: |
18
- apt-get --allow-releaseinfo-change update
19
- apt install -y libgl1-mesa-glx
20
- conda install -y anaconda-client conda-build
21
- conda config --set anaconda_upload no
22
- - name: Build and publish to conda
23
- env:
24
- ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
25
- run: |
26
- conda build conda -c conda-forge --config-file conda/conda_build_config.yaml
27
- conda convert /opt/conda/conda-bld/linux-64/*.tar.bz2 --platform osx-64
28
- anaconda upload -f /opt/conda/conda-bld/*/*.tar.bz2
29
-
30
- # Note conversion to windows is not supported as MOAB is a dependency
Binary file
File without changes
File without changes