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
f4bf3bde
Commit
f4bf3bde
authored
Jan 16, 2019
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
0511c59b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
13 deletions
+53
-13
src/ITAPropagationModels/FilterEngine.cpp
src/ITAPropagationModels/FilterEngine.cpp
+47
-11
src/ITAPropagationModels/Utils.cpp
src/ITAPropagationModels/Utils.cpp
+3
-0
tests/ReceiverDirectivityTest/ReceiverDirectivityTest.cpp
tests/ReceiverDirectivityTest/ReceiverDirectivityTest.cpp
+3
-2
No files found.
src/ITAPropagationModels/FilterEngine.cpp
View file @
f4bf3bde
#
include
<
ITAPropagationModels
/
FilterEngine
.
h
>
// ITA includes
#include <ITAException.h>
#include <ITAGeo/Halfedge/MeshModel.h>
#include <ITAPropagationModels/UTD.h>
#include <ITAPropagationModels/Maekawa.h>
#include <ITAGeo/Halfedge/MeshModel.h>
#include <ITAGeo/Directivity/Base.h>
#include <ITAGeo/Directivity/DAFF_Format.h>
#include <ITAGeo/Directivity/DAFF_ImpulseResponse.h>
#include <ITAGeo/Directivity/DAFF_MagnitudeSpectrum.h>
#include <ITAException.h>
#include <ITAISO9613.h>
// Vista includes
...
...
@@ -207,18 +212,48 @@ void CFilterEngine::Generate(const ITAGeo::CPropagationPathList & oPathList, ITA
oThirdOctFactors
[
iFrequencyIndex
]
*=
sqrt
(
1
-
abs
(
oThirdOctAbsorption
[
iFrequencyIndex
]));
}
//Set scalar and third octave filter components of the propagation anchors
for
(
auto
&
pAnchor
:
oPath
)
// Process path and assemble filter components domain by domain
for
(
size_t
i
=
0
;
i
<
oPath
.
size
();
i
++
)
{
if
(
pAnchor
->
pAcousticMaterial
->
GetType
()
==
ITAGeo
::
Material
::
IMaterial
::
SCALAR
)
auto
pAnchor
(
oPath
[
i
]);
switch
(
pAnchor
->
iAnchorType
)
{
//Type cast of the acoustic material
auto
pScalarMaterial
=
std
::
dynamic_pointer_cast
<
ITAGeo
::
Material
::
CScalarMaterial
>
(
pAnchor
->
pAcousticMaterial
);
case
(
ITAGeo
::
CPropagationAnchor
::
ACOUSTIC_EMITTER
):
{
auto
pEmitter
=
std
::
dynamic_pointer_cast
<
const
ITAGeo
::
CEmitter
>
(
pAnchor
);
if
(
pAnchor
->
iAnchorType
==
ITAGeo
::
CPropagationAnchor
::
SPECULAR_REFLECTION
)
fScalarMagnitude
*=
(
float
)
abs
(
pScalarMaterial
->
cdReflectionFactor
);
else
fScalarMagnitude
*=
(
float
)
abs
(
pScalarMaterial
->
cdTransmissionFactor
);
if
(
i
==
oPath
.
size
())
ITA_EXCEPT_INVALID_PARAMETER
(
"Propagation path invalid: detected an emitting anchor point at the end of the path."
);
auto
pNextAnchor
(
oPath
[
i
+
1
]);
if
(
pEmitter
->
pDirectivity
)
{
switch
(
pEmitter
->
pDirectivity
->
GetFormat
())
{
case
(
ITAGeo
::
Directivity
::
IDirectivity
::
OPENDAFF
):
{
auto
pDAFFDirectivity
=
std
::
dynamic_pointer_cast
<
const
ITAGeo
::
Directivity
::
CDAFF_Format
>
(
pEmitter
->
pDirectivity
);
if
(
pDAFFDirectivity
->
GetDomain
()
==
ITADomain
::
ITA_FREQUENCY_DOMAIN
)
{
auto
pDAFFDirectivityMS
=
std
::
dynamic_pointer_cast
<
const
ITAGeo
::
Directivity
::
CDAFF_MagnitudeSpectrum
>
(
pAnchor
);
pDAFFDirectivityMS
->
GetMagnitudeSpectrum
();
}
}
}
}
/*
if (pAnchor->pAcousticMaterial->GetType() == ITAGeo::Material::IMaterial::SCALAR)
{
//Type cast of the acoustic material
auto pScalarMaterial = std::dynamic_pointer_cast<ITAGeo::Material::CScalarMaterial>(pAnchor->pAcousticMaterial);
if (pAnchor->iAnchorType == ITAGeo::CPropagationAnchor::SPECULAR_REFLECTION)
fScalarMagnitude *= (float)abs(pScalarMaterial->cdReflectionFactor);
else
fScalarMagnitude *= (float)abs(pScalarMaterial->cdTransmissionFactor);
}
*/
}
if
(
pAnchor
->
pAcousticMaterial
->
GetType
()
==
ITAGeo
::
Material
::
IMaterial
::
THIRD_OCTAVE
)
...
...
@@ -232,6 +267,7 @@ void CFilterEngine::Generate(const ITAGeo::CPropagationPathList & oPathList, ITA
oThirdOctFactors
[
i
]
*=
pThirdOctaveMaterial
->
GetTransmissionFactor
(
i
);
}
}
}
}
//Reset the HDFT spectra of the current path
...
...
src/ITAPropagationModels/Utils.cpp
View file @
f4bf3bde
...
...
@@ -20,18 +20,21 @@ float ITAPropagationModels::Utils::EstimateFilterLengthSamples(const ITAGeo::CPr
auto
p
=
std
::
dynamic_pointer_cast
<
const
ITAGeo
::
CEmitter
>
(
a
);
if
(
p
->
pDirectivity
)
fEstimatedFilterLengthSamples
+=
ITAGeo
::
Directivity
::
Utils
::
EstimateFilterLengthSamples
(
p
->
pDirectivity
,
fSampleRate
,
fSpeedOfSound
);
break
;
}
case
ITAGeo
::
CPropagationAnchor
::
ACOUSTIC_SENSOR
:
{
auto
p
=
std
::
dynamic_pointer_cast
<
const
ITAGeo
::
CSensor
>
(
a
);
if
(
p
->
pDirectivity
)
fEstimatedFilterLengthSamples
+=
ITAGeo
::
Directivity
::
Utils
::
EstimateFilterLengthSamples
(
p
->
pDirectivity
,
fSampleRate
,
fSpeedOfSound
);
break
;
}
case
ITAGeo
::
CPropagationAnchor
::
SPECULAR_REFLECTION
:
{
auto
p
=
std
::
dynamic_pointer_cast
<
const
ITAGeo
::
CSpecularReflection
>
(
a
);
if
(
p
->
pAcousticMaterial
)
fEstimatedFilterLengthSamples
+=
ITAGeo
::
Material
::
Utils
::
EstimateFilterLengthSamples
(
p
->
pAcousticMaterial
,
fSampleRate
,
fSpeedOfSound
);
break
;
}
default:
{
...
...
tests/ReceiverDirectivityTest/ReceiverDirectivityTest.cpp
View file @
f4bf3bde
...
...
@@ -22,7 +22,8 @@
#include <ITAGeo/Base.h>
#include <ITAGeo/Directivity/Base.h>
#include <ITAGeo/Directivity/DAFF_TimeDomain.h>
#include <ITAGeo/Directivity/DAFF_ImpulseResponse.h>
#include <ITAGeo/Directivity/DAFF_MagnitudeSpectrum.h>
#include <ITAFFTUtils.h>
...
...
@@ -38,7 +39,7 @@ int main( int, char** )
auto
pSenderLeft
=
make_shared
<
CEmitter
>
(
VistaVector3D
(
-
2.0
f
,
0.0
f
,
0.0
f
));
auto
pSenderRight
=
make_shared
<
CEmitter
>
(
VistaVector3D
(
2.0
f
,
0.0
f
,
0.0
f
));
shared_ptr
<
Directivity
::
CDAFF_
TimeDomain
>
pHRIR
=
make_shared
<
Directivity
::
CDAFF_TimeDomain
>
();
shared_ptr
<
Directivity
::
CDAFF_
ImpulseResponse
>
pHRIR
=
make_shared
<
Directivity
::
CDAFF_ImpulseResponse
>
();
pHRIR
->
LoadFromFile
(
"ITA_Artificial_Head_5x5_44kHz_128.v17.ir.daff"
);
auto
pReceiver
=
make_shared
<
CSensor
>
(
VistaVector3D
(
0.0
f
,
0.0
f
,
0.0
f
));
...
...
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