cad-to-dagmc 0.8.1__tar.gz → 0.8.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.
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/PKG-INFO +1 -1
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/src/_version.py +2 -2
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc/core.py +16 -16
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc.egg-info/PKG-INFO +1 -1
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/test_python_api.py +2 -2
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/.github/workflows/black.yml +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/.github/workflows/ci_with_benchmarks.yml +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/.github/workflows/ci_with_conda_install.yml +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/.github/workflows/ci_with_pip_install.yml +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/.github/workflows/python-publish.yml +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/.gitignore +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/CITATION.cff +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/LICENSE +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/README.md +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_assembly.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_compound.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_text.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/different_resolution_meshes.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/from_gmsh_mesh_file.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/multiple_stp_files.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/single_cadquery_object.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/single_stp_file.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/unstrucutred_volume_mesh/different_resolution_meshes.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/pyproject.toml +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/setup.cfg +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc/__init__.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc.egg-info/SOURCES.txt +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc.egg-info/requires.txt +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/ball_reactor.brep +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/curved_extrude.stp +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/extrude_rectangle.stp +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/multi_volume_cylinders.stp +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/one_cube.brep +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/single_cube.stp +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/single_volume_thin.stp +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/single_volume_thin.vtk +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/test_brep_file.brep +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/test_file_creation.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/test_h5m_in_transport.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/test_loading_from_file_vs_shape_object.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/test_two_joined_cubes.brep +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/test_two_sep_cubes.brep +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/test_version.py +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/two_connected_cubes.stp +0 -0
- {cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/tests/two_disconnected_cubes.stp +0 -0
|
@@ -8,7 +8,7 @@ import tempfile
|
|
|
8
8
|
import warnings
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def
|
|
11
|
+
def define_moab_core_and_tags() -> tuple[core.Core, dict]:
|
|
12
12
|
"""Creates a MOAB Core instance which can be built up by adding sets of
|
|
13
13
|
triangles to the instance
|
|
14
14
|
|
|
@@ -62,7 +62,7 @@ def _define_moab_core_and_tags() -> tuple[core.Core, dict]:
|
|
|
62
62
|
return moab_core, tags
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
def
|
|
65
|
+
def vertices_to_h5m(
|
|
66
66
|
vertices: list[tuple[float, float, float]] | list["cadquery.occ_impl.geom.Vector"],
|
|
67
67
|
triangles_by_solid_by_face: list[list[tuple[int, int, int]]],
|
|
68
68
|
material_tags: list[str],
|
|
@@ -100,7 +100,7 @@ def _vertices_to_h5m(
|
|
|
100
100
|
else:
|
|
101
101
|
face_ids_with_solid_ids[face_id] = [solid_id]
|
|
102
102
|
|
|
103
|
-
moab_core, tags =
|
|
103
|
+
moab_core, tags = define_moab_core_and_tags()
|
|
104
104
|
|
|
105
105
|
volume_sets_by_solid_id = {}
|
|
106
106
|
for material_tag, (solid_id, triangles_on_each_face) in zip(
|
|
@@ -233,7 +233,7 @@ def init_gmsh():
|
|
|
233
233
|
return gmsh
|
|
234
234
|
|
|
235
235
|
|
|
236
|
-
def
|
|
236
|
+
def mesh_brep(
|
|
237
237
|
gmsh,
|
|
238
238
|
min_mesh_size: float | None = None,
|
|
239
239
|
max_mesh_size: float | None = None,
|
|
@@ -355,21 +355,21 @@ def mesh_to_vertices_and_triangles(
|
|
|
355
355
|
return vertices, triangles_by_solid_by_face
|
|
356
356
|
|
|
357
357
|
|
|
358
|
-
def
|
|
358
|
+
def get_ids_from_assembly(assembly: cq.assembly.Assembly):
|
|
359
359
|
ids = []
|
|
360
360
|
for obj, name, loc, _ in assembly:
|
|
361
361
|
ids.append(name)
|
|
362
362
|
return ids
|
|
363
363
|
|
|
364
364
|
|
|
365
|
-
def
|
|
365
|
+
def get_ids_from_imprinted_assembly(solid_id_dict):
|
|
366
366
|
ids = []
|
|
367
367
|
for id in list(solid_id_dict.values()):
|
|
368
368
|
ids.append(id[0])
|
|
369
369
|
return ids
|
|
370
370
|
|
|
371
371
|
|
|
372
|
-
def
|
|
372
|
+
def check_material_tags(material_tags, iterable_solids):
|
|
373
373
|
if material_tags:
|
|
374
374
|
if len(material_tags) != len(iterable_solids):
|
|
375
375
|
msg = (
|
|
@@ -448,7 +448,7 @@ class MeshToDagmc:
|
|
|
448
448
|
|
|
449
449
|
gmsh.finalize()
|
|
450
450
|
|
|
451
|
-
h5m_filename =
|
|
451
|
+
h5m_filename = vertices_to_h5m(
|
|
452
452
|
vertices=vertices,
|
|
453
453
|
triangles_by_solid_by_face=triangles_by_solid_by_face,
|
|
454
454
|
material_tags=material_tags,
|
|
@@ -537,7 +537,7 @@ class CadToDagmc:
|
|
|
537
537
|
else:
|
|
538
538
|
scaled_iterable_solids = [part.scale(scale_factor) for part in iterable_solids]
|
|
539
539
|
|
|
540
|
-
|
|
540
|
+
check_material_tags(material_tags, scaled_iterable_solids)
|
|
541
541
|
if material_tags:
|
|
542
542
|
self.material_tags = self.material_tags + material_tags
|
|
543
543
|
self.parts = self.parts + scaled_iterable_solids
|
|
@@ -613,7 +613,7 @@ class CadToDagmc:
|
|
|
613
613
|
|
|
614
614
|
gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method, scale_factor=scale_factor)
|
|
615
615
|
|
|
616
|
-
gmsh =
|
|
616
|
+
gmsh = mesh_brep(
|
|
617
617
|
gmsh=gmsh,
|
|
618
618
|
min_mesh_size=min_mesh_size,
|
|
619
619
|
max_mesh_size=max_mesh_size,
|
|
@@ -690,7 +690,7 @@ class CadToDagmc:
|
|
|
690
690
|
|
|
691
691
|
gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method, scale_factor=scale_factor)
|
|
692
692
|
|
|
693
|
-
gmsh =
|
|
693
|
+
gmsh = mesh_brep(
|
|
694
694
|
gmsh=gmsh,
|
|
695
695
|
min_mesh_size=min_mesh_size,
|
|
696
696
|
max_mesh_size=max_mesh_size,
|
|
@@ -761,7 +761,7 @@ class CadToDagmc:
|
|
|
761
761
|
for part in self.parts:
|
|
762
762
|
assembly.add(part)
|
|
763
763
|
|
|
764
|
-
original_ids =
|
|
764
|
+
original_ids = get_ids_from_assembly(assembly)
|
|
765
765
|
|
|
766
766
|
# both id lists should be the same length as each other and the same
|
|
767
767
|
# length as the self.material_tags
|
|
@@ -774,7 +774,7 @@ class CadToDagmc:
|
|
|
774
774
|
assembly
|
|
775
775
|
)
|
|
776
776
|
|
|
777
|
-
scrambled_ids =
|
|
777
|
+
scrambled_ids = get_ids_from_imprinted_assembly(imprinted_solids_with_org_id)
|
|
778
778
|
|
|
779
779
|
material_tags_in_brep_order = order_material_ids_by_brep_order(
|
|
780
780
|
original_ids, scrambled_ids, self.material_tags
|
|
@@ -783,7 +783,7 @@ class CadToDagmc:
|
|
|
783
783
|
material_tags_in_brep_order = self.material_tags
|
|
784
784
|
imprinted_assembly = assembly
|
|
785
785
|
|
|
786
|
-
|
|
786
|
+
check_material_tags(material_tags_in_brep_order, self.parts)
|
|
787
787
|
|
|
788
788
|
gmsh = init_gmsh()
|
|
789
789
|
|
|
@@ -791,7 +791,7 @@ class CadToDagmc:
|
|
|
791
791
|
gmsh, imprinted_assembly, method=method, scale_factor=scale_factor
|
|
792
792
|
)
|
|
793
793
|
|
|
794
|
-
gmsh =
|
|
794
|
+
gmsh = mesh_brep(
|
|
795
795
|
gmsh=gmsh,
|
|
796
796
|
min_mesh_size=min_mesh_size,
|
|
797
797
|
max_mesh_size=max_mesh_size,
|
|
@@ -808,7 +808,7 @@ class CadToDagmc:
|
|
|
808
808
|
gmsh.finalize()
|
|
809
809
|
|
|
810
810
|
# checks and fixes triangle fix_normals within vertices_to_h5m
|
|
811
|
-
return
|
|
811
|
+
return vertices_to_h5m(
|
|
812
812
|
vertices=vertices,
|
|
813
813
|
triangles_by_solid_by_face=triangles_by_solid_by_face,
|
|
814
814
|
material_tags=material_tags_in_brep_order,
|
|
@@ -9,7 +9,7 @@ import pytest
|
|
|
9
9
|
from pymoab import core, types
|
|
10
10
|
|
|
11
11
|
from cad_to_dagmc import CadToDagmc
|
|
12
|
-
from cad_to_dagmc.core import
|
|
12
|
+
from cad_to_dagmc.core import check_material_tags
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def get_volumes_and_materials_from_h5m(filename: str) -> dict:
|
|
@@ -214,7 +214,7 @@ def test_export_gmsh_mesh_file_handel_paths_folders_strings(filename):
|
|
|
214
214
|
def test_check_material_tags_too_long():
|
|
215
215
|
with warnings.catch_warnings(record=True) as w:
|
|
216
216
|
warnings.simplefilter("always")
|
|
217
|
-
|
|
217
|
+
check_material_tags(["a" * 29], [1])
|
|
218
218
|
assert len(w) == 1
|
|
219
219
|
assert issubclass(w[-1].category, UserWarning)
|
|
220
220
|
assert "Material tag" in str(w[-1].message)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_object_and_stp_file.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/different_resolution_meshes.py
RENAMED
|
File without changes
|
|
File without changes
|
{cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/multiple_cadquery_objects.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cad_to_dagmc-0.8.1 → cad_to_dagmc-0.8.2}/examples/surface_mesh/single_stp_file_multiple_volumes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|