34 |
INTEGER myIter, myThid |
INTEGER myIter, myThid |
35 |
|
|
36 |
C === Functions == |
C === Functions == |
|
INTEGER ILNBLNK |
|
37 |
_RL FLT_MAP_K2R |
_RL FLT_MAP_K2R |
|
EXTERNAL ILNBLNK |
|
38 |
EXTERNAL FLT_MAP_K2R |
EXTERNAL FLT_MAP_K2R |
39 |
|
|
40 |
C == local variables == |
C == local variables == |
44 |
_RL ix, jy, i0x, j0y, xx, yy, zz |
_RL ix, jy, i0x, j0y, xx, yy, zz |
45 |
_RL uu, vv, tt, ss, pp |
_RL uu, vv, tt, ss, pp |
46 |
|
|
|
INTEGER ioUnit, irecord |
|
47 |
_RL tmp(imax) |
_RL tmp(imax) |
48 |
_RL npart_read,npart_times |
_RL npart_read,npart_times |
49 |
_RS dummyRS(1) |
_RS dummyRS(1) |
50 |
|
INTEGER fp, ioUnit, irecord |
51 |
CHARACTER*(MAX_LEN_FNAM) fn |
CHARACTER*(MAX_LEN_FNAM) fn |
52 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
|
CHARACTER*(80) dataFName |
|
|
INTEGER iG,jG,IL |
|
53 |
#ifdef ALLOW_EXCH2 |
#ifdef ALLOW_EXCH2 |
54 |
INTEGER nT |
INTEGER nT |
55 |
#endif |
#endif |
|
LOGICAL exst |
|
|
LOGICAL globalFile |
|
56 |
|
|
57 |
C == end of interface == |
C == end of interface == |
58 |
|
|
59 |
fn = 'float_trajectories' |
fn = 'float_trajectories' |
60 |
|
fp = writeBinaryPrec |
61 |
|
|
62 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
63 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
64 |
|
|
65 |
C (1) read actual number floats from file (if exists) |
C (1) read actual number floats from file (if exists) |
66 |
IL=ILNBLNK( fn ) |
ioUnit = -2 |
67 |
iG=bi+(myXGlobalLo-1)/sNx ! Kludge until unstructered tiles |
CALL MDS_READVEC_LOC( fn, fp, ioUnit, |
68 |
jG=bj+(myYGlobalLo-1)/sNy ! Kludge until unstructered tiles |
& 'RL', imax, tmp, dummyRS, |
69 |
WRITE(dataFname(1:80),'(2a,i3.3,a,i3.3,a)') |
& bi, bj, 1, myThid ) |
70 |
& fn(1:IL),'.',iG,'.',jG,'.data' |
IF ( ioUnit.GT. 0 ) THEN |
|
INQUIRE( file=dataFname, exist=exst ) |
|
|
IF (exst) THEN |
|
|
CALL FLT_MDSREADVECTOR(fn,globalFile,precFloat64,'RL', |
|
|
& imax,tmp,bi,bj,1,myThid) |
|
71 |
npart_read = tmp(1) |
npart_read = tmp(1) |
72 |
npart_times = tmp(5) |
npart_times = tmp(5) |
73 |
|
C- close the read-unit (safer to use a different unit for writing) |
74 |
|
CLOSE( ioUnit ) |
75 |
ELSE |
ELSE |
76 |
npart_read = 0. |
npart_read = 0. |
77 |
npart_times = 0. |
npart_times = 0. |
98 |
ENDDO |
ENDDO |
99 |
|
|
100 |
ioUnit = -1 |
ioUnit = -1 |
101 |
CALL MDS_WRITEVEC_LOC( fn, precFloat64, ioUnit, |
CALL MDS_WRITEVEC_LOC( fn, fp, ioUnit, |
102 |
& 'RL', imax, tmp, dummyRS, |
& 'RL', imax, tmp, dummyRS, |
103 |
& bi,bj,-1, myIter, myThid ) |
& bi,bj,-1, myIter, myThid ) |
104 |
|
|
168 |
C (3) WRITE float positions into file |
C (3) WRITE float positions into file |
169 |
irecord = npart_read+ip+1 |
irecord = npart_read+ip+1 |
170 |
IF ( ip.NE.npart_tile(bi,bj) ) irecord = -irecord |
IF ( ip.NE.npart_tile(bi,bj) ) irecord = -irecord |
171 |
CALL MDS_WRITEVEC_LOC( fn, precFloat64, ioUnit, |
CALL MDS_WRITEVEC_LOC( fn, fp, ioUnit, |
172 |
& 'RL', imax, tmp, dummyRS, |
& 'RL', imax, tmp, dummyRS, |
173 |
& bi,bj,irecord, myIter, myThid ) |
& bi,bj,irecord, myIter, myThid ) |
174 |
|
|