/[MITgcm]/MITgcm/eesupp/src/print.F
ViewVC logotype

Diff of /MITgcm/eesupp/src/print.F

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

revision 1.14 by adcroft, Mon May 24 15:15:11 1999 UTC revision 1.21 by jmc, Tue Jan 27 15:59:23 2004 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2    C $Name$
3    
4  #include "CPP_EEOPTIONS.h"  #include "CPP_EEOPTIONS.h"
5    
# Line 18  C--    o print_mapr8    Formats ABCD... Line 19  C--    o print_mapr8    Formats ABCD...
19  C--                     Uses print_message for writing  C--                     Uses print_message for writing
20  C--    o print_message  Does IO with unhighlighted header  C--    o print_message  Does IO with unhighlighted header
21    
22  CStartOfInterface  CBOP              
23    
24    C     !ROUTINE: PRINT_ERROR
25    
26    C     !INTERFACE:
27        SUBROUTINE PRINT_ERROR( message , myThid )        SUBROUTINE PRINT_ERROR( message , myThid )
 C     /============================================================\  
 C     | SUBROUTINE PRINT_ERROR                                     |  
 C     | o Write out error 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     \============================================================/  
28        IMPLICIT NONE        IMPLICIT NONE
29    
30    C     !DESCRIPTION:
31    C     *============================================================*
32    C     | SUBROUTINE PRINT_ERROR                                      
33    C     | o Write out error message using "standard" format.          
34    C     *============================================================*
35    C     | Notes                                                      
36    C     | =====                                                      
37    C     | o Some system   I/O is not "thread-safe". For this reason  
38    C     |   without the FMTFTN_IO_THREAD_SAFE directive set a        
39    C     |   critical region is defined around the write here. In some
40    C     |   cases  BEGIN_CRIT() is approximated by only doing writes  
41    C     |   for thread number 1 - writes for other threads are        
42    C     |   ignored!                                                  
43    C     | o In a non-parallel form these routines are still used  
44    C     |   to produce pretty printed output. The process and thread
45    C     |   id prefix is omitted in this case.
46    C     *============================================================*
47    
48    C     !USES:
49  C     == Global data ==  C     == Global data ==
50  #include "SIZE.h"  #include "SIZE.h"
51  #include "EEPARAMS.h"  #include "EEPARAMS.h"
52  #include "EESUPPORT.h"  #include "EESUPPORT.h"
 C     == Routine arguments ==  
       CHARACTER*(*) message  
       INTEGER       myThid  
 CEndOfInterface  
53        INTEGER  IFNBLNK        INTEGER  IFNBLNK
54        EXTERNAL IFNBLNK        EXTERNAL IFNBLNK
55        INTEGER  ILNBLNK        INTEGER  ILNBLNK
56        EXTERNAL ILNBLNK        EXTERNAL ILNBLNK
57    
58    C     !INPUT/OUTPUT PARAMETERS:
59    C     == Routine arguments ==
60    C     message :: Text string to print
61    C     myThid  :: Thread number of this instance
62          CHARACTER*(*) message
63          INTEGER       myThid
64    
65    C     !LOCAL VARIABLES:
66  C     == Local variables ==  C     == Local variables ==
67    C     iStart, iEnd :: Temps. for string indexing
68    C     idString     :: Temp. for building message prefix
69        INTEGER iStart        INTEGER iStart
70        INTEGER iEnd        INTEGER iEnd
71        CHARACTER*9 idString        CHARACTER*9 idString
72    CEOP
73    
74  C--   Find beginning and end of message  C--   Find beginning and end of message
75        iStart = IFNBLNK( message )        iStart = IFNBLNK( message )
76        iEnd   = ILNBLNK( message )        iEnd   = ILNBLNK( message )
# Line 97  C       The write statement may need to Line 117  C       The write statement may need to
117  #endif  #endif
118         ENDIF         ENDIF
119        ENDIF        ENDIF
120  C  
121    #ifndef DISABLE_WRITE_TO_UNIT_ZERO
122    C--   also write directly to unit 0 :
123          IF ( numberOfProcs .EQ. 1 .AND. nThreads .EQ. 1 ) THEN
124            IF (iEnd.NE.0) WRITE(0,'(A)') message(1:iEnd)
125          ENDIF
126    #endif
127    
128   1000 CONTINUE   1000 CONTINUE
129        RETURN        RETURN
130    
# Line 106  C Line 133  C
133        GOTO 1000        GOTO 1000
134        END        END
135    
136  CStartofinterface  CBOP
137    C     !ROUTINE: PRINT_LIST_I
138    
139    C     !INTERFACE:
140        SUBROUTINE PRINT_LIST_I( fld, lFld, index_type,        SUBROUTINE PRINT_LIST_I( fld, lFld, index_type,
141       &                         markEnd, compact, ioUnit )       &                         markEnd, compact, ioUnit )
 C     /==========================================================\  
 C     | o SUBROUTINE PRINT_LIST_I                                |  
 C     |==========================================================|  
 C     | Routine for producing list of values for a field with    |  
 C     | duplicate values collected into                          |  
 C     |    n @ value                                             |  
 C     | record.                                                  |  
 C     \==========================================================/  
