Converting double max to np.inf on the Python side for bounding boxes.

This commit is contained in:
Patrick Shriwise 2019-07-24 14:36:55 -05:00
parent 5ad4f94f3a
commit d5eaa3b5b7
4 changed files with 27 additions and 13 deletions

View file

@ -1,6 +1,5 @@
from collections.abc import Mapping
import os
import sys
import numpy as np
import pytest
@ -477,10 +476,8 @@ def test_position(capi_init):
def test_global_bounding_box(capi_init):
inf = sys.float_info.max
expected_llc = (-0.63, -0.63, -inf)
expected_urc = (0.63, 0.63, inf)
expected_llc = (-0.63, -0.63, -np.inf)
expected_urc = (0.63, 0.63, np.inf)
llc, urc = openmc.capi.global_bounding_box()

View file

@ -1,5 +1,3 @@
import sys
import numpy as np
import openmc.capi
import pytest
@ -82,13 +80,17 @@ def complex_cell(run_in_tmpdir):
openmc.capi.finalize()
inf = sys.float_info.max
expected_results = ( (1, (( -4., -4., -inf), ( 4., 4., inf))),
(2, (( -7., -7., -inf), ( 7., 7., inf))),
(3, ((-10., -10., -inf), (10., 10., inf))),
(4, ((-10., -10., -inf), (10., 10., inf))),
(5, ((-inf, -inf, -inf), (inf, inf, inf))) )
expected_results = ( (1, (( -4., -4., -np.inf),
( 4., 4., np.inf))),
(2, (( -7., -7., -np.inf),
( 7., 7., np.inf))),
(3, ((-10., -10., -np.inf),
( 10., 10., np.inf))),
(4, ((-10., -10., -np.inf),
( 10., 10., np.inf))),
(5, ((-np.inf, -np.inf, -np.inf),
( np.inf, np.inf, np.inf))) )
@pytest.mark.parametrize("cell_id,expected_box", expected_results)
def test_cell_box(cell_id, expected_box):
cell_box = openmc.capi.cells[cell_id].bounding_box