Applying refactoring from Kirchhoff to Maekawa for benchmarks

parent 5665b91c
......@@ -21,7 +21,7 @@
#include <ITAPropagationModels/Base.h>
#include <ITAPropagationModels/Kirchhoff.h>
#include <ITAPropagationModels/Maekawa.h>
#include <ITAPropagationModels/UTD.h>
#include <ITAPropagationModels/Svensson.h>
......@@ -82,33 +82,33 @@ void benchmark_single_wedge()
oReceiver->qOrient = VistaQuaternion( 0, 1, 0, 0 );
oReceiver->vPos.SetValues( -.4f, .6f, .1f );
auto oWedge = std::make_shared< ITAGeo::CITADiffractionWedgeAperture >();
oWedge->v3MainWedgeFaceNormal = VistaVector3D( 1.0f, 1.0f, .0f ).GetNormalized();
oWedge->v3OppositeWedgeFaceNormal = VistaVector3D( -1.0f, 1.0f, .0f ).GetNormalized();
oWedge->v3VertextStart.SetValues( .0f, 1.0f, -1.0f );
oWedge->v3VertextEnd.SetValues( .0f, 1.0f, 1.0f );
auto pWedge = std::make_shared< ITAGeo::CITADiffractionWedgeAperture >();
pWedge->v3MainWedgeFaceNormal = VistaVector3D( 1.0f, 1.0f, .0f ).GetNormalized();
pWedge->v3OppositeWedgeFaceNormal = VistaVector3D( -1.0f, 1.0f, .0f ).GetNormalized();
pWedge->v3VertextStart.SetValues( .0f, 1.0f, -1.0f );
pWedge->v3VertextEnd.SetValues( .0f, 1.0f, 1.0f );
ITAGeoUtils::CalculateDiffractionAperturePoint( oWedge->GetEdgeRay(), oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge->v3AperturePoint );
ITAGeoUtils::CalculateDiffractionAperturePoint( pWedge->GetEdgeRay(), oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, pWedge->v3AperturePoint );
if( !ITAGeoUtils::IsDiffractionAperturePointInRange( oWedge->v3VertextStart, oWedge->v3VertextEnd, oWedge->v3AperturePoint ) )
if( !ITAGeoUtils::IsDiffractionAperturePointInRange( pWedge->v3VertextStart, pWedge->v3VertextEnd, pWedge->v3AperturePoint ) )
ITA_EXCEPT_INVALID_PARAMETER( "Aperture point over wedge is outside edge vertices" );
if( !oWedge->IsOutsideWedge( oSource->v3InteractionPoint ) )
if( !pWedge->IsOutsideWedge( oSource->v3InteractionPoint ) )
ITA_EXCEPT_INVALID_PARAMETER( "Source point is inside wedge (solid part)" );
if( !oWedge->IsOutsideWedge( oReceiver->v3InteractionPoint ) )
if( !pWedge->IsOutsideWedge( oReceiver->v3InteractionPoint ) )
ITA_EXCEPT_INVALID_PARAMETER( "Receiver point is inside wedge (solid part)" );
ITAGeo::CPropagationPath oPropPath;
oPropPath.push_back( oSource );
oPropPath.push_back( oWedge );
oPropPath.push_back( pWedge );
oPropPath.push_back( oReceiver );
cout << "Path: " << oPropPath << endl;
// Kirchhoff
if( Kirchhoff::IsApplicable( oPropPath ) )
if( Maekawa::IsApplicable( oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, pWedge ) )
ITA_EXCEPT_INVALID_PARAMETER( "Kirchhoff model can not be applied for this propagation path." );
ITAStopWatch sw;
......@@ -120,7 +120,9 @@ void benchmark_single_wedge()
for( int i = 0; i < 1e8; i++ )
{
sw.start();
Kirchhoff::CalculateDiffractionFilter( oPropPath, oTF, g_fSpeedOfSound );
double dDir, dDet;
Maekawa::GetDirectLengthAndDetourLength( oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, pWedge, dDir, dDet );
Maekawa::CalculateDiffractionFilter( dDir, dDet, oTF, g_fSpeedOfSound );
sw.stop();
}
double dStopTime = ITAClock::getDefaultClock()->getTime();
......@@ -137,7 +139,7 @@ void benchmark_single_wedge()
for( int i = 0; i < 1e6; i++ )
{
sw.start();
UTD::CalculateDiffractionFilter(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge, oTF, iMethod, g_fSpeedOfSound);
UTD::CalculateDiffractionFilter(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, pWedge, oTF, iMethod, g_fSpeedOfSound);
sw.stop();
}
dStopTime = ITAClock::getDefaultClock()->getTime();
......@@ -150,14 +152,14 @@ void benchmark_single_wedge()
sw.reset();
cout << "Starting Biot-Tolstoy-Medwin-Svensson model benchmark:" << endl;
dStartTime = ITAClock::getDefaultClock()->getTime();
const float fMinDelay = oWedge->GetMinimumWavefrontDelayTime(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, g_fSpeedOfSound);
const float fMaxDelay = oWedge->GetMaximumWavefrontDelayTime(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, g_fSpeedOfSound);
const float fMinDelay = pWedge->GetMinimumWavefrontDelayTime(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, g_fSpeedOfSound);
const float fMaxDelay = pWedge->GetMaximumWavefrontDelayTime(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, g_fSpeedOfSound);
const int iIRLength = ( int ) ceil( float( fMaxDelay - fMinDelay ) * g_fSampleRate );
ITABase::CFiniteImpulseResponse oIR( iIRLength, g_fSampleRate, true );
for( int i = 0; i < 1e4; i++ )
{
sw.start();
Svensson::CalculateDiffractionIR(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge, oIR, g_fSpeedOfSound);
Svensson::CalculateDiffractionIR(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, pWedge, oIR, g_fSpeedOfSound);
sw.stop();
}
dStopTime = ITAClock::getDefaultClock()->getTime();
......
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