Fixed array out-of-bounds errors for union energy grid. Closes gh-29.

This commit is contained in:
Paul Romano 2011-08-27 21:50:36 -04:00
parent 9400e46786
commit f78819682e
2 changed files with 12 additions and 8 deletions

View file

@ -440,8 +440,10 @@ contains
! read ENDF interpolation parameters
XSS_index = LDIS + LOCC + 3
nuc % nu_d_edist(i) % nbt = get_real(NR)
nuc % nu_d_edist(i) % int = get_real(NR)
if (NR > 0) then
nuc % nu_d_edist(i) % nbt = get_real(NR)
nuc % nu_d_edist(i) % int = get_real(NR)
end if
! allocate space for law validity data
NE = XSS(LDIS + LOCC + 3 + 2*NR)
@ -698,8 +700,10 @@ contains
! read ENDF interpolation parameters
XSS_index = LDIS + LOCC + 3
rxn % edist % nbt = get_real(NR)
rxn % edist % int = get_real(NR)
if (NR > 0) then
rxn % edist % nbt = get_real(NR)
rxn % edist % int = get_real(NR)
end if
! allocate space for law validity data
NE = XSS(LDIS + LOCC + 3 + 2*NR)

View file

@ -95,8 +95,8 @@ contains
current => list
head => list
E = energy(index)
do while (index <= n)
E = energy(index)
! If we've reached the end of the grid energy list, add the remaining
! energy points to the end
@ -129,13 +129,11 @@ contains
! advance index
index = index + 1
E = energy(index)
elseif (E == current % data) then
! found the exact same energy, no need to store duplicates so just
! skip and move to next index
index = index + 1
E = energy(index)
else
previous => current
current => current % next
@ -157,6 +155,7 @@ contains
integer :: i, j
integer :: index
integer :: n_grid_nuclide
type(Nuclide), pointer :: nuc
real(8) :: union_energy
@ -165,6 +164,7 @@ contains
do i = 1, n_nuclides_total
nuc => nuclides(i)
n_grid_nuclide = size(nuc % energy)
allocate(nuc % grid_index(n_grid))
index = 1
@ -172,7 +172,7 @@ contains
do j = 1, n_grid
union_energy = e_grid(j)
if (union_energy >= energy) then
if (union_energy >= energy .and. index < n_grid_nuclide) then
index = index + 1
energy = nuc % energy(index)
end if