New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
do_loop_substitute.h90 in NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE – NEMO

source: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/do_loop_substitute.h90 @ 12341

Last change on this file since 12341 was 12341, checked in by acc, 2 years ago

Branch 2019/dev_r11943_MERGE_2019. Minor style changes to do_loop_substitute.h90

File size: 4.3 KB
Line 
1#ifdef show_comments
2! These comments are not intended to be retained during preprocessing; i.e. do not define "show_comments"
3!!----------------------------------------------------------------------
4!! NEMO/OCE 4.0 , NEMO Consortium (2018)
5!! Software governed by the CeCILL license (see ./LICENSE)
6!!----------------------------------------------------------------------
7! This header file contains preprocessor definitions and macros used in the do-loop substitutions introduced
8! between version 4.0 and 4.2. The primary aim of these macros is to assist in future applications of tiling
9! to improve performance. This is expected to be achieved by alternative versions of these macros in selected
10! locations. The initial introduction of these macros simply replaces all identifiable nested 2D- and 3D-loops
11! with single line statements (and adjusts indenting accordingly). Do loops are identifiable if they comform
12! to either:
13!                                       DO jk = ....
14!   DO jj = ....                           DO jj = ...
15!      DO ji = ....                           DO ji = ...
16!         .                   OR                 . 
17!         .                                      .
18!     END DO                                  END DO
19!   END DO                                 END DO
20!                                       END DO
21! and white-space variants thereof.
22!
23! Additionally, only loops with recognised jj and ji loops limits are treated; these are:
24! Lower limits of 1, 2 or fs_2
25! Upper limits of jpi, jpim1 or fs_jpim1 (for ji) or jpj, jpjm1 or fs_jpjm1 (for jj)
26!
27! The macro naming convention takes the form: DO_2D_BT_LR where:
28!   B is the Bottom offset from the PE's inner domain;
29!   T is the Top    offset from the PE's inner domain;
30!   L is the Left   offset from the PE's inner domain;
31!   R is the Right  offset from the PE's inner domain
32!
33! So, given an inner domain of 2,jpim1 and 2,jpjm1, a typical example would replace:
34!
35!   DO jj = 2, jpj
36!      DO ji = 1, jpim1
37!         .
38!         .
39!      END DO
40!   END DO
41!
42! with:
43!
44!   DO_2D_01_10
45!      .
46!      .
47!   END_2D
48!
49! similar conventions apply to the 3D loops macros. jk loop limits are retained through macro arguments and are not restricted. This
50! includes the possibility of strides for which an extra set of DO_3DS macros are defined.
51!
52! In the definitions below the inner PE domain is defined by start indices of (kIs, kJs) and end indices of (kIe, KJe)
53!
54#endif
55#define kIs     2
56#define kJs     2
57#define kIsm1   1
58#define kJsm1   1
59
60#define kIe     jpim1
61#define kJe     jpjm1
62#define kIep1   jpi
63#define kJep1   jpj
64
65#define DO_2D_00_00   DO jj = kJs, kJe   ;   DO ji = kIs, kIe
66#define DO_2D_00_01   DO jj = kJs, kJe   ;   DO ji = kIs, kIep1
67#define DO_2D_00_10   DO jj = kJs, kJe   ;   DO ji = kIsm1, kIe
68#define DO_2D_00_11   DO jj = kJs, kJe   ;   DO ji = kIsm1, kIep1
69 
70#define DO_2D_01_00   DO jj = kJs, kJep1   ;   DO ji = kIs, kIe
71#define DO_2D_01_01   DO jj = kJs, kJep1   ;   DO ji = kIs, kIep1
72#define DO_2D_01_10   DO jj = kJs, kJep1   ;   DO ji = kIsm1, kIe
73#define DO_2D_01_11   DO jj = kJs, kJep1   ;   DO ji = kIsm1, kIep1
74 
75#define DO_2D_10_00   DO jj = kJsm1, kJe   ;   DO ji = kIs, kIe
76#define DO_2D_10_10   DO jj = kJsm1, kJe   ;   DO ji = kIsm1, kIe
77#define DO_2D_10_11   DO jj = kJsm1, kJe   ;   DO ji = kIsm1, kIep1
78 
79#define DO_2D_11_00   DO jj = kJsm1, kJep1   ;   DO ji = kIs, kIe
80#define DO_2D_11_01   DO jj = kJsm1, kJep1   ;   DO ji = kIs, kIep1
81#define DO_2D_11_10   DO jj = kJsm1, kJep1   ;   DO ji = kIsm1, kIe
82#define DO_2D_11_11   DO jj = kJsm1, kJep1   ;   DO ji = kIsm1, kIep1
83
84
85#define DO_3D_00_00(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_00
86#define DO_3D_00_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_00_10
87 
88#define DO_3D_01_01(ks,ke)   DO jk = ks, ke   ;   DO_2D_01_01
89 
90#define DO_3D_10_00(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_00
91#define DO_3D_10_10(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_10
92#define DO_3D_10_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_10_11
93 
94#define DO_3D_11_11(ks,ke)   DO jk = ks, ke   ;   DO_2D_11_11
95
96#define DO_3DS_00_00(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_00_00
97#define DO_3DS_01_01(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_01_01
98#define DO_3DS_10_10(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_10_10
99#define DO_3DS_11_11(ks,ke,ki)   DO jk = ks, ke, ki   ;   DO_2D_11_11
100
101#define END_2D   END DO   ;   END DO
102#define END_3D   END DO   ;   END DO   ;   END DO
Note: See TracBrowser for help on using the repository browser.