diff --git a/src/cross_section.f90 b/src/cross_section.f90 index 885b5c9bac..e5920e1e10 100644 --- a/src/cross_section.f90 +++ b/src/cross_section.f90 @@ -7,7 +7,7 @@ module cross_section use datatypes_header, only: DictionaryCI use endf, only: reaction_name use error, only: fatal_error - use fileio, only: read_line, read_data, skip_lines + use fileio, only: read_line, skip_lines use global use material_header, only: Material use output, only: write_message @@ -180,7 +180,6 @@ contains integer :: in = 7 ! unit to read from integer :: ioError ! error status for file access - integer :: words_per_line ! number of words per line (data) integer :: lines ! number of lines (data integer :: n ! number of data values real(8) :: kT ! ACE table temperature @@ -251,29 +250,23 @@ contains ! Skip 5 lines call skip_lines(in, 5, ioError) - ! Read NXS data - lines = 2 - words_per_line = 8 - call read_data(in, NXS, 16, lines, words_per_line) - - ! Set ZAID of nuclide - nuc % zaid = NXS(2) - - ! Read JXS data - lines = 4 - call read_data(in, JXS, 32, lines, words_per_line) + ! Read NXS and JXS data + read(UNIT=in, FMT=*) NXS + read(UNIT=in, FMT=*) JXS ! Calculate how many data points and lines in the XSS array n = NXS(1) lines = (n + 3)/4 if (found_xs) then + ! Set ZAID of nuclide + nuc % zaid = NXS(2) + ! allocate storage for XSS array allocate(XSS(n)) ! Read XSS - words_per_line = 4 - call read_data(in, XSS, n, lines, words_per_line) + read(UNIT=in, FMT=*) XSS else call skip_lines(in, lines, ioError) end if @@ -1077,7 +1070,6 @@ contains integer :: in = 7 ! unit to read from integer :: ioError ! error status for file access - integer :: words_per_line ! number of words per line (data) integer :: lines ! number of lines (data integer :: n ! number of data values real(8) :: kT ! ACE table temperature @@ -1148,14 +1140,9 @@ contains call skip_lines(in, 5, ioError) end if - ! Read NXS data - lines = 2 - words_per_line = 8 - call read_data(in, NXS, 16, lines, words_per_line) - - ! Read JXS data - lines = 4 - call read_data(in, JXS, 32, lines, words_per_line) + ! Read NXS and JXS data + read(UNIT=in, FMT=*) NXS + read(UNIT=in, FMT=*) JXS ! Calculate how many data points and lines in the XSS array n = NXS(1) @@ -1166,8 +1153,7 @@ contains allocate(XSS(n)) ! Read XSS - words_per_line = 4 - call read_data(in, XSS, n, lines, words_per_line) + read(UNIT=in, FMT=*) XSS else call skip_lines(in, lines, ioError) end if diff --git a/src/fileio.f90 b/src/fileio.f90 index 96a7f83c8b..48205a3f82 100644 --- a/src/fileio.f90 +++ b/src/fileio.f90 @@ -6,16 +6,6 @@ module fileio implicit none -!=============================================================================== -! READ_DATA interface allows data to be read with one function regardless of -! whether it is integer or real data. E.g. NXS and JXS can be read with the -! integer version and XSS can be read with the real version -!=============================================================================== - - interface read_data - module procedure read_data_int, read_data_real - end interface - contains !=============================================================================== @@ -89,67 +79,12 @@ contains integer, intent(in) :: n_lines ! number of lines to skip integer, intent(out) :: ioError ! error status - integer :: i ! index for number of lines - character(MAX_LINE_LEN) :: tmp ! single line + integer :: i ! index for number of lines do i = 1, n_lines - read(UNIT=unit, FMT='(A)', IOSTAT=ioError) tmp + read(UNIT=unit, FMT=*, IOSTAT=ioError) end do end subroutine skip_lines -!=============================================================================== -! READ_DATA_INT reads integer data into an array from a file open -!=============================================================================== - - subroutine read_data_int(unit, array, n, lines, words_per_line) - - integer, intent(in) :: unit ! unit to read from - integer, intent(in) :: n ! total number of ints - integer, intent(out) :: array(n) ! ints read from file - integer, intent(in) :: lines ! total number of lines - integer, intent(in) :: words_per_line ! number of words per line - - integer :: i ! line index - integer :: loc ! locator for array - - loc = 0 - do i = 1, lines - if (i == lines) then - read(UNIT=unit,FMT=*) array(loc+1:n) - else - read(UNIT=unit,FMT=*) array(loc+1:loc+words_per_line) - loc = loc + words_per_line - end if - end do - - end subroutine read_data_int - -!=============================================================================== -! READ_DATA_REAL reads real(8) data into an array from a file open -!=============================================================================== - - subroutine read_data_real(unit, array, n, lines, words_per_line) - - integer, intent(in) :: unit ! unit to read from - integer, intent(in) :: n ! total number of ints - real(8), intent(out) :: array(n) ! real(8)s read from file - integer, intent(in) :: lines ! total number of lines - integer, intent(in) :: words_per_line ! number of words per line - - integer :: i ! line index - integer :: loc ! locator for array - - loc = 0 - do i = 1, lines - if (i == lines) then - read(UNIT=unit,FMT=*) array(loc+1:n) - else - read(UNIT=unit,FMT=*) array(loc+1:loc+words_per_line) - loc = loc + words_per_line - end if - end do - - end subroutine read_data_real - end module fileio diff --git a/src/main.f90 b/src/main.f90 index 5b90a527a1..1313906a0d 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -55,7 +55,6 @@ contains integer :: i_cycle ! cycle index integer(8) :: i_particle ! history index - character(MAX_LINE_LEN) :: msg ! output/error message type(Particle), pointer :: p => null() if (master) call header("BEGIN SIMULATION", 1) @@ -70,7 +69,7 @@ contains ! Start timer for computation call timer_start(time_compute) - msg = "Simulating cycle " // trim(int_to_str(i_cycle)) // "..." + message = "Simulating cycle " // trim(int_to_str(i_cycle)) // "..." call write_message(8) ! Set all tallies to zero diff --git a/src/source.f90 b/src/source.f90 index c448da0a1b..1da0ea2e68 100644 --- a/src/source.f90 +++ b/src/source.f90 @@ -30,9 +30,8 @@ contains real(8) :: E ! outgoing energy real(8) :: p_min(3) ! minimum coordinates of source real(8) :: p_max(3) ! maximum coordinates of source - character(MAX_LINE_LEN) :: msg ! error message - msg = 'Initializing source particles...' + message = "Initializing source particles..." call write_message(6) ! Determine maximum amount of particles to simulate on each processor