Coverage Report: beampattern.f90

Generated from GCOV analysis of Fortran source code

35.7%
Lines Executed
28 total lines
53.8%
Branches Executed
80 total branches
0.0%
Calls Executed
0 total calls
0
-
Source:beampattern.f90
0
-
Graph:beampattern.gcno
0
-
Data:beampattern.gcda
0
-
Runs:29
1
-
!! Source beam pattern loading and processing
2
-
3
-
MODULE beampattern
4
-
!! Source beam pattern handling including loading, interpolation, and angular weighting
5
-
6
-
USE FatalError
7
-
USE monotonicMod
8
-
9
-
IMPLICIT NONE
10
-
PUBLIC
11
-
SAVE
12
-
13
-
INTEGER, PARAMETER :: SBPFile = 50
14
-
INTEGER :: NSBPPts ! Number of source beam-pattern points
15
-
REAL (KIND=8), ALLOCATABLE :: SrcBmPat( :, : )
16
-
CHARACTER (LEN=1) :: SBPFlag ! '*' or 'O' to indicate a directional or omni pattern
17
-
18
-
CONTAINS
19
-
20
14*
SUBROUTINE ReadPat( FileRoot, PRTFile )
21
-
!! Reads a source beam pattern file (`.sbp`) based on `FileRoot``.
22
-
!! Reports status messages to the print/log file connected to `PRTFile``.
23
-
24
-
IMPLICIT NONE
25
-
26
-
! Arguments
27
-
CHARACTER (LEN=80), INTENT( IN ) :: FileRoot
28
-
!! Source beampattern filename *without* `.sbp` extension
29
-
INTEGER, INTENT( IN ) :: PRTFile
30
-
!! I/O Unit for print file
31
-
32
-
! Local variables
33
-
INTEGER :: I, IAllocStat, IOStat
34
-
35
14
IF ( SBPFlag == '*' ) THEN
36
#####
WRITE( PRTFile, * )
37
#####
WRITE( PRTFile, * ) '______________________________'
38
#####
WRITE( PRTFile, * ) 'Using source beam pattern file'
39
-
40
#####
OPEN( UNIT = SBPFile, FILE = TRIM( FileRoot ) // '.sbp', STATUS = 'OLD', IOSTAT = IOStat, ACTION = 'READ' )
41
#####
IF ( IOstat /= 0 ) THEN
42
#####
WRITE( PRTFile, * ) 'SBPFile = ', TRIM( FileRoot ) // '.sbp'
43
#####
CALL ERROUT( 'BELLHOP-ReadPat', 'Unable to open source beampattern file' )
44
-
END IF
45
-
46
#####
READ( SBPFile, * ) NSBPPts
47
#####
WRITE( PRTFile, * ) 'Number of source beam pattern points', NSBPPts
48
-
49
#####
ALLOCATE( SrcBmPat( NSBPPts, 2 ), Stat = IAllocStat )
50
#####
IF ( IAllocStat /= 0 ) &
51
#####
CALL ERROUT( 'BELLHOP-ReadPat', 'Insufficient memory for source beam pattern data: reduce # SBP points' )
52
-
53
#####
WRITE( PRTFile, * )
54
#####
WRITE( PRTFile, * ) ' Angle (degrees) Power (dB)'
55
-
56
#####
DO I = 1, NSBPPts
57
#####
READ( SBPFile, * ) SrcBmPat( I, : )
58
#####
WRITE( PRTFile, FMT = "( 2G11.3 )" ) SrcBmPat( I, : )
59
-
END DO
60
-
61
-
ELSE ! no pattern given, use omni source pattern
62
14
NSBPPts = 2
63
14*
ALLOCATE( SrcBmPat( 2, 2 ), Stat = IAllocStat )
64
14*
IF ( IAllocStat /= 0 ) CALL ERROUT( 'BELLHOP-ReadPat', 'Insufficient memory' )
65
42*
SrcBmPat( 1, : ) = [ -180.0, 0.0 ]
66
42*
SrcBmPat( 2, : ) = [ 180.0, 0.0 ]
67
-
ENDIF
68
-
69
14*
IF ( .NOT. monotonic( SrcBmPat( :, 1 ) , NSBPPts ) ) &
70
#####
CALL ERROUT( 'beampattern : ReadPat', 'Source beam-pattern angles are not monotonic' )
71
-
72
42*
SrcBmPat( :, 2 ) = 10 ** ( SrcBmPat( :, 2 ) / 20 ) ! convert dB to linear scale
73
-
74
14
END SUBROUTINE ReadPat
75
-
76
-
END MODULE beampattern