Skip to content

Commit

Permalink
fix: Strip leading and trailing spaces from the output file name
Browse files Browse the repository at this point in the history
  • Loading branch information
abensonca committed Sep 22, 2024
1 parent 66b058d commit cf510cd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions source/output.HDF5.open.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ subroutine Output_HDF5_Open_File(parameters)
use :: HDF5_Access , only : hdf5Access
use :: IO_HDF5 , only : IO_HDF5_Set_Defaults
use :: ISO_Varying_String, only : var_str , char , operator(//) , extract , &
& len , operator(==)
& len , operator(==) , adjustl , trim
use :: Input_Parameters , only : inputParameters , inputParameter
#ifdef USEMPI
use :: MPI_Utilities , only : mpiSelf
Expand All @@ -67,6 +67,7 @@ subroutine Output_HDF5_Open_File(parameters)
integer(hsize_t ) :: chunkSize
integer :: sieveBufferSize
integer(size_t ) :: cacheElementsCount, cacheSizeBytes
type (varying_string ) :: outputFileName_ , outputScratchFileName_
#ifdef USEMPI
type (varying_string ) :: fileNamePrefix
#endif
Expand All @@ -75,13 +76,15 @@ subroutine Output_HDF5_Open_File(parameters)
!![
<inputParameter>
<name>outputFileName</name>
<variable>outputFileName_</variable>
<defaultValue>var_str('galacticus.hdf5')</defaultValue>
<description>The name of the file to which \glc\ results will be written.</description>
<source>parameters</source>
</inputParameter>
<inputParameter>
<name>outputScratchFileName</name>
<defaultValue>outputFileName</defaultValue>
<variable>outputScratchFileName_</variable>
<defaultValue>outputFileName_</defaultValue>
<description>The name of the file to which \glc\ results will be written temporarily during runs.</description>
<source>parameters</source>
</inputParameter>
Expand Down Expand Up @@ -120,6 +123,9 @@ subroutine Output_HDF5_Open_File(parameters)
</inputParameter>
!!]
hdf5CacheSizeBytes=cacheSizeBytes
! Remove leadimg and trailing spaces.
outputFileName =trim(adjustl(outputFileName_ ))
outputScratchFileName=trim(adjustl(outputScratchFileName_))
! Modify the file name on a per-process basis if running under MPI.
#ifdef USEMPI
if (extract(outputFileName ,len(outputFileName )-4,len(outputFileName )) == ".hdf5") then
Expand Down

0 comments on commit cf510cd

Please sign in to comment.