cad-to-dagmc 0.7.3__tar.gz → 0.7.4__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 (53) hide show
  1. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/PKG-INFO +1 -1
  2. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +1 -1
  3. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +2 -2
  4. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/src/_version.py +2 -2
  5. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/src/cad_to_dagmc/core.py +41 -8
  6. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/src/cad_to_dagmc.egg-info/PKG-INFO +1 -1
  7. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/.github/workflows/black.yml +0 -0
  8. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/.github/workflows/ci_with_benchmarks.yml +0 -0
  9. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/.github/workflows/ci_with_conda_install.yml +0 -0
  10. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/.github/workflows/ci_with_pip_install.yml +0 -0
  11. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/.github/workflows/python-publish.yml +0 -0
  12. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/.gitignore +0 -0
  13. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/CITATION.cff +0 -0
  14. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/LICENSE +0 -0
  15. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/README.md +0 -0
  16. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/cadquery_assembly.py +0 -0
  17. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +0 -0
  18. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/cadquery_compound.py +0 -0
  19. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
  20. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/cadquery_text.py +0 -0
  21. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
  22. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/from_gmsh_mesh_file.py +0 -0
  23. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
  24. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/multiple_stp_files.py +0 -0
  25. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/single_cadquery_object.py +0 -0
  26. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/single_stp_file.py +0 -0
  27. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
  28. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/pyproject.toml +0 -0
  29. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/setup.cfg +0 -0
  30. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/src/cad_to_dagmc/__init__.py +0 -0
  31. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/src/cad_to_dagmc.egg-info/SOURCES.txt +0 -0
  32. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
  33. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/src/cad_to_dagmc.egg-info/requires.txt +0 -0
  34. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
  35. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
  36. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/ball_reactor.brep +0 -0
  37. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/curved_extrude.stp +0 -0
  38. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/extrude_rectangle.stp +0 -0
  39. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/multi_volume_cylinders.stp +0 -0
  40. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/one_cube.brep +0 -0
  41. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/single_cube.stp +0 -0
  42. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/single_volume_thin.stp +0 -0
  43. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/single_volume_thin.vtk +0 -0
  44. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/test_brep_file.brep +0 -0
  45. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/test_file_creation.py +0 -0
  46. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/test_h5m_in_transport.py +0 -0
  47. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/test_loading_from_file_vs_shape_object.py +0 -0
  48. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/test_python_api.py +0 -0
  49. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/test_two_joined_cubes.brep +0 -0
  50. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/test_two_sep_cubes.brep +0 -0
  51. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/test_version.py +0 -0
  52. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/two_connected_cubes.stp +0 -0
  53. {cad_to_dagmc-0.7.3 → cad_to_dagmc-0.7.4}/tests/two_disconnected_cubes.stp +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cad_to_dagmc
3
- Version: 0.7.3
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
@@ -59,4 +59,4 @@ my_model = CadToDagmc()
59
59
  my_model.add_cadquery_object(result, material_tags=["mat1"])
60
60
  my_model.add_cadquery_object(result2, material_tags=["mat2"])
61
61
 
62
- my_model.export_unstructured_mesh_file(filename="umesh.h5m", max_mesh_size=1, min_mesh_size=0.1)
62
+ my_model.export_unstructured_mesh_file(filename="umesh.vtk", max_mesh_size=1, min_mesh_size=0.1)
@@ -1,4 +1,4 @@
1
- # script assumes that "umesh.h5m" has been created by
1
+ # script assumes that "umesh.vtk" has been created by
2
2
  # curved_cadquery_object_to_dagmc_volume_mesh.py has been
3
3
 
4
4
  import openmc
@@ -14,7 +14,7 @@ with open("cross_sections.xml", "w") as file:
14
14
  )
15
15
  openmc.config["cross_sections"] = "cross_sections.xml"
16
16
 
17
- umesh = openmc.UnstructuredMesh("umesh.h5m", library="moab")
17
+ umesh = openmc.UnstructuredMesh("umesh.vtk", library="moab")
18
18
  mesh_filter = openmc.MeshFilter(umesh)
19
19
  tally = openmc.Tally(name="unstrucutred_mesh_tally")
20
20
  tally.filters = [mesh_filter]
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.7.3'
16
- __version_tuple__ = version_tuple = (0, 7, 3)
15
+ __version__ = version = '0.7.4'
16
+ __version_tuple__ = version_tuple = (0, 7, 4)
@@ -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, exporters
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.h5m",
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 converted by pymoab into a h5 file
514
- gmsh.write(filename + ".vtk")
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
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
File without changes
File without changes
File without changes
File without changes
File without changes