mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Merge pull request #1153 from liangjg/develop
Fix bug when loading nuclides with openmc.capi
This commit is contained in:
commit
6935433737
2 changed files with 10 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue