[cig-commits] [commit] devel, master: new version of Paul Cristini's script (d6b2f9d)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Jun 18 15:22:35 PDT 2014


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

On branches: devel,master
Link       : https://github.com/geodynamics/specfem2d/compare/fc67e6fd7ad890705b2b72b4b3c509accb22249e...e9ca46c40131588d89d7b0883250bc6584ce6b4c

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

commit d6b2f9d25d02450404861c78d7c665d78161d047
Author: Dimitri Komatitsch <komatitsch at lma.cnrs-mrs.fr>
Date:   Sat Dec 15 16:01:26 2012 +0000

    new version of Paul Cristini's script


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

d6b2f9d25d02450404861c78d7c665d78161d047
 ...e_their_format_when_new_parameters_are_added.py | 33 +++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py b/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
index 294b4a2..a41e96e 100755
--- a/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
+++ b/process_DATA_Par_files_to_update_their_format_when_new_parameters_are_added.py
@@ -450,7 +450,7 @@ def ProcessParfile_r20859(fic):
 
     # Test if already processed
     for lig in ligs:
-        if lig.endswith('section 4.5 of the user manual)\n'):
+        if lig.endswith(' for how to do this)\n'):
             print '----> '+fic+' already processed to r20859'            
             return
     #--------------------------------------------------------------------------
@@ -471,6 +471,36 @@ def ProcessParfile_r20859(fic):
     print 'xxxxx------> '+fic+' processed to r20859'
     return
 #------------------------------------------------------------------------------
+def ProcessParfile_r21000(fic):
+    # define the release number
+    release_number='r21000'
+    # Open the file and get all lines from Par_file
+    ligs= LoadLig(fic)
+
+    # Test if already processed
+    for lig in ligs:
+        if lig.startswith('ROTATE'):
+            print '----> '+fic+' already processed to '+release_number          
+            return
+    #
+    a1='ROTATE_PML_ACTIVATE             = .false.\nROTATE_PML_ANGLE     '+ \
+       '           = 30.\n'
+    #--------------------------------------------------------------------------
+    # Add new parameters
+    # 
+    for ilg, lig in enumerate(ligs):
+        if lig.startswith('NELEM_PML_THICKNESS'):
+            ligs.insert(ilg+1,a1)
+    #
+    move(fic,fic+'.before_update_to_'+release_number)
+    #
+    fm = open(fic,'w')
+    fm.writelines(ligs)
+    fm.close()
+    #
+    print 'xxxxx------> '+fic+' processed to '+release_number
+    return   
+#------------------------------------------------------------------------------
 if __name__=='__main__':
     ## List of all files of current directory
     Fichiers=[]
@@ -496,6 +526,7 @@ if __name__=='__main__':
                     ProcessParfile_r20359(fic)
                     ProcessParfile_r20561(fic)
                     ProcessParfile_r20859(fic)
+                    ProcessParfile_r21000(fic)
                     print '~'*80
     #                
     print 'Number of Par_file analysed : ', Ct_Par_file



More information about the CIG-COMMITS mailing list