Reduced unnecessary calls to mesh_indices_to_bin.

This commit is contained in:
Paul Romano 2011-12-09 13:56:06 -05:00
parent eeb95facb4
commit 129d9a1cae
2 changed files with 19 additions and 17 deletions

View file

@ -12,15 +12,15 @@ contains
! GET_MESH_BIN determines the tally bin for a particle in a structured mesh
!===============================================================================
subroutine get_mesh_bin(m, xyz, bin, in_mesh)
subroutine get_mesh_bin(m, xyz, bin)
type(StructuredMesh), pointer :: m
real(8), intent(in) :: xyz(:)
integer, intent(out) :: bin
logical, intent(out) :: in_mesh
integer :: n
integer, allocatable :: ijk(:)
logical :: in_mesh
! Get number of dimensions
n = m % n_dimension
@ -32,7 +32,11 @@ contains
call get_mesh_indices(m, xyz(1:n), ijk, in_mesh)
! Convert indices to bin
bin = mesh_indices_to_bin(m, ijk)
if (in_mesh) then
bin = mesh_indices_to_bin(m, ijk)
else
bin = NO_BIN_FOUND
end if
! Release memory for ijk
deallocate(ijk)

View file

@ -333,7 +333,6 @@ contains
real(8) :: wgt
real(8) :: mu
real(8) :: E_out
logical :: in_mesh
logical :: has_energyout_bin
logical :: analog
type(TallyObject), pointer :: t
@ -356,6 +355,18 @@ contains
! =======================================================================
! DETERMINE SCORING BIN COMBINATION
! determine mesh bin
if (t % n_bins(T_MESH) > 0) then
m => meshes(t % mesh)
! Determine if we're in the mesh first
call get_mesh_bin(m, p % coord0 % xyz, mesh_bin)
if (mesh_bin == NO_BIN_FOUND) cycle
bins(T_MESH) = mesh_bin
else
bins(T_MESH) = 1
end if
! determine next universe bin
if (t % n_bins(T_UNIVERSE) > 0) then
bins(T_UNIVERSE) = get_next_bin(T_UNIVERSE, p % coord % universe, i)
@ -396,19 +407,6 @@ contains
bins(T_SURFACE) = 1
end if
! determine mesh bin
if (t % n_bins(T_MESH) > 0) then
m => meshes(t % mesh)
! Determine if we're in the mesh first
call get_mesh_bin(m, p % coord0 % xyz, mesh_bin, in_mesh)
if (.not. in_mesh) cycle
bins(T_MESH) = mesh_bin
else
bins(T_MESH) = 1
end if
! determine incoming energy bin
n = t % n_bins(T_ENERGYIN)
if (n > 0) then