Merge pull request #1153 from liangjg/develop

Fix bug when loading nuclides with openmc.capi
This commit is contained in:
Paul Romano 2019-02-06 22:27:46 -06:00 committed by GitHub
commit 6935433737
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 11 deletions

View file

@ -703,15 +703,13 @@ contains
end function openmc_nuclide_name
subroutine extend_nuclides() bind(C)
integer :: n
type(Nuclide), allocatable :: new_nuclides(:)
! allocate extra space in nuclides array
n = n_nuclides
allocate(new_nuclides(n + 1))
new_nuclides(1:n) = nuclides(:)
allocate(new_nuclides(n_nuclides + 1))
new_nuclides(1:n_nuclides) = nuclides(:)
call move_alloc(FROM=new_nuclides, TO=nuclides)
n = n + 1
n_nuclides = n_nuclides + 1
end subroutine
end module nuclide_header

View file

@ -130,12 +130,6 @@ def test_nuclide_mapping(capi_init):
assert name == nuc.name
def test_load_nuclide(capi_init):
openmc.capi.load_nuclide('Pu239')
with pytest.raises(exc.DataError):
openmc.capi.load_nuclide('Pu3')
def test_settings(capi_init):
settings = openmc.capi.settings
assert settings.batches == 10
@ -393,3 +387,10 @@ def test_restart(capi_init):
# Compare the keff values.
assert keff0 == pytest.approx(keff1)
def test_load_nuclide(capi_init):
openmc.capi.load_nuclide('H3')
openmc.capi.load_nuclide('Pu239')
with pytest.raises(exc.DataError):
openmc.capi.load_nuclide('Pu3')