Skip to content

Commit

Permalink
Don't use PWD environment variable when setting path to input files. C…
Browse files Browse the repository at this point in the history
…loses openmc-dev#302

on github.
  • Loading branch information
paulromano committed Aug 6, 2014
1 parent 2e60c0e commit 3e0870a
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/initialize.F90
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ subroutine initialize_mpi()
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)

Expand Down Expand Up @@ -308,13 +308,9 @@ subroutine read_command_line()
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()

Expand Down Expand Up @@ -414,7 +410,7 @@ subroutine read_command_line()
! 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
Expand Down Expand Up @@ -454,16 +450,12 @@ subroutine read_command_line()
! 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

Expand Down Expand Up @@ -563,7 +555,7 @@ subroutine adjust_indices()
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()
Expand Down Expand Up @@ -634,7 +626,7 @@ subroutine adjust_indices()
" 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."
Expand Down Expand Up @@ -805,7 +797,7 @@ subroutine normalize_ao()
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

Expand Down Expand Up @@ -866,7 +858,7 @@ subroutine allocate_banks()
! 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()
Expand Down Expand Up @@ -894,7 +886,7 @@ subroutine allocate_banks()
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()
Expand Down

0 comments on commit 3e0870a

Please sign in to comment.