cad-to-dagmc 0.9.5__tar.gz → 0.9.6__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.
Files changed (64) hide show
  1. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/PKG-INFO +2 -2
  2. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/README.md +1 -1
  3. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/src/_version.py +3 -3
  4. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/src/cad_to_dagmc/core.py +21 -10
  5. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/src/cad_to_dagmc.egg-info/PKG-INFO +2 -2
  6. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_kwarg_args.py +115 -0
  7. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/.github/workflows/black.yml +0 -0
  8. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/.github/workflows/ci_with_benchmarks.yml +0 -0
  9. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/.github/workflows/ci_with_conda_install.yml +0 -0
  10. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/.github/workflows/ci_with_pip_install.yml +0 -0
  11. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/.github/workflows/python-publish.yml +0 -0
  12. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/.gitignore +0 -0
  13. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/CITATION.cff +0 -0
  14. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/LICENSE +0 -0
  15. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_and_unstructured_mesh/unstructured_mesh_with_conformal_surface_mesh.py +0 -0
  16. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/cadquery_assembly.py +0 -0
  17. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
  18. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/cadquery_compound.py +0 -0
  19. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
  20. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/cadquery_text.py +0 -0
  21. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
  22. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/different_resolution_meshes.py +0 -0
  23. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/from_gmsh_mesh_file.py +0 -0
  24. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/from_gmsh_mesh_file_with_tags.py +0 -0
  25. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/from_gmsh_object_with_tag.py +0 -0
  26. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
  27. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/multiple_stp_files.py +0 -0
  28. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/single_cadquery_object.py +0 -0
  29. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/single_stp_file.py +0 -0
  30. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
  31. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/surface_mesh/tagged_mesh.msh +0 -0
  32. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +0 -0
  33. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/unstrucutred_volume_mesh/different_resolution_meshes.py +0 -0
  34. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
  35. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/pyproject.toml +0 -0
  36. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/setup.cfg +0 -0
  37. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/src/cad_to_dagmc/__init__.py +0 -0
  38. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/src/cad_to_dagmc/direct_mesh_plugin.py +0 -0
  39. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/src/cad_to_dagmc.egg-info/SOURCES.txt +0 -0
  40. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
  41. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/src/cad_to_dagmc.egg-info/requires.txt +0 -0
  42. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
  43. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
  44. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/ball_reactor.brep +0 -0
  45. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/curved_extrude.stp +0 -0
  46. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/extrude_rectangle.stp +0 -0
  47. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/multi_volume_cylinders.stp +0 -0
  48. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/one_cube.brep +0 -0
  49. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/single_cube.stp +0 -0
  50. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/single_volume_thin.stp +0 -0
  51. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/single_volume_thin.vtk +0 -0
  52. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/tagged_mesh.msh +0 -0
  53. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_brep_file.brep +0 -0
  54. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_file_creation.py +0 -0
  55. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_get_volumes.py +0 -0
  56. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_h5m_in_transport.py +0 -0
  57. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_loading_from_file_vs_shape_object.py +0 -0
  58. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_mesh_to_dagmc.py +0 -0
  59. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_python_api.py +0 -0
  60. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_two_joined_cubes.brep +0 -0
  61. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_two_sep_cubes.brep +0 -0
  62. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/test_version.py +0 -0
  63. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/two_connected_cubes.stp +0 -0
  64. {cad_to_dagmc-0.9.5 → cad_to_dagmc-0.9.6}/tests/two_disconnected_cubes.stp +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cad_to_dagmc
3
- Version: 0.9.5
3
+ Version: 0.9.6
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
@@ -50,7 +50,7 @@ cad-to-dagmc can convert the following in to DAGMC compatible meshes:
50
50
 
51
51
  Cad-to-dagmc offers a wide range of features including.
52
52
  - Geometry scaling with ```scale_factor``` argument
53
- - Ddirect surface meshing of CadQuery geometry with ```tolerance``` and ```angular_tolerance``` arguments (avoids using Gmsh)
53
+ - Direct surface meshing of CadQuery geometry with ```tolerance``` and ```angular_tolerance``` arguments (avoids using Gmsh)
54
54
  - Model wide mesh Gmsh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
55
55
  - Volume specific mesh sizing parameters with the ```set_size``` argument
56
56
  - Unstructured mesh that share the same coordinates as the surface mesh.
@@ -25,7 +25,7 @@ cad-to-dagmc can convert the following in to DAGMC compatible meshes:
25
25
 
26
26
  Cad-to-dagmc offers a wide range of features including.