142        IMPLICIT NONE        IMPLICIT NONE
143    C     !DESCRIPTION:
144    C     *==========================================================*
145    C     | o SUBROUTINE PRINT_LIST_I                                
146    C     *==========================================================*
147    C     | Routine for producing list of values for a field with    
148    C     | duplicate values collected into                          
149    C     |    n @ value                                              
150    C     | record.                                                  
151    C     *==========================================================*
152    
153    C     !USES:
154  C     == Global data ==    C     == Global data ==  
155  #include "SIZE.h"  #include "SIZE.h"
156  #include "EEPARAMS.h"  #include "EEPARAMS.h"
157    
158    C     !INPUT/OUTPUT PARAMETERS:
159  C     == Routine arguments ==  C     == Routine arguments ==
160  C     fld    -  Data to be printed  C     fld    ::  Data to be printed
161  C     lFld   -  Number of elements to be printed  C     lFld   ::  Number of elements to be printed
162  C     index_type - Flag indicating which type of index to print  C     index_type :: Flag indicating which type of index to print
163  C                  INDEX_K    => /* K = nnn */  C                   INDEX_K    => /* K = nnn */
164  C                  INDEX_I    => /* I = nnn */  C                   INDEX_I    => /* I = nnn */
165  C                  INDEX_J    => /* J = nnn */  C                   INDEX_J    => /* J = nnn */
166  C                  INDEX_NONE =>  C                   INDEX_NONE =>
167  C     compact -  Flag to control use of repeat symbol for same valued  C     compact ::  Flag to control use of repeat symbol for same valued
168  C                fields.  C                 fields.
169  C     markEnd -  Flag to control whether there is a separator after the  C     markEnd ::  Flag to control whether there is a separator after the
170  C                last element  C                 last element
171  C     ioUnit -  Unit number for IO.  C     ioUnit ::   Unit number for IO.
172        INTEGER lFld        INTEGER lFld
173        INTEGER index_type        INTEGER index_type
174        INTEGER fld(lFld)        INTEGER fld(lFld)
175        LOGICAL markEnd        LOGICAL markEnd
176        LOGICAL compact        LOGICAL compact
177        INTEGER ioUnit        INTEGER ioUnit
 CEndifinterface  
178    
179    C     !LOCAL VARIABLES:
180  C     == Local variables ==  C     == Local variables ==
181  C     iLo  - Range index holders for selecting elements with  C     iLo  - Range index holders for selecting elements with
182  C     iHi    with the same value  C     iHi    with the same value
# Line 162  C     K    - Loop counter Line 195  C     K    - Loop counter
195        CHARACTER*2 commOpen,commClose        CHARACTER*2 commOpen,commClose
196        CHARACTER*3 index_lab        CHARACTER*3 index_lab
197        INTEGER K        INTEGER K
198    CEOP
199    
200        IF     ( index_type .EQ. INDEX_I ) THEN        IF     ( index_type .EQ. INDEX_I ) THEN
201         index_lab = 'I ='         index_lab = 'I ='
# Line 180  C     K    - Loop counter Line 214  C     K    - Loop counter
214        xOld = fld(1)        xOld = fld(1)
215        DO K=2,lFld        DO K=2,lFld
216         xNew = fld(K  )         xNew = fld(K  )
217         IF ( .NOT. compact .OR. xNew .NE. xOld ) THEN         IF ( .NOT. compact .OR. (xNew .NE. xOld) ) THEN
218          nDup = iHi-iLo+1          nDup = iHi-iLo+1
219          IF ( nDup .EQ. 1 ) THEN          IF ( nDup .EQ. 1 ) THEN
220           WRITE(msgBuf,'(A,I9,A)') '              ',xOld,punc           WRITE(msgBuf,'(A,I9,A)') '              ',xOld,punc
# Line 188  C     K    - Loop counter Line 222  C     K    - Loop counter
222       &    WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)')       &    WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)')
223       &    commOpen,index_lab,iLo,commClose       &    commOpen,index_lab,iLo,commClose
224          ELSE          ELSE
225           WRITE(msgBuf,'(I,'' '',A,I9,A)') nDup,'@',xOld,punc           WRITE(msgBuf,'(I5,'' '',A,I9,A)') nDup,'@',xOld,punc
226           IF ( index_type .NE. INDEX_NONE )           IF ( index_type .NE. INDEX_NONE )
227       &    WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)')       &    WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)')
228       &    commOpen,index_lab,iLo,':',iHi,commClose       &    commOpen,index_lab,iLo,':',iHi,commClose
# Line 210  C     K    - Loop counter Line 244  C     K    - Loop counter
244       &  WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)')       &  WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)')
245       &  commOpen,index_lab,iLo,commClose       &  commOpen,index_lab,iLo,commClose
246        ELSEIF( nDup .GT. 1 ) THEN        ELSEIF( nDup .GT. 1 ) THEN
247         WRITE(msgBuf,'(I,'' '',A,I9,A)') nDup,'@',xOld,punc         WRITE(msgBuf,'(I5,'' '',A,I9,A)') nDup,'@',xOld,punc
248         IF ( index_type .NE. INDEX_NONE )         IF ( index_type .NE. INDEX_NONE )
249       &  WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)')       &  WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)')
250       &  commOpen,index_lab,iLo,':',iHi,commClose       &  commOpen,index_lab,iLo,':',iHi,commClose
# Line 220  C     K    - Loop counter Line 254  C     K    - Loop counter
254        RETURN        RETURN
255        END        END
256    
257  CStartofinterface  CBOP
258    C     !ROUTINE: PRINT_LIST_L
259    
260    C     !INTERFACE:
261        SUBROUTINE PRINT_LIST_L( fld, lFld, index_type, markEnd,        SUBROUTINE PRINT_LIST_L( fld, lFld, index_type, markEnd,
262       &                         compact, ioUnit )       &                         compact, ioUnit )
 C     /==========================================================\  
 C     | o SUBROUTINE PRINT_LIST_L                                |  
 C     |==========================================================|  
 C     | Routine for producing list of values for a field with    |  
 C     | duplicate values collected into                          |  
 C     |    n @ value                                             |  
 C     | record.                                                  |  
 C     \==========================================================/  
