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