NCEPLIBS-bufr  12.0.0
nvnwin.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Search for all occurrences of a specified node within a
3 C> specified portion of the current data subset.
4 C>
5 C> @author Woollen @date 1994-01-06
6 
7 C> This function looks for and returns all occurrences of a
8 C> specified node within the portion of the current subset buffer
9 C> bounded by the indices inv1 and inv2. The resulting list is a
10 C> stack of "event" indices for the requested node.
11 C>
12 C> @param[in] NODE - integer: jump/link table index to look for.
13 C> @param[in] LUN - integer: i/o stream index into internal memory arrays.
14 C> @param[in] INV1 - integer: starting index of the portion of the subset buffer in which to look.
15 C> @param[in] INV2 - integer: ending index of the portion of the subset buffer in which to look.
16 C> @param[out] INVN - integer: array of stack "event" indices for node.
17 C> @param[in] NMAX - integer: dimensioned size of invn; used by the function to ensure
18 C> that it does not overflow the invn array.
19 C>
20 C> @return number of indices within invn.
21 C>
22 C> @author Woollen @date 1994-01-06
23  FUNCTION nvnwin(NODE,LUN,INV1,INV2,INVN,NMAX)
24 
25  USE moda_usrint
26 
27  COMMON /quiet / iprt
28 
29  CHARACTER*128 bort_str
30  dimension invn(nmax)
31 
32 C----------------------------------------------------------------------
33 C----------------------------------------------------------------------
34 
35  nvnwin = 0
36 
37  IF(node.EQ.0) THEN
38  IF(iprt.GE.1) THEN
39  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
40  CALL errwrt('BUFRLIB: NVNWIN - NODE=0, IMMEDIATE RETURN')
41  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
42  CALL errwrt(' ')
43  ENDIF
44  GOTO 100
45  ENDIF
46 
47  DO i=1,nmax
48  invn(i) = 1e9
49  ENDDO
50 
51 C SEARCH BETWEEN INV1 AND INV2
52 C ----------------------------
53 
54  DO n=inv1,inv2
55  IF(inv(n,lun).EQ.node) THEN
56  IF(nvnwin+1.GT.nmax) GOTO 900
57  nvnwin = nvnwin+1
58  invn(nvnwin) = n
59  ENDIF
60  ENDDO
61 
62 C EXITS
63 C -----
64 
65 100 RETURN
66 900 WRITE(bort_str,'("BUFRLIB: NVNWIN - THE NUMBER OF EVENTS, '//
67  . 'NVNWIN (",I5,") EXCEEDS THE LIMIT, NMAX (",I5,")")') nvnwin,nmax
68  CALL bort(bort_str)
69  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
subroutine errwrt(STR)
This subroutine allows the user to specify a custom location for the logging of error and diagnostic ...
Definition: errwrt.f:36
This module contains declarations for arrays used to store data values and associated metadata for th...
integer, dimension(:,:), allocatable, target inv
Inventory pointer which links each data value to its corresponding node in the internal jump/link tab...
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:24