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