Changes between Version 14 and Version 15 of 2019WP/KERNEL-02_Storkey_Coward_IMMERSE_first_steps
- Timestamp:
- 2019-03-04T16:10:39+01:00 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
2019WP/KERNEL-02_Storkey_Coward_IMMERSE_first_steps
v14 v15 89 89 Perl is used in a 'edit in place' mode so the original files will be overwritten. Step 1 is therefore to create copies of the test files: 90 90 91 {{{ 91 {{{#!bash 92 92 #!/bin/bash 93 93 mkdir TEST_FILES … … 98 98 '''The refactoring script''' 99 99 100 {{{ 100 {{{#!bash 101 101 #!/bin/bash 102 102 # … … 123 123 '''The refactoring script explained''' 124 124 125 {{{ 125 {{{#!bash 126 126 # Some bash arrays to list the old names, new names and associated time-level index. 127 127 # The choice of names here is not meant to reflect a desired choice. Note all three arrays … … 183 183 ''' Some contrived tests:''' 184 184 185 {{{ 186 cat TEST_FILES_ORG/contrived_tests.F90185 {{{#!f 186 !cat TEST_FILES_ORG/contrived_tests.F90 187 187 un(:,:,:) ! The simplest test. Should ==> uu(:,:,:,jtn) 188 188 un ( ji , jj, : ) ! Check alternative simple case ==> uu ( ji , jj, :,jtn) … … 203 203 '''Result of the script on the contrived tests:''' 204 204 205 {{{ 205 {{{#!f 206 206 uu(:,:,:,Nii) ! The simplest test. Should ==> uu(:,:,:,jtn) 207 207 uu ( ji , jj, : ,Nii) ! Check alternative simple case ==> uu ( ji , jj, :,jtn) … … 566 566 567 567 Here is a almost complete attempt at automating the loop changes. Earlier versions (now superceded) maintained the DO loop ranges as arguments to the macros. These arguments are now interptreted and converted to the binary representative form suggested by Gurvan. The logic for this is basic at present and possibly easily fooled (but works on the examples used so far). I've persisted with a two-stage conversion with a script to convert 2D loops and then a second script to convert 3D loops. This makes the scripts readable and allows easier verification. The two scripts are named `do2dfinder.pl` and `do3dfinder.pl` and are included below. Firstly here is an example of the scripts in action on the following test file: 568 {{{ 568 {{{#!f 569 569 cat TESTDO_FILES/testdo.F90 570 570 ! some random text … … 985 985 }}} 986 986 And finally the two scripts that achieve this. Note the logic that may need tightening at sections 5 and 6 in the first script: 987 {{{ 988 cat do2dfinder.pl987 {{{#!perl 988 #cat do2dfinder.pl 989 989 # 990 990 open(F,$ARGV[0]) || die "Cannot open $ARGV[0]: $!"; … … 1109 1109 }}} 1110 1110 and 1111 {{{ 1112 cat do3dfinder.pl1111 {{{#!perl 1112 #cat do3dfinder.pl 1113 1113 # 1114 1114 use IO::Scalar;