Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
I
ITAPropagationModels
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
ITAPropagationModels
Commits
d09f0a28
Commit
d09f0a28
authored
Dec 11, 2018
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving files
parent
88863707
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
166 deletions
+72
-166
CMakeLists.txt
CMakeLists.txt
+2
-2
include/ITAPropagationModels/Maekawa.h
include/ITAPropagationModels/Maekawa.h
+0
-0
src/ITAPropagationModels/Kirchhoff.cpp
src/ITAPropagationModels/Kirchhoff.cpp
+0
-124
src/ITAPropagationModels/Maekawa.cpp
src/ITAPropagationModels/Maekawa.cpp
+70
-40
No files found.
CMakeLists.txt
View file @
d09f0a28
...
...
@@ -21,14 +21,14 @@ set( ITAPropagationModelsHeader
"include/ITAPropagationModels/DiffractionFilter.h"
"include/ITAPropagationModels/FilterEngine.h"
"include/ITAPropagationModels/FilterGenerator.h"
"include/ITAPropagationModels/
Kirchhoff
.h"
"include/ITAPropagationModels/
Maekawa
.h"
"include/ITAPropagationModels/Svensson.h"
"include/ITAPropagationModels/UTD.h"
)
set
(
ITAPropagationModelsSources
"src/ITAPropagationModels/FilterEngine.cpp"
"src/ITAPropagationModels/FilterGenerator.cpp"
"src/ITAPropagationModels/
Kirchhoff
.cpp"
"src/ITAPropagationModels/
Maekawa
.cpp"
"src/ITAPropagationModels/Svensson.cpp"
"src/ITAPropagationModels/UTD.cpp"
)
...
...
include/ITAPropagationModels/
Kirchhoff
.h
→
include/ITAPropagationModels/
Maekawa
.h
View file @
d09f0a28
File moved
src/ITAPropagationModels/Kirchhoff.cpp
deleted
100644 → 0
View file @
88863707
#include <ITAPropagationModels/Kirchhoff.h>
#include <ITAException.h>
using
namespace
ITAGeo
;
using
namespace
ITAPropagationModels
;
bool
Kirchhoff
::
IsApplicable
(
const
CPropagationPath
&
oPropPath
)
{
if
(
oPropPath
.
size
()
<
3
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Propagation path needs at least 3 anchors for Kirchhoff method"
);
auto
pAnchorDirectLazy
(
oPropPath
[
0
]
);
if
(
pAnchorDirectLazy
->
iAnchorType
==
CPropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"First geo propagation anchor is invalid, please purge first."
);
auto
pAnchorTail
(
oPropPath
[
oPropPath
.
size
()
-
1
]
);
if
(
pAnchorTail
->
iAnchorType
==
CPropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Last geo propagation anchor is invalid, please purge first."
);
// We don't care for first and last anchor's type (except invalid)
for
(
size_t
i
=
1
;
i
<
oPropPath
.
size
()
-
1
;
i
++
)
{
auto
pAnchorPrev
(
oPropPath
[
i
-
1
]
);
auto
pAnchorCur
(
oPropPath
[
i
]
);
auto
pAnchorNext
(
oPropPath
[
i
+
1
]
);
if
(
pAnchorCur
->
iAnchorType
==
CPropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Geo propagation path has invalid anchors, please purge first."
);
if
(
pAnchorCur
->
iAnchorType
==
CPropagationAnchor
::
DIFFRACTION_APEX
)
{
auto
pWedge
=
std
::
dynamic_pointer_cast
<
CITADiffractionWedgeAperture
>
(
pAnchorCur
);
// Check if prev and next anchors are occluded by wedge
if
(
!
pWedge
->
IsOccluding
(
pAnchorPrev
,
pAnchorNext
)
)
return
false
;
}
}
return
true
;
}
void
Kirchhoff
::
GetDirectLengthAndDetourLength
(
const
CPropagationPath
&
oPropPath
,
double
&
dPropagationLengthDirect
,
double
&
dPropagationLengthDetour
)
{
if
(
oPropPath
.
size
()
<
3
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Propagation path needs at least 3 anchors for Kirchhoff method"
);
auto
pAnchorDirectLazy
(
oPropPath
[
0
]
);
if
(
pAnchorDirectLazy
->
iAnchorType
==
CPropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"First geo propagation anchor is invalid, please purge."
);
auto
pAnchorTail
(
oPropPath
[
oPropPath
.
size
()
-
1
]
);
if
(
pAnchorTail
->
iAnchorType
==
CPropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Last geo propagation anchor is invalid, please purge."
);
// We don't care for first and last anchor's type (except invalid)
dPropagationLengthDirect
=
0.0
f
;
dPropagationLengthDetour
=
0.0
f
;
for
(
size_t
i
=
1
;
i
<
oPropPath
.
size
();
i
++
)
{
auto
pAnchorPrev
(
oPropPath
[
i
-
1
]
);
auto
pAnchorCur
(
oPropPath
[
i
]
);
if
(
pAnchorCur
->
iAnchorType
==
CPropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Geo propagation path has invalid anchors, please purge first."
);
// Detour is everything ...
const
VistaVector3D
vIntermediateLine
=
pAnchorCur
->
v3InteractionPoint
-
pAnchorPrev
->
v3InteractionPoint
;
const
double
dIntermediateLength
=
vIntermediateLine
.
GetLength
();
dPropagationLengthDetour
+=
dIntermediateLength
;
// ... but direct path skips diffraction anchors
if
(
pAnchorCur
->
iAnchorType
!=
CPropagationAnchor
::
DIFFRACTION_APEX
||
pAnchorCur
==
pAnchorTail
)
{
const
VistaVector3D
vIntermediateDirectLine
=
pAnchorCur
->
v3InteractionPoint
-
pAnchorDirectLazy
->
v3InteractionPoint
;
const
double
dIntermediateDirectLine
=
vIntermediateDirectLine
.
GetLength
();
dPropagationLengthDirect
+=
dIntermediateDirectLine
;
pAnchorDirectLazy
=
pAnchorCur
;
}
}
// Zero-length path would be crude, make assertion here to give user a hint that something is wrong with his input
assert
(
dPropagationLengthDetour
>
0.0
f
);
assert
(
dPropagationLengthDirect
>
0.0
f
);
return
;
}
double
Kirchhoff
::
KirchhoffDelta
(
const
double
dPropagationLengthDirect
,
const
double
dPropagationLengthDetour
)
{
if
(
dPropagationLengthDirect
<=
0.0
f
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Diffraction direct path length can not be zero or negative"
);
if
(
dPropagationLengthDetour
<=
0.0
f
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Diffraction detour path length can not be zero or negative"
)
if
(
dPropagationLengthDetour
<
dPropagationLengthDirect
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Diffraction detour path length can not be smaller than direct path"
);
const
double
dKirchhoffDelta
=
dPropagationLengthDetour
-
dPropagationLengthDirect
;
// Difference in path length, no magic here
return
dKirchhoffDelta
;
}
void
Kirchhoff
::
CalculateDiffractionFilter
(
const
double
dDirect
,
const
double
dDetour
,
ITABase
::
CHDFTSpectrum
&
oTransferFunction
,
const
float
fSpeedOfSound
/*= 344.0f*/
)
{
assert
(
fSpeedOfSound
>
0.0
f
);
if
(
fSpeedOfSound
<=
0.0
f
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Speed of sound can't be zero or negative"
);
// Per definition, DC value is real and 1.0
oTransferFunction
.
SetCoeffRI
(
0
,
1.0
f
,
0.0
f
);
const
int
iDFTSize
=
oTransferFunction
.
GetSize
();
for
(
int
i
=
1
;
i
<
iDFTSize
-
1
;
i
++
)
{
const
double
dFrequency
=
oTransferFunction
.
GetFrequencyResolution
()
*
i
;
const
double
dFresnelNumber
=
2.0
f
*
Kirchhoff
::
KirchhoffDelta
(
dDirect
,
dDetour
)
*
dFrequency
/
fSpeedOfSound
;
// Sometimes referred to as 'N'
oTransferFunction
.
SetCoeffRI
(
i
,
float
(
dFresnelNumber
)
);
}
}
src/ITAPropagationModels/Maekawa.cpp
View file @
d09f0a28
#include <ITADiffractionMaekawa.h>
#include <ITAPropagationModels/Kirchhoff.h>
#include <ITAException.h>
bool
IsMaekawaApplicable
(
const
CITAGeoPropagationPath
&
oPropPath
)
using
namespace
ITAGeo
;
using
namespace
ITAPropagationModels
;
bool
Kirchhoff
::
IsApplicable
(
const
CPropagationPath
&
oPropPath
)
{
if
(
oPropPath
.
size
()
<
3
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Propagation path needs at least 3 anchors for
Maekawa
method"
);
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Propagation path needs at least 3 anchors for
Kirchhoff
method"
);
const
CITAGeoPropagationAnchor
*
pAnchorDirectLazy
(
oPropPath
[
0
]
);
if
(
pAnchorDirectLazy
->
iAnchorType
==
C
ITAGeoPropagationAnchor
::
ITA_ANCHOR_
INVALID
)
auto
pAnchorDirectLazy
(
oPropPath
[
0
]
);
if
(
pAnchorDirectLazy
->
iAnchorType
==
C
PropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"First geo propagation anchor is invalid, please purge first."
);
const
CITAGeoPropagationAnchor
*
pAnchorTail
(
oPropPath
[
oPropPath
.
size
()
-
1
]
);
if
(
pAnchorTail
->
iAnchorType
==
C
ITAGeoPropagationAnchor
::
ITA_ANCHOR_
INVALID
)
auto
pAnchorTail
(
oPropPath
[
oPropPath
.
size
()
-
1
]
);
if
(
pAnchorTail
->
iAnchorType
==
C
PropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Last geo propagation anchor is invalid, please purge first."
);
// We don't care for first and last anchor's type (except invalid)
double
dIncrementalAngle
=
0.0
f
;
for
(
size_t
i
=
1
;
i
<
oPropPath
.
size
()
-
1
;
i
++
)
{
const
CITAGeoPropagationAnchor
*
pAnchorPrev
(
oPropPath
[
i
-
1
]
);
const
CITAGeoPropagationAnchor
*
pAnchorCur
(
oPropPath
[
i
]
);
const
CITAGeoPropagationAnchor
*
pAnchorNext
(
oPropPath
[
i
+
1
]
);
auto
pAnchorPrev
(
oPropPath
[
i
-
1
]
);
auto
pAnchorCur
(
oPropPath
[
i
]
);
auto
pAnchorNext
(
oPropPath
[
i
+
1
]
);
if
(
pAnchorCur
->
iAnchorType
==
C
ITAGeoPropagationAnchor
::
ITA_ANCHOR_
INVALID
)
if
(
pAnchorCur
->
iAnchorType
==
C
PropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Geo propagation path has invalid anchors, please purge first."
);
if
(
pAnchorCur
->
iAnchorType
==
C
ITAGeoPropagationAnchor
::
ITA_EDGE_DIFFRACTION
)
if
(
pAnchorCur
->
iAnchorType
==
C
PropagationAnchor
::
DIFFRACTION_APEX
)
{
const
CITADiffractionWedge
*
pWedge
(
(
const
CITADiffractionWedge
*
)
pAnchorCur
);
dIncrementalAngle
+=
pWedge
->
GetOpeningAngleRad
();
if
(
dIncrementalAngle
>
ITAConstants
::
TWO_PI_D
)
return
false
;
auto
pWedge
=
std
::
dynamic_pointer_cast
<
CITADiffractionWedgeAperture
>
(
pAnchorCur
);
// Check if prev and next anchors are occluded by wedge
if
(
!
pWedge
->
IsOccluding
(
pAnchorPrev
,
pAnchorNext
)
)
return
false
;
}
}
return
true
;
}
void
MaekawaDetourAndLength
(
const
CITAGeoPropagationPath
&
oPropPath
,
double
&
dPropagationLengthDetour
,
double
&
dPropagationLengthDirect
)
void
Kirchhoff
::
GetDirectLengthAndDetourLength
(
const
CPropagationPath
&
oPropPath
,
double
&
dPropagationLengthDirect
,
double
&
dPropagationLengthDetour
)
{
if
(
oPropPath
.
size
()
<
3
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Propagation path needs at least 3 anchors for
Maekawa
method"
);
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Propagation path needs at least 3 anchors for
Kirchhoff
method"
);
const
CITAGeoPropagationAnchor
*
pAnchorDirectLazy
(
oPropPath
[
0
]
);
if
(
pAnchorDirectLazy
->
iAnchorType
==
C
ITAGeoPropagationAnchor
::
ITA_ANCHOR_
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"First geo propagation anchor is invalid, please purge
first
."
);
auto
pAnchorDirectLazy
(
oPropPath
[
0
]
);
if
(
pAnchorDirectLazy
->
iAnchorType
==
C
PropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"First geo propagation anchor is invalid, please purge."
);
const
CITAGeoPropagationAnchor
*
pAnchorTail
(
oPropPath
[
oPropPath
.
size
()
-
1
]
);
if
(
pAnchorTail
->
iAnchorType
==
C
ITAGeoPropagationAnchor
::
ITA_ANCHOR_
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Last geo propagation anchor is invalid, please purge
first
."
);
auto
pAnchorTail
(
oPropPath
[
oPropPath
.
size
()
-
1
]
);
if
(
pAnchorTail
->
iAnchorType
==
C
PropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Last geo propagation anchor is invalid, please purge."
);
// We don't care for first and last anchor's type (except invalid)
dPropagationLengthDetour
=
0.0
f
;
dPropagationLengthDirect
=
0.0
f
;
dPropagationLengthDetour
=
0.0
f
;
for
(
size_t
i
=
1
;
i
<
oPropPath
.
size
()
-
1
;
i
++
)
for
(
size_t
i
=
1
;
i
<
oPropPath
.
size
();
i
++
)
{
const
CITAGeoPropagationAnchor
*
pAnchorPrev
(
oPropPath
[
i
-
1
]
);
const
CITAGeoPropagationAnchor
*
pAnchorCur
(
oPropPath
[
i
]
);
auto
pAnchorPrev
(
oPropPath
[
i
-
1
]
);
auto
pAnchorCur
(
oPropPath
[
i
]
);
if
(
pAnchorCur
->
iAnchorType
==
C
ITAGeoPropagationAnchor
::
ITA_ANCHOR_
INVALID
)
if
(
pAnchorCur
->
iAnchorType
==
C
PropagationAnchor
::
INVALID
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Geo propagation path has invalid anchors, please purge first."
);
// Detour is everything ...
...
...
@@ -76,12 +74,11 @@ void MaekawaDetourAndLength( const CITAGeoPropagationPath& oPropPath, double& dP
dPropagationLengthDetour
+=
dIntermediateLength
;
// ... but direct path skips diffraction anchors
if
(
pAnchorCur
->
iAnchorType
!=
C
ITAGeoPropagationAnchor
::
ITA_EDGE_DIFFRACTION
)
if
(
pAnchorCur
->
iAnchorType
!=
C
PropagationAnchor
::
DIFFRACTION_APEX
||
pAnchorCur
==
pAnchorTail
)
{
const
VistaVector3D
vIntermediateDirectLine
=
pAnchorCur
->
v3InteractionPoint
-
pAnchorDirectLazy
->
v3InteractionPoint
;
const
double
dIntermediateDirectLine
=
vIntermediateDirectLine
.
GetLength
();
dPropagationLengthDirect
+=
dIntermediateLength
;
dPropagationLengthDetour
+=
dIntermediateLength
;
dPropagationLengthDirect
+=
dIntermediateDirectLine
;
pAnchorDirectLazy
=
pAnchorCur
;
}
}
...
...
@@ -91,4 +88,37 @@ void MaekawaDetourAndLength( const CITAGeoPropagationPath& oPropPath, double& dP
assert
(
dPropagationLengthDirect
>
0.0
f
);
return
;
}
\ No newline at end of file
}
double
Kirchhoff
::
KirchhoffDelta
(
const
double
dPropagationLengthDirect
,
const
double
dPropagationLengthDetour
)
{
if
(
dPropagationLengthDirect
<=
0.0
f
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Diffraction direct path length can not be zero or negative"
);
if
(
dPropagationLengthDetour
<=
0.0
f
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Diffraction detour path length can not be zero or negative"
)
if
(
dPropagationLengthDetour
<
dPropagationLengthDirect
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Diffraction detour path length can not be smaller than direct path"
);
const
double
dKirchhoffDelta
=
dPropagationLengthDetour
-
dPropagationLengthDirect
;
// Difference in path length, no magic here
return
dKirchhoffDelta
;
}
void
Kirchhoff
::
CalculateDiffractionFilter
(
const
double
dDirect
,
const
double
dDetour
,
ITABase
::
CHDFTSpectrum
&
oTransferFunction
,
const
float
fSpeedOfSound
/*= 344.0f*/
)
{
assert
(
fSpeedOfSound
>
0.0
f
);
if
(
fSpeedOfSound
<=
0.0
f
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Speed of sound can't be zero or negative"
);
// Per definition, DC value is real and 1.0
oTransferFunction
.
SetCoeffRI
(
0
,
1.0
f
,
0.0
f
);
const
int
iDFTSize
=
oTransferFunction
.
GetSize
();
for
(
int
i
=
1
;
i
<
iDFTSize
-
1
;
i
++
)
{
const
double
dFrequency
=
oTransferFunction
.
GetFrequencyResolution
()
*
i
;
const
double
dFresnelNumber
=
2.0
f
*
Kirchhoff
::
KirchhoffDelta
(
dDirect
,
dDetour
)
*
dFrequency
/
fSpeedOfSound
;
// Sometimes referred to as 'N'
oTransferFunction
.
SetCoeffRI
(
i
,
float
(
dFresnelNumber
)
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment