1 |
C $Header: /u/gcmpack/MITgcm/eesupp/src/exch_cycle_ebl.F,v 1.3 2001/09/21 03:54:34 cnh Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_EEOPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: EXCH_CYCLE_EBL |
8 |
|
9 |
C !INTERFACE: |
10 |
SUBROUTINE EXCH_CYCLE_EBL( myThid ) |
11 |
IMPLICIT NONE |
12 |
|
13 |
C !DESCRIPTION: |
14 |
C *==========================================================* |
15 |
C | SUBROUTINE EXCH_CYCLE_EBL |
16 |
C | o Cycle exchange buffer level. |
17 |
C *==========================================================* |
18 |
C | Step the "exchange buffer level" to next value. |
19 |
C | The buffer level is used to prevent consecutive messages |
20 |
C | overwriting one another. Because we know that every tile |
21 |
C | will participate in an exchange we can be sure that every |
22 |
C | tile will cycle through the buffers with the same |
23 |
C | sequence. Also we know that a tile cannot start a new |
24 |
C | exchange before it has completed its end of the previous |
25 |
C | exchange. Thus by cycling through three buffer levels we |
26 |
C | can be sure that the buffer we write to will be free. |
27 |
C | That is by the time we are participating in the third |
28 |
C | exchange transaction we know that both ends of the first |
29 |
C | transaction must have completed. |
30 |
C | Note -- |
31 |
C | 1. We allow more than three levels below although this |
32 |
C | is not necessary. |
33 |
C *==========================================================* |
34 |
|
35 |
C !USES: |
36 |
C == Global data == |
37 |
#include "SIZE.h" |
38 |
#include "EEPARAMS.h" |
39 |
#include "EESUPPORT.h" |
40 |
#include "EXCH.h" |
41 |
|
42 |
C !INPUT PARAMETERS: |
43 |
C == Routine arguments == |
44 |
C myThid :: Thread number of this instance of the routine |
45 |
INTEGER myThid |
46 |
|
47 |
C !LOCAL VARIABLES: |
48 |
C == Local variables == |
49 |
C bi, bj :: Loop counters |
50 |
INTEGER bi, bj |
51 |
CEOP |
52 |
|
53 |
DO bj=myByLo(myThid),myByHi(myThid) |
54 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
55 |
C-- Use next level exchange buffer in cycle. |
56 |
exchangeBufLevel(1,bi,bj) = exchangeBufLevel(1,bi,bj)+1 |
57 |
IF ( exchangeBufLevel(1,bi,bj) .GT. NUMBER_OF_BUFFER_LEVELS ) |
58 |
& exchangeBufLevel(1,bi,bj) = 1 |
59 |
ENDDO |
60 |
ENDDO |
61 |
|
62 |
RETURN |
63 |
END |