[cig-commits] [commit] devel, master: Remove unnecessary string trimming. (9fa2185)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Nov 6 08:20:26 PST 2014


Repository : https://github.com/geodynamics/specfem3d_globe

On branches: devel,master
Link       : https://github.com/geodynamics/specfem3d_globe/compare/bc58e579b3b0838a0968725a076f5904845437ca...be63f20cbb6f462104e949894dbe205d2398cd7f

>---------------------------------------------------------------

commit 9fa21857949f4876e86f75469c6e8b8413e072f8
Author: Elliott Sales de Andrade <esalesde at physics.utoronto.ca>
Date:   Sun Jun 1 02:54:41 2014 -0400

    Remove unnecessary string trimming.
    
    These strings are trimmed when extracted from the Par_file, so there's
    no need to do it again. What's worse in this case is the string is
    trimmed in a loop over all receivers.


>---------------------------------------------------------------

9fa21857949f4876e86f75469c6e8b8413e072f8
 src/specfem3D/write_seismograms.f90 | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/specfem3D/write_seismograms.f90 b/src/specfem3D/write_seismograms.f90
index 6825671..242c1d9 100644
--- a/src/specfem3D/write_seismograms.f90
+++ b/src/specfem3D/write_seismograms.f90
@@ -539,7 +539,6 @@ contains
   integer :: iorientation,isample
 
   character(len=4) :: chn
-  character(len=150) :: clean_LOCAL_PATH,final_LOCAL_PATH
   character(len=256) :: sisname
   character(len=2) :: bic
 
@@ -575,13 +574,7 @@ contains
 
       ! create the name of the seismogram file for each slice
       ! file name includes the name of the station, the network and the component
-      write(sisname,"(a,i6.6,'.',a,'.',a3,'.sem')") 'S',irec,'NT',chn
-
-      ! suppress white spaces if any
-      clean_LOCAL_PATH = adjustl(LOCAL_TMP_PATH)
-
-      ! create full final local path
-      final_LOCAL_PATH = clean_LOCAL_PATH(1:len_trim(clean_LOCAL_PATH)) // '/'
+      write(sisname,"(a2,i6.6,'.',a,'.',a3,'.sem')") '/S',irec,'NT',chn
 
       ! save seismograms in text format with no subsampling.
       ! Because we do not subsample the output, this can result in large files
@@ -590,11 +583,11 @@ contains
       ! the results with the source time function
       if(it <= NTSTEP_BETWEEN_OUTPUT_SEISMOS) then
         !open new file
-        open(unit=IOUT,file=final_LOCAL_PATH(1:len_trim(final_LOCAL_PATH))//sisname(1:len_trim(sisname)),&
+        open(unit=IOUT,file=LOCAL_TMP_PATH(1:len_trim(LOCAL_TMP_PATH))//sisname(1:len_trim(sisname)),&
               status='unknown',action='write')
       else if(it > NTSTEP_BETWEEN_OUTPUT_SEISMOS) then
         !append to existing file
-        open(unit=IOUT,file=final_LOCAL_PATH(1:len_trim(final_LOCAL_PATH))//sisname(1:len_trim(sisname)),&
+        open(unit=IOUT,file=LOCAL_TMP_PATH(1:len_trim(LOCAL_TMP_PATH))//sisname(1:len_trim(sisname)),&
               status='old',position='append',action='write')
       endif
       ! make sure we never write more than the maximum number of time steps



More information about the CIG-COMMITS mailing list