diff --git a/src/error.F90 b/src/error.F90 index 78fd64c25e..ffcd7fb9ab 100644 --- a/src/error.F90 +++ b/src/error.F90 @@ -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 diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 0a5b4e23ee..3ab9b11352 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -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 must be the same as & + &the number of entries on ." + call fatal_error() + end if + + else if (get_arraysize_double(node_lat, "pitch") /= n) then message = "Number of entries on must be the same as & &the number of entries on ." 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)