Finalizing refactoring for now

parent bd3aa166
......@@ -19,11 +19,11 @@
* ----------------------------------------------------------------
*/
#include <ITAPropagationModelsBase.h>
#include <ITAPropagationModels/Base.h>
#include <ITAPropagationModelKirchhoff.h>
#include <ITAPropagationModelUTD.h>
#include <ITAPropagationModelSvensson.h>
#include <ITAPropagationModels/Kirchhoff.h>
#include <ITAPropagationModels/UTD.h>
#include <ITAPropagationModels/Svensson.h>
#include <ITAGeoBase.h>
#include <ITAGeoModelBase.h>
......@@ -45,6 +45,7 @@
#include <iostream>
using namespace std;
using namespace ITAPropagationModels;
float g_fSpeedOfSound = 344.0f;
float g_fSampleRate = 44.1e3;
......@@ -107,7 +108,7 @@ void benchmark_single_wedge()
// Kirchhoff
if( !ITADiffractionKirchhoff::IsApplicable( oPropPath ) )
if( Kirchhoff::IsApplicable( oPropPath ) )
ITA_EXCEPT_INVALID_PARAMETER( "Kirchhoff model can not be applied for this propagation path." );
ITAStopWatch sw;
......@@ -118,7 +119,7 @@ void benchmark_single_wedge()
for( int i = 0; i < 1e8; i++ )
{
sw.start();
ITADiffractionKirchhoff::CalculateDiffractionFilter( oPropPath, oTF, g_fSpeedOfSound );
Kirchhoff::CalculateDiffractionFilter( oPropPath, oTF, g_fSpeedOfSound );
sw.stop();
}
double dStopTime = ITAClock::getDefaultClock()->getTime();
......@@ -131,11 +132,11 @@ void benchmark_single_wedge()
sw.reset();
cout << "Starting UTD model benchmark:" << endl;
dStartTime = ITAClock::getDefaultClock()->getTime();
const int iMethod = ITADiffractionUTD::UTD_APPROX_KAWAI_KOUYOUMJIAN;
const int iMethod = UTD::UTD_APPROX_KAWAI_KOUYOUMJIAN;
for( int i = 0; i < 1e6; i++ )
{
sw.start();
ITADiffractionUTD::CalculateDiffractionFilter(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge, oTF, iMethod, g_fSpeedOfSound);
UTD::CalculateDiffractionFilter(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge, oTF, iMethod, g_fSpeedOfSound);
sw.stop();
}
dStopTime = ITAClock::getDefaultClock()->getTime();
......@@ -155,7 +156,7 @@ void benchmark_single_wedge()
for( int i = 0; i < 1e4; i++ )
{
sw.start();
ITADiffractionSvensson::CalculateDiffractionIR(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge, oIR, g_fSpeedOfSound);
Svensson::CalculateDiffractionIR(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge, oIR, g_fSpeedOfSound);
sw.stop();
}
dStopTime = ITAClock::getDefaultClock()->getTime();
......
......@@ -19,7 +19,7 @@
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODEL_BASE
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODEL_BASE
namespace ITAPropagationModel
namespace ITAPropagationModels
{
}
......
......@@ -24,18 +24,22 @@
// ITA includes
#include <ITASampleBuffer.h>
//! Diffraction filter impulse response in time domain
/**
*
* Because only the diffraction part is described, leading
* zeros from the propagation delay is discarded in the IR.
*/
class ITA_PROPAGATION_MODELS_API CITADiffractionFilter
namespace ITAPropagationModels
{
CITADiffractionFilter();
ITASampleBuffer sbFIRFilter;
int nLeadingZeros;
int nFilterLength;
};
//! Diffraction filter impulse response in time domain
/**
*
* Because only the diffraction part is described, leading
* zeros from the propagation delay is discarded in the IR.
*/
class ITA_PROPAGATION_MODELS_API CITADiffractionFilter
{
CITADiffractionFilter();
ITASampleBuffer sbFIRFilter;
int nLeadingZeros;
int nFilterLength;
};
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER
......@@ -65,7 +65,8 @@ namespace ITAPropagationModels
inline void GenerateTF( ITABase::CHDFTSpectrum& pTransferFunction )
{
const std::vector< ITABase::CHDFTSpectrum* > vpSpectra = { &( pTransferFunction ) };
GenerateTF( ITABase::CHDFTSpectra( vpSpectra ) );
ITABase::CHDFTSpectra oTF( vpSpectra );
GenerateTF( oTF );
};
//! Generate a multi-channel transfer function
......
This diff is collapsed.
......@@ -22,7 +22,7 @@
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_SVENSSON
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_SVENSSON
#include <ITAPropagationModelsDefinitions.h>
#include "Definitions.h"
// Vista includes
#include <VistaBase/VistaVector3D.h>
......@@ -34,20 +34,23 @@
#include <ITAFiniteImpulseResponse.h>
namespace ITADiffractionSvensson
namespace ITAPropagationModels
{
//! Calculates the impulse response of Svensson diffraction model for a given constellation
/**
* @sa Svensson, P.; Fred, R. & Vanderkooy, J.; An analytic secondary source model of edge diffraction impulse responses; J. Acoust. Soc. Am., 1999, 106, 2331
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[out] oEffectiveDiffractionIR Effective impulse response for diffraction part of sound path from source to target (not including delay)
*
* @sa GetMinimumWavefrontDelayTime, GetMaximumWavefrontDelayTime
*/
ITA_PROPAGATION_MODELS_API bool CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CFiniteImpulseResponse& oEffectiveDiffractionIR, const float fSpeedOfSound = 344.0f );
};
namespace Svensson
{
//! Calculates the impulse response of Svensson diffraction model for a given constellation
/**
* @sa Svensson, P.; Fred, R. & Vanderkooy, J.; An analytic secondary source model of edge diffraction impulse responses; J. Acoust. Soc. Am., 1999, 106, 2331
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[out] oEffectiveDiffractionIR Effective impulse response for diffraction part of sound path from source to target (not including delay)
*
* @sa GetMinimumWavefrontDelayTime, GetMaximumWavefrontDelayTime
*/
ITA_PROPAGATION_MODELS_API bool CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CFiniteImpulseResponse& oEffectiveDiffractionIR, const float fSpeedOfSound = 344.0f );
}
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_SVENSSON
......@@ -21,7 +21,7 @@
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_UTD
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_UTD
#include <ITAPropagationModelsDefinitions.h>
#include "Definitions.h"
// Vista includes
#include <VistaBase/VistaVector3D.h>
......@@ -35,47 +35,50 @@
// STL includes
#include <ccomplex>
namespace ITADiffractionUTD
namespace ITAPropagationModels
{
//! UTD diffraction coefficient calculation methods (only approximation implemented yet!)
enum UTD_DIFFRACTION_ALGORITHM
namespace UTD
{
UTD_FRESNEL_INTEGRAL_FORM = 1, //!< Solve Fresnel integral over komplex value (not implemented yet!)
UTD_APPROX_KAWAI_KOUYOUMJIAN = 2, //!< Skip integral solution and use approximations
};
//! UTD diffraction coefficient calculation methods (only approximation implemented yet!)
enum UTD_DIFFRACTION_ALGORITHM
{
UTD_FRESNEL_INTEGRAL_FORM = 1, //!< Solve Fresnel integral over komplex value (not implemented yet!)
UTD_APPROX_KAWAI_KOUYOUMJIAN = 2, //!< Skip integral solution and use approximations
};
//ITA_PROPAGATION_MODELS_API bool GenerateUTDDiffractionFilter( const CITAGeoPropagationPath& vPath, ITAHDFTSpectrum& oDiffractionAttenuationSpectrum );
//ITA_PROPAGATION_MODELS_API bool GenerateUTDDiffractionFilter( const CITAGeoPropagationAnchor& oSource, const CITAGeoPropagationAnchor& oTarget, const CITADiffractionWedgeAperture& oApex, ITAHDFTSpectrum& oDiffractionAttenuationSpectrum );
//! Calculates the complex valued UTD diffraction coefficient for a given constellation and wave number
/**
* @sa Tsingos, N.; Funkhouser, T.; Ngan, A. & Carlbom, I.; Modeling Acoustics in Virtual Environments Using the Uniform Theory of Diffraction; Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, ACM, 2001, 545-552
* @sa Kouyoumjian, R. G. & Pathak, P. H.; A uniform geometrical theory of diffraction for an edge in a perfectly conducting surface; Proceedings of the IEEE, IEEE, 1974, 62, 1448-1461
* @sa Kawai, T.; Sound diffraction by a many-sided barrier or pillar; Journal of Sound Vibration, 1981, 79, 229-242
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[in] fWaveNumber Wave number ( k )
* @param[out] cfCoeff Complex-valued diffraction coefficient ( D( n, k,\rho, r, \phi_i, \alpha_i, \alpha_d ) )
* @param[in] iMethod Approximation algorithm
*/
ITA_PROPAGATION_MODELS_API bool CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, const float fWaveNumber, std::complex< float >& cfCoeff, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN );
//ITA_PROPAGATION_MODELS_API bool GenerateUTDDiffractionFilter( const CITAGeoPropagationPath& vPath, ITAHDFTSpectrum& oDiffractionAttenuationSpectrum );
//ITA_PROPAGATION_MODELS_API bool GenerateUTDDiffractionFilter( const CITAGeoPropagationAnchor& oSource, const CITAGeoPropagationAnchor& oTarget, const CITADiffractionWedgeAperture& oApex, ITAHDFTSpectrum& oDiffractionAttenuationSpectrum );
//! Calculates the UTD diffraction filter in frequency domain for a given constellation
/**
* @sa Tsingos, N.; Funkhouser, T.; Ngan, A. & Carlbom, I.; Modeling Acoustics in Virtual Environments Using the Uniform Theory of Diffraction; Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, ACM, 2001, 545-552
* @sa Kouyoumjian, R. G. & Pathak, P. H.; A uniform geometrical theory of diffraction for an edge in a perfectly conducting surface; Proceedings of the IEEE, IEEE, 1974, 62, 1448-1461
* @sa Kawai, T.; Sound diffraction by a many-sided barrier or pillar; Journal of Sound Vibration, 1981, 79, 229-242
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[out] oTF Diffraction transfer function / filter in frequency domain
* @param[in] iMethod Approximation algorithm
* @param[in] fSpeedOfSound Sound speed
*/
ITA_PROPAGATION_MODELS_API void CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CHDFTSpectrum& oTF, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN, const float fSpeedOfSound = 344.0f );
};
//! Calculates the complex valued UTD diffraction coefficient for a given constellation and wave number
/**
* @sa Tsingos, N.; Funkhouser, T.; Ngan, A. & Carlbom, I.; Modeling Acoustics in Virtual Environments Using the Uniform Theory of Diffraction; Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, ACM, 2001, 545-552
* @sa Kouyoumjian, R. G. & Pathak, P. H.; A uniform geometrical theory of diffraction for an edge in a perfectly conducting surface; Proceedings of the IEEE, IEEE, 1974, 62, 1448-1461
* @sa Kawai, T.; Sound diffraction by a many-sided barrier or pillar; Journal of Sound Vibration, 1981, 79, 229-242
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[in] fWaveNumber Wave number ( k )
* @param[out] cfCoeff Complex-valued diffraction coefficient ( D( n, k,\rho, r, \phi_i, \alpha_i, \alpha_d ) )
* @param[in] iMethod Approximation algorithm
*/
ITA_PROPAGATION_MODELS_API bool CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, const float fWaveNumber, std::complex< float >& cfCoeff, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN );
//! Calculates the UTD diffraction filter in frequency domain for a given constellation
/**
* @sa Tsingos, N.; Funkhouser, T.; Ngan, A. & Carlbom, I.; Modeling Acoustics in Virtual Environments Using the Uniform Theory of Diffraction; Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, ACM, 2001, 545-552
* @sa Kouyoumjian, R. G. & Pathak, P. H.; A uniform geometrical theory of diffraction for an edge in a perfectly conducting surface; Proceedings of the IEEE, IEEE, 1974, 62, 1448-1461
* @sa Kawai, T.; Sound diffraction by a many-sided barrier or pillar; Journal of Sound Vibration, 1981, 79, 229-242
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[out] oTF Diffraction transfer function / filter in frequency domain
* @param[in] iMethod Approximation algorithm
* @param[in] fSpeedOfSound Sound speed
*/
ITA_PROPAGATION_MODELS_API void CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CHDFTSpectrum& oTF, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN, const float fSpeedOfSound = 344.0f );
}
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_UTD
#include <ITAPropagationModelFilterGenerator.h>
#include <ITAPropagationModels/FilterGenerator.h>
// ITA includes
#include <ITAException.h>
......@@ -11,17 +11,4 @@
#include <assert.h>
#include <stdio.h>
using namespace ITAGeo;
CITADiffractionFilterGenerator::CITADiffractionFilterGenerator( int iModel )
: m_iModel( iModel )
{
}
/* see @todo
void CITAFilterGenerator::GenerateFIR( const CPropagationAnchor& oSource, const CPropagationAnchor& oDestination, CITADiffractionWedgeAperture& oWedge, CITADiffractionFilter& oFilter )
{
}
*/
\ No newline at end of file
using namespace ITAPropagationModels;
......@@ -14,8 +14,12 @@
using namespace ITAGeo;
using namespace ITAPropagationModels;
CTFGenerator::CFilterGenerator( int iModel )
: m_iModel( iModel )
ITAPropagationModels::CTFGenerator::CTFGenerator( const int iNumOutputChannels, const int iDFTSize /*= 128 */ )
{
}
void ITAPropagationModels::CTFGenerator::GenerateTF( ITABase::CHDFTSpectra& pTransferFunctions )
{
}
#include <ITAPropagationModelKirchhoff.h>
#include <ITAPropagationModels/Kirchhoff.h>
#include <ITAException.h>
using namespace ITAGeo;
using namespace ITAPropagationModels;
bool ITADiffractionKirchhoff::IsApplicable( const CPropagationPath& oPropPath )
bool Kirchhoff::IsApplicable( const CPropagationPath& oPropPath )
{
if( oPropPath.size() < 3 )
ITA_EXCEPT1( INVALID_PARAMETER, "Propagation path needs at least 3 anchors for Kirchhoff method" );
......@@ -40,7 +42,7 @@ bool ITADiffractionKirchhoff::IsApplicable( const CPropagationPath& oPropPath )
return true;
}
void ITADiffractionKirchhoff::GetDirectLengthAndDetourLength( const CPropagationPath& oPropPath, double& dPropagationLengthDirect, double& dPropagationLengthDetour )
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" );
......@@ -88,7 +90,7 @@ void ITADiffractionKirchhoff::GetDirectLengthAndDetourLength( const CPropagation
return;
}
double ITADiffractionKirchhoff::KirchhoffDelta( const double dPropagationLengthDirect, const double dPropagationLengthDetour )
double Kirchhoff::KirchhoffDelta( const double dPropagationLengthDirect, const double dPropagationLengthDetour )
{
if( dPropagationLengthDirect <= 0.0f )
ITA_EXCEPT1( INVALID_PARAMETER, "Diffraction direct path length can not be zero or negative" );
......@@ -103,7 +105,7 @@ double ITADiffractionKirchhoff::KirchhoffDelta( const double dPropagationLengthD
return dKirchhoffDelta;
}
void ITADiffractionKirchhoff::CalculateDiffractionFilter( const double dDirect, const double dDetour, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound /*= 344.0f*/ )
void Kirchhoff::CalculateDiffractionFilter( const double dDirect, const double dDetour, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound /*= 344.0f*/ )
{
assert( fSpeedOfSound > 0.0f );
if( fSpeedOfSound <= 0.0f )
......@@ -116,7 +118,7 @@ void ITADiffractionKirchhoff::CalculateDiffractionFilter( const double dDirect,
for( int i = 1; i < iDFTSize - 1; i++ )
{
const double dFrequency = oTransferFunction.GetFrequencyResolution() * i;
const double dFresnelNumber = 2.0f * ITADiffractionKirchhoff::KirchhoffDelta( dDirect, dDetour ) * dFrequency / fSpeedOfSound; // Sometimes referred to as 'N'
const double dFresnelNumber = 2.0f * Kirchhoff::KirchhoffDelta( dDirect, dDetour ) * dFrequency / fSpeedOfSound; // Sometimes referred to as 'N'
oTransferFunction.SetCoeffRI( i, float( dFresnelNumber ) );
}
}
#include <ITAPropagationModelSvensson.h>
#include <ITAPropagationModels/Svensson.h>
#include <ITAConstants.h>
#include <ITAGeoUtils.h>
......@@ -7,6 +7,7 @@
#include <cassert>
using namespace ITAConstants;
using namespace ITAPropagationModels;
//! Heaviside's unit step function
float SvenssonHelperHeavisideFunction( const float fX );
......@@ -23,7 +24,7 @@ float SvenssonHelperBeta( const float nu, const float theta_s, const float theta
//! Plus-minus variant for beta values in geometrical functions
float SvenssonHelperBetaEval( const float nu, const float alpha, const float gamma, const float fPMVariant );
bool ITADiffractionSvensson::CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CFiniteImpulseResponse& oEffectiveDiffractionIR, const float fSpeedOfSound /* = 344.0f */ )
bool Svensson::CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CFiniteImpulseResponse& oEffectiveDiffractionIR, const float fSpeedOfSound /* = 344.0f */ )
{
if( fSpeedOfSound <= 0.0f )
ITA_EXCEPT_INVALID_PARAMETER( "Speed of sound must be greate zero" );
......
#include <ITAPropagationModelUTD.h>
#include <ITAPropagationModels/UTD.h>
#include <ITAConstants.h>
#include <ITAGeoUtils.h>
......@@ -7,6 +7,7 @@
#include <cassert>
using namespace ITAConstants;
using namespace ITAPropagationModels;
//! Solves the Fresnel integral for given value, in literature often referred to as F( X )
std::complex< float > UTDHelperFunctionFresnelIntegralSolution( const float fX );
......@@ -29,7 +30,7 @@ float UTDHelperFunction_a_plus( const float fBeta, const float n );
float UTDHelperFunction_a_minus( const float fBeta, const float n );
void ITADiffractionUTD::CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CHDFTSpectrum& oTF, const int iMethod /* = UTD_APPROX_KAWAI_KOUYOUMJIAN */, const float fSpeedOfSound /* = 344.0f */ )
void UTD::CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CHDFTSpectrum& oTF, const int iMethod /* = UTD_APPROX_KAWAI_KOUYOUMJIAN */, const float fSpeedOfSound /* = 344.0f */ )
{
std::complex< float > cfCoeff;
oTF.SetCoeffRI( 0, 1.0f, 0.0f ); // DC
......@@ -38,12 +39,12 @@ void ITADiffractionUTD::CalculateDiffractionFilter( const VistaVector3D& v3Sourc
const float fFrequency = float( i ) * oTF.GetFrequencyResolution();
assert( fFrequency > 0.0f );
const float fWaveNumberRad = 2.0f * PI_F * fFrequency / fSpeedOfSound;
CalculateDiffractionCoefficient( v3SourcePos, v3TargetPos, pApex, fWaveNumberRad, cfCoeff, iMethod );
UTD::CalculateDiffractionCoefficient( v3SourcePos, v3TargetPos, pApex, fWaveNumberRad, cfCoeff, iMethod );
oTF.SetCoeff( i, cfCoeff );
}
}
bool ITADiffractionUTD::CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, const float fWaveNumber, std::complex< float >& cfCoeff, const int iMethod /* = UTD_APPROX_KAWAI_KOUYOUMJIAN */ )
bool UTD::CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, const float fWaveNumber, std::complex< float >& cfCoeff, const int iMethod /* = UTD_APPROX_KAWAI_KOUYOUMJIAN */ )
{
if( ITAGeoUtils::IsPointInsideDiffrationWedge( pApex->v3VertextStart, pApex->v3VertextEnd, pApex->v3MainWedgeFaceNormal, pApex->v3OppositeWedgeFaceNormal, v3SourcePos ) )
return false;
......
......@@ -16,7 +16,7 @@
*
*/
#include <ITAPropagationModelKirchhoff.h>
#include <ITAPropagationModels/Kirchhoff.h>
#include <ITAException.h>
#include <ITAStopWatch.h>
......@@ -31,6 +31,7 @@
using namespace std;
using namespace ITAGeo;
using namespace ITAPropagationModels;
static float g_fSampleRate = 44.1e3f;
static int g_iFilterLength = 128;
......@@ -62,21 +63,21 @@ int main( int, char** )
try
{
if( ITADiffractionKirchhoff::IsApplicable( oPropPath ) )
if( Kirchhoff::IsApplicable( oPropPath ) )
cout << "[OK] Kirchhoff method can be applied for this path" << endl;
else
cout << "[BAD] Kirchhoff method can't be applied for this path, trying anyway" << endl;
double dPropLendthDirect, dPropLengthDetour;
ITADiffractionKirchhoff::GetDirectLengthAndDetourLength( oPropPath, dPropLendthDirect, dPropLengthDetour );
Kirchhoff::GetDirectLengthAndDetourLength( oPropPath, dPropLendthDirect, dPropLengthDetour );
cout << "Kirchhoff direct path length: " << dPropLendthDirect << " m" << endl;
cout << "Kirchhoff detour path length: " << dPropLengthDetour << " m" << endl;
cout << "Kirchhoff delta: " << ITADiffractionKirchhoff::KirchhoffDelta( dPropLendthDirect, dPropLengthDetour ) << " m" << endl;
cout << "Kirchhoff delta: " << Kirchhoff::KirchhoffDelta( dPropLendthDirect, dPropLengthDetour ) << " m" << endl;
ITABase::CHDFTSpectrum oDiffractionTF( g_fSampleRate, g_iFilterLength / 2 + 1, true );
ITAStopWatch sw; sw.start();
ITADiffractionKirchhoff::CalculateDiffractionFilter( dPropLendthDirect, dPropLengthDetour, oDiffractionTF );
Kirchhoff::CalculateDiffractionFilter( dPropLendthDirect, dPropLengthDetour, oDiffractionTF );
cout << "Kirchhoff filter generation calculation time: " << timeToString( sw.stop() ) << endl;
cout << oDiffractionTF.ToString() << endl;
......
......@@ -16,7 +16,7 @@
*
*/
#include <ITAPropagationModelSvensson.h>
#include <ITAPropagationModels/Svensson.h>
#include <ITAException.h>
#include <ITAStopWatch.h>
......@@ -34,6 +34,7 @@
using namespace std;
using namespace ITAConstants;
using namespace ITAGeo;
using namespace ITAPropagationModels;
static const float g_fSampleRate = 44.1e3f;
static const float g_fSpeedOfSound = 344.0f;
......@@ -73,7 +74,7 @@ int main( int, char** )
ITABase::CFiniteImpulseResponse oEffectiveDiffractionIR( iIRLength, g_fSampleRate, true );
ITAStopWatch sw; sw.start();
ITADiffractionSvensson::CalculateDiffractionIR( pS->v3InteractionPoint, pR->v3InteractionPoint, pW, oEffectiveDiffractionIR );
Svensson::CalculateDiffractionIR( pS->v3InteractionPoint, pR->v3InteractionPoint, pW, oEffectiveDiffractionIR );
cout << "Svensson IR generation calculation time: " << timeToString( sw.stop() ) << endl;
cout << oEffectiveDiffractionIR.toString() << endl;
......
......@@ -16,7 +16,7 @@
*
*/
#include <ITAPropagationModelUTD.h>
#include <ITAPropagationModels/UTD.h>
#include <ITAException.h>
#include <ITAStopWatch.h>
......@@ -32,6 +32,7 @@
using namespace std;
using namespace ITAConstants;
using namespace ITAGeo;
using namespace ITAPropagationModels;
static const float g_fSampleRate = 44.1e3f;
static const int g_iFilterLength = 128;
......@@ -73,7 +74,7 @@ int main( int, char** )
{
const float f = float( i ) * float( oDiffractionTF.GetFrequencyResolution() );
const float k = 2.0f * PI_F * f / g_fSpeedOfSound;
ITADiffractionUTD::CalculateDiffractionCoefficient( pS->v3InteractionPoint, pR->v3InteractionPoint, pW, k, cfCoeff, ITADiffractionUTD::UTD_APPROX_KAWAI_KOUYOUMJIAN );
UTD::CalculateDiffractionCoefficient( pS->v3InteractionPoint, pR->v3InteractionPoint, pW, k, cfCoeff, UTD::UTD_APPROX_KAWAI_KOUYOUMJIAN );
oDiffractionTF.SetCoeff( i, cfCoeff );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment