Index: NEMO/branches/2020/r12377_ticket2386/src/OCE/do_loop_substitute.h90
===================================================================
--- NEMO/branches/2020/r12377_ticket2386/src/OCE/do_loop_substitute.h90	(revision 12451)
+++ NEMO/branches/2020/r12377_ticket2386/src/OCE/do_loop_substitute.h90	(revision 13540)
@@ -8,6 +8,6 @@
 ! between version 4.0 and 4.2. The primary aim of these macros is to assist in future applications of tiling
 ! to improve performance. This is expected to be achieved by alternative versions of these macros in selected
-! locations. The initial introduction of these macros simply replaces all identifiable nested 2D- and 3D-loops
-! with single line statements (and adjusts indenting accordingly). Do loops are identifiable if they comform
+! locations. The initial introduction of these macros simply replaced all identifiable nested 2D- and 3D-loops
+! with single line statements (and adjusts indenting accordingly). Do loops were identifiable if they comformed
 ! to either:
 !                                       DO jk = ....
@@ -21,9 +21,9 @@
 ! and white-space variants thereof.
 !
-! Additionally, only loops with recognised jj and ji loops limits are treated; these are:
+! Additionally, only loops with recognised jj and ji loops limits were treated; these were:
 ! Lower limits of 1, 2 or fs_2
 ! Upper limits of jpi, jpim1 or fs_jpim1 (for ji) or jpj, jpjm1 or fs_jpjm1 (for jj)
 !
-! The macro naming convention takes the form: DO_2D_BT_LR where: 
+! The macro naming convention takes the form: DO_2D( B, T, L, R) where: 
 !   B is the Bottom offset from the PE's inner domain;
 !   T is the Top    offset from the PE's inner domain;
@@ -42,61 +42,26 @@
 ! with:
 !
-!   DO_2D_01_10
+!   DO_2D( 0, 1, 1, 0 )
 !      .
 !      .
 !   END_2D
 ! 
-! similar conventions apply to the 3D loops macros. jk loop limits are retained through macro arguments and are not restricted. This
-! includes the possibility of strides for which an extra set of DO_3DS macros are defined.
+! similar conventions apply to the 3D loops macros. jk loop limits are retained through macro arguments 
+! and are not restricted. This includes the possibility of strides for which an extra set of DO_3DS 
+! macros are defined.
 !
-! In the following definitions the inner PE domain is defined by start indices of (___kIs_, __kJs_) and end indices of (__kIe_, __kJe_)
-! The following macros are defined just below: ___kIs_, __kJs_, ___kIsm1_, __kJsm1_, ___kIe_, __kJe_, ___kIep1_, __kJep1_. 
-! These names are chosen to, hopefully, avoid any future, unintended matches elsewhere in the code.
+! In the following definitions the inner PE domain is defined by start indices of (Nis0, Njs0) and end 
+! indices of (Nie0, Nje0) where:
 !
+! Nis0 =   1 + nn_hls     Njs0 =   1 + nn_hls
+! Nie0 = jpi - nn_hls     Nje0 = jpj - nn_hls
+! 
 #endif
-#define __kIs_     2
-#define __kJs_     2
-#define __kIsm1_   1
-#define __kJsm1_   1
 
-#define __kIe_     jpim1
-#define __kJe_     jpjm1
-#define __kIep1_   jpi
-#define __kJep1_   jpj
+#define DO_2D(B, T, L, R) DO jj = Njs0-(B), Nje0+(T)   ;   DO ji = Nis0-(L), Nie0+(R)
 
-#define DO_2D_00_00   DO jj = __kJs_, __kJe_   ;   DO ji = __kIs_, __kIe_
-#define DO_2D_00_01   DO jj = __kJs_, __kJe_   ;   DO ji = __kIs_, __kIep1_
-#define DO_2D_00_10   DO jj = __kJs_, __kJe_   ;   DO ji = __kIsm1_, __kIe_
-#define DO_2D_00_11   DO jj = __kJs_, __kJe_   ;   DO ji = __kIsm1_, __kIep1_
- 
-#define DO_2D_01_00   DO jj = __kJs_, __kJep1_   ;   DO ji = __kIs_, __kIe_
-#define DO_2D_01_01   DO jj = __kJs_, __kJep1_   ;   DO ji = __kIs_, __kIep1_
-#define DO_2D_01_10   DO jj = __kJs_, __kJep1_   ;   DO ji = __kIsm1_, __kIe_
-#define DO_2D_01_11   DO jj = __kJs_, __kJep1_   ;   DO ji = __kIsm1_, __kIep1_
- 
-#define DO_2D_10_00   DO jj = __kJsm1_, __kJe_   ;   DO ji = __kIs_, __kIe_
-#define DO_2D_10_10   DO jj = __kJsm1_, __kJe_   ;   DO ji = __kIsm1_, __kIe_
-#define DO_2D_10_11   DO jj = __kJsm1_, __kJe_   ;   DO ji = __kIsm1_, __kIep1_
- 
-#define DO_2D_11_00   DO jj = __kJsm1_, __kJep1_   ;   DO ji = __kIs_, __kIe_
-#define DO_2D_11_01   DO jj = __kJsm1_, __kJep1_   ;   DO ji = __kIs_, __kIep1_
-#define DO_2D_11_10   DO jj = __kJsm1_, __kJep1_   ;   DO ji = __kIsm1_, __kIe_
-#define DO_2D_11_11   DO jj = __kJsm1_, __kJep1_   ;   DO ji = __kIsm1_, __kIep1_
+#define DO_3D(B, T, L, R, ks, ke) DO jk = ks, ke   ;   DO_2D(B, T, L, R)
 
-#define DO_3D_00_00(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_00
-#define DO_3D_00_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_10
- 
-#define DO_3D_01_01(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_01
- 
-#define DO_3D_10_00(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_00
-#define DO_3D_10_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_10
-#define DO_3D_10_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_11
- 
-#define DO_3D_11_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_11
-
-#define DO_3DS_00_00(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_00
-#define DO_3DS_01_01(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_01
-#define DO_3DS_10_10(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_10
-#define DO_3DS_11_11(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_11
+#define DO_3DS(B, T, L, R, ks, ke, ki) DO jk = ks, ke, ki   ;   DO_2D(B, T, L, R)
 
 #define END_2D   END DO   ;   END DO
