1 |
C $Header$ |
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
5 |
|
|
6 |
C-- File printf.F: Routines for performing formatted textual I/O |
C-- File printf.F: Routines for performing formatted textual I/O |
7 |
C-- in the MITgcm UV implementation environment. |
C-- in the MITgcm UV implementation environment. |
8 |
C-- Contents |
C-- Contents |
9 |
C-- o print_error Does IO with **ERROR** highlighted header |
C-- o PRINT_MESSAGE Does IO with unhighlighted header |
10 |
C-- o print_list_i Prints one-deimensional list of INTEGER |
C-- o PRINT_ERROR Does IO with **ERROR** highlighted header |
11 |
C-- numbers. |
C-- o PRINT_LIST_I Prints one-dimensional list of INTEGER |
12 |
C-- o print_list_l Prints one-deimensional list of LOGICAL |
C-- numbers. |
13 |
C-- variables. |
C-- o PRINT_LIST_L Prints one-dimensional list of LOGICAL |
14 |
C-- o print_list_r8 Prints one-deimensional list of Real*8 |
C-- variables. |
15 |
C-- numbers. |
C-- o PRINT_LIST_RL Prints one-dimensional list of Real(_RL) |
16 |
C-- o print_mapr4 Formats ABCD... contour map of a Real*4 field |
C-- numbers. |
17 |
C-- Uses print_message for writing |
C-- o PRINT_MAPRS Formats ABCD... contour map of a Real(_RS) field |
18 |
C-- o print_mapr8 Formats ABCD... contour map of a Real*8 field |
C-- Uses print_message for writing |
19 |
C-- Uses print_message for writing |
C-- o PRINT_MAPRL Formats ABCD... contour map of a Real(_RL) field |
20 |
C-- o print_message Does IO with unhighlighted header |
C-- Uses print_message for writing |
21 |
|
|
22 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
23 |
|
CBOP |
24 |
|
C !ROUTINE: PRINT_MESSAGE |
25 |
|
C !INTERFACE: |
26 |
|
SUBROUTINE PRINT_MESSAGE( message, unit, sq , myThid ) |
27 |
|
|
28 |
CStartOfInterface |
C !DESCRIPTION: |
29 |
SUBROUTINE PRINT_ERROR( message , myThid ) |
C *============================================================* |
30 |
C /============================================================\ |
C | SUBROUTINE PRINT\_MESSAGE |
31 |
C | SUBROUTINE PRINT_ERROR | |
C | o Write out informational message using "standard" format. |
32 |
C | o Write out error message using "standard" format. | |
C *============================================================* |
33 |
C | Notes | |
C | Notes |
34 |
C | ===== | |
C | ===== |
35 |
C | o Some system I/O is not "thread-safe". For this reason | |
C | o Some system I/O is not "thread-safe". For this reason |
36 |
C | without the FMTFTN_IO_THREAD_SAFE directive set a | |
C | without the FMTFTN\_IO\_THREAD\_SAFE directive set a |
37 |
C | critical region is defined around the write here. In some| |
C | critical region is defined around the write here. In some |
38 |
C | cases BEGIN_CRIT() is approximated by only doing writes | |
C | cases BEGIN\_CRIT() is approximated by only doing writes |
39 |
C | for thread number 1 - writes for other threads are | |
C | for thread number 1 - writes for other threads are |
40 |
C | ignored! | |
C | ignored! |
41 |
C | o In a non-parallel form these routines can still be used. | |
C | o In a non-parallel form these routines can still be used. |
42 |
C | to produce pretty printed output! | |
C | to produce pretty printed output! |
43 |
C \============================================================/ |
C *============================================================* |
44 |
|
|
45 |
|
C !USES: |
46 |
IMPLICIT NONE |
IMPLICIT NONE |
47 |
|
|
48 |
C == Global data == |
C == Global data == |
49 |
#include "SIZE.h" |
#include "SIZE.h" |
50 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
51 |
#include "EESUPPORT.h" |
#include "EESUPPORT.h" |
52 |
|
|
53 |
|
C !INPUT/OUTPUT PARAMETERS: |
54 |
C == Routine arguments == |
C == Routine arguments == |
55 |
|
C message :: Message to write |
56 |
|
C unit :: Unit number to write to |
57 |
|
C sq :: Justification option |
58 |
CHARACTER*(*) message |
CHARACTER*(*) message |
59 |
INTEGER myThid |
INTEGER unit |
60 |
CEndOfInterface |
CHARACTER*(*) sq |
61 |
|
INTEGER myThid |
62 |
|
|
63 |
|
C !FUNCTIONS: |
64 |
INTEGER IFNBLNK |
INTEGER IFNBLNK |
65 |
EXTERNAL IFNBLNK |
EXTERNAL IFNBLNK |
66 |
INTEGER ILNBLNK |
INTEGER ILNBLNK |
67 |
EXTERNAL ILNBLNK |
EXTERNAL ILNBLNK |
68 |
|
|
69 |
|
C !LOCAL VARIABLES: |
70 |
C == Local variables == |
C == Local variables == |
71 |
|
C iStart, iEnd :: String indexing variables |
72 |
|
C idString :: Temp. for building prefix. |
73 |
INTEGER iStart |
INTEGER iStart |
74 |
INTEGER iEnd |
INTEGER iEnd |
75 |
CHARACTER*9 idString |
CHARACTER*9 idString |
76 |
|
CEOP |
77 |
|
|
78 |
C-- Find beginning and end of message |
C-- Find beginning and end of message |
79 |
iStart = IFNBLNK( message ) |
IF ( sq .EQ. SQUEEZE_BOTH .OR. |
80 |
iEnd = ILNBLNK( message ) |
& sq .EQ. SQUEEZE_LEFT ) THEN |
81 |
|
iStart = IFNBLNK( message ) |
82 |
|
ELSE |
83 |
|
iStart = 1 |
84 |
|
ENDIF |
85 |
|
IF ( sq .EQ. SQUEEZE_BOTH .OR. |
86 |
|
& sq .EQ. SQUEEZE_RIGHT ) THEN |
87 |
|
iEnd = ILNBLNK( message ) |
88 |
|
ELSE |
89 |
|
iEnd = LEN(message) |
90 |
|
ENDIF |
91 |
C-- Test to see if in multi-process ( or multi-threaded ) mode. |
C-- Test to see if in multi-process ( or multi-threaded ) mode. |
92 |
C If so include process or thread identifier. |
C If so include process or thread identifier. |
93 |
IF ( numberOfProcs .EQ. 0 .AND. nThreads .EQ. 1 ) THEN |
IF ( numberOfProcs .EQ. 0 .AND. nThreads .EQ. 1 ) THEN |
94 |
C-- Write single process format |
C-- Write single process format |
95 |
IF ( message .EQ. ' ' ) THEN |
IF ( message .EQ. ' ' ) THEN |
96 |
WRITE(errorMessageUnit,'(A,1X,A)') ERROR_HEADER, ' ' |
WRITE(unit,'(A)') ' ' |
97 |
ELSE |
ELSE |
98 |
WRITE(errorMessageUnit,'(A,1X,A)') ERROR_HEADER, |
WRITE(unit,'(A)') message(iStart:iEnd) |
|
& message(iStart:iEnd) |
|
99 |
ENDIF |
ENDIF |
100 |
ELSEIF ( pidIO .EQ. myProcId ) THEN |
ELSEIF ( pidIO .EQ. myProcId ) THEN |
101 |
C-- Write multi-process format |
C-- Write multi-process format |
107 |
_END_CRIT(myThid) |
_END_CRIT(myThid) |
108 |
#endif |
#endif |
109 |
IF ( message .EQ. ' ' ) THEN |
IF ( message .EQ. ' ' ) THEN |
110 |
C PRINT_ERROR can be called by several threads simulataneously. |
C PRINT can be called by several threads simultaneously. |
111 |
C The write statement may need to be marked as a critical section. |
C The write statement may need to ne marked as a critical section. |
112 |
#ifndef FMTFTN_IO_THREAD_SAFE |
#ifndef FMTFTN_IO_THREAD_SAFE |
113 |
_BEGIN_CRIT(myThid) |
_BEGIN_CRIT(myThid) |
114 |
#endif |
#endif |
115 |
WRITE(errorMessageUnit,'(A,A,1X,A,A,A,A,A)',ERR=999) |
WRITE(unit,'(A,A,A,A,A,A)',ERR=999) |
116 |
& '(',PROCESS_HEADER,idString,')',ERROR_HEADER,' ', |
& '(',PROCESS_HEADER,' ',idString,')',' ' |
|
& ' ' |
|
117 |
#ifndef FMTFTN_IO_THREAD_SAFE |
#ifndef FMTFTN_IO_THREAD_SAFE |
118 |
_END_CRIT(myThid) |
_END_CRIT(myThid) |
119 |
#endif |
#endif |
121 |
#ifndef FMTFTN_IO_THREAD_SAFE |
#ifndef FMTFTN_IO_THREAD_SAFE |
122 |
_BEGIN_CRIT(myThid) |
_BEGIN_CRIT(myThid) |
123 |
#endif |
#endif |
124 |
WRITE(errorMessageUnit,'(A,A,1X,A,A,A,A,A)',ERR=999) |
WRITE(unit,'(A,A,A,A,A,A,A)',ERR=999) |
125 |
& '(',PROCESS_HEADER,idString,')',ERROR_HEADER,' ', |
& '(',PROCESS_HEADER,' ',idString(1:ILNBLNK(idString)),')',' ', |
126 |
& message(iStart:iEnd) |
& message(iStart:iEnd) |
127 |
#ifndef FMTFTN_IO_THREAD_SAFE |
#ifndef FMTFTN_IO_THREAD_SAFE |
128 |
_END_CRIT(myThid) |
_END_CRIT(myThid) |
129 |
#endif |
#endif |
130 |
ENDIF |
ENDIF |
131 |
ENDIF |
ENDIF |
132 |
|
|
133 |
|
#ifndef DISABLE_WRITE_TO_UNIT_ZERO |
134 |
|
C-- if error message, also write directly to unit 0 : |
135 |
|
IF ( numberOfProcs .EQ. 1 .AND. nThreads .EQ. 1 |
136 |
|
& .AND. unit.EQ.errorMessageUnit ) THEN |
137 |
|
iEnd = ILNBLNK( message ) |
138 |
|
IF (iEnd.NE.0) WRITE(0,'(A)') message(1:iEnd) |
139 |
|
ENDIF |
140 |
|
#endif |
141 |
C |
C |
142 |
1000 CONTINUE |
1000 CONTINUE |
143 |
RETURN |
RETURN |
|
|
|
144 |
999 CONTINUE |
999 CONTINUE |
145 |
ioErrorCount(myThid) = ioErrorCount(myThid)+1 |
ioErrorCount(myThid) = ioErrorCount(myThid)+1 |
146 |
GOTO 1000 |
GOTO 1000 |
147 |
|
|
148 |
|
END |
149 |
|
|
150 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
151 |
|
CBOP |
152 |
|
C !ROUTINE: PRINT_ERROR |
153 |
|
C !INTERFACE: |
154 |
|
SUBROUTINE PRINT_ERROR( message , myThid ) |
155 |
|
|
156 |
|
C !DESCRIPTION: |
157 |
|
C *============================================================* |
158 |
|
C | SUBROUTINE PRINT\_ERROR |
159 |
|
C | o Write out error message using "standard" format. |
160 |
|
C *============================================================* |
161 |
|
C | Notes |
162 |
|
C | ===== |
163 |
|
C | o Some system I/O is not "thread-safe". For this reason |
164 |
|
C | without the FMTFTN\_IO\_THREAD\_SAFE directive set a |
165 |
|
C | critical region is defined around the write here. In some |
166 |
|
C | cases BEGIN\_CRIT() is approximated by only doing writes |
167 |
|
C | for thread number 1 - writes for other threads are |
168 |
|
C | ignored! |
169 |
|
C | o In a non-parallel form these routines are still used |
170 |
|
C | to produce pretty printed output. The process and thread |
171 |
|
C | id prefix is omitted in this case. |
172 |
|
C *============================================================* |
173 |
|
|
174 |
|
C !USES: |
175 |
|
IMPLICIT NONE |
176 |
|
|
177 |
|
C == Global data == |
178 |
|
#include "SIZE.h" |
179 |
|
#include "EEPARAMS.h" |
180 |
|
#include "EESUPPORT.h" |
181 |
|
|
182 |
|
C !INPUT/OUTPUT PARAMETERS: |
183 |
|
C == Routine arguments == |
184 |
|
C message :: Text string to print |
185 |
|
C myThid :: Thread number of this instance |
186 |
|
CHARACTER*(*) message |
187 |
|
INTEGER myThid |
188 |
|
|
189 |
|
C !FUNCTIONS: |
190 |
|
c INTEGER IFNBLNK |
191 |
|
c EXTERNAL IFNBLNK |
192 |
|
INTEGER ILNBLNK |
193 |
|
EXTERNAL ILNBLNK |
194 |
|
|
195 |
|
C !LOCAL VARIABLES: |
196 |
|
C == Local variables == |
197 |
|
C iStart, iEnd :: Temps. for string indexing |
198 |
|
C idString :: Temp. for building message prefix |
199 |
|
c INTEGER iStart |
200 |
|
INTEGER iEnd |
201 |
|
CHARACTER*9 idString |
202 |
|
CEOP |
203 |
|
|
204 |
|
C-- Find beginning and end of message |
205 |
|
c iStart = IFNBLNK( message ) |
206 |
|
iEnd = ILNBLNK( message ) |
207 |
|
C-- Test to see if in multi-process ( or multi-threaded ) mode. |
208 |
|
C If so include process or thread identifier. |
209 |
|
IF ( numberOfProcs .EQ. 0 .AND. nThreads .EQ. 1 ) THEN |
210 |
|
C-- Write single process format |
211 |
|
IF ( iEnd.EQ.0 ) THEN |
212 |
|
WRITE(errorMessageUnit,'(A,1X,A)') ERROR_HEADER, ' ' |
213 |
|
ELSE |
214 |
|
WRITE(errorMessageUnit,'(A,1X,A)') ERROR_HEADER, |
215 |
|
& message(1:iEnd) |
216 |
|
c & message(iStart:iEnd) |
217 |
|
ENDIF |
218 |
|
ELSE |
219 |
|
C PRINT_ERROR can be called by several threads simulataneously. |
220 |
|
C The write statement may need to be marked as a critical section. |
221 |
|
#ifndef FMTFTN_IO_THREAD_SAFE |
222 |
|
# ifdef USE_OMP_THREADING |
223 |
|
C$OMP CRITICAL |
224 |
|
# else |
225 |
|
_BEGIN_CRIT(myThid) |
226 |
|
# endif |
227 |
|
#endif |
228 |
|
IF ( pidIO .EQ. myProcId ) THEN |
229 |
|
C-- Write multi-process format |
230 |
|
WRITE(idString,'(I4.4,A,I4.4)') myProcId,'.',myThid |
231 |
|
|
232 |
|
IF ( iEnd.EQ.0 ) THEN |
233 |
|
c WRITE(errorMessageUnit,'(A,A,1X,A,A,A,A,A)',ERR=999) |
234 |
|
WRITE(errorMessageUnit,'(A,A,1X,A,A,A,A,A)') |
235 |
|
& '(',PROCESS_HEADER,idString,')',ERROR_HEADER,' ', |
236 |
|
& ' ' |
237 |
|
ELSE |
238 |
|
c WRITE(errorMessageUnit,'(A,A,1X,A,A,A,A,A)',ERR=999) |
239 |
|
WRITE(errorMessageUnit,'(A,A,1X,A,A,A,A,A)') |
240 |
|
& '(',PROCESS_HEADER,idString,')',ERROR_HEADER,' ', |
241 |
|
& message(1:iEnd) |
242 |
|
c & message(iStart:iEnd) |
243 |
|
ENDIF |
244 |
|
ENDIF |
245 |
|
|
246 |
|
#ifndef DISABLE_WRITE_TO_UNIT_ZERO |
247 |
|
C-- also write directly to unit 0 : |
248 |
|
IF ( numberOfProcs.EQ.1 .AND. iEnd.NE.0 ) THEN |
249 |
|
IF ( nThreads.LE.1 ) THEN |
250 |
|
WRITE(0,'(A)') message(1:iEnd) |
251 |
|
ELSE |
252 |
|
WRITE(0,'(A,I4.4,A,A)') '(TID ', myThid, ') ', |
253 |
|
& message(1:iEnd) |
254 |
|
ENDIF |
255 |
|
ENDIF |
256 |
|
#endif |
257 |
|
|
258 |
|
#ifndef FMTFTN_IO_THREAD_SAFE |
259 |
|
# ifdef USE_OMP_THREADING |
260 |
|
C$OMP END CRITICAL |
261 |
|
# else |
262 |
|
_END_CRIT(myThid) |
263 |
|
# endif |
264 |
|
#endif |
265 |
|
ENDIF |
266 |
|
|
267 |
|
1000 CONTINUE |
268 |
|
RETURN |
269 |
|
|
270 |
|
c 999 CONTINUE |
271 |
|
c ioErrorCount(myThid) = ioErrorCount(myThid)+1 |
272 |
|
c GOTO 1000 |
273 |
END |
END |
274 |
|
|
275 |
CStartofinterface |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
276 |
SUBROUTINE PRINT_LIST_I( fld, lFld, index_type, |
CBOP |
277 |
|
C !ROUTINE: PRINT_LIST_I |
278 |
|
C !INTERFACE: |
279 |
|
SUBROUTINE PRINT_LIST_I( fld, iFirst, iLast, index_type, |
280 |
& markEnd, compact, ioUnit ) |
& markEnd, compact, ioUnit ) |
281 |
C /==========================================================\ |
|
282 |
C | o SUBROUTINE PRINT_LIST_I | |
C !DESCRIPTION: |
283 |
C |==========================================================| |
C *==========================================================* |
284 |
C | Routine for producing list of values for a field with | |
C | o SUBROUTINE PRINT\_LIST\_I |
285 |
C | duplicate values collected into | |
C *==========================================================* |
286 |
C | n @ value | |
C | Routine for producing list of values for a field with |
287 |
C | record. | |
C | duplicate values collected into |
288 |
C \==========================================================/ |
C | n \@ value |
289 |
|
C | record. |
290 |
|
C *==========================================================* |
291 |
|
|
292 |
|
C !USES: |
293 |
IMPLICIT NONE |
IMPLICIT NONE |
294 |
|
|
295 |
C == Global data == |
C == Global data == |
296 |
#include "SIZE.h" |
#include "SIZE.h" |
297 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
298 |
|
|
299 |
|
C !INPUT/OUTPUT PARAMETERS: |
300 |
C == Routine arguments == |
C == Routine arguments == |
301 |
C fld - Data to be printed |
C fld :: Data to be printed |
302 |
C lFld - Number of elements to be printed |
C iFirst :: First element to print |
303 |
C index_type - Flag indicating which type of index to print |
C iLast :: Last element to print |
304 |
|
C index_type :: Flag indicating which type of index to print |
305 |
C INDEX_K => /* K = nnn */ |
C INDEX_K => /* K = nnn */ |
306 |
C INDEX_I => /* I = nnn */ |
C INDEX_I => /* I = nnn */ |
307 |
C INDEX_J => /* J = nnn */ |
C INDEX_J => /* J = nnn */ |
308 |
C INDEX_NONE => |
C INDEX_NONE => |
309 |
C compact - Flag to control use of repeat symbol for same valued |
C markEnd :: Flag to control whether there is a separator after the |
|
C fields. |
|
|
C markEnd - Flag to control whether there is a separator after the |
|
310 |
C last element |
C last element |
311 |
C ioUnit - Unit number for IO. |
C compact :: Flag to control use of repeat symbol for same valued |
312 |
INTEGER lFld |
C fields. |
313 |
|
C ioUnit :: Unit number for IO. |
314 |
|
INTEGER iFirst, iLast |
315 |
|
INTEGER fld(iFirst:iLast) |
316 |
INTEGER index_type |
INTEGER index_type |
|
INTEGER fld(lFld) |
|
317 |
LOGICAL markEnd |
LOGICAL markEnd |
318 |
LOGICAL compact |
LOGICAL compact |
319 |
INTEGER ioUnit |
INTEGER ioUnit |
|
CEndifinterface |
|
320 |
|
|
321 |
|
C !LOCAL VARIABLES: |
322 |
C == Local variables == |
C == Local variables == |
323 |
C iLo - Range index holders for selecting elements with |
C iLo - Range index holders for selecting elements with |
324 |
C iHi with the same value |
C iHi with the same value |
336 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
337 |
CHARACTER*2 commOpen,commClose |
CHARACTER*2 commOpen,commClose |
338 |
CHARACTER*3 index_lab |
CHARACTER*3 index_lab |
339 |
|
CHARACTER*25 fmt1, fmt2 |
340 |
INTEGER K |
INTEGER K |
341 |
|
CEOP |
342 |
|
|
343 |
IF ( index_type .EQ. INDEX_I ) THEN |
IF ( index_type .EQ. INDEX_I ) THEN |
344 |
index_lab = 'I =' |
index_lab = 'I =' |
349 |
ELSE |
ELSE |
350 |
index_lab = '?=' |
index_lab = '?=' |
351 |
ENDIF |
ENDIF |
352 |
|
C- fortran format to write 1 or 2 indices: |
353 |
|
fmt1='(A,1X,A,I3,1X,A)' |
354 |
|
fmt2='(A,1X,A,I3,A,I3,1X,A)' |
355 |
|
IF ( iLast.GE.1000 ) THEN |
356 |
|
K = 1+INT(LOG10(FLOAT(iLast))) |
357 |
|
WRITE(fmt1,'(A,I1,A)') '(A,1X,A,I',K,',1X,A)' |
358 |
|
WRITE(fmt2,'(A,I1,A,I1,A)') '(A,1X,A,I',K,',A,I',K,',1X,A)' |
359 |
|
ENDIF |
360 |
commOpen = '/*' |
commOpen = '/*' |
361 |
commClose = '*/' |
commClose = '*/' |
362 |
iLo = 1 |
iLo = iFirst |
363 |
iHi = 1 |
iHi = iFirst |
364 |
punc = ',' |
punc = ',' |
365 |
xOld = fld(1) |
xOld = fld(iFirst) |
366 |
DO K=2,lFld |
DO K = iFirst+1,iLast |
367 |
xNew = fld(K ) |
xNew = fld(K ) |
368 |
IF ( .NOT. compact .OR. xNew .NE. xOld ) THEN |
IF ( .NOT. compact .OR. (xNew .NE. xOld) ) THEN |
369 |
nDup = iHi-iLo+1 |
nDup = iHi-iLo+1 |
370 |
IF ( nDup .EQ. 1 ) THEN |
IF ( nDup .EQ. 1 ) THEN |
371 |
WRITE(msgBuf,'(A,I9,A)') ' ',xOld,punc |
WRITE(msgBuf,'(A,I9,A)') ' ',xOld,punc |
372 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
373 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)') |
& WRITE(msgBuf(45:),fmt1) |
374 |
& commOpen,index_lab,iLo,commClose |
& commOpen,index_lab,iLo,commClose |
375 |
ELSE |
ELSE |
376 |
WRITE(msgBuf,'(I5,'' '',A,I9,A)') nDup,'@',xOld,punc |
WRITE(msgBuf,'(I5,'' '',A,I9,A)') nDup,'@',xOld,punc |
377 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
378 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)') |
& WRITE(msgBuf(45:),fmt2) |
379 |
& commOpen,index_lab,iLo,':',iHi,commClose |
& commOpen,index_lab,iLo,':',iHi,commClose |
380 |
ENDIF |
ENDIF |
381 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
391 |
nDup = iHi-iLo+1 |
nDup = iHi-iLo+1 |
392 |
IF ( nDup .EQ. 1 ) THEN |
IF ( nDup .EQ. 1 ) THEN |
393 |
WRITE(msgBuf,'(A,I9,A)') ' ',xOld,punc |
WRITE(msgBuf,'(A,I9,A)') ' ',xOld,punc |
394 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
395 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)') |
& WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)') |
396 |
& commOpen,index_lab,iLo,commClose |
& commOpen,index_lab,iLo,commClose |
397 |
ELSEIF( nDup .GT. 1 ) THEN |
ELSEIF( nDup .GT. 1 ) THEN |
398 |
WRITE(msgBuf,'(I5,'' '',A,I9,A)') nDup,'@',xOld,punc |
WRITE(msgBuf,'(I5,'' '',A,I9,A)') nDup,'@',xOld,punc |
399 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
400 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)') |
& WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)') |
401 |
& commOpen,index_lab,iLo,':',iHi,commClose |
& commOpen,index_lab,iLo,':',iHi,commClose |
402 |
ENDIF |
ENDIF |
403 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
405 |
RETURN |
RETURN |
406 |
END |
END |
407 |
|
|
408 |
CStartofinterface |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
409 |
SUBROUTINE PRINT_LIST_L( fld, lFld, index_type, markEnd, |
CBOP |
410 |
& compact, ioUnit ) |
C !ROUTINE: PRINT_LIST_L |
411 |
C /==========================================================\ |
C !INTERFACE: |
412 |
C | o SUBROUTINE PRINT_LIST_L | |
SUBROUTINE PRINT_LIST_L( fld, iFirst, iLast, index_type, |
413 |
C |==========================================================| |
& markEnd, compact, ioUnit ) |
414 |
C | Routine for producing list of values for a field with | |
|
415 |
C | duplicate values collected into | |
C !DESCRIPTION: |
416 |
C | n @ value | |
C *==========================================================* |
417 |
C | record. | |
C | o SUBROUTINE PRINT\_LIST\_L |
418 |
C \==========================================================/ |
C *==========================================================* |
419 |
|
C | Routine for producing list of values for a field with |
420 |
|
C | duplicate values collected into |
421 |
|
C | n \@ value |
422 |
|
C | record. |
423 |
|
C *==========================================================* |
424 |
|
|
425 |
|
C !USES: |
426 |
IMPLICIT NONE |
IMPLICIT NONE |
427 |
|
|
428 |
C == Global data == |
C == Global data == |
429 |
#include "SIZE.h" |
#include "SIZE.h" |
430 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
431 |
|
|
432 |
|
C !INPUT/OUTPUT PARAMETERS: |
433 |
C == Routine arguments == |
C == Routine arguments == |
434 |
C fld - Data to be printed |
C fld :: Data to be printed |
435 |
C lFld - Number of elements to be printed |
C iFirst :: First element to print |
436 |
C index_type - Flag indicating which type of index to print |
C iLast :: Last element to print |
437 |
|
C index_type :: Flag indicating which type of index to print |
438 |
C INDEX_K => /* K = nnn */ |
C INDEX_K => /* K = nnn */ |
439 |
C INDEX_I => /* I = nnn */ |
C INDEX_I => /* I = nnn */ |
440 |
C INDEX_J => /* J = nnn */ |
C INDEX_J => /* J = nnn */ |
441 |
C INDEX_NONE => |
C INDEX_NONE => |
442 |
C compact - Flag to control use of repeat symbol for same valued |
C markEnd :: Flag to control whether there is a separator after the |
|
C fields. |
|
|
C markEnd - Flag to control whether there is a separator after the |
|
443 |
C last element |
C last element |
444 |
C ioUnit - Unit number for IO. |
C compact :: Flag to control use of repeat symbol for same valued |
445 |
INTEGER lFld |
C fields. |
446 |
|
C ioUnit :: Unit number for IO. |
447 |
|
INTEGER iFirst, iLast |
448 |
|
LOGICAL fld(iFirst:iLast) |
449 |
INTEGER index_type |
INTEGER index_type |
|
LOGICAL fld(lFld) |
|
450 |
LOGICAL markEnd |
LOGICAL markEnd |
451 |
LOGICAL compact |
LOGICAL compact |
452 |
INTEGER ioUnit |
INTEGER ioUnit |
|
CEndifinterface |
|
453 |
|
|
454 |
|
C !LOCAL VARIABLES: |
455 |
C == Local variables == |
C == Local variables == |
456 |
C iLo - Range index holders for selecting elements with |
C iLo - Range index holders for selecting elements with |
457 |
C iHi with the same value |
C iHi with the same value |
469 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
470 |
CHARACTER*2 commOpen,commClose |
CHARACTER*2 commOpen,commClose |
471 |
CHARACTER*3 index_lab |
CHARACTER*3 index_lab |
472 |
|
CHARACTER*25 fmt1, fmt2 |
473 |
INTEGER K |
INTEGER K |
474 |
|
CEOP |
475 |
|
|
476 |
IF ( index_type .EQ. INDEX_I ) THEN |
IF ( index_type .EQ. INDEX_I ) THEN |
477 |
index_lab = 'I =' |
index_lab = 'I =' |
482 |
ELSE |
ELSE |
483 |
index_lab = '?=' |
index_lab = '?=' |
484 |
ENDIF |
ENDIF |
485 |
|
C- fortran format to write 1 or 2 indices: |
486 |
|
fmt1='(A,1X,A,I3,1X,A)' |
487 |
|
fmt2='(A,1X,A,I3,A,I3,1X,A)' |
488 |
|
IF ( iLast.GE.1000 ) THEN |
489 |
|
K = 1+INT(LOG10(FLOAT(iLast))) |
490 |
|
WRITE(fmt1,'(A,I1,A)') '(A,1X,A,I',K,',1X,A)' |
491 |
|
WRITE(fmt2,'(A,I1,A,I1,A)') '(A,1X,A,I',K,',A,I',K,',1X,A)' |
492 |
|
ENDIF |
493 |
commOpen = '/*' |
commOpen = '/*' |
494 |
commClose = '*/' |
commClose = '*/' |
495 |
iLo = 1 |
iLo = iFirst |
496 |
iHi = 1 |
iHi = iFirst |
497 |
punc = ',' |
punc = ',' |
498 |
xOld = fld(1) |
xOld = fld(iFirst) |
499 |
DO K=2,lFld |
DO K = iFirst+1,iLast |
500 |
xNew = fld(K ) |
xNew = fld(K ) |
501 |
IF ( .NOT. compact .OR. xNew .NEQV. xOld ) THEN |
IF ( .NOT. compact .OR. (xNew .NEQV. xOld) ) THEN |
502 |
nDup = iHi-iLo+1 |
nDup = iHi-iLo+1 |
503 |
IF ( nDup .EQ. 1 ) THEN |
IF ( nDup .EQ. 1 ) THEN |
504 |
WRITE(msgBuf,'(A,L5,A)') ' ',xOld,punc |
WRITE(msgBuf,'(A,L5,A)') ' ',xOld,punc |
505 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
506 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)') |
& WRITE(msgBuf(45:),fmt1) |
507 |
& commOpen,index_lab,iLo,commClose |
& commOpen,index_lab,iLo,commClose |
508 |
ELSE |
ELSE |
509 |
WRITE(msgBuf,'(I5,'' '',A,L5,A)') nDup,'@',xOld,punc |
WRITE(msgBuf,'(I5,'' '',A,L5,A)') nDup,'@',xOld,punc |
510 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
511 |
& WRITE(msgBuf(45:),'(A,1X,A,L3,A,I3,1X,A)') |
& WRITE(msgBuf(45:),fmt2) |
512 |
& commOpen,index_lab,iLo,':',iHi,commClose |
& commOpen,index_lab,iLo,':',iHi,commClose |
513 |
ENDIF |
ENDIF |
514 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
524 |
nDup = iHi-iLo+1 |
nDup = iHi-iLo+1 |
525 |
IF ( nDup .EQ. 1 ) THEN |
IF ( nDup .EQ. 1 ) THEN |
526 |
WRITE(msgBuf,'(A,L5,A)') ' ',xOld,punc |
WRITE(msgBuf,'(A,L5,A)') ' ',xOld,punc |
527 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
528 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)') |
& WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)') |
529 |
& commOpen,index_lab,iLo,commClose |
& commOpen,index_lab,iLo,commClose |
530 |
ELSEIF( nDup .GT. 1 ) THEN |
ELSEIF( nDup .GT. 1 ) THEN |
531 |
WRITE(msgBuf,'(I5,'' '',A,L5,A)') nDup,'@',xOld,punc |
WRITE(msgBuf,'(I5,'' '',A,L5,A)') nDup,'@',xOld,punc |
532 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
533 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)') |
& WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)') |
534 |
& commOpen,index_lab,iLo,':',iHi,commClose |
& commOpen,index_lab,iLo,':',iHi,commClose |
535 |
ENDIF |
ENDIF |
536 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
538 |
RETURN |
RETURN |
539 |
END |
END |
540 |
|
|
541 |
CStartofinterface |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
542 |
SUBROUTINE PRINT_LIST_R8( fld, lFld, index_type, |
CBOP |
543 |
& markEnd, compact, ioUnit ) |
C !ROUTINE: PRINT_LIST_RL |
544 |
C /==========================================================\ |
C !INTERFACE: |
545 |
C | o SUBROUTINE PRINT_LIST_R8 | |
SUBROUTINE PRINT_LIST_RL( fld, iFirst, iLast, index_type, |
546 |
C |==========================================================| |
& markEnd, compact, ioUnit ) |
547 |
C | Routine for producing list of values for a field with | |
|
548 |
C | duplicate values collected into | |
C !DESCRIPTION: |
549 |
C | n @ value | |
C *==========================================================* |
550 |
C | record. | |
C | o SUBROUTINE PRINT\_LIST\_RL |
551 |
C \==========================================================/ |
C *==========================================================* |
552 |
|
C | Routine for producing list of values for a field with |
553 |
|
C | duplicate values collected into |
554 |
|
C | n \@ value |
555 |
|
C | record. |
556 |
|
C *==========================================================* |
557 |
|
|
558 |
|
C !USES: |
559 |
IMPLICIT NONE |
IMPLICIT NONE |
560 |
|
|
561 |
C == Global data == |
C == Global data == |
562 |
#include "SIZE.h" |
#include "SIZE.h" |
563 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
564 |
|
|
565 |
|
C !INPUT/OUTPUT PARAMETERS: |
566 |
C == Routine arguments == |
C == Routine arguments == |
567 |
C fld - Data to be printed |
C fld :: Data to be printed |
568 |
C lFld - Number of elements to be printed |
C iFirst :: First element to print |
569 |
C index_type - Flag indicating which type of index to print |
C iLast :: Last element to print |
570 |
|
C index_type :: Flag indicating which type of index to print |
571 |
C INDEX_K => /* K = nnn */ |
C INDEX_K => /* K = nnn */ |
572 |
C INDEX_I => /* I = nnn */ |
C INDEX_I => /* I = nnn */ |
573 |
C INDEX_J => /* J = nnn */ |
C INDEX_J => /* J = nnn */ |
574 |
C INDEX_NONE => |
C INDEX_NONE => |
575 |
C compact - Flag to control use of repeat symbol for same valued |
C markEnd :: Flag to control whether there is a separator after the |
|
C fields. |
|
|
C markEnd - Flag to control whether there is a separator after the |
|
576 |
C last element |
C last element |
577 |
C ioUnit - Unit number for IO. |
C compact :: Flag to control use of repeat symbol for same valued |
578 |
INTEGER lFld |
C fields. |
579 |
|
C ioUnit :: Unit number for IO. |
580 |
|
INTEGER iFirst, iLast |
581 |
|
_RL fld(iFirst:iLast) |
582 |
INTEGER index_type |
INTEGER index_type |
|
Real*8 fld(lFld) |
|
583 |
LOGICAL markEnd |
LOGICAL markEnd |
584 |
LOGICAL compact |
LOGICAL compact |
585 |
INTEGER ioUnit |
INTEGER ioUnit |
|
CEndifinterface |
|
586 |
|
|
587 |
|
C !LOCA VARIABLES: |
588 |
C == Local variables == |
C == Local variables == |
589 |
C iLo - Range index holders for selecting elements with |
C iLo - Range index holders for selecting elements with |
590 |
C iHi with the same value |
C iHi with the same value |
597 |
INTEGER iLo |
INTEGER iLo |
598 |
INTEGER iHi |
INTEGER iHi |
599 |
INTEGER nDup |
INTEGER nDup |
600 |
Real*8 xNew, xOld |
_RL xNew, xOld |
601 |
CHARACTER punc |
CHARACTER punc |
602 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
603 |
CHARACTER*2 commOpen,commClose |
CHARACTER*2 commOpen,commClose |
604 |
CHARACTER*3 index_lab |
CHARACTER*3 index_lab |
605 |
|
CHARACTER*25 fmt1, fmt2 |
606 |
INTEGER K |
INTEGER K |
607 |
|
CEOP |
608 |
|
|
609 |
IF ( index_type .EQ. INDEX_I ) THEN |
IF ( index_type .EQ. INDEX_I ) THEN |
610 |
index_lab = 'I =' |
index_lab = 'I =' |
615 |
ELSE |
ELSE |
616 |
index_lab = '?=' |
index_lab = '?=' |
617 |
ENDIF |
ENDIF |
618 |
|
C- fortran format to write 1 or 2 indices: |
619 |
|
fmt1='(A,1X,A,I3,1X,A)' |
620 |
|
fmt2='(A,1X,A,I3,A,I3,1X,A)' |
621 |
|
IF ( iLast.GE.1000 ) THEN |
622 |
|
K = 1+INT(LOG10(FLOAT(iLast))) |
623 |
|
WRITE(fmt1,'(A,I1,A)') '(A,1X,A,I',K,',1X,A)' |
624 |
|
WRITE(fmt2,'(A,I1,A,I1,A)') '(A,1X,A,I',K,',A,I',K,',1X,A)' |
625 |
|
ENDIF |
626 |
commOpen = '/*' |
commOpen = '/*' |
627 |
commClose = '*/' |
commClose = '*/' |
628 |
iLo = 1 |
iLo = iFirst |
629 |
iHi = 1 |
iHi = iFirst |
630 |
punc = ',' |
punc = ',' |
631 |
xOld = fld(1) |
xOld = fld(iFirst) |
632 |
DO K=2,lFld |
DO K = iFirst+1,iLast |
633 |
xNew = fld(K ) |
xNew = fld(K ) |
634 |
IF ( .NOT. compact .OR. xNew .NE. xOld ) THEN |
IF ( .NOT. compact .OR. (xNew .NE. xOld) ) THEN |
635 |
nDup = iHi-iLo+1 |
nDup = iHi-iLo+1 |
636 |
IF ( nDup .EQ. 1 ) THEN |
IF ( nDup .EQ. 1 ) THEN |
637 |
WRITE(msgBuf,'(A,1PE23.15,A)') ' ',xOld,punc |
WRITE(msgBuf,'(A,1PE23.15,A)') ' ',xOld,punc |
638 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
639 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)') |
& WRITE(msgBuf(45:),fmt1) |
640 |
& commOpen,index_lab,iLo,commClose |
& commOpen,index_lab,iLo,commClose |
641 |
ELSE |
ELSE |
642 |
WRITE(msgBuf,'(I5,'' '',A,1PE23.15,A)') nDup,'@',xOld,punc |
WRITE(msgBuf,'(I5,'' '',A,1PE23.15,A)') nDup,'@',xOld,punc |
643 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
644 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)') |
& WRITE(msgBuf(45:),fmt2) |
645 |
& commOpen,index_lab,iLo,':',iHi,commClose |
& commOpen,index_lab,iLo,':',iHi,commClose |
646 |
ENDIF |
ENDIF |
647 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
|
& SQUEEZE_RIGHT , 1) |
|
648 |
iLo = K |
iLo = K |
649 |
iHi = K |
iHi = K |
650 |
xOld = xNew |
xOld = xNew |
657 |
nDup = iHi-iLo+1 |
nDup = iHi-iLo+1 |
658 |
IF ( nDup .EQ. 1 ) THEN |
IF ( nDup .EQ. 1 ) THEN |
659 |
WRITE(msgBuf,'(A,1PE23.15,A)') ' ',xOld,punc |
WRITE(msgBuf,'(A,1PE23.15,A)') ' ',xOld,punc |
660 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
661 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)') |
& WRITE(msgBuf(45:),fmt1) |
662 |
& commOpen,index_lab,iLo,commClose |
& commOpen,index_lab,iLo,commClose |
663 |
ELSEIF( nDup .GT. 1 ) THEN |
ELSEIF( nDup .GT. 1 ) THEN |
664 |
WRITE(msgBuf,'(I5,'' '',A,1PE23.15,A)') nDup,'@',xOld,punc |
WRITE(msgBuf,'(I5,'' '',A,1PE23.15,A)') nDup,'@',xOld,punc |
665 |
IF ( index_type .NE. INDEX_NONE ) |
IF ( index_type .NE. INDEX_NONE ) |
666 |
& WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)') |
& WRITE(msgBuf(45:),fmt2) |
667 |
& commOpen,index_lab,iLo,':',iHi,commClose |
& commOpen,index_lab,iLo,':',iHi,commClose |
668 |
ENDIF |
ENDIF |
669 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT , 1) |
|
& SQUEEZE_RIGHT , 1) |
|
670 |
|
|
671 |
RETURN |
RETURN |
672 |
END |
END |
673 |
|
|
674 |
CStartOfInterface |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
675 |
|
CBOP |
676 |
|
C !ROUTINE: PRINT_MAPRS |
677 |
|
C !INTERFACE: |
678 |
SUBROUTINE PRINT_MAPRS ( fld, fldTitle, plotMode, |
SUBROUTINE PRINT_MAPRS ( fld, fldTitle, plotMode, |
679 |
I iLo, iHi, jLo, jHi, kLo, kHi, nBx, nBy, |
I iLo, iHi, jLo, jHi, kLo, kHi, nBx, nBy, |
680 |
I iMin, iMax, iStr, |
I iMin, iMax, iStr, |
682 |
I kMin, kMax, kStr, |
I kMin, kMax, kStr, |
683 |
I bxMin, bxMax, bxStr, |
I bxMin, bxMax, bxStr, |
684 |
I byMin, byMax, byStr ) |
I byMin, byMax, byStr ) |
685 |
C /==========================================================\ |
|
686 |
C | SUBROUTINE PRINT_MAPR4 | |
C !DESCRIPTION: |
687 |
C | o Does textual mapping printing of a field. | |
C *==========================================================* |
688 |
C |==========================================================| |
C | SUBROUTINE PRINT\_MAPRS |
689 |
C | This routine does the actual formatting of the data | |
C | o Does textual mapping printing of a field. |
690 |
C | and printing to a file. It assumes an array using the | |
C *==========================================================* |
691 |
C | MITgcm UV indexing scheme and base index variables. | |
C | This routine does the actual formatting of the data |
692 |
C | User code should call an interface routine like | |
C | and printing to a file. It assumes an array using the |
693 |
C | PLOT_FIELD_XYR4( ... ) rather than this code directly. | |
C | MITgcm UV indexing scheme and base index variables. |
694 |
C | Text plots can be oriented XY, YZ, XZ. An orientation | |
C | User code should call an interface routine like |
695 |
C | is specficied through the "plotMode" argument. All the | |
C | PLOT\_FIELD\_XYRS( ... ) rather than this code directly. |
696 |
C | plots made by a single call to this routine will use the | |
C | Text plots can be oriented XY, YZ, XZ. An orientation |
697 |
C | same contour interval. The plot range (iMin,...,byStr) | |
C | is specficied through the "plotMode" argument. All the |
698 |
C | can be three-dimensional. A separate plot is made for | |
C | plots made by a single call to this routine will use the |
699 |
C | each point in the plot range normal to the orientation. | |
C | same contour interval. The plot range (iMin,...,byStr) |
700 |
C | e.g. if the orientation is XY (plotMode = PRINT_MAP_XY). | |
C | can be three-dimensional. A separate plot is made for |
701 |
C | kMin =1, kMax = 5 and kStr = 2 will produce three XY| |
C | each point in the plot range normal to the orientation. |
702 |
C | plots - one for K=1, one for K=3 and one for K=5. | |
C | e.g. if the orientation is XY (plotMode = PRINT\_MAP\_XY). |
703 |
C | Each plot would have extents iMin:iMax step iStr | |
C | kMin =1, kMax = 5 and kStr = 2 will produce three XY |
704 |
C | and jMin:jMax step jStr. | |
C | plots - one for K=1, one for K=3 and one for K=5. |
705 |
C \==========================================================/ |
C | Each plot would have extents iMin:iMax step iStr |
706 |
|
C | and jMin:jMax step jStr. |
707 |
|
C *==========================================================* |
708 |
|
|
709 |
|
C !USES: |
710 |
IMPLICIT NONE |
IMPLICIT NONE |
711 |
|
|
712 |
C == Global variables == |
C == Global variables == |
713 |
#include "SIZE.h" |
#include "SIZE.h" |
714 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
|
#include "EESUPPORT.h" |
|
715 |
|
|
716 |
|
C !INPUT/OUTPUT PARAMETERS: |
717 |
C == Routine arguments == |
C == Routine arguments == |
718 |
C fld - Real*4 array holding data to be plotted |
C fld - Real*4 array holding data to be plotted |
719 |
C fldTitle - Name of field to be plotted |
C fldTitle - Name of field to be plotted |
724 |
C kLo, kHi |
C kLo, kHi |
725 |
C nBx, nBy |
C nBx, nBy |
726 |
C iMin, iMax - Indexing for points to plot. Points from |
C iMin, iMax - Indexing for points to plot. Points from |
727 |
C iStr iMin -> iMax in steps of iStr are plotted |
C iStr iMin -> iMax in steps of iStr are plotted |
728 |
C jMin. jMax and similarly for jMin, jMax, jStr and |
C jMin. jMax and similarly for jMin, jMax, jStr and |
729 |
C jStr kMin, kMax, kStr and bxMin, bxMax, bxStr |
C jStr kMin, kMax, kStr and bxMin, bxMax, bxStr |
730 |
C kMin, kMax byMin, byMax, byStr. |
C kMin, kMax byMin, byMax, byStr. |
741 |
INTEGER kMin, kMax, kStr |
INTEGER kMin, kMax, kStr |
742 |
INTEGER bxMin, bxMax, bxStr |
INTEGER bxMin, bxMax, bxStr |
743 |
INTEGER byMin, byMax, byStr |
INTEGER byMin, byMax, byStr |
744 |
CEndOfInterface |
|
745 |
C == Local variables == |
C !FUNCTIONS: |
746 |
INTEGER IFNBLNK |
INTEGER IFNBLNK |
747 |
EXTERNAL IFNBLNK |
EXTERNAL IFNBLNK |
748 |
INTEGER ILNBLNK |
INTEGER ILNBLNK |
749 |
EXTERNAL ILNBLNK |
EXTERNAL ILNBLNK |
750 |
|
|
751 |
|
C !LOCAL VARIABLES: |
752 |
C == Local variables == |
C == Local variables == |
753 |
C plotBuf - Buffer for building plot record |
C plotBuf - Buffer for building plot record |
754 |
C chList - Character string used for plot |
C chList - Character string used for plot |
772 |
C Max - End index within block |
C Max - End index within block |
773 |
C Str - stride within block |
C Str - stride within block |
774 |
INTEGER MAX_LEN_PLOTBUF |
INTEGER MAX_LEN_PLOTBUF |
775 |
PARAMETER ( MAX_LEN_PLOTBUF = MAX_LEN_MBUF-4 ) |
PARAMETER ( MAX_LEN_PLOTBUF = MAX_LEN_MBUF-20 ) |
776 |
CHARACTER*(MAX_LEN_PLOTBUF) plotBuf |
CHARACTER*(MAX_LEN_PLOTBUF) plotBuf |
777 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
778 |
INTEGER lChList |
INTEGER lChList |
797 |
INTEGER I, J, K, iStrngLo, iStrngHi, iBuf, iDx |
INTEGER I, J, K, iStrngLo, iStrngHi, iBuf, iDx |
798 |
INTEGER bi, bj, bk |
INTEGER bi, bj, bk |
799 |
LOGICAL validRange |
LOGICAL validRange |
800 |
|
CEOP |
801 |
|
|
802 |
chList = '-abcdefghijklmnopqrstuvwxyz+' |
chList = '-abcdefghijklmnopqrstuvwxyz+' |
803 |
small = 1. _d -15 |
small = 1. _d -15 |
812 |
DO J=jMin, jMax, jStr |
DO J=jMin, jMax, jStr |
813 |
DO I=iMin, iMax, iStr |
DO I=iMin, iMax, iStr |
814 |
IF (printMapIncludesZeros .OR. fld(I,J,K,bi,bj) .NE. 0.) THEN |
IF (printMapIncludesZeros .OR. fld(I,J,K,bi,bj) .NE. 0.) THEN |
815 |
IF ( fld(I,J,K,bi,bj) .LT. fMin ) |
IF ( fld(I,J,K,bi,bj) .LT. fMin ) |
816 |
& fMin = fld(I,J,K,bi,bj) |
& fMin = fld(I,J,K,bi,bj) |
817 |
IF ( fld(I,J,K,bi,bj) .GT. fMax ) |
IF ( fld(I,J,K,bi,bj) .GT. fMax ) |
818 |
& fMax = fld(I,J,K,bi,bj) |
& fMax = fld(I,J,K,bi,bj) |
819 |
ENDIF |
ENDIF |
820 |
ENDDO |
ENDDO |
823 |
ENDDO |
ENDDO |
824 |
ENDDO |
ENDDO |
825 |
fRange = fMax-fMin |
fRange = fMax-fMin |
826 |
IF ( fRange .GT. small ) THEN |
IF ( fRange .GT. small ) validRange = .TRUE. |
|
validRange = .TRUE. |
|
|
ENDIF |
|
827 |
|
|
828 |
C-- Write field title and statistics |
C-- Write field title and statistics |
829 |
msgBuf = |
msgBuf = |
830 |
& '// =======================================================' |
& '// =======================================================' |
831 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
832 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
864 |
& '// 0.0: ','.' |
& '// 0.0: ','.' |
865 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
866 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
867 |
WRITE(msgBuf,'(A,3(A,I4),A)') |
WRITE(msgBuf,'(A,3(A,I6),A)') |
868 |
& '// RANGE I (Lo:Hi:Step):', |
& '// RANGE I (Lo:Hi:Step):', |
869 |
& '(',myXGlobalLo-1+(bxMin-1)*sNx+iMin, |
& '(',myXGlobalLo-1+(bxMin-1)*sNx+iMin, |
870 |
& ':',myXGlobalLo-1+(bxMax-1)*sNx+iMax, |
& ':',myXGlobalLo-1+(bxMax-1)*sNx+iMax, |
871 |
& ':',iStr,')' |
& ':',iStr,')' |
872 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
873 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
874 |
WRITE(msgBuf,'(A,3(A,I4),A)') |
WRITE(msgBuf,'(A,3(A,I6),A)') |
875 |
& '// RANGE J (Lo:Hi:Step):', |
& '// RANGE J (Lo:Hi:Step):', |
876 |
& '(',myYGlobalLo-1+(byMin-1)*sNy+jMin, |
& '(',myYGlobalLo-1+(byMin-1)*sNy+jMin, |
877 |
& ':',myYGlobalLo-1+(byMax-1)*sNy+jMax, |
& ':',myYGlobalLo-1+(byMax-1)*sNy+jMax, |
885 |
& ':',kStr,')' |
& ':',kStr,')' |
886 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
887 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
888 |
msgBuf = |
msgBuf = |
889 |
& '// =======================================================' |
& '// =======================================================' |
890 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
891 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
892 |
|
|
893 |
|
c if (Nx.gt.MAX_LEN_PLOTBUF-20) THEN |
894 |
|
c msgBuf = |
895 |
|
c & 'Model domain too big to print to terminal - skipping I/O' |
896 |
|
c CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
897 |
|
c & SQUEEZE_RIGHT, 1) |
898 |
|
c RETURN |
899 |
|
c endif |
900 |
|
|
901 |
C-- Write field |
C-- Write field |
902 |
C Figure out slice type and set plotting parameters appropriately |
C Figure out slice type and set plotting parameters appropriately |
903 |
C acc = accross the page |
C acc = accross the page |
990 |
pltStep = sNy |
pltStep = sNy |
991 |
pltLab = 'J =' |
pltLab = 'J =' |
992 |
ENDIF |
ENDIF |
993 |
C IF ( validRange ) THEN |
C- check if it fits into buffer (-10 should be enough but -12 is safer): |
994 |
|
IF ( (accMax-accMin+1)*(accBhi-accBlo+1).GT.MAX_LEN_PLOTBUF-12 |
995 |
|
& .AND. validRange ) THEN |
996 |
|
msgBuf = |
997 |
|
& 'Model domain too big to print to terminal - skipping I/O' |
998 |
|
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
999 |
|
& SQUEEZE_RIGHT, 1) |
1000 |
|
validRange = .FALSE. |
1001 |
|
ENDIF |
1002 |
|
IF ( validRange ) THEN |
1003 |
C Header |
C Header |
1004 |
C Data |
C Data |
1005 |
DO bk=pltBlo, pltBhi, pltBstr |
DO bk=pltBlo, pltBhi, pltBstr |
1009 |
CALL PRINT_MESSAGE(plotBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(plotBuf, standardMessageUnit, |
1010 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1011 |
plotBuf = ' ' |
plotBuf = ' ' |
1012 |
iBuf = 6 |
iBuf = 6 |
1013 |
DO bi=accBlo, accBhi, accBstr |
DO bi=accBlo, accBhi, accBstr |
1014 |
DO I=accMin, accMax, accStr |
DO I=accMin, accMax, accStr |
1015 |
iDx = accBase-1+(bi-1)*accStep+I |
iDx = accBase-1+(bi-1)*accStep+I |
1031 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1032 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1033 |
plotBuf = dwnLab |
plotBuf = dwnLab |
1034 |
iBuf = 7 |
iBuf = 7 |
1035 |
DO bi=accBlo, accBhi, accBstr |
DO bi=accBlo, accBhi, accBstr |
1036 |
DO I=accMin, accMax, accStr |
DO I=accMin, accMax, accStr |
1037 |
iDx = accBase-1+(bi-1)*accStep+I |
iDx = accBase-1+(bi-1)*accStep+I |
1039 |
IF ( 10*((iBuf-7)/10) .EQ. iBuf-7 ) THEN |
IF ( 10*((iBuf-7)/10) .EQ. iBuf-7 ) THEN |
1040 |
WRITE(plotBuf(iBuf:),'(A)') '|' |
WRITE(plotBuf(iBuf:),'(A)') '|' |
1041 |
ELSE |
ELSE |
1042 |
WRITE(plotBuf(iBuf:iBuf),'(I1)') MOD(iDx,10) |
WRITE(plotBuf(iBuf:iBuf),'(I1)') MOD(ABS(iDx),10) |
1043 |
ENDIF |
ENDIF |
1044 |
ENDDO |
ENDDO |
1045 |
ENDDO |
ENDDO |
1048 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1049 |
DO bj=dwnBlo, dwnBhi, dwnBStr |
DO bj=dwnBlo, dwnBhi, dwnBStr |
1050 |
DO J=dwnMin, dwnMax, dwnStr |
DO J=dwnMin, dwnMax, dwnStr |
1051 |
WRITE(plotBuf,'(1X,I5,1X)') |
WRITE(plotBuf,'(1X,I5,1X)') |
1052 |
& dwnBase-1+(bj-1)*dwnStep+J |
& dwnBase-1+(bj-1)*dwnStep+J |
1053 |
iBuf = 7 |
iBuf = 7 |
1054 |
DO bi=accBlo,accBhi,accBstr |
DO bi=accBlo,accBhi,accBstr |
1062 |
val = fld(K,I,J,bk,bi) |
val = fld(K,I,J,bk,bi) |
1063 |
ENDIF |
ENDIF |
1064 |
IF ( validRange .AND. val .NE. 0. ) THEN |
IF ( validRange .AND. val .NE. 0. ) THEN |
1065 |
IDX = NINT( |
IDX = NINT( |
1066 |
& FLOAT( lChList-1 )*( val-fMin ) / (fRange) |
& FLOAT( lChList-1 )*( val-fMin ) / (fRange) |
1067 |
& )+1 |
& )+1 |
1068 |
ELSE |
ELSE |
1069 |
IDX = 1 |
IDX = 1 |
1070 |
ENDIF |
ENDIF |
1071 |
IF ( iBuf .LE. MAX_LEN_PLOTBUF ) |
IF ( iBuf .LE. MAX_LEN_PLOTBUF ) |
1072 |
& plotBuf(iBuf:iBuf) = chList(IDX:IDX) |
& plotBuf(iBuf:iBuf) = chList(IDX:IDX) |
1073 |
IF ( val .EQ. 0. ) THEN |
IF ( val .EQ. 0. ) THEN |
1074 |
IF ( iBuf .LE. MAX_LEN_PLOTBUF ) |
IF ( iBuf .LE. MAX_LEN_PLOTBUF ) |
1075 |
& plotBuf(iBuf:iBuf) = '.' |
& plotBuf(iBuf:iBuf) = '.' |
1076 |
ENDIF |
ENDIF |
1077 |
ENDDO |
ENDDO |
1083 |
ENDDO |
ENDDO |
1084 |
ENDDO |
ENDDO |
1085 |
ENDDO |
ENDDO |
1086 |
C ENDIF |
ENDIF |
1087 |
C-- Write delimiter |
C-- Write delimiter |
1088 |
msgBuf = |
msgBuf = |
1089 |
& '// =======================================================' |
& '// =======================================================' |
1090 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1091 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1092 |
msgBuf = |
msgBuf = |
1093 |
& '// END OF FIELD =' |
& '// END OF FIELD =' |
1094 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1095 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1096 |
msgBuf = |
msgBuf = |
1097 |
& '// =======================================================' |
& '// =======================================================' |
1098 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1099 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1104 |
RETURN |
RETURN |
1105 |
END |
END |
1106 |
|
|
1107 |
CStartOfInterface |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
1108 |
|
CBOP |
1109 |
|
C !ROUTINE: PRINT_MAPRL |
1110 |
|
C !INTERFACE: |
1111 |
SUBROUTINE PRINT_MAPRL ( fld, fldTitle, plotMode, |
SUBROUTINE PRINT_MAPRL ( fld, fldTitle, plotMode, |
1112 |
I iLo, iHi, jLo, jHi, kLo, kHi, nBx, nBy, |
I iLo, iHi, jLo, jHi, kLo, kHi, nBx, nBy, |
1113 |
I iMin, iMax, iStr, |
I iMin, iMax, iStr, |
1115 |
I kMin, kMax, kStr, |
I kMin, kMax, kStr, |
1116 |
I bxMin, bxMax, bxStr, |
I bxMin, bxMax, bxStr, |
1117 |
I byMin, byMax, byStr ) |
I byMin, byMax, byStr ) |
1118 |
C /==========================================================\ |
|
1119 |
C | SUBROUTINE PRINT_MAPRL | |
C !DESCRIPTION: |
1120 |
C | o Does textual mapping printing of a field. | |
C *==========================================================* |
1121 |
C |==========================================================| |
C | SUBROUTINE PRINT\_MAPRL |
1122 |
C | This routine does the actual formatting of the data | |
C | o Does textual mapping printing of a field. |
1123 |
C | and printing to a file. It assumes an array using the | |
C *==========================================================* |
1124 |
C | MITgcm UV indexing scheme and base index variables. | |
C | This routine does the actual formatting of the data |
1125 |
C | User code should call an interface routine like | |
C | and printing to a file. It assumes an array using the |
1126 |
C | PLOT_FIELD_XYR8( ... ) rather than this code directly. | |
C | MITgcm UV indexing scheme and base index variables. |
1127 |
C | Text plots can be oriented XY, YZ, XZ. An orientation | |
C | User code should call an interface routine like |
1128 |
C | is specficied through the "plotMode" argument. All the | |
C | PLOT\_FIELD\_XYRL( ... ) rather than this code directly. |
1129 |
C | plots made by a single call to this routine will use the | |
C | Text plots can be oriented XY, YZ, XZ. An orientation |
1130 |
C | same contour interval. The plot range (iMin,...,byStr) | |
C | is specficied through the "plotMode" argument. All the |
1131 |
C | can be three-dimensional. A separate plot is made for | |
C | plots made by a single call to this routine will use the |
1132 |
C | each point in the plot range normal to the orientation. | |
C | same contour interval. The plot range (iMin,...,byStr) |
1133 |
C | e.g. if the orientation is XY (plotMode = PRINT_MAP_XY). | |
C | can be three-dimensional. A separate plot is made for |
1134 |
C | kMin =1, kMax = 5 and kStr = 2 will produce three XY| |
C | each point in the plot range normal to the orientation. |
1135 |
C | plots - one for K=1, one for K=3 and one for K=5. | |
C | e.g. if the orientation is XY (plotMode = PRINT\_MAP\_XY). |
1136 |
C | Each plot would have extents iMin:iMax step iStr | |
C | kMin =1, kMax = 5 and kStr = 2 will produce three XY |
1137 |
C | and jMin:jMax step jStr. | |
C | plots - one for K=1, one for K=3 and one for K=5. |
1138 |
C \==========================================================/ |
C | Each plot would have extents iMin:iMax step iStr |
1139 |
|
C | and jMin:jMax step jStr. |
1140 |
|
C *==========================================================* |
1141 |
|
|
1142 |
|
C !USES: |
1143 |
IMPLICIT NONE |
IMPLICIT NONE |
1144 |
|
|
1145 |
C == Global variables == |
C == Global variables == |
1146 |
#include "SIZE.h" |
#include "SIZE.h" |
1147 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
|
#include "EESUPPORT.h" |
|
1148 |
|
|
1149 |
|
C !INPUT/OUTPUT PARAMETERS: |
1150 |
C == Routine arguments == |
C == Routine arguments == |
1151 |
C fld - Real*8 array holding data to be plotted |
C fld - Real*8 array holding data to be plotted |
1152 |
C fldTitle - Name of field to be plotted |
C fldTitle - Name of field to be plotted |
1157 |
C kLo, kHi |
C kLo, kHi |
1158 |
C nBx, nBy |
C nBx, nBy |
1159 |
C iMin, iMax - Indexing for points to plot. Points from |
C iMin, iMax - Indexing for points to plot. Points from |
1160 |
C iStr iMin -> iMax in steps of iStr are plotted |
C iStr iMin -> iMax in steps of iStr are plotted |
1161 |
C jMin. jMax and similarly for jMin, jMax, jStr and |
C jMin. jMax and similarly for jMin, jMax, jStr and |
1162 |
C jStr kMin, kMax, kStr and bxMin, bxMax, bxStr |
C jStr kMin, kMax, kStr and bxMin, bxMax, bxStr |
1163 |
C kMin, kMax byMin, byMax, byStr. |
C kMin, kMax byMin, byMax, byStr. |
1174 |
INTEGER kMin, kMax, kStr |
INTEGER kMin, kMax, kStr |
1175 |
INTEGER bxMin, bxMax, bxStr |
INTEGER bxMin, bxMax, bxStr |
1176 |
INTEGER byMin, byMax, byStr |
INTEGER byMin, byMax, byStr |
1177 |
CEndOfInterface |
|
1178 |
C == Local variables == |
C !FUNCTIONS: |
1179 |
INTEGER IFNBLNK |
INTEGER IFNBLNK |
1180 |
EXTERNAL IFNBLNK |
EXTERNAL IFNBLNK |
1181 |
INTEGER ILNBLNK |
INTEGER ILNBLNK |
1182 |
EXTERNAL ILNBLNK |
EXTERNAL ILNBLNK |
1183 |
|
|
1184 |
|
C !LOCAL VARIABLES: |
1185 |
C == Local variables == |
C == Local variables == |
1186 |
C plotBuf - Buffer for building plot record |
C plotBuf - Buffer for building plot record |
1187 |
C chList - Character string used for plot |
C chList - Character string used for plot |
1205 |
C Max - End index within block |
C Max - End index within block |
1206 |
C Str - stride within block |
C Str - stride within block |
1207 |
INTEGER MAX_LEN_PLOTBUF |
INTEGER MAX_LEN_PLOTBUF |
1208 |
PARAMETER ( MAX_LEN_PLOTBUF = MAX_LEN_MBUF-4 ) |
PARAMETER ( MAX_LEN_PLOTBUF = MAX_LEN_MBUF-20 ) |
1209 |
CHARACTER*(MAX_LEN_PLOTBUF) plotBuf |
CHARACTER*(MAX_LEN_PLOTBUF) plotBuf |
1210 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
1211 |
INTEGER lChList |
INTEGER lChList |
1230 |
INTEGER I, J, K, iStrngLo, iStrngHi, iBuf, iDx |
INTEGER I, J, K, iStrngLo, iStrngHi, iBuf, iDx |
1231 |
INTEGER bi, bj, bk |
INTEGER bi, bj, bk |
1232 |
LOGICAL validRange |
LOGICAL validRange |
1233 |
|
CEOP |
1234 |
|
|
1235 |
chList = '-abcdefghijklmnopqrstuvwxyz+' |
chList = '-abcdefghijklmnopqrstuvwxyz+' |
1236 |
small = 1. _d -15 |
small = 1. _d -15 |
1244 |
DO K=kMin, kMax, kStr |
DO K=kMin, kMax, kStr |
1245 |
DO J=jMin, jMax, jStr |
DO J=jMin, jMax, jStr |
1246 |
DO I=iMin, iMax, iStr |
DO I=iMin, iMax, iStr |
1247 |
IF ( printMapIncludesZeros .OR. fld(I,J,K,bi,bj) .NE. 0. ) |
IF ( printMapIncludesZeros .OR. fld(I,J,K,bi,bj) .NE. 0. ) |
1248 |
& THEN |
& THEN |
1249 |
IF ( fld(I,J,K,bi,bj) .LT. fMin ) |
IF ( fld(I,J,K,bi,bj) .LT. fMin ) |
1250 |
& fMin = fld(I,J,K,bi,bj) |
& fMin = fld(I,J,K,bi,bj) |
1251 |
IF ( fld(I,J,K,bi,bj) .GT. fMax ) |
IF ( fld(I,J,K,bi,bj) .GT. fMax ) |
1252 |
& fMax = fld(I,J,K,bi,bj) |
& fMax = fld(I,J,K,bi,bj) |
1253 |
ENDIF |
ENDIF |
1254 |
ENDDO |
ENDDO |
1257 |
ENDDO |
ENDDO |
1258 |
ENDDO |
ENDDO |
1259 |
fRange = fMax-fMin |
fRange = fMax-fMin |
1260 |
IF ( fRange .GT. small ) THEN |
IF ( fRange .GT. small ) validRange = .TRUE. |
|
validRange = .TRUE. |
|
|
ENDIF |
|
1261 |
|
|
1262 |
C-- Write field title and statistics |
C-- Write field title and statistics |
1263 |
msgBuf = |
msgBuf = |
1264 |
& '// =======================================================' |
& '// =======================================================' |
1265 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1266 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1298 |
& '// 0.0: ','.' |
& '// 0.0: ','.' |
1299 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1300 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1301 |
WRITE(msgBuf,'(A,3(A,I4),A)') |
WRITE(msgBuf,'(A,3(A,I6),A)') |
1302 |
& '// RANGE I (Lo:Hi:Step):', |
& '// RANGE I (Lo:Hi:Step):', |
1303 |
& '(',myXGlobalLo-1+(bxMin-1)*sNx+iMin, |
& '(',myXGlobalLo-1+(bxMin-1)*sNx+iMin, |
1304 |
& ':',myXGlobalLo-1+(bxMax-1)*sNx+iMax, |
& ':',myXGlobalLo-1+(bxMax-1)*sNx+iMax, |
1305 |
& ':',iStr,')' |
& ':',iStr,')' |
1306 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1307 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1308 |
WRITE(msgBuf,'(A,3(A,I4),A)') |
WRITE(msgBuf,'(A,3(A,I6),A)') |
1309 |
& '// RANGE J (Lo:Hi:Step):', |
& '// RANGE J (Lo:Hi:Step):', |
1310 |
& '(',myYGlobalLo-1+(byMin-1)*sNy+jMin, |
& '(',myYGlobalLo-1+(byMin-1)*sNy+jMin, |
1311 |
& ':',myYGlobalLo-1+(byMax-1)*sNy+jMax, |
& ':',myYGlobalLo-1+(byMax-1)*sNy+jMax, |
1319 |
& ':',kStr,')' |
& ':',kStr,')' |
1320 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1321 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1322 |
msgBuf = |
msgBuf = |
1323 |
& '// =======================================================' |
& '// =======================================================' |
1324 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1325 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1326 |
|
|
1327 |
|
c if (Nx.gt.MAX_LEN_PLOTBUF-20) THEN |
1328 |
|
c msgBuf = |
1329 |
|
c & 'Model domain too big to print to terminal - skipping I/O' |
1330 |
|
c CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1331 |
|
c & SQUEEZE_RIGHT, 1) |
1332 |
|
c RETURN |
1333 |
|
c endif |
1334 |
|
|
1335 |
C-- Write field |
C-- Write field |
1336 |
C Figure out slice type and set plotting parameters appropriately |
C Figure out slice type and set plotting parameters appropriately |
1337 |
C acc = accross the page |
C acc = accross the page |
1424 |
pltStep = sNy |
pltStep = sNy |
1425 |
pltLab = 'J =' |
pltLab = 'J =' |
1426 |
ENDIF |
ENDIF |
1427 |
C IF ( validRange ) THEN |
C- check if it fits into buffer (-10 should be enough but -12 is safer): |
1428 |
|
IF ( (accMax-accMin+1)*(accBhi-accBlo+1).GT.MAX_LEN_PLOTBUF-12 |
1429 |
|
& .AND. validRange ) THEN |
1430 |
|
msgBuf = |
1431 |
|
& 'Model domain too big to print to terminal - skipping I/O' |
1432 |
|
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1433 |
|
& SQUEEZE_RIGHT, 1) |
1434 |
|
validRange = .FALSE. |
1435 |
|
ENDIF |
1436 |
|
IF ( validRange ) THEN |
1437 |
C Header |
C Header |
1438 |
C Data |
C Data |
1439 |
DO bk=pltBlo, pltBhi, pltBstr |
DO bk=pltBlo, pltBhi, pltBstr |
1443 |
CALL PRINT_MESSAGE(plotBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(plotBuf, standardMessageUnit, |
1444 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1445 |
plotBuf = ' ' |
plotBuf = ' ' |
1446 |
iBuf = 6 |
iBuf = 6 |
1447 |
DO bi=accBlo, accBhi, accBstr |
DO bi=accBlo, accBhi, accBstr |
1448 |
DO I=accMin, accMax, accStr |
DO I=accMin, accMax, accStr |
1449 |
iDx = accBase-1+(bi-1)*accStep+I |
iDx = accBase-1+(bi-1)*accStep+I |
1464 |
CALL PRINT_MESSAGE(plotBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(plotBuf, standardMessageUnit, |
1465 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1466 |
plotBuf = dwnLab |
plotBuf = dwnLab |
1467 |
iBuf = 7 |
iBuf = 7 |
1468 |
DO bi=accBlo, accBhi, accBstr |
DO bi=accBlo, accBhi, accBstr |
1469 |
DO I=accMin, accMax, accStr |
DO I=accMin, accMax, accStr |
1470 |
iDx = accBase-1+(bi-1)*accStep+I |
iDx = accBase-1+(bi-1)*accStep+I |
1472 |
IF ( 10*((iBuf-7)/10) .EQ. iBuf-7 ) THEN |
IF ( 10*((iBuf-7)/10) .EQ. iBuf-7 ) THEN |
1473 |
WRITE(plotBuf(iBuf:),'(A)') '|' |
WRITE(plotBuf(iBuf:),'(A)') '|' |
1474 |
ELSE |
ELSE |
1475 |
WRITE(plotBuf(iBuf:iBuf),'(I1)') MOD(iDx,10) |
WRITE(plotBuf(iBuf:iBuf),'(I1)') MOD(ABS(iDx),10) |
1476 |
ENDIF |
ENDIF |
1477 |
ENDDO |
ENDDO |
1478 |
ENDDO |
ENDDO |
1480 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1481 |
DO bj=dwnBlo, dwnBhi, dwnBStr |
DO bj=dwnBlo, dwnBhi, dwnBStr |
1482 |
DO J=dwnMin, dwnMax, dwnStr |
DO J=dwnMin, dwnMax, dwnStr |
1483 |
WRITE(plotBuf,'(1X,I5,1X)') |
WRITE(plotBuf,'(1X,I5,1X)') |
1484 |
& dwnBase-1+(bj-1)*dwnStep+J |
& dwnBase-1+(bj-1)*dwnStep+J |
1485 |
iBuf = 7 |
iBuf = 7 |
1486 |
DO bi=accBlo,accBhi,accBstr |
DO bi=accBlo,accBhi,accBstr |
1494 |
val = fld(K,I,J,bk,bi) |
val = fld(K,I,J,bk,bi) |
1495 |
ENDIF |
ENDIF |
1496 |
IF ( validRange .AND. val .NE. 0. ) THEN |
IF ( validRange .AND. val .NE. 0. ) THEN |
1497 |
IDX = NINT( |
IDX = NINT( |
1498 |
& FLOAT( lChList-1 )*( val-fMin ) / (fRange) |
& FLOAT( lChList-1 )*( val-fMin ) / (fRange) |
1499 |
& )+1 |
& )+1 |
1500 |
ELSE |
ELSE |
1501 |
IDX = 1 |
IDX = 1 |
1502 |
ENDIF |
ENDIF |
1503 |
IF ( iBuf .LE. MAX_LEN_PLOTBUF ) |
IF ( iBuf .LE. MAX_LEN_PLOTBUF ) |
1504 |
& plotBuf(iBuf:iBuf) = chList(IDX:IDX) |
& plotBuf(iBuf:iBuf) = chList(IDX:IDX) |
1505 |
IF ( val .EQ. 0. ) THEN |
IF ( val .EQ. 0. ) THEN |
1506 |
IF ( iBuf .LE. MAX_LEN_PLOTBUF ) |
IF ( iBuf .LE. MAX_LEN_PLOTBUF ) |
1507 |
& plotBuf(iBuf:iBuf) = '.' |
& plotBuf(iBuf:iBuf) = '.' |
1508 |
ENDIF |
ENDIF |
1509 |
ENDDO |
ENDDO |
1514 |
ENDDO |
ENDDO |
1515 |
ENDDO |
ENDDO |
1516 |
ENDDO |
ENDDO |
1517 |
C ENDIF |
ENDIF |
1518 |
C-- Write delimiter |
C-- Write delimiter |
1519 |
msgBuf = |
msgBuf = |
1520 |
& '// =======================================================' |
& '// =======================================================' |
1521 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1522 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1523 |
msgBuf = |
msgBuf = |
1524 |
& '// END OF FIELD =' |
& '// END OF FIELD =' |
1525 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1526 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1527 |
msgBuf = |
msgBuf = |
1528 |
& '// =======================================================' |
& '// =======================================================' |
1529 |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit, |
1530 |
& SQUEEZE_RIGHT, 1) |
& SQUEEZE_RIGHT, 1) |
1534 |
|
|
1535 |
RETURN |
RETURN |
1536 |
END |
END |
|
|
|
|
CStartOfInterface |
|
|
SUBROUTINE PRINT_MESSAGE( message, unit, sq , myThid ) |
|
|
C /============================================================\ |
|
|
C | SUBROUTINE PRINT_MESSAGE | |
|
|
C | o Write out informational message using "standard" format. | |
|
|
C | Notes | |
|
|
C | ===== | |
|
|
C | o Some system I/O is not "thread-safe". For this reason | |
|
|
C | without the FMTFTN_IO_THREAD_SAFE directive set a | |
|
|
C | critical region is defined around the write here. In some| |
|
|
C | cases BEGIN_CRIT() is approximated by only doing writes | |
|
|
C | for thread number 1 - writes for other threads are | |
|
|
C | ignored! | |
|
|
C | o In a non-parallel form these routines can still be used. | |
|
|
C | to produce pretty printed output! | |
|
|
C \============================================================/ |
|
|
IMPLICIT NONE |
|
|
C == Global data == |
|
|
#include "SIZE.h" |
|
|
#include "EEPARAMS.h" |
|
|
#include "EESUPPORT.h" |
|
|
C == Routine arguments == |
|
|
C message - Message to write |
|
|
C unit - Unit number to write to |
|
|
C sq - Justification option |
|
|
CHARACTER*(*) message |
|
|
INTEGER unit |
|
|
CHARACTER*(*) sq |
|
|
INTEGER myThid |
|
|
CEndOfInterface |
|
|
INTEGER IFNBLNK |
|
|
EXTERNAL IFNBLNK |
|
|
INTEGER ILNBLNK |
|
|
EXTERNAL ILNBLNK |
|
|
C == Local variables == |
|
|
INTEGER iStart |
|
|
INTEGER iEnd |
|
|
CHARACTER*9 idString |
|
|
C-- Find beginning and end of message |
|
|
IF ( sq .EQ. SQUEEZE_BOTH .OR. |
|
|
& sq .EQ. SQUEEZE_LEFT ) THEN |
|
|
iStart = IFNBLNK( message ) |
|
|
ELSE |
|
|
iStart = 1 |
|
|
ENDIF |
|
|
IF ( sq .EQ. SQUEEZE_BOTH .OR. |
|
|
& sq .EQ. SQUEEZE_RIGHT ) THEN |
|
|
iEnd = ILNBLNK( message ) |
|
|
ELSE |
|
|
iEnd = LEN(message) |
|
|
ENDIF |
|
|
C-- Test to see if in multi-process ( or multi-threaded ) mode. |
|
|
C If so include process or thread identifier. |
|
|
IF ( numberOfProcs .EQ. 0 .AND. nThreads .EQ. 1 ) THEN |
|
|
C-- Write single process format |
|
|
IF ( message .EQ. ' ' ) THEN |
|
|
WRITE(unit,'(A)') ' ' |
|
|
ELSE |
|
|
WRITE(unit,'(A)') message(iStart:iEnd) |
|
|
ENDIF |
|
|
ELSEIF ( pidIO .EQ. myProcId ) THEN |
|
|
C-- Write multi-process format |
|
|
#ifndef FMTFTN_IO_THREAD_SAFE |
|
|
_BEGIN_CRIT(myThid) |
|
|
#endif |
|
|
WRITE(idString,'(I4.4,A,I4.4)') myProcId,'.',myThid |
|
|
#ifndef FMTFTN_IO_THREAD_SAFE |
|
|
_END_CRIT(myThid) |
|
|
#endif |
|
|
IF ( message .EQ. ' ' ) THEN |
|
|
C PRINT can be called by several threads simultaneously. |
|
|
C The write statement may need to ne marked as a critical section. |
|
|
#ifndef FMTFTN_IO_THREAD_SAFE |
|
|
_BEGIN_CRIT(myThid) |
|
|
#endif |
|
|
WRITE(unit,'(A,A,A,A,A,A)',ERR=999) |
|
|
& '(',PROCESS_HEADER,' ',idString,')',' ' |
|
|
#ifndef FMTFTN_IO_THREAD_SAFE |
|
|
_END_CRIT(myThid) |
|
|
#endif |
|
|
ELSE |
|
|
#ifndef FMTFTN_IO_THREAD_SAFE |
|
|
_BEGIN_CRIT(myThid) |
|
|
#endif |
|
|
WRITE(unit,'(A,A,A,A,A,A,A)',ERR=999) |
|
|
& '(',PROCESS_HEADER,' ',idString(1:ILNBLNK(idString)),')',' ', |
|
|
& message(iStart:iEnd) |
|
|
#ifndef FMTFTN_IO_THREAD_SAFE |
|
|
_END_CRIT(myThid) |
|
|
#endif |
|
|
ENDIF |
|
|
ENDIF |
|
|
C |
|
|
1000 CONTINUE |
|
|
RETURN |
|
|
999 CONTINUE |
|
|
ioErrorCount(myThid) = ioErrorCount(myThid)+1 |
|
|
GOTO 1000 |
|
|
|
|
|
END |
|