module_peg_util.F

References to this file elsewhere.
1 !#**********************************************************************************  
2 ! This computer software was prepared by Battelle Memorial Institute, hereinafter
3 ! the Contractor, under Contract No. DE-AC05-76RL0 1830 with the Department of 
4 ! Energy (DOE). NEITHER THE GOVERNMENT NOR THE CONTRACTOR MAKES ANY WARRANTY,
5 ! EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
6 !
7 ! miscellaneous debuging routines for CBMZ and MOSAIC
8 !**********************************************************************************  
9 	module module_peg_util
10 
11 
12 	contains
13 
14 
15 !-----------------------------------------------------------------------
16 	subroutine peg_debugmsg( lun, level, str )
17 !
18 ! when lun >  0, writes "str" to unit "lun"
19 ! when lun <= 0, passes "str" on to wrf_debug
20 !
21 	implicit none
22 ! subr arguments
23 	integer, intent(in) :: lun, level
24 	character(len=*), intent(in) :: str
25 ! local variables
26 	integer n
27 
28 	n = max( 1, len_trim(str) )
29 	if (lun .gt. 0) then
30 	    write(lun,'(a)') str(1:n)
31 	else
32 	    call wrf_debug( level, str(1:n) )
33 	end if
34 	return
35 	end subroutine peg_debugmsg
36 
37 
38 !-----------------------------------------------------------------------
39 	subroutine peg_message( lun, str )
40 !
41 ! when lun >  0, writes "str" to unit "lun"
42 ! when lun <= 0, passes "str" on to wrf_message
43 !
44 	implicit none
45 ! subr arguments
46 	integer, intent(in) :: lun
47 	character(len=*), intent(in) :: str
48 ! local variables
49 	integer n
50 
51 	n = max( 1, len_trim(str) )
52 	if (lun .gt. 0) then
53 	    write(lun,'(a)') str(1:n)
54 	else
55 	    call wrf_message( str(1:n) )
56 	end if
57 	return
58 	end subroutine peg_message
59 
60 
61 !-----------------------------------------------------------------------
62 	subroutine peg_error_fatal( lun, str )
63 !
64 ! when lun >  0, writes "str" to unit "lun"
65 ! then (always)  passes "str" on to wrf_error_fatal
66 !
67 	implicit none
68 ! subr arguments
69 	integer, intent(in) :: lun
70 	character(len=*), intent(in) :: str
71 ! local variables
72 	integer n
73 
74 	n = max( 1, len_trim(str) )
75 	if (lun .gt. 0) write(lun,'(a)') str(1:n)
76 	call wrf_error_fatal( str(1:n) )
77 	return
78 	end subroutine peg_error_fatal
79 
80 
81 !-----------------------------------------------------------------------
82 	end module module_peg_util