/[MITgcm]/MITgcm/pkg/mdsio/mdsio_pass_r4torl.F
ViewVC logotype

Contents of /MITgcm/pkg/mdsio/mdsio_pass_r4torl.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Mon Jun 1 14:20:31 2009 UTC (14 years, 11 months ago) by jmc
Branch: MAIN
Changes since 1.1: +44 -17 lines
read/write tiled (local) files: read/write 1-level tile chunk at a time
 (instead of segment of length sNx); expected to speed up tiled IO.

1 C $Header: /u/gcmpack/MITgcm/pkg/mdsio/mdsio_pass_r4torl.F,v 1.1 2009/05/11 02:20:49 jmc 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_R4toRL
14 C !INTERFACE:
15 SUBROUTINE MDS_PASS_R4toRL( local, arr, k, nNz,
16 I biArg, bjArg, copyTo, myThid )
17
18 C !DESCRIPTION:
19 C Transfert 2-D real*4 array to 3-D RL array, or the reverse,
20 C depending on "copyTo" value. Apply transfert to tile biArg,bjArg
21 C only or to all myThid tiles if called with biArg=bjArg=0.
22
23 C !USES:
24 IMPLICIT NONE
25
26 C Global variables / common blocks
27 #include "EEPARAMS.h"
28 #include "SIZE.h"
29
30 C !INPUT/OUTPUT PARAMETERS:
31 C Routine arguments
32 C local (real*4) :: local 2-D array (Input/Output if copyTo=T/F)
33 C arr ( RL ) :: model 3-D tiled array (Output/Input if copyTo=T/F)
34 C k (integer):: level index to - fill in / extract from - 3-D array
35 C nNz (integer):: size of third dimension of 3-D array "arr"
36 C biArg (integer):: tile X-index to - fill in / extract from - tiled array
37 C bjArg (integer):: tile Y-index to - fill in / extract from - tiled array
38 C copyTo (logical):: if =T, copy 2-D -> 3-D ; if =F: copy 2-D <- 3-D
39 C myThid (integer):: my Thread Id number
40 INTEGER nNz
41 Real*4 local(1:sNx,1:sNy,nSx,nSy)
42 _RL arr (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nNz,nSx,nSy)
43 INTEGER k
44 INTEGER biArg
45 INTEGER bjArg
46 LOGICAL copyTo
47 INTEGER myThid
48
49 C !LOCAL VARIABLES:
50 C i,j :: loop indices
51 C bi,bj :: tile indices
52 INTEGER i,j,bi,bj
53 CEOP
54
55 IF ( biArg.EQ.0 .AND. bjArg.EQ.0 ) THEN
56 IF ( copyTo ) THEN
57 DO bj = myByLo(myThid), myByHi(myThid)
58 DO bi = myBxLo(myThid), myBxHi(myThid)
59 DO j=1,sNy
60 DO i=1,sNx
61 arr(i,j,k,bi,bj) = local(i,j,bi,bj)
62 ENDDO
63 ENDDO
64 ENDDO
65 ENDDO
66 ELSE
67 DO bj = myByLo(myThid), myByHi(myThid)
68 DO bi = myBxLo(myThid), myBxHi(myThid)
69 DO j=1,sNy
70 DO i=1,sNx
71 local(i,j,bi,bj) = arr(i,j,k,bi,bj)
72 ENDDO
73 ENDDO
74 ENDDO
75 ENDDO
76 ENDIF
77 ELSEIF ( biArg.GE.1 .AND. biArg.LE.nSx
78 & .AND. bjArg.GE.1 .AND. bjArg.LE.nSy ) THEN
79 bi = biArg
80 bj = bjArg
81 IF ( copyTo ) THEN
82 DO j=1,sNy
83 DO i=1,sNx
84 arr(i,j,k,bi,bj) = local(i,j,1,1)
85 ENDDO
86 ENDDO
87 ELSE
88 DO j=1,sNy
89 DO i=1,sNx
90 local(i,j,1,1) = arr(i,j,k,bi,bj)
91 ENDDO
92 ENDDO
93 ENDIF
94 ELSE
95 STOP 'ABNORMAL END: MDS_PASS_R4toRL invalid bi,bj Arg'
96 ENDIF
97
98 RETURN
99 END

  ViewVC Help
Powered by ViewVC 1.1.22