54 |
integer ILNBLNK |
integer ILNBLNK |
55 |
integer MDS_RECLEN |
integer MDS_RECLEN |
56 |
C Local variables |
C Local variables |
57 |
character*(80) dataFName |
character*(128) dataFName,pfName |
58 |
integer iG,jG,irec,dUnit,IL |
integer iG,jG,irec,dUnit,IL,pIL |
59 |
logical exst |
logical exst |
60 |
logical globalFile,fileIsOpen |
logical globalFile,fileIsOpen |
61 |
integer length_of_rec |
integer length_of_rec |
80 |
C Assume nothing |
C Assume nothing |
81 |
globalFile = .FALSE. |
globalFile = .FALSE. |
82 |
fileIsOpen = .FALSE. |
fileIsOpen = .FALSE. |
83 |
IL=ILNBLNK( fName ) |
IL = ILNBLNK( fName ) |
84 |
|
pIL = ILNBLNK( mdsioLocalDir ) |
85 |
|
|
86 |
|
C Assign special directory |
87 |
|
if ( mdsioLocalDir .NE. ' ' ) then |
88 |
|
write(pFname(1:128),'(2a)') |
89 |
|
& mdsioLocalDir(1:pIL), fName(1:IL) |
90 |
|
else |
91 |
|
pFname= fName |
92 |
|
endif |
93 |
|
pIL=ILNBLNK( pfName ) |
94 |
|
|
95 |
C Assign a free unit number as the I/O channel for this routine |
C Assign a free unit number as the I/O channel for this routine |
96 |
call MDSFINDUNIT( dUnit, mythid ) |
call MDSFINDUNIT( dUnit, mythid ) |
99 |
dataFName = fName |
dataFName = fName |
100 |
inquire( file=dataFname, exist=exst ) |
inquire( file=dataFname, exist=exst ) |
101 |
if (exst) then |
if (exst) then |
102 |
write(msgbuf,'(a,a)') |
if ( debugLevel .GE. debLevB ) then |
103 |
|
write(msgbuf,'(a,a)') |
104 |
& ' MDSREADVECTOR: opening global file: ',dataFName |
& ' MDSREADVECTOR: opening global file: ',dataFName |
105 |
call print_message( msgbuf, standardmessageunit, |
call print_message( msgbuf, standardmessageunit, |
106 |
& SQUEEZE_RIGHT , mythid) |
& SQUEEZE_RIGHT , mythid) |
107 |
|
endif |
108 |
globalFile = .TRUE. |
globalFile = .TRUE. |
109 |
endif |
endif |
110 |
|
|
111 |
C If negative check for global file with MDS name (ie. fName.data) |
C If negative check for global file with MDS name (ie. fName.data) |
112 |
if (.NOT. globalFile) then |
if (.NOT. globalFile) then |
113 |
write(dataFname(1:80),'(2a)') fName(1:IL),'.data' |
write(dataFname(1:128),'(2a)') fName(1:IL),'.data' |
114 |
inquire( file=dataFname, exist=exst ) |
inquire( file=dataFname, exist=exst ) |
115 |
if (exst) then |
if (exst) then |
116 |
|
if ( debugLevel .GE. debLevB ) then |
117 |
write(msgbuf,'(a,a)') |
write(msgbuf,'(a,a)') |
118 |
& ' MDSREADVECTOR: opening global file: ',dataFName |
& ' MDSREADVECTOR: opening global file: ',dataFName |
119 |
call print_message( msgbuf, standardmessageunit, |
call print_message( msgbuf, standardmessageunit, |
120 |
& SQUEEZE_RIGHT , mythid) |
& SQUEEZE_RIGHT , mythid) |
121 |
|
endif |
122 |
globalFile = .TRUE. |
globalFile = .TRUE. |
123 |
endif |
endif |
124 |
endif |
endif |
138 |
if (.NOT. globalFile) then |
if (.NOT. globalFile) then |
139 |
iG=bi+(myXGlobalLo-1)/sNx ! Kludge until unstructered tiles |
iG=bi+(myXGlobalLo-1)/sNx ! Kludge until unstructered tiles |
140 |
jG=bj+(myYGlobalLo-1)/sNy ! Kludge until unstructered tiles |
jG=bj+(myYGlobalLo-1)/sNy ! Kludge until unstructered tiles |
141 |
write(dataFname(1:80),'(2a,i3.3,a,i3.3,a)') |
write(dataFname(1:128),'(2a,i3.3,a,i3.3,a)') |
142 |
& fName(1:IL),'.',iG,'.',jG,'.data' |
& pfName(1:pIL),'.',iG,'.',jG,'.data' |
143 |
inquire( file=dataFname, exist=exst ) |
inquire( file=dataFname, exist=exst ) |
144 |
C Of course, we only open the file if the tile is "active" |
C Of course, we only open the file if the tile is "active" |
145 |
C (This is a place-holder for the active/passive mechanism) |
C (This is a place-holder for the active/passive mechanism) |
146 |
if (exst) then |
if (exst) then |
147 |
write(msgbuf,'(a,a)') |
if ( debugLevel .GE. debLevB ) then |
148 |
|
write(msgbuf,'(a,a)') |
149 |
& ' MDSREADVECTOR: opening file: ',dataFName |
& ' MDSREADVECTOR: opening file: ',dataFName |
150 |
call print_message( msgbuf, standardmessageunit, |
call print_message( msgbuf, standardmessageunit, |
151 |
& SQUEEZE_RIGHT , mythid) |
& SQUEEZE_RIGHT , mythid) |
152 |
|
endif |
153 |
length_of_rec=MDS_RECLEN( filePrec, narr, mythid ) |
length_of_rec=MDS_RECLEN( filePrec, narr, mythid ) |
154 |
open( dUnit, file=dataFName, status='old', |
open( dUnit, file=dataFName, status='old', |
155 |
& access='direct', recl=length_of_rec ) |
& access='direct', recl=length_of_rec ) |
156 |
fileIsOpen=.TRUE. |
fileIsOpen=.TRUE. |
157 |
else |
else |
158 |
fileIsOpen=.FALSE. |
fileIsOpen=.FALSE. |
159 |
write(msgbuf,'(a,a)') |
write(msgbuf,'(3a)') |
160 |
& ' MDSREADVECTOR: opening file: ',dataFName |
& ' MDSREADVECTOR: opening file: ',dataFName,pfName |
161 |
call print_message( msgbuf, standardmessageunit, |
call print_message( msgbuf, standardmessageunit, |
162 |
& SQUEEZE_RIGHT , mythid) |
& SQUEEZE_RIGHT , mythid) |
163 |
write(msgbuf,'(a)') |
write(msgbuf,'(a)') |