Don't use PWD environment variable when setting path to input files. Closes #302

on github.
This commit is contained in:
Paul Romano 2014-08-05 22:49:44 -04:00
parent 2e60c0ea61
commit 3e0870ac96

View file

@ -211,13 +211,13 @@ contains
call MPI_GET_ADDRESS(b % uvw, bank_disp(3), mpi_err)
call MPI_GET_ADDRESS(b % E, bank_disp(4), mpi_err)
! Adjust displacements
! Adjust displacements
bank_disp = bank_disp - bank_disp(1)
! Define MPI_BANK for fission sites
bank_blocks = (/ 1, 3, 3, 1 /)
bank_types = (/ MPI_REAL8, MPI_REAL8, MPI_REAL8, MPI_REAL8 /)
call MPI_TYPE_CREATE_STRUCT(4, bank_blocks, bank_disp, &
call MPI_TYPE_CREATE_STRUCT(4, bank_blocks, bank_disp, &
bank_types, MPI_BANK, mpi_err)
call MPI_TYPE_COMMIT(MPI_BANK, mpi_err)
@ -308,13 +308,9 @@ contains
integer :: argc ! number of command line arguments
integer :: last_flag ! index of last flag
integer :: filetype
character(MAX_FILE_LEN) :: pwd ! present working directory
character(MAX_WORD_LEN), allocatable :: argv(:) ! command line arguments
type(BinaryOutput) :: sp
! Get working directory
call GET_ENVIRONMENT_VARIABLE("PWD", pwd)
! Check number of command line arguments and allocate argv
argc = COMMAND_ARGUMENT_COUNT()
@ -414,7 +410,7 @@ contains
! Read number of threads
i = i + 1
#ifdef _OPENMP
#ifdef _OPENMP
! Read and set number of OpenMP threads
n_threads = int(str_to_int(argv(i)), 4)
if (n_threads < 1) then
@ -454,16 +450,12 @@ contains
! Determine directory where XML input files are
if (argc > 0 .and. last_flag < argc) then
path_input = argv(last_flag + 1)
! Need to add working directory if the given path is a relative path
if (.not. starts_with(path_input, "/")) then
path_input = trim(pwd) // "/" // trim(path_input)
end if
else
path_input = pwd
path_input = ''
end if
! Add slash at end of directory if it isn't there
if (.not. ends_with(path_input, "/")) then
if (.not. ends_with(path_input, "/") .and. len_trim(path_input) > 0) then
path_input = trim(path_input) // "/"
end if
@ -563,7 +555,7 @@ contains
integer :: m ! loop index for lattices
integer :: mid, lid ! material and lattice IDs
integer :: n_x, n_y, n_z ! size of lattice
integer :: i_array ! index in surfaces/materials array
integer :: i_array ! index in surfaces/materials array
integer :: id ! user-specified id
type(Cell), pointer :: c => null()
type(Lattice), pointer :: lat => null()
@ -634,7 +626,7 @@ contains
" specified on lattice " // trim(to_str(lid))
call fatal_error()
end if
else
message = "Specified fill " // trim(to_str(id)) // " on cell " // &
trim(to_str(c % id)) // " is neither a universe nor a lattice."
@ -805,7 +797,7 @@ contains
sum_percent = sum_percent + x*awr
end do
sum_percent = ONE / sum_percent
mat % density = -mat % density * N_AVOGADRO &
mat % density = -mat % density * N_AVOGADRO &
/ MASS_NEUTRON * sum_percent
end if
@ -866,7 +858,7 @@ contains
! Allocate source bank
allocate(source_bank(work), STAT=alloc_err)
! Check for allocation errors
! Check for allocation errors
if (alloc_err /= 0) then
message = "Failed to allocate source bank."
call fatal_error()
@ -894,7 +886,7 @@ contains
allocate(fission_bank(3*work), STAT=alloc_err)
#endif
! Check for allocation errors
! Check for allocation errors
if (alloc_err /= 0) then
message = "Failed to allocate fission bank."
call fatal_error()