mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
add dagmc testing
This commit is contained in:
parent
e799346502
commit
06e6d5d347
1 changed files with 22 additions and 1 deletions
|
|
@ -107,11 +107,13 @@ def test_clone():
|
|||
c2.fill = openmc.Material()
|
||||
c3 = openmc.Cell()
|
||||
u1 = openmc.Universe(name='cool', cells=(c1, c2, c3))
|
||||
u1.volume = 1.
|
||||
|
||||
u2 = u1.clone()
|
||||
assert u2.name == u1.name
|
||||
assert u2.cells != u1.cells
|
||||
assert u2.get_all_materials() != u1.get_all_materials()
|
||||
assert u2.volume == u1.volume
|
||||
|
||||
u2 = u1.clone(clone_materials=False)
|
||||
assert u2.get_all_materials() == u1.get_all_materials()
|
||||
|
|
@ -120,14 +122,33 @@ def test_clone():
|
|||
assert next(iter(u3.cells.values())).region ==\
|
||||
next(iter(u1.cells.values())).region
|
||||
|
||||
dagmc_u = openmc.DAGMCUniverse(filename="")
|
||||
# Change attributes, make sure clone stays intact
|
||||
u1.volume = 2.
|
||||
u1.name = "different name"
|
||||
assert u3.volume != u1.volume
|
||||
assert u3.name != u1.name
|
||||
|
||||
# Test cloning a DAGMC universe
|
||||
dagmc_u = openmc.DAGMCUniverse(filename="", name="DAGMC universe")
|
||||
dagmc_u.volume = 1.
|
||||
dagmc_u.auto_geom_ids = True
|
||||
dagmc_u.auto_mat_ids = True
|
||||
dagmc_u1 = dagmc_u.clone()
|
||||
assert dagmc_u1.name == dagmc_u.name
|
||||
assert dagmc_u1.volume == dagmc_u.volume
|
||||
assert dagmc_u1.auto_geom_ids == dagmc_u.auto_geom_ids
|
||||
assert dagmc_u1.auto_mat_ids == dagmc_u.auto_mat_ids
|
||||
|
||||
# Change attributes, check the clone remained intact
|
||||
dagmc_u.name = "another name"
|
||||
dagmc_u.auto_geom_ids = False
|
||||
dagmc_u.auto_mat_ids = False
|
||||
dagmc_u.volume = 2.
|
||||
assert dagmc_u1.name != dagmc_u.name
|
||||
assert dagmc_u1.volume != dagmc_u.volume
|
||||
assert dagmc_u1.auto_geom_ids != dagmc_u.auto_geom_ids
|
||||
assert dagmc_u1.auto_mat_ids != dagmc_u.auto_mat_ids
|
||||
|
||||
|
||||
def test_create_xml(cell_with_lattice):
|
||||
cells = [openmc.Cell() for i in range(5)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue