From b19a0b186d1557d7ca506c9402908010e1c96d89 Mon Sep 17 00:00:00 2001 From: shimwell Date: Sat, 30 Jul 2022 23:03:01 +0100 Subject: [PATCH 01/17] added test yml --- .github/workflows/ci_with_install.yml | 44 +++++++++++++++++++++++++++ cad_to_dagmc/core.py | 10 ------ tests/test_package.py | 2 +- 3 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/ci_with_install.yml diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml new file mode 100644 index 0000000..5dcc331 --- /dev/null +++ b/.github/workflows/ci_with_install.yml @@ -0,0 +1,44 @@ + +# This CI will launch a Docker image that contains all the dependencies required +# within that image the pytest test suite is run + +name: CI with install + +on: + pull_request: + branches: + - develop + - main + paths-ignore: + - 'docs/**' + - '.gitignore' + - '*.md' + - 'CITATION.cff' + - 'LICENSE.txt' + - 'readthedocs.yml' + +jobs: + testing: + runs-on: ubuntu-latest + container: + image: openmc/openmc:develop + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: install package + run: | + pip install . + python -c "import cad_to_dagmc" + + # - name: Run examples + # run: | + # python examples/ + + - name: Run tests + run: | + pip install .[tests] + pytest tests -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml + + - name: Upload to codecov + uses: codecov/codecov-action@v2 diff --git a/cad_to_dagmc/core.py b/cad_to_dagmc/core.py index b28db69..af3e080 100644 --- a/cad_to_dagmc/core.py +++ b/cad_to_dagmc/core.py @@ -1,17 +1,7 @@ from vertices_to_h5m import vertices_to_h5m from pathlib import Path -import dagmc_h5m_file_inspector as di -import openmc -import openmc_data_downloader as odd import math -""" -Tests that check that: - - h5m files are created - - h5m files contain the correct number of volumes - - h5m files contain the correct material tags - - h5m files can be used a transport geometry in DAGMC with OpenMC -""" from cadquery import importers diff --git a/tests/test_package.py b/tests/test_package.py index 901f31a..0a7e680 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -1,6 +1,6 @@ from vertices_to_h5m import vertices_to_h5m from pathlib import Path -import dagmc_h5m_file_inspector as di +# import dagmc_h5m_file_inspector as di import openmc import openmc_data_downloader as odd import math From 73015fd65eb03069a3371b32a87bec0971c8eb92 Mon Sep 17 00:00:00 2001 From: shimwell Date: Sat, 30 Jul 2022 22:03:44 +0000 Subject: [PATCH 02/17] [skip ci] Apply formatting changes --- cad_to_dagmc/core.py | 1 - tests/test_package.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/cad_to_dagmc/core.py b/cad_to_dagmc/core.py index af3e080..83c3933 100644 --- a/cad_to_dagmc/core.py +++ b/cad_to_dagmc/core.py @@ -3,7 +3,6 @@ import math - from cadquery import importers from OCP.GCPnts import GCPnts_QuasiUniformDeflection diff --git a/tests/test_package.py b/tests/test_package.py index 0a7e680..01809a4 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -1,5 +1,6 @@ from vertices_to_h5m import vertices_to_h5m from pathlib import Path + # import dagmc_h5m_file_inspector as di import openmc import openmc_data_downloader as odd From 3116f7e4fefe1725d15bb518361fa3896cf13abc Mon Sep 17 00:00:00 2001 From: shimwell Date: Sat, 30 Jul 2022 23:09:52 +0100 Subject: [PATCH 03/17] added python publish ci --- .github/workflows/python-publish.yml | 40 ++++++++++++++++++++++++++++ README.md | 8 +++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..ac5bbec --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,40 @@ +# This yml file will trigger a Github Actions event that builds and upload the +# Python package to PiPy. This makes use of Twine and is triggered when a push +# to the main branch occures. For more information see: +# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries +# and for details on the Autobump version section see: +# https://github.com/grst/python-ci-versioneer + +name: Upload Python Package + +on: + # allows us to run workflows manually + workflow_dispatch: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel build twine + + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python -m build + twine check dist/* + twine upload dist/* diff --git a/README.md b/README.md index a864f9c..ca22752 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ -# cad_to_dagmc + A minimal package that uses CadQuery functionality to convert Cad geometry to DAGMC h5m files +# Install + +```bash +pip install cad_to_dagmc +``` + # Usage ```python From 0d230601ea81edcb28ddda808b544cb8273a0a0e Mon Sep 17 00:00:00 2001 From: shimwell Date: Sat, 30 Jul 2022 23:14:58 +0100 Subject: [PATCH 04/17] change docker image --- .github/workflows/ci_with_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index 5dcc331..f30cb47 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -21,7 +21,7 @@ jobs: testing: runs-on: ubuntu-latest container: - image: openmc/openmc:develop + image: openmc/openmc:develop-dagmc steps: - name: Checkout repository uses: actions/checkout@v2 From 4079ab19fae50d51bcaf35d70725af4c1a109e3e Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 09:59:24 +0100 Subject: [PATCH 05/17] added moab to ci env --- .github/workflows/ci_with_install.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index f30cb47..ddf8770 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -31,9 +31,10 @@ jobs: pip install . python -c "import cad_to_dagmc" - # - name: Run examples - # run: | - # python examples/ + - name: install non pypi dependencies + run: | + conda install -c conda-forge mamba + mamba install -c conda-forge moab - name: Run tests run: | From 5328e6350f99f3527aff1a4bb8a449b87bb5a9da Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 10:03:59 +0100 Subject: [PATCH 06/17] moab==5.3.1 --- .github/workflows/ci_with_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index ddf8770..6c97b07 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -34,7 +34,7 @@ jobs: - name: install non pypi dependencies run: | conda install -c conda-forge mamba - mamba install -c conda-forge moab + mamba install -c conda-forge moab==5.3.1 - name: Run tests run: | From 9730e43565d08247d5f003e7cabda5934c8be3f3 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 10:19:23 +0100 Subject: [PATCH 07/17] trying mamba env for all --- .github/workflows/ci_with_install.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index 6c97b07..140e047 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -21,7 +21,7 @@ jobs: testing: runs-on: ubuntu-latest container: - image: openmc/openmc:develop-dagmc + image: continuumio/miniconda3:4.12.0 steps: - name: Checkout repository uses: actions/checkout@v2 @@ -34,7 +34,8 @@ jobs: - name: install non pypi dependencies run: | conda install -c conda-forge mamba - mamba install -c conda-forge moab==5.3.1 + mamba install -c conda-forge openmc + mamba install -c cadquery -c conda-forge cadquery=master - name: Run tests run: | From 2495c784afecf1f614fa2a7f5e5533aa5a73e7df Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 10:22:27 +0100 Subject: [PATCH 08/17] moving order of package install --- .github/workflows/ci_with_install.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index 140e047..d4d125c 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -26,20 +26,20 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: install package - run: | - pip install . - python -c "import cad_to_dagmc" - - name: install non pypi dependencies run: | conda install -c conda-forge mamba - mamba install -c conda-forge openmc mamba install -c cadquery -c conda-forge cadquery=master + - name: install package + run: | + pip install . + python -c "import cad_to_dagmc" + - name: Run tests run: | pip install .[tests] + mamba install -c conda-forge openmc pytest tests -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml - name: Upload to codecov From 6f042c9542724a6ed359bf6aaa25c8f5d257b953 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 10:40:50 +0100 Subject: [PATCH 09/17] added moab --- .github/workflows/ci_with_install.yml | 1 + README.md | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index d4d125c..481bbcb 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -29,6 +29,7 @@ jobs: - name: install non pypi dependencies run: | conda install -c conda-forge mamba + mamba install -c conda-forge moab mamba install -c cadquery -c conda-forge cadquery=master - name: install package diff --git a/README.md b/README.md index ca22752..c8f9433 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,23 @@ - A minimal package that uses CadQuery functionality to convert Cad geometry to DAGMC h5m files +This particular method of producing DAGMC compatible h5m files from CAD geometry +is intended to convert STP files or [CadQuery](https://cadquery.readthedocs.io) objects to h5m file. + +The use of CadQuery based surface tesselation and then conversion of the +vertices and triangle sets into h5m files directly (in memory) is relatively +fast with minimal file IO and the resulting meshed volumes have low triangle +count while maintaining a good representation of the volume as described in +[this](https://www.sciencedirect.com/science/article/abs/pii/S0920379615301484) +publication. + +While this package concentrates on loading the CAD and meshing the surface it +then hands off the vertices and triangles sets to +[vertices_to_h5m](https://github.com/fusion-energy/vertices_to_h5m) which +converts these into a h5m geometry file. +Due to the modularity of this workflow if you have a preferred meshing +algorithm then it is entirely possible to pipe your own vertices and triangles +directly into vertices_to_h5m. + # Install ```bash From e46a76fcd0b2ffff54131ec6449910dc925c53c5 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 10:44:12 +0100 Subject: [PATCH 10/17] added libgl to container --- .github/workflows/ci_with_install.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index 481bbcb..10e4216 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -28,6 +28,10 @@ jobs: - name: install non pypi dependencies run: | + apt-get --allow-releaseinfo-change update + apt-get update -y + apt-get upgrade -y + apt-get install -y libgl1-mesa-glx libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libosmesa6 libosmesa6-dev libgles2-mesa-dev conda install -c conda-forge mamba mamba install -c conda-forge moab mamba install -c cadquery -c conda-forge cadquery=master @@ -40,7 +44,7 @@ jobs: - name: Run tests run: | pip install .[tests] - mamba install -c conda-forge openmc + mamba install -c conda-forge -y "openmc=0.13.0=dagmc*nompi*" pytest tests -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml - name: Upload to codecov From 079813da5a2ab26f0fae350724baa9626653a433 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 12:05:28 +0100 Subject: [PATCH 11/17] split tests into creation and transport --- tests/test_h5m_creation.py | 85 ++++++++++++++++++ ...t_package.py => test_h5m_in_simulation.py} | 89 +++---------------- 2 files changed, 97 insertions(+), 77 deletions(-) create mode 100644 tests/test_h5m_creation.py rename tests/{test_package.py => test_h5m_in_simulation.py} (59%) diff --git a/tests/test_h5m_creation.py b/tests/test_h5m_creation.py new file mode 100644 index 0000000..3c815d7 --- /dev/null +++ b/tests/test_h5m_creation.py @@ -0,0 +1,85 @@ + +# import dagmc_h5m_file_inspector as di +import cad_to_dagmc +from vertices_to_h5m import vertices_to_h5m +import dagmc_h5m_file_inspector as di + +""" +Tests that check that: + - h5m files are created + - h5m files contain the correct number of volumes + - h5m files contain the correct material tags + +""" + + +from cadquery import importers +from OCP.GCPnts import GCPnts_QuasiUniformDeflection + +# from cadquery.occ_impl import shapes +import OCP +import cadquery as cq +from OCP.TopLoc import TopLoc_Location +from OCP.BRep import BRep_Tool +from OCP.TopAbs import TopAbs_Orientation + + +def test_h5m_production_with_single_volume_list(): + # """The simplest geometry, a single 4 sided shape with lists instead of np arrays""" + + stp_files = ["tests/extrude_rectangle.stp", "tests/single_cube.stp"] + h5m_files = ["tests/extrude_rectangle.h5m", "tests/single_cube.h5m"] + + for stp_file, h5m_file in zip(stp_files, h5m_files): + + stp_file = cad_to_dagmc.load_stp_file(stp_file) + + merged_stp_file = cad_to_dagmc.merge_surfaces(stp_file) + vertices, triangles = cad_to_dagmc.tessellate(merged_stp_file, tolerance=2) + + vertices_to_h5m( + vertices=vertices, + triangles=[triangles], + material_tags=["mat1"], + h5m_filename=h5m_file, + ) + + assert di.get_volumes_and_materials_from_h5m(h5m_file) == {1: 'mat1'} + + +def test_h5m_production_with_multi_volume_list(): + + stp_files = [ + "tests/multi_volume_cylinders.stp", + "tests/two_disconnected_cubes.stp", + "tests/two_connected_cubes.stp", + ] + material_tags = [ + ["mat1", "mat2", "mat3", "mat4", "mat5", "mat6"], + ["mat1", "mat2"], + ["mat1", "mat2"], + ] + h5m_files = [ + "tests/multi_volume_cylinders.h5m", + "tests/two_disconnected_cubes.h5m", + "tests/two_connected_cubes.h5m", + ] + for stp_file, mat_tags, h5m_file in zip(stp_files, material_tags, h5m_files): + + stp_file_object = cad_to_dagmc.load_stp_file(stp_file) + merged_stp_file = cad_to_dagmc.merge_surfaces(stp_file_object) + vertices, triangles = cad_to_dagmc.tessellate_touching_parts( + merged_stp_file, tolerance=2 + ) + + vertices_to_h5m( + vertices=vertices, + triangles=triangles, + material_tags=mat_tags, + h5m_filename=h5m_file, + ) + + tags_dict = {} + for counter, loop_mat_tag in enumerate(mat_tags, 1): + tags_dict[counter] = loop_mat_tag + assert di.get_volumes_and_materials_from_h5m(h5m_file) == tags_dict diff --git a/tests/test_package.py b/tests/test_h5m_in_simulation.py similarity index 59% rename from tests/test_package.py rename to tests/test_h5m_in_simulation.py index 01809a4..ffed022 100644 --- a/tests/test_package.py +++ b/tests/test_h5m_in_simulation.py @@ -1,33 +1,13 @@ -from vertices_to_h5m import vertices_to_h5m -from pathlib import Path - # import dagmc_h5m_file_inspector as di import openmc import openmc_data_downloader as odd -import math -import cad_to_dagmc + """ -Tests that check that: - - h5m files are created - - h5m files contain the correct number of volumes - - h5m files contain the correct material tags - h5m files can be used a transport geometry in DAGMC with OpenMC """ -from cadquery import importers -from OCP.GCPnts import GCPnts_QuasiUniformDeflection - -# from cadquery.occ_impl import shapes -import OCP -import cadquery as cq -from vertices_to_h5m import vertices_to_h5m -from OCP.TopLoc import TopLoc_Location -from OCP.BRep import BRep_Tool -from OCP.TopAbs import TopAbs_Orientation - - def transport_particles_on_h5m_geometry( h5m_filename, material_tags, @@ -111,26 +91,14 @@ def transport_particles_on_h5m_geometry( def test_h5m_production_with_single_volume_list(): - # """The simplest geometry, a single 4 sided shape with lists instead of np arrays""" + """The simplest geometry, a single 4 sided shape with lists instead of np arrays""" - stp_files = ["tests/extrude_rectangle.stp", "tests/single_cube.stp"] - for stp_file in stp_files: - test_h5m_filename = "single_tet.h5m" + h5m_files = ["tests/extrude_rectangle.h5m", "tests/single_cube.h5m"] - stp_file = cad_to_dagmc.load_stp_file(stp_file) - - merged_stp_file = cad_to_dagmc.merge_surfaces(stp_file) - vertices, triangles = cad_to_dagmc.tessellate(merged_stp_file, tolerance=2) - - vertices_to_h5m( - vertices=vertices, - triangles=[triangles], - material_tags=["mat1"], - h5m_filename=test_h5m_filename, - ) + for h5m_file in h5m_files: transport_particles_on_h5m_geometry( - h5m_filename=test_h5m_filename, + h5m_filename=h5m_file, material_tags=["mat1"], ) @@ -148,46 +116,13 @@ def test_h5m_production_with_multi_volume_list(): ["mat1", "mat2"], ["mat1", "mat2"], ] - for stp_file, mat_tags in zip(stp_files, material_tags): - - stp_file_object = cad_to_dagmc.load_stp_file(stp_file) - merged_stp_file = cad_to_dagmc.merge_surfaces(stp_file_object) - vertices, triangles = cad_to_dagmc.tessellate_touching_parts( - merged_stp_file, tolerance=2 - ) - - vertices_to_h5m( - vertices=vertices, - triangles=triangles, - material_tags=mat_tags, - h5m_filename="test.h5m", - ) + h5m_files = [ + "tests/multi_volume_cylinders.h5m", + "tests/two_disconnected_cubes.h5m", + "tests/two_connected_cubes.h5m", + ] + for mat_tags, h5m_file in zip(material_tags, h5m_files): transport_particles_on_h5m_geometry( - h5m_filename="test.h5m", material_tags=mat_tags + h5m_filename=h5m_file, material_tags=mat_tags ) - - -import cad_to_dagmc -import json - -mat_tags = ["mat1", "mat2"] -# mat_tags=["mat1", "mat2", "mat3", "mat4", "mat5", "mat6"] -stp_file = cad_to_dagmc.load_stp_file("tests/two_connected_cubes.stp") -# stp_file = cad_to_dagmc.load_stp_file("tests/multi_volume_cylinders.stp") -merged_stp_file = cad_to_dagmc.merge_surfaces(stp_file) -vertices, triangles = cad_to_dagmc.tessellate_touching_parts( - merged_stp_file, tolerance=2 -) - -with open("data.json", "w") as f: - json.dump([vertices, triangles], f, indent=1) - -vertices_to_h5m( - vertices=vertices, - triangles=triangles, - material_tags=mat_tags, - h5m_filename="test.h5m", -) - -transport_particles_on_h5m_geometry(h5m_filename="test.h5m", material_tags=mat_tags) From 28a2a4a04cd314642d594c2321f5c44def63f05a Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 12:05:42 +0100 Subject: [PATCH 12/17] removed print statement --- cad_to_dagmc/core.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cad_to_dagmc/core.py b/cad_to_dagmc/core.py index 83c3933..a00900f 100644 --- a/cad_to_dagmc/core.py +++ b/cad_to_dagmc/core.py @@ -50,7 +50,7 @@ def merge_surfaces(geometry): return solids[0] for solid in solids: - print(type(solid)) + # print(type(solid)) # checks if solid is a compound as .val() is not needed for compounds if isinstance(solid, (cq.occ_impl.shapes.Compound, cq.occ_impl.shapes.Solid)): bldr.AddArgument(solid.wrapped) @@ -133,7 +133,7 @@ def tessellate_parts(merged_solid, tolerance: float, angularTolerance: float = 0 loop_counter = 0 for s in merged_solid.Solids(): - print(s.hashCode()) + # print(s.hashCode()) # all_vertices[s.hashCode()] = {} triangles_on_solids_faces[s.hashCode()] = {} for f in s.Faces(): @@ -213,7 +213,7 @@ def tessellate_touching_parts( loop_counter = 0 for s in merged_solid.Solids(): - print(s.hashCode()) + # print(s.hashCode()) # all_vertices[s.hashCode()] = {} triangles_on_solids_faces[s.hashCode()] = {} for f in s.Faces(): @@ -261,11 +261,11 @@ def tessellate_touching_parts( offset += poly.NbNodes() else: - print("found face in existing faces, reusing triangles") + # print("found face in existing faces, reusing triangles") for key_s, value in triangles_on_solids_faces.items(): for key_f, face in value.items(): if key_f == f.hashCode(): - print(f"found face {f.hashCode()}") + # print(f"found face {f.hashCode()}") face_triangles = triangles_on_solids_faces[key_s][key_f] # triangles.append(face_triangles) # triangles_on_solids_faces[s.hashCode()] @@ -278,14 +278,14 @@ def tessellate_touching_parts( list_of_triangles_per_solid = [] for key, value in triangles_on_solids_faces.items(): - print(key) + # print(key) triangles_on_solid = [] for key, face in value.items(): - print(" ", key, face) + # print(" ", key, face) triangles_on_solid = triangles_on_solid + face list_of_triangles_per_solid.append(triangles_on_solid) - for vertice in vertices: - print(vertice) - print(len(vertices)) + # for vertice in vertices: + # print(vertice) + # print(len(vertices)) return vertices, list_of_triangles_per_solid From 5fa21ddc35876ea1e60937b14bf2de7f1a5e2089 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 12:10:25 +0100 Subject: [PATCH 13/17] added two test blocks --- .github/workflows/ci_with_install.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index 10e4216..2f9731d 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -26,7 +26,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: install non pypi dependencies + - name: install non pypi dependencies for cad creation run: | apt-get --allow-releaseinfo-change update apt-get update -y @@ -41,11 +41,18 @@ jobs: pip install . python -c "import cad_to_dagmc" - - name: Run tests + - name: Run cad creation tests run: | pip install .[tests] + pytest tests/test_h5m_creation.py -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml + + - name: install non pypi dependencies for neutronics + run: | + mamba uninstall moab + mamba uninstall cadquery mamba install -c conda-forge -y "openmc=0.13.0=dagmc*nompi*" - pytest tests -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml - - name: Upload to codecov - uses: codecov/codecov-action@v2 + - name: Run cad creation tests + run: | + pip install .[tests] + pytest tests/test_h5m_creation.py -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml From 6d3a3c53f4d1f06b71e40a6f3aa9763bdebf4c33 Mon Sep 17 00:00:00 2001 From: shimwell Date: Fri, 5 Aug 2022 11:11:11 +0000 Subject: [PATCH 14/17] [skip ci] Apply formatting changes --- cad_to_dagmc/core.py | 2 +- tests/test_h5m_creation.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cad_to_dagmc/core.py b/cad_to_dagmc/core.py index a00900f..f86516f 100644 --- a/cad_to_dagmc/core.py +++ b/cad_to_dagmc/core.py @@ -285,7 +285,7 @@ def tessellate_touching_parts( triangles_on_solid = triangles_on_solid + face list_of_triangles_per_solid.append(triangles_on_solid) # for vertice in vertices: - # print(vertice) + # print(vertice) # print(len(vertices)) return vertices, list_of_triangles_per_solid diff --git a/tests/test_h5m_creation.py b/tests/test_h5m_creation.py index 3c815d7..3065bea 100644 --- a/tests/test_h5m_creation.py +++ b/tests/test_h5m_creation.py @@ -1,4 +1,3 @@ - # import dagmc_h5m_file_inspector as di import cad_to_dagmc from vertices_to_h5m import vertices_to_h5m @@ -44,7 +43,7 @@ def test_h5m_production_with_single_volume_list(): h5m_filename=h5m_file, ) - assert di.get_volumes_and_materials_from_h5m(h5m_file) == {1: 'mat1'} + assert di.get_volumes_and_materials_from_h5m(h5m_file) == {1: "mat1"} def test_h5m_production_with_multi_volume_list(): @@ -80,6 +79,6 @@ def test_h5m_production_with_multi_volume_list(): ) tags_dict = {} - for counter, loop_mat_tag in enumerate(mat_tags, 1): + for counter, loop_mat_tag in enumerate(mat_tags, 1): tags_dict[counter] = loop_mat_tag assert di.get_volumes_and_materials_from_h5m(h5m_file) == tags_dict From 14947a81c21ab0d483ea9cb776357156c55c0750 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 12:16:51 +0100 Subject: [PATCH 15/17] removed need for pytest cov --- .github/workflows/ci_with_install.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index 2f9731d..80b4cbd 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -44,7 +44,8 @@ jobs: - name: Run cad creation tests run: | pip install .[tests] - pytest tests/test_h5m_creation.py -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml + pytest tests/test_h5m_creation.py -v + # pytest tests/test_h5m_creation.py -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml - name: install non pypi dependencies for neutronics run: | @@ -55,4 +56,5 @@ jobs: - name: Run cad creation tests run: | pip install .[tests] - pytest tests/test_h5m_creation.py -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml + pytest tests/test_h5m_creation.py -v + # pytest tests/test_h5m_creation.py -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml From dddc7d97804a4c4748f1c74f3951f3064de846d5 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 12:23:55 +0100 Subject: [PATCH 16/17] fixed filename typo --- .github/workflows/ci_with_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index 2f9731d..374359c 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -55,4 +55,4 @@ jobs: - name: Run cad creation tests run: | pip install .[tests] - pytest tests/test_h5m_creation.py -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml + pytest tests/test_h5m_in_simulation.py -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml From 5e3ac0f22ca3ff514b283f46386d3eefb915addf Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 5 Aug 2022 12:28:27 +0100 Subject: [PATCH 17/17] fixed 2nd stage of testing commands --- .github/workflows/ci_with_install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index 6f7e3ac..2cb6681 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -53,7 +53,7 @@ jobs: mamba uninstall cadquery mamba install -c conda-forge -y "openmc=0.13.0=dagmc*nompi*" - - name: Run cad creation tests + - name: Run simulation tests run: | pip install .[tests] - pytest tests/test_h5m_in_simulation.py -v --cov=cad_to_dagmc --cov-append --cov-report term --cov-report xml + pytest tests/test_h5m_in_simulation.py -v