Added deprecation warnings to hex_lattice

This commit is contained in:
Sterling Harper 2014-09-05 23:41:55 -04:00
parent 616009dc04
commit a83da11b7f
2 changed files with 50 additions and 11 deletions

View file

@ -17,21 +17,34 @@ contains
! stream.
!===============================================================================
subroutine warning(force)
subroutine warning(force, deprecation)
logical, optional :: force ! force write from proc other than master
logical, optional, intent(in) :: force ! force write from non-master proc
logical, optional, intent(in) :: deprecation ! is a depreciation warning
integer :: i_start ! starting position
integer :: i_end ! ending position
integer :: line_wrap ! length of line
integer :: length ! length of message
integer :: indent ! length of indentation
logical :: deprecation_ ! is a deprecation warning
integer :: i_start ! starting position
integer :: i_end ! ending position
integer :: line_wrap ! length of line
integer :: length ! length of message
integer :: indent ! length of indentation
! Only allow master to print to screen
if (.not. master .and. .not. present(force)) return
! Make a deprecation alias in case deprecation is not present.
if (.not. present(deprecation)) then
deprecation_ = .false.
else
deprecation_ = deprecation
end if
! Write warning at beginning
write(ERROR_UNIT, fmt='(1X,A)', advance='no') 'WARNING: '
if (deprecation_) then
message = 'DEPRECATION WARNING: ' // message
else
message = 'WARNING: ' // message
end if
! Set line wrapping and indentation
line_wrap = 80

View file

@ -1245,15 +1245,41 @@ contains
allocate(lat % lower_left(n))
call get_node_array(node_lat, "lower_left", lat % lower_left)
! Read lattice pitches
if (get_arraysize_double(node_lat, "pitch") /= n) then
! Read lattice pitches.
! TODO: Remove this deprecation warning in a future release.
if (check_for_node(node_lat, "width")) then
message = "The use of 'width' is deprecated and will be disallowed in &
&a future release. Use 'pitch' instead. The utility openmc/src/&
&utils/update_lattices.py can be used to automatically update &
&geometry.xml files."
call warning(deprecation=.true.)
if (get_arraysize_double(node_lat, "width") /= n) then
message = "Number of entries on <pitch> must be the same as &
&the number of entries on <dimension>."
call fatal_error()
end if
else if (get_arraysize_double(node_lat, "pitch") /= n) then
message = "Number of entries on <pitch> must be the same as &
&the number of entries on <dimension>."
call fatal_error()
end if
allocate(lat % pitch(n))
call get_node_array(node_lat, "pitch", lat % pitch)
! TODO: Remove the 'width' code in a future release.
if (check_for_node(node_lat, "width")) then
call get_node_array(node_lat, "width", lat % pitch)
else
call get_node_array(node_lat, "pitch", lat % pitch)
end if
! TODO: Remove deprecation warning in a future release.
if (check_for_node(node_lat, "type")) then
message = "The use of 'type' is no longer needed. The utility &
&openmc/src/utils/update_lattices.py can be used to automatically &
&update geometry.xml files."
call warning(deprecation=.true.)
end if
! Copy number of dimensions
n_x = lat % n_cells(1)