From 25ab9d28ce0c45f886639681aa9233eb1a2dfac1 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 29 Jul 2022 00:47:27 +0100 Subject: [PATCH] Apply suggestions from @paulromano Co-authored-by: Paul Romano --- openmc/mesh.py | 6 +++--- src/state_point.cpp | 1 - tests/unit_tests/mesh_to_vtk/test.py | 11 +++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/openmc/mesh.py b/openmc/mesh.py index 9c837fd8e1..211c4075d1 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -1485,7 +1485,7 @@ class UnstructuredMesh(MeshBase): element_types : Iterable of integers Mesh element types - .. versionadded:: 0.13 + .. versionadded:: 0.13.1 total_volume : float Volume of the unstructured mesh in total """ @@ -1770,8 +1770,8 @@ class UnstructuredMesh(MeshBase): vertices = group['vertices'][()] mesh._vertices = vertices.reshape((-1, 3)) - connectvity = group['connectivity'][()] - mesh._connectivity = connectvity.reshape((-1, 8)) + connectivity = group['connectivity'][()] + mesh._connectivity = connectivity.reshape((-1, 8)) mesh._element_types = group['element_types'][()] if 'length_multiplier' in group: diff --git a/src/state_point.cpp b/src/state_point.cpp index b4200ffe2d..11c93447d0 100644 --- a/src/state_point.cpp +++ b/src/state_point.cpp @@ -812,7 +812,6 @@ void write_unstructured_mesh_results() auto umesh = dynamic_cast(model::meshes[mesh_idx].get()); - if (!umesh) continue; diff --git a/tests/unit_tests/mesh_to_vtk/test.py b/tests/unit_tests/mesh_to_vtk/test.py index 4ac8750027..d9f050226c 100644 --- a/tests/unit_tests/mesh_to_vtk/test.py +++ b/tests/unit_tests/mesh_to_vtk/test.py @@ -17,11 +17,10 @@ def ids_func(param): test_params = (['libmesh', 'moab'], ['tets', 'hexes']) -test_cases = [] -for library, elem_type in product(*test_params): - test_case = {'library' : library, - 'elem_type' : elem_type} - test_cases.append(test_case) +test_cases = [ + {'library' : library, 'elem_type' : elem_type} + for library, elem_type in product(*test_params) +] @pytest.mark.parametrize("test_opts", test_cases, ids=ids_func) def test_unstructured_mesh_to_vtk(run_in_tmpdir, request, test_opts): @@ -60,7 +59,7 @@ def test_unstructured_mesh_to_vtk(run_in_tmpdir, request, test_opts): with openmc.StatePoint(sp_file) as sp: umesh = sp.meshes[umesh.id] - test_data = {'ids' : np.arange(umesh.n_elements)} + test_data = {'ids': np.arange(umesh.n_elements)} umesh.write_data_to_vtk('umesh.vtk', datasets=test_data, volume_normalization=False)