cad-to-dagmc 0.8.0__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.0 → cad_to_dagmc-0.8.2}/PKG-INFO +1 -1
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/src/_version.py +2 -2
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc/core.py +28 -18
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc.egg-info/PKG-INFO +1 -1
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/test_python_api.py +121 -7
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/.github/workflows/black.yml +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/.github/workflows/ci_with_benchmarks.yml +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/.github/workflows/ci_with_conda_install.yml +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/.github/workflows/ci_with_pip_install.yml +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/.github/workflows/python-publish.yml +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/.gitignore +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/CITATION.cff +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/LICENSE +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/README.md +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_assembly.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_compound.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/cadquery_text.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/different_resolution_meshes.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/from_gmsh_mesh_file.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/multiple_stp_files.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/single_cadquery_object.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/single_stp_file.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
- {cad_to_dagmc-0.8.0 → 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.0 → cad_to_dagmc-0.8.2}/examples/unstrucutred_volume_mesh/different_resolution_meshes.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/pyproject.toml +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/setup.cfg +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc/__init__.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc.egg-info/SOURCES.txt +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc.egg-info/requires.txt +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/ball_reactor.brep +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/curved_extrude.stp +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/extrude_rectangle.stp +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/multi_volume_cylinders.stp +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/one_cube.brep +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/single_cube.stp +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/single_volume_thin.stp +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/single_volume_thin.vtk +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/test_brep_file.brep +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/test_file_creation.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/test_h5m_in_transport.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/test_loading_from_file_vs_shape_object.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/test_two_joined_cubes.brep +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/test_two_sep_cubes.brep +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/test_version.py +0 -0
- {cad_to_dagmc-0.8.0 → cad_to_dagmc-0.8.2}/tests/two_connected_cubes.stp +0 -0
- {cad_to_dagmc-0.8.0 → 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,
|
|
@@ -503,6 +503,7 @@ class CadToDagmc:
|
|
|
503
503
|
cq.assembly.Assembly | cq.occ_impl.shapes.Compound | cq.occ_impl.shapes.Solid
|
|
504
504
|
),
|
|
505
505
|
material_tags: list[str] | None,
|
|
506
|
+
scale_factor: float = 1.0,
|
|
506
507
|
) -> int:
|
|
507
508
|
"""Loads the parts from CadQuery object into the model.
|
|
508
509
|
|
|
@@ -514,6 +515,10 @@ class CadToDagmc:
|
|
|
514
515
|
same order as the volumes in the geometry added (STP file and
|
|
515
516
|
CadQuery objects) and match the material tags used in the
|
|
516
517
|
neutronics code (e.g. OpenMC).
|
|
518
|
+
scale_factor: a scaling factor to apply to the geometry that can be
|
|
519
|
+
used to increase the size or decrease the size of the geometry.
|
|
520
|
+
Useful when converting the geometry to cm for use in neutronics
|
|
521
|
+
simulations.
|
|
517
522
|
|
|
518
523
|
Returns:
|
|
519
524
|
int: number of volumes in the stp file.
|
|
@@ -527,12 +532,17 @@ class CadToDagmc:
|
|
|
527
532
|
else:
|
|
528
533
|
iterable_solids = cadquery_object.val().Solids()
|
|
529
534
|
|
|
530
|
-
|
|
535
|
+
if scale_factor == 1.0:
|
|
536
|
+
scaled_iterable_solids = iterable_solids
|
|
537
|
+
else:
|
|
538
|
+
scaled_iterable_solids = [part.scale(scale_factor) for part in iterable_solids]
|
|
539
|
+
|
|
540
|
+
check_material_tags(material_tags, scaled_iterable_solids)
|
|
531
541
|
if material_tags:
|
|
532
542
|
self.material_tags = self.material_tags + material_tags
|
|
533
|
-
self.parts = self.parts +
|
|
543
|
+
self.parts = self.parts + scaled_iterable_solids
|
|
534
544
|
|
|
535
|
-
return len(
|
|
545
|
+
return len(scaled_iterable_solids)
|
|
536
546
|
|
|
537
547
|
def export_unstructured_mesh_file(
|
|
538
548
|
self,
|
|
@@ -603,7 +613,7 @@ class CadToDagmc:
|
|
|
603
613
|
|
|
604
614
|
gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method, scale_factor=scale_factor)
|
|
605
615
|
|
|
606
|
-
gmsh =
|
|
616
|
+
gmsh = mesh_brep(
|
|
607
617
|
gmsh=gmsh,
|
|
608
618
|
min_mesh_size=min_mesh_size,
|
|
609
619
|
max_mesh_size=max_mesh_size,
|
|
@@ -680,7 +690,7 @@ class CadToDagmc:
|
|
|
680
690
|
|
|
681
691
|
gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method, scale_factor=scale_factor)
|
|
682
692
|
|
|
683
|
-
gmsh =
|
|
693
|
+
gmsh = mesh_brep(
|
|
684
694
|
gmsh=gmsh,
|
|
685
695
|
min_mesh_size=min_mesh_size,
|
|
686
696
|
max_mesh_size=max_mesh_size,
|
|
@@ -751,7 +761,7 @@ class CadToDagmc:
|
|
|
751
761
|
for part in self.parts:
|
|
752
762
|
assembly.add(part)
|
|
753
763
|
|
|
754
|
-
original_ids =
|
|
764
|
+
original_ids = get_ids_from_assembly(assembly)
|
|
755
765
|
|
|
756
766
|
# both id lists should be the same length as each other and the same
|
|
757
767
|
# length as the self.material_tags
|
|
@@ -764,7 +774,7 @@ class CadToDagmc:
|
|
|
764
774
|
assembly
|
|
765
775
|
)
|
|
766
776
|
|
|
767
|
-
scrambled_ids =
|
|
777
|
+
scrambled_ids = get_ids_from_imprinted_assembly(imprinted_solids_with_org_id)
|
|
768
778
|
|
|
769
779
|
material_tags_in_brep_order = order_material_ids_by_brep_order(
|
|
770
780
|
original_ids, scrambled_ids, self.material_tags
|
|
@@ -773,7 +783,7 @@ class CadToDagmc:
|
|
|
773
783
|
material_tags_in_brep_order = self.material_tags
|
|
774
784
|
imprinted_assembly = assembly
|
|
775
785
|
|
|
776
|
-
|
|
786
|
+
check_material_tags(material_tags_in_brep_order, self.parts)
|
|
777
787
|
|
|
778
788
|
gmsh = init_gmsh()
|
|
779
789
|
|
|
@@ -781,7 +791,7 @@ class CadToDagmc:
|
|
|
781
791
|
gmsh, imprinted_assembly, method=method, scale_factor=scale_factor
|
|
782
792
|
)
|
|
783
793
|
|
|
784
|
-
gmsh =
|
|
794
|
+
gmsh = mesh_brep(
|
|
785
795
|
gmsh=gmsh,
|
|
786
796
|
min_mesh_size=min_mesh_size,
|
|
787
797
|
max_mesh_size=max_mesh_size,
|
|
@@ -798,7 +808,7 @@ class CadToDagmc:
|
|
|
798
808
|
gmsh.finalize()
|
|
799
809
|
|
|
800
810
|
# checks and fixes triangle fix_normals within vertices_to_h5m
|
|
801
|
-
return
|
|
811
|
+
return vertices_to_h5m(
|
|
802
812
|
vertices=vertices,
|
|
803
813
|
triangles_by_solid_by_face=triangles_by_solid_by_face,
|
|
804
814
|
material_tags=material_tags_in_brep_order,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
import pytest
|
|
4
|
-
import cadquery as cq
|
|
5
|
-
from cad_to_dagmc import CadToDagmc
|
|
6
2
|
import warnings
|
|
7
|
-
from cad_to_dagmc.core import _check_material_tags
|
|
8
|
-
|
|
9
3
|
from pathlib import Path
|
|
10
4
|
|
|
5
|
+
import cadquery as cq
|
|
6
|
+
import gmsh
|
|
11
7
|
import pymoab as mb
|
|
8
|
+
import pytest
|
|
12
9
|
from pymoab import core, types
|
|
13
10
|
|
|
11
|
+
from cad_to_dagmc import CadToDagmc
|
|
12
|
+
from cad_to_dagmc.core import check_material_tags
|
|
13
|
+
|
|
14
14
|
|
|
15
15
|
def get_volumes_and_materials_from_h5m(filename: str) -> dict:
|
|
16
16
|
"""Reads in a DAGMC h5m file and uses PyMoab to find the volume ids with
|
|
@@ -214,8 +214,122 @@ 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)
|
|
221
221
|
assert "a" * 29 in str(w[-1].message)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
@pytest.mark.parametrize(
|
|
225
|
+
"scale_factor, expected_width",
|
|
226
|
+
[
|
|
227
|
+
(1, 10.0),
|
|
228
|
+
(2, 20.0),
|
|
229
|
+
(10, 100.0),
|
|
230
|
+
],
|
|
231
|
+
)
|
|
232
|
+
def test_scaling_factor_when_adding_stp(scale_factor, expected_width):
|
|
233
|
+
|
|
234
|
+
c2d = CadToDagmc()
|
|
235
|
+
c2d.add_stp_file("tests/single_cube.stp", scale_factor=scale_factor)
|
|
236
|
+
c2d.export_gmsh_mesh_file(f"st_test_scaling_factor_{scale_factor}.msh")
|
|
237
|
+
|
|
238
|
+
gmsh.initialize()
|
|
239
|
+
gmsh.open(f"st_test_scaling_factor_{scale_factor}.msh")
|
|
240
|
+
_, node_coords, _ = gmsh.model.mesh.getNodes()
|
|
241
|
+
|
|
242
|
+
# Reshape the node coordinates into a 2D array
|
|
243
|
+
node_coords = node_coords.reshape(-1, 3)
|
|
244
|
+
|
|
245
|
+
# Calculate the bounding box
|
|
246
|
+
min_coords = node_coords.min(axis=0)
|
|
247
|
+
max_coords = node_coords.max(axis=0)
|
|
248
|
+
|
|
249
|
+
width_x = max_coords[0] - min_coords[0]
|
|
250
|
+
width_y = max_coords[1] - min_coords[1]
|
|
251
|
+
width_z = max_coords[2] - min_coords[2]
|
|
252
|
+
|
|
253
|
+
gmsh.finalize()
|
|
254
|
+
|
|
255
|
+
assert width_x == expected_width
|
|
256
|
+
assert width_y == expected_width
|
|
257
|
+
assert width_z == expected_width
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
@pytest.mark.parametrize(
|
|
261
|
+
"scale_factor, expected_width",
|
|
262
|
+
[
|
|
263
|
+
(1, 10.0),
|
|
264
|
+
(2, 20.0),
|
|
265
|
+
(10, 100.0),
|
|
266
|
+
],
|
|
267
|
+
)
|
|
268
|
+
def test_scaling_factor_when_adding_cq_object(scale_factor, expected_width):
|
|
269
|
+
|
|
270
|
+
box = cq.Workplane("XY").box(10, 10, 10)
|
|
271
|
+
c2d = CadToDagmc()
|
|
272
|
+
c2d.add_cadquery_object(box, scale_factor=scale_factor, material_tags=["mat1"])
|
|
273
|
+
c2d.export_gmsh_mesh_file(f"cq_test_scaling_factor_{scale_factor}.msh")
|
|
274
|
+
|
|
275
|
+
gmsh.initialize()
|
|
276
|
+
gmsh.open(f"cq_test_scaling_factor_{scale_factor}.msh")
|
|
277
|
+
_, node_coords, _ = gmsh.model.mesh.getNodes()
|
|
278
|
+
|
|
279
|
+
# Reshape the node coordinates into a 2D array
|
|
280
|
+
node_coords = node_coords.reshape(-1, 3)
|
|
281
|
+
|
|
282
|
+
# Calculate the bounding box
|
|
283
|
+
min_coords = node_coords.min(axis=0)
|
|
284
|
+
max_coords = node_coords.max(axis=0)
|
|
285
|
+
|
|
286
|
+
width_x = max_coords[0] - min_coords[0]
|
|
287
|
+
width_y = max_coords[1] - min_coords[1]
|
|
288
|
+
width_z = max_coords[2] - min_coords[2]
|
|
289
|
+
|
|
290
|
+
gmsh.finalize()
|
|
291
|
+
|
|
292
|
+
assert width_x == expected_width
|
|
293
|
+
assert width_y == expected_width
|
|
294
|
+
assert width_z == expected_width
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
@pytest.mark.parametrize(
|
|
298
|
+
"scale_factor, expected_x_width, expected_y_width, expected_z_width",
|
|
299
|
+
[
|
|
300
|
+
(1, 20.0, 10.0, 10.0),
|
|
301
|
+
(2, 40.0, 20.0, 20.0),
|
|
302
|
+
(10, 200.0, 100.0, 100.0),
|
|
303
|
+
],
|
|
304
|
+
)
|
|
305
|
+
def test_two_box_scaling_factor_when_adding_cq_object(
|
|
306
|
+
scale_factor, expected_x_width, expected_y_width, expected_z_width
|
|
307
|
+
):
|
|
308
|
+
|
|
309
|
+
box = cq.Workplane("XY").box(10, 10, 10)
|
|
310
|
+
box2 = cq.Workplane("XY").moveTo(10, 0).box(10, 10, 10)
|
|
311
|
+
c2d = CadToDagmc()
|
|
312
|
+
c2d.add_cadquery_object(box, scale_factor=scale_factor, material_tags=["mat1"])
|
|
313
|
+
c2d.add_cadquery_object(box2, scale_factor=scale_factor, material_tags=["mat1"])
|
|
314
|
+
c2d.export_gmsh_mesh_file(f"cq_test_2_box_scaling_factor_{scale_factor}.msh")
|
|
315
|
+
|
|
316
|
+
gmsh.initialize()
|
|
317
|
+
gmsh.open(f"cq_test_2_box_scaling_factor_{scale_factor}.msh")
|
|
318
|
+
_, node_coords, _ = gmsh.model.mesh.getNodes()
|
|
319
|
+
|
|
320
|
+
# Reshape the node coordinates into a numpy 2D array
|
|
321
|
+
node_coords = node_coords.reshape(-1, 3)
|
|
322
|
+
|
|
323
|
+
# Calculate the bounding box
|
|
324
|
+
min_coords = node_coords.min(axis=0)
|
|
325
|
+
max_coords = node_coords.max(axis=0)
|
|
326
|
+
|
|
327
|
+
width_x = max_coords[0] - min_coords[0]
|
|
328
|
+
width_y = max_coords[1] - min_coords[1]
|
|
329
|
+
width_z = max_coords[2] - min_coords[2]
|
|
330
|
+
|
|
331
|
+
gmsh.finalize()
|
|
332
|
+
|
|
333
|
+
assert width_x == expected_x_width
|
|
334
|
+
assert width_y == expected_y_width
|
|
335
|
+
assert width_z == expected_z_width
|
|
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.0 → 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.0 → 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.0 → 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.0 → 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
|