Fix bug in maximum_levels() pointed out by @wbinventor and respond to his other

comments as well.
This commit is contained in:
Paul Romano 2015-07-07 10:28:03 +07:00
parent 1a0969e9ca
commit a7815ad913
4 changed files with 11 additions and 8 deletions

View file

@ -162,7 +162,7 @@ openmp
coverage
Compile and link code instrumented for coverage analysis. This is typically
used in conjunction with gcov.
used in conjunction with gcov_.
maxcoord
Maximum number of nested coordinate levels in geometry. Defaults to 10.
@ -174,6 +174,8 @@ should be used:
cmake -Ddebug=on /path/to/openmc
.. _gcov: https://gcc.gnu.org/onlinedocs/gcc/Gcov.html
Compiling with MPI
++++++++++++++++++

View file

@ -76,8 +76,8 @@ contains
type(Particle), intent(inout) :: p
integer :: i ! cell loop index on a level
integer :: j
integer :: n_coord
integer :: j ! coordinate level index
integer :: n_coord ! saved number of coordinate levels
integer :: n ! number of cells to search on a level
integer :: index_cell ! index in cells array
type(Cell), pointer :: c ! pointer to cell
@ -125,7 +125,7 @@ contains
logical, intent(inout) :: found
integer, optional :: search_cells(:)
integer :: i ! index over cells
integer :: j
integer :: j ! coordinate level index
integer :: i_xyz(3) ! indices in lattice
integer :: n ! number of cells to search
integer :: index_cell ! index in cells array
@ -186,7 +186,7 @@ contains
! ======================================================================
! CELL CONTAINS LOWER UNIVERSE, RECURSIVELY FIND CELL
! Create new level of coordinates
! Store lower level coordinates
p % coord(j + 1) % xyz = p % coord(j) % xyz
p % coord(j + 1) % uvw = p % coord(j) % uvw
@ -221,7 +221,7 @@ contains
! Determine lattice indices
i_xyz = lat % get_indices(p % coord(j) % xyz + TINY_BIT * p % coord(j) % uvw)
! Create new level of coordinates
! Store lower level coordinates
p % coord(j + 1) % xyz = lat % get_local_xyz(p % coord(j) % xyz, i_xyz)
p % coord(j + 1) % uvw = p % coord(j) % uvw
@ -1911,7 +1911,7 @@ contains
if (c % type == CELL_FILL) then
next_univ => universes(c % fill)
levels_below = maximum_levels(next_univ)
levels_below = max(levels_below, maximum_levels(next_univ))
! ====================================================================
! CELL CONTAINS LATTICE, RECURSIVELY FIND CELL

View file

@ -104,6 +104,7 @@ contains
! Check to make sure there are not too many nested coordinate levels in the
! geometry since the coordinate list is statically allocated for performance
! reasons
print *, 'Max levels = ', maximum_levels(universes(BASE_UNIVERSE))
if (maximum_levels(universes(BASE_UNIVERSE)) > MAX_COORD) then
call fatal_error("Too many nested coordinate levels in the geometry. &
&Try increasing the maximum number of coordinate levels by &

View file

@ -41,7 +41,7 @@ module particle_header
integer :: type ! Particle type (n, p, e, etc)
! Particle coordinates
integer :: n_coord ! number of current coordinates
integer :: n_coord ! number of current coordinates
type(LocalCoord) :: coord(MAX_COORD) ! coordinates for all levels
! Other physical data