mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
fix bug when loading nuclides using capi: invalid index updating
This commit is contained in:
parent
4878a4601d
commit
5f571a5eaf
2 changed files with 4 additions and 5 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
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ def test_nuclide_mapping(capi_init):
|
|||
|
||||
|
||||
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