cad-to-dagmc 0.9.4__py3-none-any.whl → 0.9.6__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.
_version.py CHANGED
@@ -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.4'
32
- __version_tuple__ = version_tuple = (0, 9, 4)
31
+ __version__ = version = '0.9.6'
32
+ __version_tuple__ = version_tuple = (0, 9, 6)
33
33
 
34
34
  __commit_id__ = commit_id = None
cad_to_dagmc/core.py CHANGED
@@ -812,7 +812,6 @@ class CadToDagmc:
812
812
  def export_dagmc_h5m_file(
813
813
  self,
814
814
  filename: str = "dagmc.h5m",
815
- meshing_backend: str = "cadquery",
816
815
  implicit_complement_material_tag: str | None = None,
817
816
  scale_factor: float = 1.0,
818
817
  imprint: bool = True,
@@ -822,8 +821,6 @@ class CadToDagmc:
822
821
 
823
822
  Args:
824
823
  filename: the filename to use for the saved DAGMC file.
825
- meshing_backend: determines whether gmsh or cadquery's direct mesh method
826
- is used for meshing. Options are 'gmsh' or 'cadquery'.
827
824
  implicit_complement_material_tag: the name of the material tag to use
828
825
  for the implicit complement (void space).
829
826
  scale_factor: a scaling factor to apply to the geometry.
@@ -831,6 +828,11 @@ class CadToDagmc:
831
828
 
832
829
  **kwargs: Backend-specific parameters:
833
830
 
831
+ Backend selection:
832
+ - meshing_backend (str, optional): explicitly specify 'gmsh' or 'cadquery'.
833
+ If not provided, backend is auto-selected based on other arguments.
834
+ Defaults to 'cadquery' if no backend-specific arguments are given.
835
+
834
836
  For GMSH backend:
835
837
  - min_mesh_size (float): minimum mesh element size
836
838
  - max_mesh_size (float): maximum mesh element size
@@ -851,6 +853,52 @@ class CadToDagmc:
851
853
  ValueError: If invalid parameter combinations are used.
852
854
  """
853
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
+
877
+ # Handle meshing_backend - either from kwargs or auto-detect
878
+ meshing_backend = kwargs.pop("meshing_backend", None)
879
+
880
+ if meshing_backend is None:
881
+ # Auto-select meshing_backend based on kwargs
882
+ has_cadquery = any(key in kwargs for key in cadquery_keys)
883
+ has_gmsh = any(key in kwargs for key in gmsh_keys)
884
+ if has_cadquery and not has_gmsh:
885
+ meshing_backend = "cadquery"
886
+ elif has_gmsh and not has_cadquery:
887
+ meshing_backend = "gmsh"
888
+ elif has_cadquery and has_gmsh:
889
+ provided_cadquery = [key for key in cadquery_keys if key in kwargs]
890
+ provided_gmsh = [key for key in gmsh_keys if key in kwargs]
891
+ raise ValueError(
892
+ "Ambiguous backend: both CadQuery and GMSH-specific arguments provided.\n"
893
+ f"CadQuery-specific arguments: {sorted(cadquery_keys)}\n"
894
+ f"GMSH-specific arguments: {sorted(gmsh_keys)}\n"
895
+ f"Provided CadQuery arguments: {provided_cadquery}\n"
896
+ f"Provided GMSH arguments: {provided_gmsh}\n"
897
+ "Please provide only one backend's arguments."
898
+ )
899
+ else:
900
+ meshing_backend = "cadquery" # default
901
+
854
902
  # Validate meshing backend
855
903
  if meshing_backend not in ["gmsh", "cadquery"]:
856
904
  raise ValueError(
@@ -858,6 +906,8 @@ class CadToDagmc:
858
906
  'Available options are "gmsh" or "cadquery"'
859
907
  )
860
908
 
909
+ print(f"Using meshing backend: {meshing_backend}")
910
+
861
911
  # Initialize variables to avoid unbound errors
862
912
  tolerance = 0.1
863
913
  angular_tolerance = 0.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cad_to_dagmc
3
- Version: 0.9.4
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.
@@ -0,0 +1,9 @@
1
+ _version.py,sha256=e8-aWL0R1dkk01VJUUTVieOVR2LgJj8i-n3ez_PgchQ,704
2
+ cad_to_dagmc/__init__.py,sha256=oCr1P0QnBsf6AH0RZujX7T7tdrb75NazdF70HtqXSfc,528
3
+ cad_to_dagmc/core.py,sha256=88L93amP-SMzppnXa7tWTvPnVGTxJUvVLN9B8PL_fp4,42556
4
+ cad_to_dagmc/direct_mesh_plugin.py,sha256=5jG5ILafjbDacaAvBRWD_ilMZLepcM6H1Tjze85vAxE,24013
5
+ cad_to_dagmc-0.9.6.dist-info/licenses/LICENSE,sha256=B8kznH_777JVNZ3HOKDc4Tj24F7wJ68ledaNYeL9sCw,1070
6
+ cad_to_dagmc-0.9.6.dist-info/METADATA,sha256=0CdxtSGC0GnICOxxkFZB45Bj5lJyqBh052HVjiq23K8,9120
7
+ cad_to_dagmc-0.9.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ cad_to_dagmc-0.9.6.dist-info/top_level.txt,sha256=zTi8C64SEBsE5WOtPovnxhOzt-E6Oc5nC3RW6M_5aEA,22
9
+ cad_to_dagmc-0.9.6.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- _version.py,sha256=neCU47g_h2UhyiDH9FD_S8jzk8iEdw9LEgRY7JImMPs,704
2
- cad_to_dagmc/__init__.py,sha256=oCr1P0QnBsf6AH0RZujX7T7tdrb75NazdF70HtqXSfc,528
3
- cad_to_dagmc/core.py,sha256=xYDP7OQ8D-FtPhjfcbZ2Gs5oX4pZisd72zyk3lSkpJg,40352
4
- cad_to_dagmc/direct_mesh_plugin.py,sha256=5jG5ILafjbDacaAvBRWD_ilMZLepcM6H1Tjze85vAxE,24013
5
- cad_to_dagmc-0.9.4.dist-info/licenses/LICENSE,sha256=B8kznH_777JVNZ3HOKDc4Tj24F7wJ68ledaNYeL9sCw,1070
6
- cad_to_dagmc-0.9.4.dist-info/METADATA,sha256=7EeDiEXc-NKoTwMSiTPs2bo2uLPKSQqB2n1cgGyudFM,9121
7
- cad_to_dagmc-0.9.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- cad_to_dagmc-0.9.4.dist-info/top_level.txt,sha256=zTi8C64SEBsE5WOtPovnxhOzt-E6Oc5nC3RW6M_5aEA,22
9
- cad_to_dagmc-0.9.4.dist-info/RECORD,,