263        IMPLICIT NONE        IMPLICIT NONE
264    C     !DESCRIPTION:
265    C     *==========================================================*
266    C     | o SUBROUTINE PRINT_LIST_L                                
267    C     *==========================================================*
268    C     | Routine for producing list of values for a field with    
269    C     | duplicate values collected into                          
270    C     |    n @ value                                              
271    C     | record.                                                  
272    C     *==========================================================*
273    
274    C     !USES:
275  C     == Global data ==    C     == Global data ==  
276  #include "SIZE.h"  #include "SIZE.h"
277  #include "EEPARAMS.h"  #include "EEPARAMS.h"
278    
279    C     !INPUT/OUTPUT PARAMETERS:
280  C     == Routine arguments ==  C     == Routine arguments ==
281  C     fld    -  Data to be printed  C     fld    -  Data to be printed
282  C     lFld   -  Number of elements to be printed  C     lFld   -  Number of elements to be printed
# Line 256  C     ioUnit -  Unit number for IO. Line 296  C     ioUnit -  Unit number for IO.
296        LOGICAL markEnd        LOGICAL markEnd
297        LOGICAL compact        LOGICAL compact
298        INTEGER ioUnit        INTEGER ioUnit
 CEndifinterface  
299    
300    C     !LOCAL VARIABLES:
301  C     == Local variables ==  C     == Local variables ==
302  C     iLo  - Range index holders for selecting elements with  C     iLo  - Range index holders for selecting elements with
303  C     iHi    with the same value  C     iHi    with the same value
# Line 276  C     K    - Loop counter Line 316  C     K    - Loop counter
316        CHARACTER*2 commOpen,commClose        CHARACTER*2 commOpen,commClose
317        CHARACTER*3 index_lab        CHARACTER*3 index_lab
318        INTEGER K        INTEGER K
319    CEOP
320    
321        IF     ( index_type .EQ. INDEX_I ) THEN        IF     ( index_type .EQ. INDEX_I ) THEN
322         index_lab = 'I ='         index_lab = 'I ='
# Line 294  C     K    - Loop counter Line 335  C     K    - Loop counter
335        xOld = fld(1)        xOld = fld(1)
336        DO K=2,lFld        DO K=2,lFld
337         xNew = fld(K  )         xNew = fld(K  )
338         IF ( .NOT. compact .OR. xNew .NEQV. xOld ) THEN         IF ( .NOT. compact .OR. (xNew .NEQV. xOld) ) THEN
339          nDup = iHi-iLo+1          nDup = iHi-iLo+1
340          IF ( nDup .EQ. 1 ) THEN          IF ( nDup .EQ. 1 ) THEN
341           WRITE(msgBuf,'(A,L5,A)') '              ',xOld,punc           WRITE(msgBuf,'(A,L5,A)') '              ',xOld,punc
# Line 302  C     K    - Loop counter Line 343  C     K    - Loop counter
343       &    WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)')       &    WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)')
344       &    commOpen,index_lab,iLo,commClose       &    commOpen,index_lab,iLo,commClose
345          ELSE          ELSE
346           WRITE(msgBuf,'(I,'' '',A,L5,A)') nDup,'@',xOld,punc           WRITE(msgBuf,'(I5,'' '',A,L5,A)') nDup,'@',xOld,punc
347           IF ( index_type .NE. INDEX_NONE )           IF ( index_type .NE. INDEX_NONE )
348       &    WRITE(msgBuf(45:),'(A,1X,A,L3,A,I3,1X,A)')       &    WRITE(msgBuf(45:),'(A,1X,A,L3,A,I3,1X,A)')
349       &    commOpen,index_lab,iLo,':',iHi,commClose       &    commOpen,index_lab,iLo,':',iHi,commClose
# Line 324  C     K    - Loop counter Line 365  C     K    - Loop counter
365       &  WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)')       &  WRITE(msgBuf(45:),'(A,1X,A,I3,1X,A)')
366       &    commOpen,index_lab,iLo,commClose       &    commOpen,index_lab,iLo,commClose
367        ELSEIF( nDup .GT. 1 ) THEN        ELSEIF( nDup .GT. 1 ) THEN
368         WRITE(msgBuf,'(I,'' '',A,L5,A)') nDup,'@',xOld,punc         WRITE(msgBuf,'(I5,'' '',A,L5,A)') nDup,'@',xOld,punc
369         IF ( index_type .NE. INDEX_NONE )         IF ( index_type .NE. INDEX_NONE )
370       &  WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)')       &  WRITE(msgBuf(45:),'(A,1X,A,I3,A,I3,1X,A)')
371       &  commOpen,index_lab,iLo,':',iHi,commClose       &  commOpen,index_lab,iLo,':',iHi,commClose
# Line 334  C     K    - Loop counter Line 375  C     K    - Loop counter
375        RETURN        RETURN
376        END        END
377    
378  CStartofinterface  CBOP
379    C     !ROUTINE: PRINT_LIST_R8
380    C     !INTERFACE:
381        SUBROUTINE PRINT_LIST_R8( fld, lFld, index_type,        SUBROUTINE PRINT_LIST_R8( fld, lFld, index_type,
382       &    markEnd, compact, ioUnit )       &    markEnd, compact, ioUnit )
 C     /==========================================================\  
 C     | o SUBROUTINE PRINT_LIST_R8                               |  
 C     |==========================================================|  
 C     | Routine for producing list of values for a field with    |  
 C     | duplicate values collected into                          |  
 C     |    n @ value                                             |  
 C     | record.                                                  |  
 C     \==========================================================/  