27
27
  - Geometry scaling with ```scale_factor``` argument
28
- - Ddirect surface meshing of CadQuery geometry with ```tolerance``` and ```angular_tolerance``` arguments (avoids using Gmsh)
28
+ - Direct surface meshing of CadQuery geometry with ```tolerance``` and ```angular_tolerance``` arguments (avoids using Gmsh)
29
29
  - Model wide mesh Gmsh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
30
30
  - Volume specific mesh sizing parameters with the ```set_size``` argument
31
31
  - Unstructured mesh that share the same coordinates as the surface mesh.
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.9.5'
32
- __version_tuple__ = version_tuple = (0, 9, 5)
31
+ __version__ = version = '0.9.6'
32
+ __version_tuple__ = version_tuple = (0, 9, 6)
33
33
 
34
- __commit_id__ = commit_id = 'gf1807169b'
34
+ __commit_id__ = commit_id = 'gc9bf24ac7'
@@ -853,21 +853,32 @@ class CadToDagmc:
853
853
  ValueError: If invalid parameter combinations are used.
854
854
  """
855
855
 
856
+ # Define all acceptable kwargs
857
+ cadquery_keys = {"tolerance", "angular_tolerance"}
858
+ gmsh_keys = {
859
+ "min_mesh_size",
860
+ "max_mesh_size",
861
+ "mesh_algorithm",
862
+ "set_size",
863
+ "umesh_filename",
864
+ "method",
865
+ "unstructured_volumes",
866
+ }
867
+ all_acceptable_keys = cadquery_keys | gmsh_keys | {"meshing_backend"}
868
+
869
+ # Check for invalid kwargs
870
+ invalid_keys = set(kwargs.keys()) - all_acceptable_keys
871
+ if invalid_keys:
872
+ raise ValueError(
873
+ f"Invalid keyword arguments: {sorted(invalid_keys)}\n"
874
+ f"Acceptable arguments are: {sorted(all_acceptable_keys)}"
875
+ )
876
+
856
877
  # Handle meshing_backend - either from kwargs or auto-detect
857
878
  meshing_backend = kwargs.pop("meshing_backend", None)
858
879
 
859
880
  if meshing_backend is None:
860
881
  # Auto-select meshing_backend based on kwargs
861
- cadquery_keys = {"tolerance", "angular_tolerance"}
862
- gmsh_keys = {
863
- "min_mesh_size",
864
- "max_mesh_size",
865
- "mesh_algorithm",
866
- "set_size",
867
- "umesh_filename",
868
- "method",
869
- "unstructured_volumes",
870
- }
871
882
  has_cadquery = any(key in kwargs for key in cadquery_keys)
872
883
  has_gmsh = any(key in kwargs for key in gmsh_keys)
873
884
  if has_cadquery and not has_gmsh:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cad_to_dagmc
3
- Version: 0.9.5
3
+ Version: 0.9.6
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
@@ -50,7 +50,7 @@ cad-to-dagmc can convert the following in to DAGMC compatible meshes:
50
50
 
51
51
  Cad-to-dagmc offers a wide range of features including.
52
52
  - Geometry scaling with ```scale_factor``` argument
53
- - Ddirect surface meshing of CadQuery geometry with ```tolerance``` and ```angular_tolerance``` arguments (avoids using Gmsh)
53
+ - Direct surface meshing of CadQuery geometry with ```tolerance``` and ```angular_tolerance``` arguments (avoids using Gmsh)
54
54
  - Model wide mesh Gmsh size parameters with ```min_mesh_size``` and ```max_mesh_size``` arguments
55
55
  - Volume specific mesh sizing parameters with the ```set_size``` argument
56
56
  - Unstructured mesh that share the same coordinates as the surface mesh.
@@ -187,6 +187,121 @@ class TestKwargsExportDagmcH5mFile:
187
187
  assert output_file_gmsh.exists()
188
188
 
189
189
 
190
+ class TestKwargsValidation:
191
+ """Test kwargs validation for export_dagmc_h5m_file method"""
192
+
193
+ def setup_method(self):
194
+ """Setup method to create a simple geometry for testing"""
195
+ self.my_model = CadToDagmc()
196
+
197
+ # Create a simple box
198
+ box = cq.Workplane("XY").box(10, 10, 10)
199
+ self.my_model.add_cadquery_object(box, material_tags=["steel"])
200
+
201
+ def test_invalid_kwargs_raises_error(self, tmp_path):
202
+ """Test that invalid kwargs raise ValueError with helpful message"""
203
+ output_file = tmp_path / "test_invalid_kwargs.h5m"
204
+
205
+ with pytest.raises(ValueError) as excinfo:
206
+ self.my_model.export_dagmc_h5m_file(
207
+ filename=str(output_file),
208
+ invalid_param=123,
209
+ another_invalid=True,
210
+ )
211
+
212
+ error_message = str(excinfo.value)
213
+ assert "Invalid keyword arguments:" in error_message
214
+ assert "another_invalid" in error_message
215
+ assert "invalid_param" in error_message
216
+ assert "Acceptable arguments are:" in error_message
217
+
218
+ def test_mixed_valid_invalid_kwargs_raises_error(self, tmp_path):
219
+ """Test that mix of valid and invalid kwargs raises error"""
220
+ output_file = tmp_path / "test_mixed_kwargs.h5m"
221
+
222
+ with pytest.raises(ValueError) as excinfo:
223
+ self.my_model.export_dagmc_h5m_file(
224
+ filename=str(output_file),
225
+ tolerance=0.1, # valid
226
+ bad_param=456, # invalid
227
+ min_mesh_size=0.5, # valid
228
+ )
229
+
230
+ error_message = str(excinfo.value)
231
+ assert "Invalid keyword arguments:" in error_message
232
+ assert "bad_param" in error_message
233
+ assert "tolerance" in error_message # valid param should be in error
234
+ assert "min_mesh_size" in error_message # valid param should be in error
235
+
236
+ def test_all_valid_cadquery_kwargs_accepted(self, tmp_path):
237
+ """Test that all valid CadQuery kwargs are accepted"""
238
+ output_file = tmp_path / "test_valid_cq_kwargs.h5m"
239
+
240
+ # Should not raise any error
241
+ result = self.my_model.export_dagmc_h5m_file(
242
+ filename=str(output_file),
243
+ meshing_backend="cadquery",
244
+ tolerance=0.1,
245
+ angular_tolerance=0.2,
246
+ )
247
+
248
+ assert result == str(output_file)
249
+ assert output_file.exists()
250
+
251
+ def test_all_valid_gmsh_kwargs_accepted(self, tmp_path):
252
+ """Test that all valid GMSH kwargs are accepted"""
253
+ output_file = tmp_path / "test_valid_gmsh_kwargs.h5m"
254
+
255
+ # Should not raise any error
256
+ result = self.my_model.export_dagmc_h5m_file(
257
+ filename=str(output_file),
258
+ meshing_backend="gmsh",
259
+ min_mesh_size=0.1,
260
+ max_mesh_size=1.0,
261
+ mesh_algorithm=1,
262
+ set_size={1: 0.5},
263
+ umesh_filename="test.vtk",
264
+ method="file",
265
+ # unstructured_volumes would be tested separately
266
+ )
267
+
268
+ assert result == str(output_file)
269
+ assert output_file.exists()
270
+
271
+ def test_typo_in_kwarg_name_raises_helpful_error(self, tmp_path):
272
+ """Test that typos in parameter names give helpful error messages"""
273
+ output_file = tmp_path / "test_typo.h5m"
274
+
275
+ # Common typo: "tolerance" -> "tollerance"
276
+ with pytest.raises(ValueError) as excinfo:
277
+ self.my_model.export_dagmc_h5m_file(
278
+ filename=str(output_file),
279
+ tollerance=0.1, # typo
280
+ )
281
+
282
+ error_message = str(excinfo.value)
283
+ assert "Invalid keyword arguments:" in error_message
284
+ assert "tollerance" in error_message
285
+ assert "tolerance" in error_message # should show the correct options
286
+
287
+ def test_case_sensitivity_in_kwargs(self, tmp_path):
288
+ """Test that kwargs are case sensitive"""
289
+ output_file = tmp_path / "test_case_sensitive.h5m"
290
+
291
+ # Wrong case should raise error
292
+ with pytest.raises(ValueError) as excinfo:
293
+ self.my_model.export_dagmc_h5m_file(
294
+ filename=str(output_file),
295
+ Tolerance=0.1, # wrong case
296
+ MESHING_BACKEND="cadquery", # wrong case
297
+ )
298
+
299
+ error_message = str(excinfo.value)
300
+ assert "Invalid keyword arguments:" in error_message
301
+ assert "Tolerance" in error_message
302
+ assert "MESHING_BACKEND" in error_message
303
+
304
+
190
305
  class TestKwargsWithMultipleVolumes:
191
306
  """Test kwargs functionality with multiple volumes"""
192
307
 
File without changes
File without changes
File without changes
File without changes