[cig-commits] [commit] devel: Clean version of convolve_source_timefunction.csh (7859081)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Oct 31 07:37:44 PDT 2014


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

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/73f4ef636194629ed7db93c7a3f78f24615ea1be...7859081e0f292b938ab02b77e397e2458df03601

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

commit 7859081e0f292b938ab02b77e397e2458df03601
Author: Alexis Bottero <alexis.bottero at gmail.com>
Date:   Fri Oct 31 14:42:29 2014 +0100

    Clean version of convolve_source_timefunction.csh


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

7859081e0f292b938ab02b77e397e2458df03601
 utils/convolve_source_timefunction.csh | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/utils/convolve_source_timefunction.csh b/utils/convolve_source_timefunction.csh
index b070014..905aa14 100755
--- a/utils/convolve_source_timefunction.csh
+++ b/utils/convolve_source_timefunction.csh
@@ -1,25 +1,23 @@
 #!/bin/csh
 
-# we mimic a triangle of half duration equal to half_duration_triangle
-# using a Gaussian having a very close shape, as explained in Figure 4.2
+# We mimic a triangle of half duration equal to half_duration_triangle
+# using a Gaussian having a very close shape, as explained in Figure 5.2
 # of the manual
 
-set half_duration_triangle = 11.2
+set half_duration_triangle = 11.2  # TODO : It shall be better to send this to the script with an option. Ex : ./convolve_source_timefunction fileToConvolve --hdur 11.2
+set SPECFEM_PATH = "~/specfem3d/"  # Path to your specfem3d/ directory. TODO Could also be send as an (optional) option --path_to_specfem
+set use_triangle_source = ".false" # Use .true. for a triangle and .false. for a Gaussian. TODO Idem --use_triangle_source
 
-foreach file ( $* )
+########### DO NOT CHANGE ANYTHING BELOW ###########
 
-set nlines = `wc -l $file `
-echo $nlines > input_convolve_code.txt
-echo $half_duration_triangle >> input_convolve_code.txt
-# use .true. for a triangle and .false. for a Gaussian
-#echo ".true." >> input_convolve_code.txt
-echo ".false." >> input_convolve_code.txt
+foreach file ( $* ) # Loop on all files (and directories) given in argument
  
-echo convolving $file with half_duration_triangle = $half_duration_triangle using lines $nlines 
-
-./xconvolve_source_timefunction < $file > ${file}.convolved
-
-rm input_convolve_code.txt
-
-end
+  set nlines = `wc -l $file`                              # nlines is the number of lines in the file considered
+  echo $nlines > input_convolve_code.txt                  # Create a new temp file input_convolve_code.txt (or recreate it if it exists) and write nlines on it 
+  echo $half_duration_triangle >> input_convolve_code.txt # Write half_duration_triangle after that...
+  echo $use_triangle_source >> input_convolve_code.txt    #  ... and write .true. or false at the end depending on the source chosen 
+  echo convolving $file with half_duration_triangle = $half_duration_triangle using lines $nlines # A small print
+  $SPECFEM_PATH/bin/xconvolve_source_timefunction < $file > ${file}.convolved                     # Execute xconvolve_source_timefunction with argument $file and write the output on ${file}.convolved
+  rm input_convolve_code.txt                              # Remove the temp file input_convolve_code.txt
 
+end # End of the loop



More information about the CIG-COMMITS mailing list