383        IMPLICIT NONE        IMPLICIT NONE
384    C     !DESCRIPTION:
385    C     *==========================================================*
386    C     | o SUBROUTINE PRINT_LIST_R8                                
387    C     *==========================================================*
388    C     | Routine for producing list of values for a field with    
389    C     | duplicate values collected into                          
390    C     |    n @ value                                              
391    C     | record.                                                  
392    C     *==========================================================*
393    
394  C     == Global data ==    C     !USES:
395    C     == Global data ==
396  #include "SIZE.h"  #include "SIZE.h"
397  #include "EEPARAMS.h"  #include "EEPARAMS.h"
398    
399    C     !INPUT/OUTPUT PARAMETERS:
400  C     == Routine arguments ==  C     == Routine arguments ==
401  C     fld    -  Data to be printed  C     fld    -  Data to be printed
402  C     lFld   -  Number of elements to be printed  C     lFld   -  Number of elements to be printed
# Line 370  C     ioUnit -  Unit number for IO. Line 416  C     ioUnit -  Unit number for IO.
416        LOGICAL markEnd        LOGICAL markEnd
417        LOGICAL compact        LOGICAL compact
418        INTEGER ioUnit        INTEGER ioUnit
 CEndifinterface  
419    
420    C     !LOCA VARIABLES:
421  C     == Local variables ==  C     == Local variables ==
422  C     iLo  - Range index holders for selecting elements with  C     iLo  - Range index holders for selecting elements with
423  C     iHi    with the same value  C     iHi    with the same value
# Line 390  C     K    - Loop counter Line 436  C     K    - Loop counter
436        CHARACTER*2 commOpen,commClose        CHARACTER*2 commOpen,commClose
437        CHARACTER*3 index_lab        CHARACTER*3 index_lab
438        INTEGER K        INTEGER K
439    CEOP
440    
441        IF     ( index_type .EQ. INDEX_I ) THEN        IF     ( index_type .EQ. INDEX_I ) THEN
442         index_lab = 'I ='         index_lab = 'I ='
# Line 408  C     K    - Loop counter Line 455  C     K    - Loop counter
455        xOld = fld(1)        xOld = fld(1)
456        DO K=2,lFld        DO K=2,lFld
457         xNew = fld(K  )         xNew = fld(K  )
458         IF ( .NOT. compact .OR. xNew .NE. xOld ) THEN         IF ( .NOT. compact .OR. (xNew .NE. xOld) ) THEN
459          nDup = iHi-iLo+1          nDup = iHi-iLo+1
460          IF ( nDup .EQ. 1 ) THEN          IF ( nDup .EQ. 1 ) THEN
461           WRITE(msgBuf,'(A,1PE23.15,A)') '              ',xOld,punc           WRITE(msgBuf,'(A,1PE23.15,A)') '              ',xOld,punc
# Line 450  C     K    - Loop counter Line 497  C     K    - Loop counter
497        RETURN        RETURN
498        END        END
499    
500  CStartOfInterface  CBOP
501    C     !ROUTINE: PRINT_MAPRS
502    C     !INTERFACE:
503        SUBROUTINE PRINT_MAPRS ( fld, fldTitle, plotMode,        SUBROUTINE PRINT_MAPRS ( fld, fldTitle, plotMode,
504       I        iLo,   iHi,   jLo,   jHi,  kLo,  kHi, nBx, nBy,       I        iLo,   iHi,   jLo,   jHi,  kLo,  kHi, nBx, nBy,
505       I       iMin,  iMax,  iStr,       I       iMin,  iMax,  iStr,
# Line 458  CStartOfInterface Line 507  CStartOfInterface
507       I       kMin, kMax,   kStr,       I       kMin, kMax,   kStr,
508       I      bxMin, bxMax,  bxStr,       I      bxMin, bxMax,  bxStr,
509       I      byMin, byMax,  byStr )       I      byMin, byMax,  byStr )
 C     /==========================================================\  
 C     | SUBROUTINE PRINT_MAPR4                                   |  
 C     | o Does textual mapping printing of a field.              |  
 C     |==========================================================|  
 C     | This routine does the actual formatting of the data      |  
 C     | and printing to a file. It assumes an array using the    |  
 C     | MITgcm UV indexing scheme and base index variables.      |  
 C     | User code should call an interface routine like          |  
 C     | PLOT_FIELD_XYR4( ... ) rather than this code directly.   |  
 C     | Text plots can be oriented XY, YZ, XZ. An orientation    |  
 C     | is specficied through the "plotMode" argument. All the   |  
 C     | plots made by a single call to this routine will use the |  
 C     | same contour interval. The plot range (iMin,...,byStr)   |  
 C     | can be three-dimensional. A separate plot is made for    |  
 C     | each point in the plot range normal to the orientation.  |  
 C     | e.g. if the orientation is XY (plotMode = PRINT_MAP_XY). |  
 C     |      kMin =1, kMax = 5 and kStr = 2 will produce three XY|  
 C     |      plots - one for K=1, one for K=3 and one for K=5.   |  
 C     |      Each plot would have extents iMin:iMax step iStr    |  
 C     |      and jMin:jMax step jStr.                            |  
 C     \==========================================================/  
