cad-to-dagmc 0.7.3__py3-none-any.whl → 0.7.4__py3-none-any.whl
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.
- _version.py +2 -2
- cad_to_dagmc/core.py +41 -8
- {cad_to_dagmc-0.7.3.dist-info → cad_to_dagmc-0.7.4.dist-info}/METADATA +5 -5
- cad_to_dagmc-0.7.4.dist-info/RECORD +8 -0
- {cad_to_dagmc-0.7.3.dist-info → cad_to_dagmc-0.7.4.dist-info}/WHEEL +1 -1
- cad_to_dagmc-0.7.3.dist-info/RECORD +0 -8
- {cad_to_dagmc-0.7.3.dist-info → cad_to_dagmc-0.7.4.dist-info}/LICENSE +0 -0
- {cad_to_dagmc-0.7.3.dist-info → cad_to_dagmc-0.7.4.dist-info}/top_level.txt +0 -0
_version.py
CHANGED
cad_to_dagmc/core.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
from pathlib import Path
|
|
1
2
|
import cadquery as cq
|
|
2
3
|
import gmsh
|
|
3
4
|
import numpy as np
|
|
4
|
-
from cadquery import importers
|
|
5
|
+
from cadquery import importers
|
|
5
6
|
from pymoab import core, types
|
|
6
7
|
import tempfile
|
|
7
8
|
|
|
@@ -484,13 +485,48 @@ class CadToDagmc:
|
|
|
484
485
|
|
|
485
486
|
def export_unstructured_mesh_file(
|
|
486
487
|
self,
|
|
487
|
-
filename: str = "umesh.
|
|
488
|
+
filename: str = "umesh.vtk",
|
|
488
489
|
min_mesh_size: float = 1,
|
|
489
490
|
max_mesh_size: float = 5,
|
|
490
491
|
mesh_algorithm: int = 1,
|
|
491
492
|
method: str = "file",
|
|
492
493
|
scale_factor: float = 1.0,
|
|
493
494
|
):
|
|
495
|
+
"""
|
|
496
|
+
Exports an unstructured mesh file in VTK format for use with openmc.UnstructuredMesh.
|
|
497
|
+
Compatible with the MOAB unstructured mesh library. Example useage
|
|
498
|
+
openmc.UnstructuredMesh(filename="umesh.vtk", library="moab")
|
|
499
|
+
|
|
500
|
+
Parameters:
|
|
501
|
+
-----------
|
|
502
|
+
filename : str, optional
|
|
503
|
+
The name of the output file. Default is "umesh.vtk".
|
|
504
|
+
min_mesh_size: the minimum mesh element size to use in Gmsh. Passed
|
|
505
|
+
into gmsh.option.setNumber("Mesh.MeshSizeMin", min_mesh_size)
|
|
506
|
+
max_mesh_size: the maximum mesh element size to use in Gmsh. Passed
|
|
507
|
+
into gmsh.option.setNumber("Mesh.MeshSizeMax", max_mesh_size)
|
|
508
|
+
mesh_algorithm: The Gmsh mesh algorithm number to use. Passed into
|
|
509
|
+
gmsh.option.setNumber("Mesh.Algorithm", mesh_algorithm)
|
|
510
|
+
method: the method to use to import the geometry into gmsh. Options
|
|
511
|
+
are 'file' or 'in memory'. 'file' is the default and will write
|
|
512
|
+
the geometry to a temporary file before importing it into gmsh.
|
|
513
|
+
'in memory' will import the geometry directly into gmsh but
|
|
514
|
+
requires the version of OpenCASCADE used to build gmsh to be
|
|
515
|
+
the same as the version used by CadQuery. This is possible to
|
|
516
|
+
ensure when installing the package with Conda but harder when
|
|
517
|
+
installing from PyPI.
|
|
518
|
+
scale_factor: a scaling factor to apply to the geometry that can be
|
|
519
|
+
used to enlarge or shrink the geometry. Useful when converting
|
|
520
|
+
Useful when converting the geometry to cm for use in neutronics
|
|
521
|
+
|
|
522
|
+
Returns:
|
|
523
|
+
--------
|
|
524
|
+
gmsh : gmsh
|
|
525
|
+
The gmsh object after finalizing the mesh.
|
|
526
|
+
"""
|
|
527
|
+
|
|
528
|
+
if Path(filename).suffix != ".vtk":
|
|
529
|
+
raise ValueError("Unstructured mesh filename must have a .vtk extension")
|
|
494
530
|
|
|
495
531
|
assembly = cq.Assembly()
|
|
496
532
|
for part in self.parts:
|
|
@@ -510,12 +546,9 @@ class CadToDagmc:
|
|
|
510
546
|
dimensions=3,
|
|
511
547
|
)
|
|
512
548
|
|
|
513
|
-
# gmesh writes out a vtk file that is
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
moab_core = core.Core()
|
|
517
|
-
moab_core.load_file(filename + ".vtk")
|
|
518
|
-
moab_core.write_file(filename)
|
|
549
|
+
# gmesh writes out a vtk file that is accepted by openmc.UnstructuredMesh
|
|
550
|
+
# The library argument must be set to "moab"
|
|
551
|
+
gmsh.write(filename)
|
|
519
552
|
|
|
520
553
|
gmsh.finalize()
|
|
521
554
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cad_to_dagmc
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.4
|
|
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
|
|
@@ -14,12 +14,12 @@ Description-Content-Type: text/markdown
|
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: trimesh
|
|
16
16
|
Requires-Dist: networkx
|
|
17
|
-
Requires-Dist: cadquery
|
|
18
|
-
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: cadquery>=2.4.0
|
|
18
|
+
Requires-Dist: numpy<=1.26.4
|
|
19
19
|
Requires-Dist: gmsh
|
|
20
20
|
Provides-Extra: tests
|
|
21
|
-
Requires-Dist: pytest
|
|
22
|
-
Requires-Dist: vtk
|
|
21
|
+
Requires-Dist: pytest; extra == "tests"
|
|
22
|
+
Requires-Dist: vtk; extra == "tests"
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
[](https://www.python.org)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
_version.py,sha256=23GyHFOGbZ47N1N7nnKbPQ9DYbuR8l4JJZLlq4C_xKg,411
|
|
2
|
+
cad_to_dagmc/__init__.py,sha256=fskHUTyCunSpnpJUvBfAYjx4uwDKXHTTiMP6GqnFRf0,494
|
|
3
|
+
cad_to_dagmc/core.py,sha256=7L4HtFUc6C2_C5JG29FLiGXB6gaS7eQfgtNtTgp38bY,26414
|
|
4
|
+
cad_to_dagmc-0.7.4.dist-info/LICENSE,sha256=B8kznH_777JVNZ3HOKDc4Tj24F7wJ68ledaNYeL9sCw,1070
|
|
5
|
+
cad_to_dagmc-0.7.4.dist-info/METADATA,sha256=143eCryJu05KVSyW4xbIwnWkXJHiWf-GrlF5JnJ2tL4,7937
|
|
6
|
+
cad_to_dagmc-0.7.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
7
|
+
cad_to_dagmc-0.7.4.dist-info/top_level.txt,sha256=zTi8C64SEBsE5WOtPovnxhOzt-E6Oc5nC3RW6M_5aEA,22
|
|
8
|
+
cad_to_dagmc-0.7.4.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
_version.py,sha256=9Y_dpdWykJt40jFoLa3Q4GkYvOMvJ1Y09SkdBJZvTM4,411
|
|
2
|
-
cad_to_dagmc/__init__.py,sha256=fskHUTyCunSpnpJUvBfAYjx4uwDKXHTTiMP6GqnFRf0,494
|
|
3
|
-
cad_to_dagmc/core.py,sha256=_5q_nL_I95JlR1EOAGrG38jMN5SPPZYR86Icg-5At2s,24522
|
|
4
|
-
cad_to_dagmc-0.7.3.dist-info/LICENSE,sha256=B8kznH_777JVNZ3HOKDc4Tj24F7wJ68ledaNYeL9sCw,1070
|
|
5
|
-
cad_to_dagmc-0.7.3.dist-info/METADATA,sha256=L5xUGum0Sz5YlvxleYPlOpbLIRrMtuX5Gnas6diRRTM,7941
|
|
6
|
-
cad_to_dagmc-0.7.3.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
|
7
|
-
cad_to_dagmc-0.7.3.dist-info/top_level.txt,sha256=zTi8C64SEBsE5WOtPovnxhOzt-E6Oc5nC3RW6M_5aEA,22
|
|
8
|
-
cad_to_dagmc-0.7.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|