NCEPLIBS-bufr  11.7.0
 All Data Structures Files Functions Variables Pages
nvnwin.f
Go to the documentation of this file.
1 C> @file
2 C> @author WOOLLEN @date 1994-01-06
3 
4 C> THIS FUNCTION LOOKS FOR AND RETURNS ALL OCCURRENCES OF A
5 C> SPECIFIED NODE WITHIN THE PORTION OF THE CURRENT SUBSET BUFFER
6 C> BOUNDED BY THE INDICES INV1 AND INV2. THE RESULTING LIST IS A
7 C> STACK OF "EVENT" INDICES FOR THE REQUESTED NODE.
8 C>
9 C> PROGRAM HISTORY LOG:
10 C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
11 C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
12 C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
13 C> ROUTINE "BORT"
14 C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
15 C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
16 C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
17 C> BUFR FILES UNDER THE MPI)
18 C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
19 C> INTERDEPENDENCIES
20 C> 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
21 C> INCREASED FROM 15000 TO 16000 (WAS IN
22 C> VERIFICATION VERSION); UNIFIED/PORTABLE FOR
23 C> WRF; ADDED DOCUMENTATION (INCLUDING
24 C> HISTORY); OUTPUTS MORE COMPLETE DIAGNOSTIC
25 C> INFO WHEN ROUTINE TERMINATES ABNORMALLY OR
26 C> UNUSUAL THINGS HAPPEN
27 C> 2009-03-23 J. ATOR -- USE 1E9 TO PREVENT OVERFLOW WHEN
28 C> INITIALIZING INVN; USE ERRWRT
29 C> 2009-03-31 J. WOOLLEN -- ADDED DOCUMENTATION
30 C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
31 C>
32 C> USAGE: NVNWIN (NODE, LUN, INV1, INV2, INVN, NMAX)
33 C> INPUT ARGUMENT LIST:
34 C> NODE - INTEGER: JUMP/LINK TABLE INDEX TO LOOK FOR
35 C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
36 C> INV1 - INTEGER: STARTING INDEX OF THE PORTION OF THE SUBSET
37 C> BUFFER IN WHICH TO LOOK
38 C> INV2 - INTEGER: ENDING INDEX OF THE PORTION OF THE SUBSET
39 C> BUFFER IN WHICH TO LOOK
40 C> NMAX - INTEGER: DIMENSIONED SIZE OF INVN; USED BY THE
41 C> FUNCTION TO ENSURE THAT IT DOES NOT OVERFLOW THE
42 C> INVN ARRAY
43 C>
44 C> OUTPUT ARGUMENT LIST:
45 C> INVN - INTEGER: ARRAY OF STACK "EVENT" INDICES FOR NODE
46 C> NVNWIN - INTEGER: NUMBER OF INDICES RETURNED WITHIN INVN
47 C>
48 C> REMARKS:
49 C> THIS ROUTINE CALLS: BORT ERRWRT
50 C> THIS ROUTINE IS CALLED BY: UFBEVN
51 C> Normally not called by any application
52 C> programs.
53 C>
54  FUNCTION nvnwin(NODE,LUN,INV1,INV2,INVN,NMAX)
55 
56  USE moda_usrint
57 
58  COMMON /quiet / iprt
59 
60  CHARACTER*128 bort_str
61  dimension invn(nmax)
62 
63 C----------------------------------------------------------------------
64 C----------------------------------------------------------------------
65 
66  nvnwin = 0
67 
68  IF(node.EQ.0) THEN
69  IF(iprt.GE.1) THEN
70  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
71  CALL errwrt('BUFRLIB: NVNWIN - NODE=0, IMMEDIATE RETURN')
72  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
73  CALL errwrt(' ')
74  ENDIF
75  goto 100
76  ENDIF
77 
78  DO i=1,nmax
79  invn(i) = 1e9
80  ENDDO
81 
82 C SEARCH BETWEEN INV1 AND INV2
83 C ----------------------------
84 
85  DO n=inv1,inv2
86  IF(inv(n,lun).EQ.node) THEN
87  IF(nvnwin+1.GT.nmax) goto 900
88  nvnwin = nvnwin+1
89  invn(nvnwin) = n
90  ENDIF
91  ENDDO
92 
93 C EXITS
94 C -----
95 
96 100 RETURN
97 900 WRITE(bort_str,'("BUFRLIB: NVNWIN - THE NUMBER OF EVENTS, '//
98  . 'NVNWIN (",I5,") EXCEEDS THE LIMIT, NMAX (",I5,")")') nvnwin,nmax
99  CALL bort(bort_str)
100  END
function nvnwin(NODE, LUN, INV1, INV2, INVN, NMAX)
THIS FUNCTION LOOKS FOR AND RETURNS ALL OCCURRENCES OF A SPECIFIED NODE WITHIN THE PORTION OF THE CUR...
Definition: nvnwin.f:54
subroutine errwrt(STR)
This subroutine allows the user to specify a custom location for the logging of error and diagnostic ...
Definition: errwrt.f:41
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:22