510        IMPLICIT NONE        IMPLICIT NONE
511    C     !DESCRIPTION:
512    C     *==========================================================*
513    C     | SUBROUTINE PRINT_MAPR4                                    
514    C     | o Does textual mapping printing of a field.              
515    C     *==========================================================*
516    C     | This routine does the actual formatting of the data      
517    C     | and printing to a file. It assumes an array using the    
518    C     | MITgcm UV indexing scheme and base index variables.      
519    C     | User code should call an interface routine like          
520    C     | PLOT_FIELD_XYR4( ... ) rather than this code directly.    
521    C     | Text plots can be oriented XY, YZ, XZ. An orientation    
522    C     | is specficied through the "plotMode" argument. All the    
523    C     | plots made by a single call to this routine will use the  
524    C     | same contour interval. The plot range (iMin,...,byStr)    
525    C     | can be three-dimensional. A separate plot is made for    
526    C     | each point in the plot range normal to the orientation.  
527    C     | e.g. if the orientation is XY (plotMode = PRINT_MAP_XY).  
528    C     |      kMin =1, kMax = 5 and kStr = 2 will produce three XY
529    C     |      plots - one for K=1, one for K=3 and one for K=5.    
530    C     |      Each plot would have extents iMin:iMax step iStr    
531    C     |      and jMin:jMax step jStr.                            
532    C     *==========================================================*
533    
534    C     !USES:
535  C     == Global variables ==  C     == Global variables ==
536  #include "SIZE.h"  #include "SIZE.h"
537  #include "EEPARAMS.h"  #include "EEPARAMS.h"
538  #include "EESUPPORT.h"  #include "EESUPPORT.h"
539          INTEGER  IFNBLNK
540          EXTERNAL IFNBLNK
541          INTEGER  ILNBLNK
542          EXTERNAL ILNBLNK
543    
544    C     !INPUT/OUTPUT PARAMETERS:
545  C     == Routine arguments ==  C     == Routine arguments ==
546  C     fld        - Real*4 array holding data to be plotted  C     fld        - Real*4 array holding data to be plotted
547  C     fldTitle   - Name of field to be plotted  C     fldTitle   - Name of field to be plotted
# Line 513  C     kStr Line 569  C     kStr
569        INTEGER kMin, kMax, kStr        INTEGER kMin, kMax, kStr
570        INTEGER bxMin, bxMax, bxStr        INTEGER bxMin, bxMax, bxStr
571        INTEGER byMin, byMax, byStr        INTEGER byMin, byMax, byStr
 CEndOfInterface  
 C     == Local variables ==  
       INTEGER  IFNBLNK  
       EXTERNAL IFNBLNK  
       INTEGER  ILNBLNK  
       EXTERNAL ILNBLNK  
