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
e51635c5
Commit
e51635c5
authored
Jan 10, 2019
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applying major changes in directivity and material managers
parent
b1f7c2c7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
28 deletions
+25
-28
include/ITAPropagationModels/FilterEngine.h
include/ITAPropagationModels/FilterEngine.h
+2
-2
src/ITAPropagationModels/FilterEngine.cpp
src/ITAPropagationModels/FilterEngine.cpp
+13
-16
tests/FilterEngine/FilterEngineTest.cpp
tests/FilterEngine/FilterEngineTest.cpp
+4
-4
tests/ReceiverDirectivityTest/ReceiverDirectivityTest.cpp
tests/ReceiverDirectivityTest/ReceiverDirectivityTest.cpp
+2
-2
tests/SourceDirectivityTest/SourceDirectivityTest.cpp
tests/SourceDirectivityTest/SourceDirectivityTest.cpp
+4
-4
No files found.
include/ITAPropagationModels/FilterEngine.h
View file @
e51635c5
...
...
@@ -136,10 +136,10 @@ namespace ITAPropagationModels
};
//! Sets a connection to the material manager
void
SetMaterialManager
(
const
ITAGeo
::
Material
::
IManager
*
pMaterialManager
);
void
SetMaterialManager
(
std
::
shared_ptr
<
const
ITAGeo
::
Material
::
IManager
>
);
// Returns pointer to material manager or null
const
ITAGeo
::
Material
::
IManager
*
GetMaterialManager
()
const
;
std
::
shared_ptr
<
const
ITAGeo
::
Material
::
IManager
>
GetMaterialManager
()
const
;
private:
...
...
src/ITAPropagationModels/FilterEngine.cpp
View file @
e51635c5
...
...
@@ -39,8 +39,7 @@ int CFilterEngine::GetNumSensorChannels(const ITAGeo::CPropagationPathList& oPat
//Cast the sensor that is always the last propagation anchor of a path
auto
pSensor
=
std
::
dynamic_pointer_cast
<
ITAGeo
::
CSensor
>
(
oPathList
[
0
][
oPathList
[
0
].
size
()
-
1
]);
return
pSensor
->
iNumChannels
;
return
pSensor
->
GetNumChannels
();
}
bool
CFilterEngine
::
ValidateSameSensor
(
const
ITAGeo
::
CPropagationPathList
&
oPathList
)
...
...
@@ -124,9 +123,9 @@ void CFilterEngine::ApplyDiffractionModel(ITAGeo::CPropagationPathList & oPathLi
{
auto
pApex
=
std
::
dynamic_pointer_cast
<
ITAGeo
::
CITADiffractionWedgeApertureBase
>
(
pCurrentAnchor
);
if
(
iDiffractionModelResolution
==
ITAGeo
::
IMaterial
::
THIRD_OCTAVE
)
if
(
iDiffractionModelResolution
==
ITAGeo
::
Material
::
IMaterial
::
THIRD_OCTAVE
)
{
auto
pAcousticMaterial
=
make_shared
<
ITAGeo
::
CThirdOctaveMaterial
>
();
auto
pAcousticMaterial
=
make_shared
<
ITAGeo
::
Material
::
CThirdOctaveMaterial
>
();
auto
vfFrequencies
=
pAcousticMaterial
->
oAbsorptionCoefficients
.
GetCenterFrequencies
();
...
...
@@ -170,10 +169,10 @@ void CFilterEngine::ApplyReflectionModel(ITAGeo::CPropagationPathList & oPathLis
//If the anchor is a reflection and the acoustic material is not set yet, set it to default values
if
((
pAnchor
->
iAnchorType
==
ITAGeo
::
CPropagationAnchor
::
SPECULAR_REFLECTION
)
&&
(
pAnchor
->
pAcousticMaterial
==
NULL
))
{
if
(
iReflectionModel
==
ITAGeo
::
IMaterial
::
SCALAR
)
if
(
iReflectionModel
==
ITAGeo
::
Material
::
IMaterial
::
SCALAR
)
{
//Set material with default values(current reflection factor: 0.7. See constructor of CScalarMaterial)
pAnchor
->
pAcousticMaterial
=
make_shared
<
ITAGeo
::
CScalarMaterial
>
();
pAnchor
->
pAcousticMaterial
=
make_shared
<
ITAGeo
::
Material
::
CScalarMaterial
>
();
}
else
//if (m_DefaultValues::iReflectionModel == ITAGeo::IAcousticMaterial::THIRD_OCTAVE)
{
...
...
@@ -200,10 +199,10 @@ void ITAPropagationModels::CFilterEngine::ApplyEmitterModel(ITAGeo::CPropagation
{
if
(
oPath
[
0
]
->
pAcousticMaterial
==
NULL
)
{
if
(
iEmitterModel
==
ITAGeo
::
IMaterial
::
SCALAR
)
if
(
iEmitterModel
==
ITAGeo
::
Material
::
IMaterial
::
SCALAR
)
{
//Set material with factor 1.0
auto
pAcousticMaterial
=
make_shared
<
ITAGeo
::
CScalarMaterial
>
();
auto
pAcousticMaterial
=
make_shared
<
ITAGeo
::
Material
::
CScalarMaterial
>
();
pAcousticMaterial
->
cdTransmissionFactor
=
1.0
f
;
pAcousticMaterial
->
cdReflectionFactor
=
0.0
f
;
...
...
@@ -228,7 +227,7 @@ void ITAPropagationModels::CFilterEngine::ApplyEmitterModel(ITAGeo::CPropagation
void
ITAPropagationModels
::
CFilterEngine
::
ApplySensorModel
(
ITAGeo
::
CPropagationPathList
&
oPathList
,
int
iModel
)
{
//Check for correct structur of oPathList
if
(
!
HasSameSensorAnch
or
(
oPathList
))
if
(
!
ValidateSameSens
or
(
oPathList
))
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"The propagation path list has multiple sensor anchors or last anchor of paths is not a sensor."
);
int
iSensorModel
;
...
...
@@ -236,8 +235,6 @@ void ITAPropagationModels::CFilterEngine::ApplySensorModel(ITAGeo::CPropagationP
iSensorModel
=
m_oDefaultResolutions
.
iSensorModel
;
else
iSensorModel
=
iModel
;
}
void
ITAPropagationModels
::
CFilterEngine
::
SetMaterialManager
(
std
::
shared_ptr
<
const
ITAGeo
::
Material
::
IManager
>
pMaterialManager
)
...
...
@@ -245,7 +242,7 @@ void ITAPropagationModels::CFilterEngine::SetMaterialManager( std::shared_ptr< c
m_pMaterialManager
=
pMaterialManager
;
}
const
ITAGeo
::
Material
::
IManager
*
ITAPropagationModels
::
CFilterEngine
::
GetMaterialManager
()
const
std
::
shared_ptr
<
const
ITAGeo
::
Material
::
IManager
>
ITAPropagationModels
::
CFilterEngine
::
GetMaterialManager
()
const
{
return
m_pMaterialManager
;
}
...
...
@@ -305,10 +302,10 @@ void CFilterEngine::Generate(const ITAGeo::CPropagationPathList & oPathList, ITA
//Set scalar and third octave filter components of the propagation anchors
for
(
auto
&
pAnchor
:
oPath
)
{
if
(
pAnchor
->
pAcousticMaterial
->
GetType
()
==
ITAGeo
::
IMaterial
::
SCALAR
)
if
(
pAnchor
->
pAcousticMaterial
->
GetType
()
==
ITAGeo
::
Material
::
IMaterial
::
SCALAR
)
{
//Type cast of the acoustic material
auto
pScalarMaterial
=
dynamic_pointer_cast
<
ITAGeo
::
CScalarMaterial
>
(
pAnchor
->
pAcousticMaterial
);
auto
pScalarMaterial
=
std
::
dynamic_pointer_cast
<
ITAGeo
::
Material
::
CScalarMaterial
>
(
pAnchor
->
pAcousticMaterial
);
if
(
pAnchor
->
iAnchorType
==
ITAGeo
::
CPropagationAnchor
::
SPECULAR_REFLECTION
)
fScalarMagnitude
*=
(
float
)
abs
(
pScalarMaterial
->
cdReflectionFactor
);
...
...
@@ -316,10 +313,10 @@ void CFilterEngine::Generate(const ITAGeo::CPropagationPathList & oPathList, ITA
fScalarMagnitude
*=
(
float
)
abs
(
pScalarMaterial
->
cdTransmissionFactor
);
}
if
(
pAnchor
->
pAcousticMaterial
->
GetType
()
==
ITAGeo
::
IMaterial
::
THIRD_OCTAVE
)
if
(
pAnchor
->
pAcousticMaterial
->
GetType
()
==
ITAGeo
::
Material
::
IMaterial
::
THIRD_OCTAVE
)
{
//Type cast of the acoustic material
auto
pThirdOctaveMaterial
=
dynamic_pointer_cast
<
ITAGeo
::
CThirdOctaveMaterial
>
(
pAnchor
->
pAcousticMaterial
);
auto
pThirdOctaveMaterial
=
std
::
dynamic_pointer_cast
<
ITAGeo
::
Material
::
CThirdOctaveMaterial
>
(
pAnchor
->
pAcousticMaterial
);
//Multiply the scale values of the respective bands
for
(
int
i
=
0
;
i
<
pThirdOctaveMaterial
->
GetNumBands
();
i
++
)
...
...
tests/FilterEngine/FilterEngineTest.cpp
View file @
e51635c5
...
...
@@ -47,9 +47,9 @@ int main( int, char** )
auto
pSender
=
make_shared
<
CEmitter
>
(
VistaVector3D
(
-
2.0
f
,
0.0
f
,
0.0
f
)
);
auto
pReceiver
=
make_shared
<
CSensor
>
(
VistaVector3D
(
2.0
f
,
0.0
f
,
0.0
f
)
);
CMaterialDirectory
oMaterialDirectory
(
"./"
);
auto
pMaterialDirectory
=
std
::
make_shared
<
Material
::
CDirectory
>
(
"./"
);
auto
pReflection
=
make_shared
<
CSpecularReflection
>
(
VistaVector3D
(
0.0
f
,
2.0
f
,
0.0
f
)
);
pReflection
->
pAcousticMaterial
=
oMaterialDirectory
.
GetMaterial
(
"stonewall"
);
pReflection
->
pAcousticMaterial
=
pMaterialDirectory
->
GetMaterial
(
"stonewall"
);
auto
pW
=
std
::
make_shared
<
CITADiffractionOuterWedgeAperture
>
();
pW
->
v3AperturePoint
.
SetValues
(
0.0
f
,
1.0
f
,
0.0
f
);
...
...
@@ -80,7 +80,7 @@ int main( int, char** )
oPathList
.
push_back
(
oPathDiffraction
);
CFilterEngine
oFilterEngine
;
oFilterEngine
.
SetMaterialManager
(
&
o
MaterialDirectory
);
oFilterEngine
.
SetMaterialManager
(
p
MaterialDirectory
);
// Set filter length according to the maximum path length
const
float
fSpeedOfSound
=
SPEED_OF_SOUND_F
;
//Approximation of speed of sound at ~20C
...
...
@@ -88,7 +88,7 @@ int main( int, char** )
int
iFilterLengthSamples
=
(
int
)
(
oPathList
.
GetMaxLength
()
/
fSpeedOfSound
*
fSampleRate
);
iFilterLengthSamples
=
int
(
iFilterLengthSamples
+
4096
);
ITABase
::
CHDFTSpectra
oTransmissionFilter
(
fSampleRate
,
pReceiver
->
iNumChannels
,
iFilterLengthSamples
);
ITABase
::
CHDFTSpectra
oTransmissionFilter
(
fSampleRate
,
pReceiver
->
GetNumChannels
()
,
iFilterLengthSamples
);
bool
bDFTDegreeTooSmallFlag
;
oFilterEngine
.
ApplyAcousticModels
(
oPathList
);
// @todo aer remove / merge into Generate()
oFilterEngine
.
Generate
(
oPathList
,
oTransmissionFilter
,
&
bDFTDegreeTooSmallFlag
);
...
...
tests/ReceiverDirectivityTest/ReceiverDirectivityTest.cpp
View file @
e51635c5
...
...
@@ -57,7 +57,7 @@ int main( int, char** )
int
iFilterLengthSamples
=
(
int
)(
oPathFromLeft
.
GetLength
()
/
fSpeedOfSound
*
fSampleRate
);
iFilterLengthSamples
=
int
(
iFilterLengthSamples
+
4096
);
ITABase
::
CHDFTSpectra
oTransmissionFilterLeft
(
fSampleRate
,
pReceiver
->
iNumChannels
,
iFilterLengthSamples
);
ITABase
::
CHDFTSpectra
oTransmissionFilterLeft
(
fSampleRate
,
pReceiver
->
GetNumChannels
()
,
iFilterLengthSamples
);
bool
bDFTDegreeTooSmallFlag
;
oFilterEngine
.
ApplyAcousticModels
(
oPathFromLeft
);
// @todo aer remove / merge into Generate()
oFilterEngine
.
Generate
(
oPathFromLeft
,
oTransmissionFilterLeft
,
&
bDFTDegreeTooSmallFlag
);
...
...
@@ -71,7 +71,7 @@ int main( int, char** )
iFilterLengthSamples
=
(
int
)(
oPathFromRight
.
GetLength
()
/
fSpeedOfSound
*
fSampleRate
);
iFilterLengthSamples
=
int
(
iFilterLengthSamples
+
4096
);
ITABase
::
CHDFTSpectra
oTransmissionFilterRight
(
fSampleRate
,
pReceiver
->
iNumChannels
,
iFilterLengthSamples
);
ITABase
::
CHDFTSpectra
oTransmissionFilterRight
(
fSampleRate
,
pReceiver
->
GetNumChannels
()
,
iFilterLengthSamples
);
oFilterEngine
.
ApplyAcousticModels
(
oPathFromRight
);
// @todo aer remove / merge into Generate()
oFilterEngine
.
Generate
(
oPathFromRight
,
oTransmissionFilterRight
,
&
bDFTDegreeTooSmallFlag
);
...
...
tests/SourceDirectivityTest/SourceDirectivityTest.cpp
View file @
e51635c5
...
...
@@ -47,9 +47,9 @@ int main( int, char** )
auto
pSender
=
make_shared
<
CEmitter
>
(
VistaVector3D
(
-
2.0
f
,
0.0
f
,
0.0
f
)
);
auto
pReceiver
=
make_shared
<
CSensor
>
(
VistaVector3D
(
2.0
f
,
0.0
f
,
0.0
f
)
);
CMaterialDirectory
oMaterialDirectory
(
"./"
);
auto
pMaterialDirectory
=
std
::
make_shared
<
Material
::
CDirectory
>
(
"./"
);
auto
pReflection
=
make_shared
<
CSpecularReflection
>
(
VistaVector3D
(
0.0
f
,
2.0
f
,
0.0
f
)
);
pReflection
->
pAcousticMaterial
=
oMaterialDirectory
.
GetMaterial
(
"stonewall"
);
pReflection
->
pAcousticMaterial
=
pMaterialDirectory
->
GetMaterial
(
"stonewall"
);
auto
pW
=
std
::
make_shared
<
CITADiffractionOuterWedgeAperture
>
();
pW
->
v3AperturePoint
.
SetValues
(
0.0
f
,
1.0
f
,
0.0
f
);
...
...
@@ -80,7 +80,7 @@ int main( int, char** )
oPathList
.
push_back
(
oPathDiffraction
);
CFilterEngine
oFilterEngine
;
oFilterEngine
.
SetMaterialManager
(
&
o
MaterialDirectory
);
oFilterEngine
.
SetMaterialManager
(
p
MaterialDirectory
);
// Set filter length according to the maximum path length
const
float
fSpeedOfSound
=
SPEED_OF_SOUND_F
;
//Approximation of speed of sound at ~20C
...
...
@@ -88,7 +88,7 @@ int main( int, char** )
int
iFilterLengthSamples
=
(
int
)
(
oPathList
.
GetMaxLength
()
/
fSpeedOfSound
*
fSampleRate
);
iFilterLengthSamples
=
int
(
iFilterLengthSamples
+
4096
);
ITABase
::
CHDFTSpectra
oTransmissionFilter
(
fSampleRate
,
pReceiver
->
iNumChannels
,
iFilterLengthSamples
);
ITABase
::
CHDFTSpectra
oTransmissionFilter
(
fSampleRate
,
pReceiver
->
GetNumChannels
()
,
iFilterLengthSamples
);
bool
bDFTDegreeTooSmallFlag
;
oFilterEngine
.
ApplyAcousticModels
(
oPathList
);
// @todo aer remove / merge into Generate()
oFilterEngine
.
Generate
(
oPathList
,
oTransmissionFilter
,
&
bDFTDegreeTooSmallFlag
);
...
...
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