mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
adding back files to be reviewed
This commit is contained in:
parent
ae28233110
commit
bc09d1ef55
1244 changed files with 301904 additions and 0 deletions
36
tests/unit_tests/test_source.py
Normal file
36
tests/unit_tests/test_source.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import openmc
|
||||
import openmc.stats
|
||||
|
||||
|
||||
def test_source():
|
||||
space = openmc.stats.Point()
|
||||
energy = openmc.stats.Discrete([1.0e6], [1.0])
|
||||
angle = openmc.stats.Isotropic()
|
||||
|
||||
src = openmc.Source(space=space, angle=angle, energy=energy)
|
||||
assert src.space == space
|
||||
assert src.angle == angle
|
||||
assert src.energy == energy
|
||||
|
||||
elem = src.to_xml_element()
|
||||
assert 'strength' in elem.attrib
|
||||
assert elem.find('space') is not None
|
||||
assert elem.find('angle') is not None
|
||||
assert elem.find('energy') is not None
|
||||
|
||||
src = openmc.Source.from_xml_element(elem)
|
||||
assert isinstance(src.angle, openmc.stats.Isotropic)
|
||||
assert src.space.xyz == [0.0, 0.0, 0.0]
|
||||
assert src.energy.x == [1.0e6]
|
||||
assert src.energy.p == [1.0]
|
||||
assert src.strength == 1.0
|
||||
|
||||
|
||||
def test_source_file():
|
||||
filename = 'source.h5'
|
||||
src = openmc.Source(filename=filename)
|
||||
assert src.file == filename
|
||||
|
||||
elem = src.to_xml_element()
|
||||
assert 'strength' in elem.attrib
|
||||
assert 'file' in elem.attrib
|
||||
Loading…
Add table
Add a link
Reference in a new issue