572    
573    C     !LOCAL VARIABLES:
574  C     == Local variables ==  C     == Local variables ==
575  C     plotBuf - Buffer for building plot record  C     plotBuf - Buffer for building plot record
576  C     chList  - Character string used for plot  C     chList  - Character string used for plot
# Line 568  C               Str  - stride within blo Line 619  C               Str  - stride within blo
619        INTEGER I, J, K, iStrngLo, iStrngHi, iBuf, iDx        INTEGER I, J, K, iStrngLo, iStrngHi, iBuf, iDx
620        INTEGER bi, bj, bk        INTEGER bi, bj, bk
621        LOGICAL validRange        LOGICAL validRange
622    CEOP
623    
624        chList = '-abcdefghijklmnopqrstuvwxyz+'        chList = '-abcdefghijklmnopqrstuvwxyz+'
625        small  =  1. _d -15        small  =  1. _d -15
# Line 593  C--   Calculate field range Line 645  C--   Calculate field range
645         ENDDO         ENDDO
646        ENDDO        ENDDO
647        fRange = fMax-fMin        fRange = fMax-fMin
648        IF ( fRange .GT. small ) THEN        IF ( fRange .GT. small .AND.
649         validRange = .TRUE.       &     (MAX_LEN_PLOTBUF-35) .GT. sNx*nSx .AND.
650        ENDIF       &     (MAX_LEN_PLOTBUF-35) .GT. sNy*nSy ) validRange = .TRUE.
651    
652  C--   Write field title and statistics  C--   Write field title and statistics
653        msgBuf =        msgBuf =
# Line 754  C      X across, Z down slice Line 806  C      X across, Z down slice
806         pltStep = sNy         pltStep = sNy
807         pltLab  = 'J ='         pltLab  = 'J ='
808        ENDIF        ENDIF
809  C     IF ( validRange ) THEN        IF ( validRange ) THEN
810  C      Header  C      Header
811  C      Data  C      Data
812         DO bk=pltBlo, pltBhi, pltBstr         DO bk=pltBlo, pltBhi, pltBstr
# Line 838  C      Data Line 890  C      Data
890           ENDDO           ENDDO
891          ENDDO          ENDDO
892         ENDDO         ENDDO
893  C     ENDIF        ENDIF
894  C--   Write delimiter  C--   Write delimiter
895        msgBuf =        msgBuf =
896       & '// ======================================================='       & '// ======================================================='
# Line 859  C--   Write delimiter Line 911  C--   Write delimiter
911        RETURN        RETURN
912        END        END
913    
914  CStartOfInterface  CBOP
915    C     !ROUTINE: PRINT_MAPRL
916    
917    C     !INTERFACE:
918        SUBROUTINE PRINT_MAPRL ( fld, fldTitle, plotMode,        SUBROUTINE PRINT_MAPRL ( fld, fldTitle, plotMode,
919       I        iLo,   iHi,   jLo,   jHi,  kLo,  kHi, nBx, nBy,       I        iLo,   iHi,   jLo,   jHi,  kLo,  kHi, nBx, nBy,
920       I       iMin,  iMax,  iStr,       I       iMin,  iMax,  iStr,
# Line 867  CStartOfInterface Line 922  CStartOfInterface
922       I       kMin, kMax,   kStr,       I       kMin, kMax,   kStr,
923       I      bxMin, bxMax,  bxStr,       I      bxMin, bxMax,  bxStr,
924       I      byMin, byMax,  byStr )       I      byMin, byMax,  byStr )
 C     /==========================================================\  
 C     | SUBROUTINE PRINT_MAPRL                                   |  
 C     | o Does textual mapping printing of a field.              |  
 C     |==========================================================|  
 C     | This routine does the actual formatting of the data      |  
 C     | and printing to a file. It assumes an array using the    |  
 C     | MITgcm UV indexing scheme and base index variables.      |  
 C     | User code should call an interface routine like          |  
 C     | PLOT_FIELD_XYR8( ... ) rather than this code directly.   |  
 C     | Text plots can be oriented XY, YZ, XZ. An orientation    |  
 C     | is specficied through the "plotMode" argument. All the   |  
 C     | plots made by a single call to this routine will use the |  
 C     | same contour interval. The plot range (iMin,...,byStr)   |  
 C     | can be three-dimensional. A separate plot is made for    |  
 C     | each point in the plot range normal to the orientation.  |  
 C     | e.g. if the orientation is XY (plotMode = PRINT_MAP_XY). |  
 C     |      kMin =1, kMax = 5 and kStr = 2 will produce three XY|  
 C     |      plots - one for K=1, one for K=3 and one for K=5.   |  
 C     |      Each plot would have extents iMin:iMax step iStr    |  
 C     |      and jMin:jMax step jStr.                            |  
 C     \==========================================================/  
