Coverage Report: beampattern.f90

Generated from GCOV analysis of Fortran source code

85.7%
Lines Executed
28 total lines
53.9%
Branches Executed
128 total branches
100.0%
Calls Executed
29 total calls
0
-
Source:beampattern.f90
0
-
Graph:beampattern.gcno
0
-
Data:beampattern.gcda
0
-
Runs:73
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
71*
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
71
IF ( SBPFlag == '*' ) THEN
36
1
WRITE( PRTFile, * )
37
1
WRITE( PRTFile, * ) '______________________________'
38
1
WRITE( PRTFile, * ) 'Using source beam pattern file'
39
-
40
1*
OPEN( UNIT = SBPFile, FILE = TRIM( FileRoot ) // '.sbp', STATUS = 'OLD', IOSTAT = IOStat, ACTION = 'READ' )
41
1
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
1
READ( SBPFile, * ) NSBPPts
47
1
WRITE( PRTFile, * ) 'Number of source beam pattern points', NSBPPts
48
-
49
1*
ALLOCATE( SrcBmPat( NSBPPts, 2 ), Stat = IAllocStat )
50
1
IF ( IAllocStat /= 0 ) THEN
51
#####
CALL ERROUT( 'BELLHOP-ReadPat', 'Insufficient memory for source beam pattern data: reduce # SBP points' )
52
-
END IF
53
-
54
1
WRITE( PRTFile, * )
55
1
WRITE( PRTFile, * ) ' Angle (degrees) Power (dB)'
56
-
57
38*
DO I = 1, NSBPPts
58
37*
READ( SBPFile, * ) SrcBmPat( I, : )
59
38*
WRITE( PRTFile, FMT = "( 2G11.3 )" ) SrcBmPat( I, : )
60
-
END DO
61
-
62
-
ELSE ! no pattern given, use omni source pattern
63
70
NSBPPts = 2
64
70*
ALLOCATE( SrcBmPat( 2, 2 ), Stat = IAllocStat )
65
70*
IF ( IAllocStat /= 0 ) CALL ERROUT( 'BELLHOP-ReadPat', 'Insufficient memory' )
66
210*
SrcBmPat( 1, : ) = [ -180.0, 0.0 ]
67
210*
SrcBmPat( 2, : ) = [ 180.0, 0.0 ]
68
-
END IF
69
-
70
71*
IF ( .NOT. monotonic( SrcBmPat( :, 1 ) , NSBPPts ) ) THEN
71
#####
CALL ERROUT( 'beampattern : ReadPat', 'Source beam-pattern angles are not monotonic' )
72
-
END IF
73
-
74
248*
SrcBmPat( :, 2 ) = 10 ** ( SrcBmPat( :, 2 ) / 20 ) ! convert dB to linear scale
75
-
76
71
END SUBROUTINE ReadPat
77
-
78
-
END MODULE beampattern