1 |
jmc |
1.1 |
C $Header: /u/gcmpack/MITgcm/pkg/mdsio/mdsio_passtorl.F,v 1.2 2007/07/19 15:34:50 dimitri Exp $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "MDSIO_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
7 |
|
|
C- modification: no need to edit the 4 scr files mdsio_pass_r{4,8}tor{l,s}.F : |
8 |
|
|
C from the 1rst src file (mdsio_pass_r4torl.F), can update the 3 others |
9 |
|
|
C using the script "derive_other_types". |
10 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
11 |
|
|
|
12 |
|
|
CBOP |
13 |
|
|
C !ROUTINE: MDS_PASS_R4toRS |
14 |
|
|
C !INTERFACE: |
15 |
|
|
SUBROUTINE MDS_PASS_R4toRS(local,arr,k,nNz,copyTo,myThid) |
16 |
|
|
|
17 |
|
|
C !DESCRIPTION: |
18 |
|
|
C Transfert 2-D real*4 array to 3-D RS array, |
19 |
|
|
C or the reverse, depending on "copyTo" value. |
20 |
|
|
|
21 |
|
|
C !USES: |
22 |
|
|
IMPLICIT NONE |
23 |
|
|
|
24 |
|
|
C Global variables / common blocks |
25 |
|
|
#include "EEPARAMS.h" |
26 |
|
|
#include "SIZE.h" |
27 |
|
|
|
28 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
29 |
|
|
C Routine arguments |
30 |
|
|
C local (real*4) :: local 2-D array (Input/Output if copyTo=T/F) |
31 |
|
|
C arr ( RS ) :: model 3-D tiled array (Output/Input if copyTo=T/F) |
32 |
|
|
C k (integer):: level index to fill in / to extract from 3-D array |
33 |
|
|
C nNz (integer):: size of third dimension of 3-D array "arr" |
34 |
|
|
C copyTo (logical):: if =T, copy 2-D -> 3-D ; if =F: copy 2-D <- 3-D |
35 |
|
|
C myThid (integer):: my Thread Id number |
36 |
|
|
INTEGER nNz |
37 |
|
|
Real*4 local(1:sNx,1:sNy,nSx,nSy) |
38 |
|
|
_RS arr (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nNz,nSx,nSy) |
39 |
|
|
INTEGER k |
40 |
|
|
LOGICAL copyTo |
41 |
|
|
INTEGER myThid |
42 |
|
|
|
43 |
|
|
C !LOCAL VARIABLES: |
44 |
|
|
C i,j :: loop indices |
45 |
|
|
C bi,bj :: tile indices |
46 |
|
|
INTEGER i,j,bi,bj |
47 |
|
|
CEOP |
48 |
|
|
|
49 |
|
|
IF ( copyTo ) THEN |
50 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
51 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
52 |
|
|
DO j=1,sNy |
53 |
|
|
DO i=1,sNx |
54 |
|
|
arr(i,j,k,bi,bj) = local(i,j,bi,bj) |
55 |
|
|
ENDDO |
56 |
|
|
ENDDO |
57 |
|
|
ENDDO |
58 |
|
|
ENDDO |
59 |
|
|
ELSE |
60 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
61 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
62 |
|
|
DO j=1,sNy |
63 |
|
|
DO i=1,sNx |
64 |
|
|
local(i,j,bi,bj) = arr(i,j,k,bi,bj) |
65 |
|
|
ENDDO |
66 |
|
|
ENDDO |
67 |
|
|
ENDDO |
68 |
|
|
ENDDO |
69 |
|
|
ENDIF |
70 |
|
|
|
71 |
|
|
RETURN |
72 |
|
|
END |