925        IMPLICIT NONE        IMPLICIT NONE
926    
927    C     !DESCRIPTION:
928    C     *==========================================================*
929    C     | SUBROUTINE PRINT_MAPRL                                    
930    C     | o Does textual mapping printing of a field.              
931    C     *==========================================================*
932    C     | This routine does the actual formatting of the data      
933    C     | and printing to a file. It assumes an array using the    
934    C     | MITgcm UV indexing scheme and base index variables.      
935    C     | User code should call an interface routine like          
936    C     | PLOT_FIELD_XYR8( ... ) rather than this code directly.    
937    C     | Text plots can be oriented XY, YZ, XZ. An orientation    
938    C     | is specficied through the "plotMode" argument. All the    
939    C     | plots made by a single call to this routine will use the  
940    C     | same contour interval. The plot range (iMin,...,byStr)    
941    C     | can be three-dimensional. A separate plot is made for    
942    C     | each point in the plot range normal to the orientation.  
943    C     | e.g. if the orientation is XY (plotMode = PRINT_MAP_XY).  
944    C     |      kMin =1, kMax = 5 and kStr = 2 will produce three XY
945    C     |      plots - one for K=1, one for K=3 and one for K=5.    
946    C     |      Each plot would have extents iMin:iMax step iStr    
947    C     |      and jMin:jMax step jStr.                            
948    C     *==========================================================*
949    
950    C     !USES:
951  C     == Global variables ==  C     == Global variables ==
952  #include "SIZE.h"  #include "SIZE.h"
953  #include "EEPARAMS.h"  #include "EEPARAMS.h"
954  #include "EESUPPORT.h"  #include "EESUPPORT.h"
955          INTEGER  IFNBLNK
956          EXTERNAL IFNBLNK
957          INTEGER  ILNBLNK
958          EXTERNAL ILNBLNK
959    
960    C     !INPUT/OUTPUT PARAMETERS:
961  C     == Routine arguments ==  C     == Routine arguments ==
962  C     fld        - Real*8 array holding data to be plotted  C     fld        - Real*8 array holding data to be plotted
963  C     fldTitle   - Name of field to be plotted  C     fldTitle   - Name of field to be plotted
# Line 922  C     kStr Line 985  C     kStr
985        INTEGER kMin, kMax, kStr        INTEGER kMin, kMax, kStr
986        INTEGER bxMin, bxMax, bxStr        INTEGER bxMin, bxMax, bxStr
987        INTEGER byMin, byMax, byStr        INTEGER byMin, byMax, byStr
 CEndOfInterface  
 C     == Local variables ==  
       INTEGER  IFNBLNK  
       EXTERNAL IFNBLNK  
       INTEGER  ILNBLNK  
       EXTERNAL ILNBLNK  
