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

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

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


Revision 1.3 - (show annotations) (download)
Mon Jun 8 03:32:33 2009 UTC (14 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62p, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.2: +33 -19 lines
 - do tiled IO in 1 piece (all levels at a time)
 - multi-threaded: allow to read/write local (non-shared) array
   (was already working with singleCpuIO ; now works also without);
 - move barrier calls outside gather/scatter_2d to mds_read/write field

1 C $Header: /u/gcmpack/MITgcm/pkg/mdsio/mdsio_pass_r8tors.F,v 1.2 2009/06/01 14:20:31 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_R8toRS
14 C !INTERFACE:
15 SUBROUTINE MDS_PASS_R8toRS( buffer, arrFld, nNz, kLo, kSize,
16 I biArg, bjArg, copyTo, myThid )
17
18 C !DESCRIPTION:
19 C Transfert 3-D real*8 buffer to 3-D RS model 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 buffer (real*8) :: buffer 3-D array (Input/Output if copyTo=T/F)
33 C arrFld ( RS ) :: model 3-D tiled array (Output/Input if copyTo=T/F)
34 C nNz (integer):: Number of levels to - fill in / extract from - arrFld
35 C kLo (integer):: 1rst level to - fill in / extract from - arrFld
36 C kSize (integer):: third dimension of 3-D array "arrFld"
37 C biArg (integer):: tile X-index to - fill in / extract from - tiled buffer
38 C bjArg (integer):: tile Y-index to - fill in / extract from - tiled buffer
39 C copyTo (logical):: if =T, copy 2-D -> 3-D ; if =F: copy 2-D <- 3-D
40 C myThid (integer):: my Thread Id number
41 INTEGER nNz, kSize
42 Real*8 buffer(1:sNx,1:sNy,nNz,nSx,nSy)
43 _RS arrFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,kSize,nSx,nSy)
44 INTEGER kLo
45 INTEGER biArg
46 INTEGER bjArg
47 LOGICAL copyTo
48 INTEGER myThid
49
50 C !LOCAL VARIABLES:
51 C i,j,k :: loop indices
52 C bi,bj :: tile indices
53 INTEGER i,j,k,bi,bj
54 INTEGER kLev
55 CEOP
56
57 IF ( biArg.EQ.0 .AND. bjArg.EQ.0 ) THEN
58 IF ( copyTo ) THEN
59 DO bj = myByLo(myThid), myByHi(myThid)
60 DO bi = myBxLo(myThid), myBxHi(myThid)
61 DO k=1,nNz
62 kLev = kLo+k-1
63 DO j=1,sNy
64 DO i=1,sNx
65 arrFld(i,j,kLev,bi,bj) = buffer(i,j,k,bi,bj)
66 ENDDO
67 ENDDO
68 ENDDO
69 ENDDO
70 ENDDO
71 ELSE
72 DO bj = myByLo(myThid), myByHi(myThid)
73 DO bi = myBxLo(myThid), myBxHi(myThid)
74 DO k=1,nNz
75 kLev = kLo+k-1
76 DO j=1,sNy
77 DO i=1,sNx
78 buffer(i,j,k,bi,bj) = arrFld(i,j,kLev,bi,bj)
79 ENDDO
80 ENDDO
81 ENDDO
82 ENDDO
83 ENDDO
84 ENDIF
85 ELSEIF ( biArg.GE.1 .AND. biArg.LE.nSx
86 & .AND. bjArg.GE.1 .AND. bjArg.LE.nSy ) THEN
87 bi = biArg
88 bj = bjArg
89 IF ( copyTo ) THEN
90 DO k=1,nNz
91 kLev = kLo+k-1
92 DO j=1,sNy
93 DO i=1,sNx
94 arrFld(i,j,kLev,1,1) = buffer(i,j,k,bi,bj)
95 ENDDO
96 ENDDO
97 ENDDO
98 ELSE
99 DO k=1,nNz
100 kLev = kLo+k-1
101 DO j=1,sNy
102 DO i=1,sNx
103 buffer(i,j,k,bi,bj) = arrFld(i,j,kLev,1,1)
104 ENDDO
105 ENDDO
106 ENDDO
107 ENDIF
108 ELSE
109 STOP 'ABNORMAL END: MDS_PASS_R8toRS invalid bi,bj Arg'
110 ENDIF
111
112 RETURN
113 END

  ViewVC Help
Powered by ViewVC 1.1.22