Improving UrbanTrajectory test

parent d21ad12a
......@@ -29,6 +29,8 @@
#include <ITAGeo/Material/Material.h>
#include <ITAGeo/Material/Manager.h>
#include <VistaTools/VistaFileSystemDirectory.h>
#include <cassert>
using namespace std;
......@@ -43,6 +45,7 @@ using namespace ITAPropagationPathSim;
int main( int iNumInArgs, char* pcInArgs[] )
{
std::string sInFile = "UrbanSetting.skp";
std::string sOutputDirectory = "UrbanTrajectory";
auto pMeshModelList = make_shared< ITAGeo::Halfedge::CMeshModelList>();
......@@ -56,6 +59,19 @@ int main( int iNumInArgs, char* pcInArgs[] )
return 255;
}
VistaFileSystemDirectory d( sOutputDirectory );
try
{
if( !d.Exists() )
d.CreateWithParentDirectories();
}
catch( ... )
{
cerr << "Could not create target folder " << sOutputDirectory << ", aborting." << endl;
return 255;
}
// Scene
auto pReceiver = make_shared< CSensor >( VistaVector3D( 10.0f, 5.0f, 1.7f ) );
......@@ -72,9 +88,9 @@ int main( int iNumInArgs, char* pcInArgs[] )
const float fIntersectionTestResolution = 0.001;
const int iNumIterations = 10;//!< Number of iterations for the calculation of the aperture points
const int fMaxAccumulatedDiffractionAngle = -2.0f * ITAConstants::PI_F; // zero or below -> disabled
const int fMaxAccumulatedDiffractionAngle = 2.0f * ITAConstants::PI_F; // zero or below -> disabled
const float fLevelDropThreshhold = -90.f - 30.f - 11.f; //90 dB Power level of Diesel; 30 dB masking; 11 dB initial power level drop
const float fLevelDropThreshold = -90.f - 30.f - 11.f; //90 dB Power level of Diesel; 30 dB masking; 11 dB initial power level drop
const float fReflectionPenalty = -10 * log10f( 0.8 ); //Level reduction of a reflection with reflection factor rho = 0.8 from ISO9613-2
const float fDiffractionPenalty = 2.5f; // Minimum level reduction of a diffracted signal into the shadow region for a low frequency (Taken from BA Filbert Figure 16. UTD)
......@@ -91,14 +107,14 @@ int main( int iNumInArgs, char* pcInArgs[] )
{
sw.start();
cout << " #### Running step " << std::setw( 8 ) << std::setfill( '0' ) << i << " / " << iNumSteps << " #### " << endl;
cout << "\t --- \t Simulating frame " << std::setw( 5 ) << i+1 << " of " << iNumSteps << " #### " << endl;
pVehicle->vPos = pVehicle->vPos + VistaVector3D( 0.01f, 0.0f, 0.0f ); // Move source ... adjust for requested speed @henry.
auto pPathEngine = make_shared<CombinedModel::CPathEngine>();
pPathEngine->Configure( bOnlyNeighbouredEdgeDiffraction, bDiffractionOnlyIntoShadowedEdges, bFilterNotVisiblePathsBetweenEdges, bFilterNotVisiblePointToEdge, bFilterNotVisiblePointToEdge, bFilterNotVisiblePaths, iNumIterations, fIntersectionTestResolution );
pPathEngine->SetAbortionCriteria( iMaxDiffractionOrder, iMaxReflectionOrder, iMaxCombinedOrder, fLevelDropThreshhold, fReflectionPenalty, fDiffractionPenalty, fMaxAccumulatedDiffractionAngle );
pPathEngine->SetAbortionCriteria( iMaxDiffractionOrder, iMaxReflectionOrder, iMaxCombinedOrder, fLevelDropThreshold, fReflectionPenalty, fDiffractionPenalty, fMaxAccumulatedDiffractionAngle );
pPathEngine->InitializePathEnvironment( pMeshModelList );
pPathEngine->ApplyEmitter( pVehicle );
......@@ -109,11 +125,13 @@ int main( int iNumInArgs, char* pcInArgs[] )
cout << "Visible paths: " << to_string( oPathList.size() ) << endl;
std::stringstream ss;
ss << "UrbanTrajectory_pps_" << std::setw( 8 ) << std::setfill( '0' ) << 8 << i << ".json";
ss << sOutputDirectory << "/" << "UrbanTrajectory_pps_" << std::setw( 5 ) << std::setfill( '0' ) << i+1 << ".json";
oPathList.Store( ss.str().c_str() );
cout << "Done in " << timeToString( sw.stop() ) << " seconds." << endl;
#ifdef _DEBUG // For some reason, SKP export only works in debug mode. Seems too be a bug in external slapi library (2018)
// Every now and then, export a visualization model
if( i == 0 || i == ( int ) iNumIterations / 2 || i == iNumSteps-1 )
{
......@@ -153,9 +171,22 @@ int main( int iNumInArgs, char* pcInArgs[] )
}
std::stringstream ss_viz;
ss_viz << "UrbanTrajectory_pps_" << std::setw( 8 ) << std::setfill( '0' ) << 8 << i << "_viz.skp";
//oGeoModel_Viz.Store( ss_viz.str().c_str() );
ss_viz << sOutputDirectory << "/" << "UrbanTrajectory_pps_" << std::setw( 5 ) << std::setfill( '0' ) << i+1 << "_viz.skp";
string sVizFilePath = ss_viz.str().c_str();
try
{
oGeoModel_Viz.Store( sVizFilePath );
cout << "Exported visualization file to " << sVizFilePath << endl;
}
catch( ... )
{
cerr << "Failed to export visualization file to " << sVizFilePath << endl;
}
}
#endif // _DEBUG
}
return 0;
......
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