988    
989    C     !LOCAL VARIABLES:
990  C     == Local variables ==  C     == Local variables ==
991  C     plotBuf - Buffer for building plot record  C     plotBuf - Buffer for building plot record
992  C     chList  - Character string used for plot  C     chList  - Character string used for plot
# Line 977  C               Str  - stride within blo Line 1035  C               Str  - stride within blo
1035        INTEGER I, J, K, iStrngLo, iStrngHi, iBuf, iDx        INTEGER I, J, K, iStrngLo, iStrngHi, iBuf, iDx
1036        INTEGER bi, bj, bk        INTEGER bi, bj, bk
1037        LOGICAL validRange        LOGICAL validRange
1038    CEOP
1039    
1040        chList = '-abcdefghijklmnopqrstuvwxyz+'        chList = '-abcdefghijklmnopqrstuvwxyz+'
1041        small  = 1. _d -15        small  = 1. _d -15
# Line 1003  C--   Calculate field range Line 1062  C--   Calculate field range
1062         ENDDO         ENDDO
1063        ENDDO        ENDDO
1064        fRange = fMax-fMin        fRange = fMax-fMin
1065        IF ( fRange .GT. small ) THEN        IF ( fRange .GT. small .AND.
1066         validRange = .TRUE.       &     (MAX_LEN_PLOTBUF-35) .GT. sNx*nSx .AND.
1067        ENDIF       &     (MAX_LEN_PLOTBUF-35) .GT. sNy*nSy ) validRange = .TRUE.
1068    
1069  C--   Write field title and statistics  C--   Write field title and statistics
1070        msgBuf =        msgBuf =
# Line 1164  C      X across, Z down slice Line 1223  C      X across, Z down slice
1223         pltStep = sNy         pltStep = sNy
1224         pltLab  = 'J ='         pltLab  = 'J ='
1225        ENDIF        ENDIF
1226  C     IF ( validRange ) THEN        IF ( validRange ) THEN
1227  C      Header  C      Header
1228  C      Data  C      Data
1229         DO bk=pltBlo, pltBhi, pltBstr         DO bk=pltBlo, pltBhi, pltBstr
# Line 1245  C      Data Line 1304  C      Data
1304           ENDDO           ENDDO
1305          ENDDO          ENDDO
1306         ENDDO         ENDDO
1307  C     ENDIF        ENDIF
1308  C--   Write delimiter  C--   Write delimiter
1309        msgBuf =        msgBuf =
1310       & '// ======================================================='       & '// ======================================================='
# Line 1266  C--   Write delimiter Line 1325  C--   Write delimiter
1325        RETURN        RETURN
1326        END        END
1327    
1328  CStartOfInterface  CBOP
1329    C     !ROUTINE: PRINT_MESSAGE
1330    
1331    C     !INTERFACE:
1332        SUBROUTINE PRINT_MESSAGE( message, unit, sq , myThid )        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     \============================================================/  
1333        IMPLICIT NONE        IMPLICIT NONE
1334    C     !DESCRIPTION:
1335    C     *============================================================*
1336    C     | SUBROUTINE PRINT_MESSAGE                                    
1337    C     | o Write out informational message using "standard" format.  
1338    C     *============================================================*
1339    C     | Notes                                                      
1340    C     | =====                                                      
1341    C     | o Some system   I/O is not "thread-safe". For this reason  
1342    C     |   without the FMTFTN_IO_THREAD_SAFE directive set a        
1343    C     |   critical region is defined around the write here. In some
1344    C     |   cases  BEGIN_CRIT() is approximated by only doing writes  
1345    C     |   for thread number 1 - writes for other threads are        
1346    C     |   ignored!                                                  
1347    C     | o In a non-parallel form these routines can still be used.  
1348    C     |   to produce pretty printed output!                        
1349    C     *============================================================*
1350    
1351    C     !USES:
1352  C     == Global data ==  C     == Global data ==
1353  #include "SIZE.h"  #include "SIZE.h"
1354  #include "EEPARAMS.h"  #include "EEPARAMS.h"
1355  #include "EESUPPORT.h"  #include "EESUPPORT.h"
1356          INTEGER  IFNBLNK
1357          EXTERNAL IFNBLNK
1358          INTEGER  ILNBLNK
1359          EXTERNAL ILNBLNK
1360    
1361    C     !INPUT/OUTPUT PARAMETERS:
1362  C     == Routine arguments ==  C     == Routine arguments ==
1363  C     message - Message to write  C     message :: Message to write
1364  C     unit    - Unit number to write to  C     unit    :: Unit number to write to
1365  C     sq      - Justification option  C     sq      :: Justification option
1366        CHARACTER*(*) message        CHARACTER*(*) message
1367        INTEGER       unit        INTEGER       unit
1368        CHARACTER*(*) sq        CHARACTER*(*) sq
1369        INTEGER  myThid        INTEGER  myThid
1370  CEndOfInterface  
1371        INTEGER  IFNBLNK  C     !LOCAL VARIABLES:
       EXTERNAL IFNBLNK  
       INTEGER  ILNBLNK  
       EXTERNAL ILNBLNK  
1372  C     == Local variables ==  C     == Local variables ==
1373    C     iStart, iEnd :: String indexing variables
1374    C     idString     :: Temp. for building prefix.
1375        INTEGER iStart        INTEGER iStart
1376        INTEGER iEnd        INTEGER iEnd
1377        CHARACTER*9 idString        CHARACTER*9 idString
1378    CEOP
1379    
1380  C--   Find beginning and end of message  C--   Find beginning and end of message
1381        IF ( sq .EQ. SQUEEZE_BOTH .OR.        IF ( sq .EQ. SQUEEZE_BOTH .OR.
1382       &     sq .EQ. SQUEEZE_LEFT ) THEN       &     sq .EQ. SQUEEZE_LEFT ) THEN
# Line 1358  C       The write statement may need to Line 1431  C       The write statement may need to
1431  #endif  #endif
1432         ENDIF         ENDIF
1433        ENDIF        ENDIF
1434    
1435    #ifndef DISABLE_WRITE_TO_UNIT_ZERO
1436    C--   if error message, also write directly to unit 0 :
1437          IF ( numberOfProcs .EQ. 1 .AND. nThreads .EQ. 1
1438         &     .AND. unit.EQ.errorMessageUnit ) THEN
1439            iEnd   = ILNBLNK( message )
1440            IF (iEnd.NE.0) WRITE(0,'(A)') message(1:iEnd)
1441          ENDIF
1442    #endif
1443  C  C
1444   1000 CONTINUE   1000 CONTINUE
1445        RETURN        RETURN

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.22