Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tests/unit_tests/test_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from uncertainties.unumpy import uarray, nominal_values, std_devs


UMESH_DIR = Path(__file__).resolve().parents[1] / 'regression_tests' / 'unstructured_mesh'

@pytest.mark.parametrize("val_left,val_right", [(0, 0), (-1., -1.), (2.0, 2)])
def test_raises_error_when_flat(val_left, val_right):
"""Checks that an error is raised when a mesh is flat"""
Expand Down Expand Up @@ -388,7 +390,7 @@ def test_mesh_name_roundtrip(run_in_tmpdir):


def test_umesh_roundtrip(run_in_tmpdir, request):
umesh = openmc.UnstructuredMesh(request.path.parent / 'test_mesh_tets.e', 'moab')
umesh = openmc.UnstructuredMesh(UMESH_DIR / 'test_mesh_tets.exo', 'moab')
umesh.interface = 'xdg'
umesh.output = True

Expand Down Expand Up @@ -562,11 +564,11 @@ def test_umesh(run_in_tmpdir, simple_umesh, export_type):

vtkhdf_tests = [
(
Path("test_mesh_dagmc_tets.vtk"),
UMESH_DIR / "test_mesh_dagmc_tets.vtk",
"moab"
),
(
Path("test_mesh_hexes.exo"),
UMESH_DIR / "test_mesh_hexes.exo",
"libmesh"
)
]
Expand Down
1 change: 0 additions & 1 deletion tests/unit_tests/test_mesh_dagmc_tets.vtk

This file was deleted.

1 change: 0 additions & 1 deletion tests/unit_tests/test_mesh_hexes.exo

This file was deleted.

1 change: 0 additions & 1 deletion tests/unit_tests/test_mesh_tets.e

This file was deleted.

10 changes: 6 additions & 4 deletions tests/unit_tests/test_source_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# MeshSpatial Tests
###################
TETS_PER_VOXEL = 12
UMESH_TETS = (Path(__file__).resolve().parents[1] / 'regression_tests' /
'unstructured_mesh' / 'test_mesh_tets.exo')

# This test uses a geometry file with cells that match a regular mesh. Each cell
# in the geometry corresponds to 12 tetrahedra in the unstructured mesh file.
Expand Down Expand Up @@ -83,7 +85,7 @@ def test_unstructured_mesh_sampling(model, request, test_cases):
pytest.skip("XDG mesh interface not enabled in this build.")

# setup mesh source ###
mesh_filename = Path(request.fspath).parent / "test_mesh_tets.e"
mesh_filename = UMESH_TETS
uscd_mesh = openmc.UnstructuredMesh(mesh_filename, test_cases['library'])
uscd_mesh.interface = test_cases['interface']

Expand Down Expand Up @@ -153,7 +155,7 @@ def test_unstructured_mesh_sampling(model, request, test_cases):

def test_strengths_size_failure(request, model):
# setup mesh source ###
mesh_filename = Path(request.fspath).parent / "test_mesh_tets.e"
mesh_filename = UMESH_TETS
uscd_mesh = openmc.UnstructuredMesh(mesh_filename, 'libmesh')

# intentionally incorrectly sized to trigger an error
Expand Down Expand Up @@ -191,7 +193,7 @@ def test_roundtrip(run_in_tmpdir, model, request):
):
pytest.skip("Unstructured mesh is not enabled in this build.")

mesh_filename = Path(request.fspath).parent / 'test_mesh_tets.e'
mesh_filename = UMESH_TETS
ucd_mesh = openmc.UnstructuredMesh(mesh_filename, library='libmesh')

if not openmc.lib.feature_enabled('libmesh'):
Expand Down Expand Up @@ -339,7 +341,7 @@ def test_umesh_source_independent(run_in_tmpdir, request, void_model, library, i

model = void_model

mesh_filename = Path(request.fspath).parent / "test_mesh_tets.e"
mesh_filename = UMESH_TETS
uscd_mesh = openmc.UnstructuredMesh(mesh_filename, library)
uscd_mesh.interface = interface
ind_source = openmc.IndependentSource()
Expand Down
5 changes: 4 additions & 1 deletion tests/unit_tests/weightwindows/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
from tests import cdtemp


UMESH_TETS = (Path(__file__).resolve().parents[2] / 'regression_tests' /
'unstructured_mesh' / 'test_mesh_tets.exo')

@pytest.fixture
def wws():

Expand Down Expand Up @@ -372,7 +375,7 @@ def test_unstructured_mesh_applied_wws(request, run_in_tmpdir, library, interfac
cell = openmc.Cell(region=-box, fill=water)

geometry = openmc.Geometry([cell])
mesh_file = str(request.fspath.dirpath() / 'test_mesh_tets.exo')
mesh_file = str(UMESH_TETS)
mesh = openmc.UnstructuredMesh(mesh_file, library)
mesh.interface = interface

Expand Down
1 change: 0 additions & 1 deletion tests/unit_tests/weightwindows/test_mesh_tets.exo

This file was deleted.

7 changes: 6 additions & 1 deletion tests/unit_tests/weightwindows/test_ww_list.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

import h5py
import numpy as np
import pytest
Expand All @@ -6,6 +8,9 @@
import openmc.lib


UMESH_TETS = (Path(__file__).resolve().parents[2] / 'regression_tests' /
'unstructured_mesh' / 'test_mesh_tets.exo')

def test_ww_roundtrip(request, run_in_tmpdir, monkeypatch):
# Load weight windows from a wwinp file
wwinp_file = request.path.with_name('wwinp_n')
Expand Down Expand Up @@ -87,7 +92,7 @@ def test_export_hdf5_unstructured_mesh(request, run_in_tmpdir, library):
pytest.skip('DAGMC (and MOAB) not enabled in this build.')

mesh = openmc.UnstructuredMesh(
request.path.with_name('test_mesh_tets.exo'), library, mesh_id=20,
UMESH_TETS, library, mesh_id=20,
name='unstructured', length_multiplier=2.0)
ww = openmc.WeightWindows(mesh, np.ones(12_000), upper_bound_ratio=5.0)
openmc.WeightWindowsList([ww]).export_to_hdf5('ww.h5')
Expand Down
Loading