NCEPLIBS-bufr 11.7.1
exitbufr.f
Go to the documentation of this file.
1C> @file
2C> @brief Reset the BUFRLIB software for potential dynamic
3C> reallocation of memory.
4
5C> This subroutine frees all dynamically-allocated memory,
6C> closes all logical units that are open within the
7C> BUFRLIB software, and resets the library to all of its
8C> default settings as though it had never been called.
9C>
10C> @author J. Ator
11C> @date 2015-03-02
12C>
13C> @remarks
14C> - Calling this subroutine allows an application program to
15C> potentially resize arrays and reallocate memory all over again
16C> with a new subsequent series of calls to subroutines isetprm()
17C> and openbf(). However, if and when this subroutine is called,
18C> there is no longer any internal memory available within the
19C> BUFRLIB software, and the remainder of the library becomes
20C> essentially unusable within the application program, unless
21C> and until subroutine openbf() is called once again to
22C> dynamically allocate new array space. This may be a useful
23C> capability for application programs that are finished with
24C> using the BUFRLIB software and wish to move on to other
25C> unrelated tasks without continuing to tie up all of the
26C> allocated memory space within the library. Otherwise, and
27C> unless there's a need to change parameter sizes following the
28C> first call to subroutine openbf(), then there's no need to ever
29C> call this subroutine within an application program, since all
30C> allocated memory will automatically get freed anyway by the
31C> operating system once the application program terminates.
32C>
33C> <b>Program history log:</b>
34C> | Date | Programmer | Comments |
35C> | -----|------------|----------|
36C> | 2015-03-02 | J. Ator | Original author |
37C>
38 SUBROUTINE exitbufr
39
40 USE modv_ifopbf
41 USE modv_nfiles
42
43 USE moda_stbfr
44 USE moda_s01cm
45
46 COMMON /tablef/ cdmf
47
48 CHARACTER*1 CDMF
49
50C-----------------------------------------------------------------------
51C-----------------------------------------------------------------------
52
53C Close any logical units that are open to the library.
54
55 DO jj = 1, nfiles
56 IF ( iolun(jj) .NE. 0 ) CALL closbf( abs(iolun(jj)) )
57 END DO
58
59C Deallocate all allocated memory.
60
61 CALL ardllocf
62
63 IF ( cdmf .EQ. 'Y' ) CALL dlloctbf
64
65C Reset the library.
66
67 ns01v = 0
68 ifopbf = 0
69
70 RETURN
71 END
subroutine ardllocf
This subroutine frees any memory that was dynamically allocated during a previous call to subroutine ...
Definition: ardllocf.f:17
void dlloctbf(void)
This subroutine frees any memory that was dynamically allocated during a previous call to subroutine ...
Definition: dlloctbf.c:20
subroutine closbf(LUNIT)
This subroutine closes the connection between logical unit LUNIT and the BUFRLIB software.
Definition: closbf.f:35
subroutine exitbufr
This subroutine frees all dynamically-allocated memory, closes all logical units that are open within...
Definition: exitbufr.f:39
This module declares and initializes the IFOPBF variable.
Definition: modv_IFOPBF.f90:9
integer, public ifopbf
Status indicator to keep track of whether subroutine openbf() has already been called:
Definition: modv_IFOPBF.f90:16
This module declares and initializes the NFILES variable.
Definition: modv_NFILES.f90:12
integer, public nfiles
Maximum number of BUFR files that can be connected to the BUFRLIB software (for reading or writing) a...
Definition: modv_NFILES.f90:17