1 |
C$Header: /u/u0/gcmpack/MITgcm_contrib/high_res_cube/code-mods/exch2_get_send_bounds.F,v 1.1.1.1 2003/11/11 18:08:07 cnh Exp $ |
2 |
|
3 |
SUBROUTINE EXCH2_GET_SEND_BOUNDS( |
4 |
I fCode, eWdth, |
5 |
O tiStride, tjStride, |
6 |
U tIlo, tIhi, tJlo, tJhi ) |
7 |
C |
8 |
IMPLICIT NONE |
9 |
C |
10 |
CHARACTER*2 fCode |
11 |
INTEGER eWdth |
12 |
INTEGER tiStride, tjStride |
13 |
INTEGER tIlo, tIhi, tJlo, tJhi |
14 |
C |
15 |
IF ( tIlo .EQ. tIhi .AND. tIlo .EQ. 0 ) THEN |
16 |
C Sending to a west edge |
17 |
tIlo=1-eWdth |
18 |
tIhi=0 |
19 |
tistride=1 |
20 |
IF ( tJlo .LE. tJhi ) THEN |
21 |
tJlo=tJlo-eWdth+1 |
22 |
tJhi=tJhi+eWdth-1 |
23 |
tjstride=1 |
24 |
ELSE |
25 |
tJlo=tJlo+eWdth-1 |
26 |
tJhi=tJhi-eWdth+1 |
27 |
tjstride=-1 |
28 |
ENDIF |
29 |
ENDIF |
30 |
IF ( tIlo .EQ. tIhi .AND. tIlo .GT. 1 ) THEN |
31 |
C Sending to an east edge |
32 |
tIhi=tIhi+eWdth-1 |
33 |
tistride=1 |
34 |
IF ( tJlo .LE. tJhi ) THEN |
35 |
tJlo=tJlo-eWdth+1 |
36 |
tJhi=tJhi+eWdth-1 |
37 |
tjstride=1 |
38 |
ELSE |
39 |
tJlo=tJlo+eWdth-1 |
40 |
tJhi=tJhi-eWdth+1 |
41 |
tjstride=-1 |
42 |
ENDIF |
43 |
ENDIF |
44 |
IF ( tJlo .EQ. tJhi .AND. tJlo .EQ. 0 ) THEN |
45 |
C Sending to a south edge |
46 |
tJlo=1-eWdth |
47 |
tJhi=0 |
48 |
tjstride=1 |
49 |
IF ( tIlo .LE. tIhi ) THEN |
50 |
tIlo=tIlo-eWdth+1 |
51 |
tIhi=tIhi+eWdth-1 |
52 |
tistride=1 |
53 |
ELSE |
54 |
tIlo=tIlo+eWdth-1 |
55 |
tIhi=tIhi-eWdth+1 |
56 |
tistride=-1 |
57 |
ENDIF |
58 |
ENDIF |
59 |
IF ( tJlo .EQ. tJhi .AND. tJlo .GT. 1 ) THEN |
60 |
C Sending to an north edge |
61 |
tJhi=tJhi+eWdth-1 |
62 |
tjstride=1 |
63 |
IF ( tIlo .LE. tIhi ) THEN |
64 |
tIlo=tIlo-eWdth+1 |
65 |
tIhi=tIhi+eWdth-1 |
66 |
tistride=1 |
67 |
ELSE |
68 |
tIlo=tIlo+eWdth-1 |
69 |
tIhi=tIhi-eWdth+1 |
70 |
tistride=-1 |
71 |
ENDIF |
72 |
ENDIF |
73 |
|
74 |
RETURN |
75 |
END |