Avoid instantiating a Mesh during class method

This commit is contained in:
tjlaboss 2018-05-23 11:51:26 -04:00
parent 7801761a70
commit 36e2ea6b8a

View file

@ -90,12 +90,12 @@ def test_mesh2d(rlat2):
shape = np.array(rlat2.shape)
width = shape*rlat2.pitch
mesh1 = openmc.Mesh().from_rect_lattice(rlat2)
mesh1 = openmc.Mesh.from_rect_lattice(rlat2)
assert np.array_equal(mesh1.dimension, (3, 3))
assert np.array_equal(mesh1.lower_left, rlat2.lower_left)
assert np.array_equal(mesh1.upper_right, rlat2.lower_left + width)
mesh2 = openmc.Mesh().from_rect_lattice(rlat2, division=3)
mesh2 = openmc.Mesh.from_rect_lattice(rlat2, division=3)
assert np.array_equal(mesh2.dimension, (9, 9))
assert np.array_equal(mesh2.lower_left, rlat2.lower_left)
assert np.array_equal(mesh2.upper_right, rlat2.lower_left + width)
@ -105,12 +105,12 @@ def test_mesh3d(rlat3):
shape = np.array(rlat3.shape)
width = shape*rlat3.pitch
mesh1 = openmc.Mesh().from_rect_lattice(rlat3)
mesh1 = openmc.Mesh.from_rect_lattice(rlat3)
assert np.array_equal(mesh1.dimension, (3, 3, 2))
assert np.array_equal(mesh1.lower_left, rlat3.lower_left)
assert np.array_equal(mesh1.upper_right, rlat3.lower_left + width)
mesh2 = openmc.Mesh().from_rect_lattice(rlat3, division=3)
mesh2 = openmc.Mesh.from_rect_lattice(rlat3, division=3)
assert np.array_equal(mesh2.dimension, (9, 9, 6))
assert np.array_equal(mesh2.lower_left, rlat3.lower_left)
assert np.array_equal(mesh2.upper_right, rlat3.lower_left + width)