Nicer outputs during simulation for GRAS scenes 5 & 6

parent e207733b
......@@ -28,26 +28,25 @@
#include <ITAGeo/Material/Material.h>
#include <ITAGeo/Material/Manager.h>
#include <cassert>
using namespace std;
using namespace ITAGeo;
using namespace ITAPropagationPathSim;
#if 1 //#ifdef WITH_JSON_SUPPORT
#include <libjson.h>
#endif
int main( int iNumInArgs, char* pcInArgs[] )
int main( int, char** )
{
std::string sInFile = "GRAS_scene5_geometry.skp";
cout << " - - - - - GRAS scene 5.1 - - - - - " << endl << endl;
// Geo input
auto pMeshModelList = make_shared< ITAGeo::Halfedge::CMeshModelList>();
string sInFile = "GRAS_scene5_geometry.skp";
if( pMeshModelList->Load( sInFile ) )
{
cout << "Successfully loaded '" << sInFile << "'" << endl;
cout << "Successfully loaded geometry mesh from input file '" << sInFile << "'" << endl << endl;
}
else
{
......@@ -55,20 +54,20 @@ int main( int iNumInArgs, char* pcInArgs[] )
return 255;
}
// Scene
// Scenes
struct CGRASScene
{
inline CGRASScene( const std::string& sName, std::shared_ptr< CEmitter > pEmitter, std::shared_ptr< CSensor > pSensor )
inline CGRASScene( const std::string& sName, shared_ptr< CEmitter > pEmitter, shared_ptr< CSensor > pSensor )
: sName( sName )
, pEmitter( pEmitter )
, pSensor( pSensor )
{
};
std::shared_ptr< CSensor > pSensor;
std::shared_ptr< CEmitter > pEmitter;
std::string sName;
shared_ptr< CSensor > pSensor;
shared_ptr< CEmitter > pEmitter;
string sName;
};
auto pMP01 = make_shared< CSensor >( VistaVector3D( 8.512f, 2.985f, 1.235f ) );
......@@ -110,6 +109,7 @@ int main( int iNumInArgs, char* pcInArgs[] )
CGRASScene( "GRAS_5_1_LS04_MP04", pLS04, pMP04 ),
};
// Configuration
const bool bOnlyNeighbouredEdgeDiffraction = false;
......@@ -117,80 +117,67 @@ int main( int iNumInArgs, char* pcInArgs[] )
const bool bFilterNotVisiblePathsBetweenEdges = false; //Intersection test between edges(expensive)
const bool bFilterNotVisiblePointToEdge = false; //Intersection test between emitter/sensor and edges
const bool bFilterNotVisiblePaths = true; //Intersection test of calculated sub paths
const float fIntersectionTestResolution = 0.001;
const float fIntersectionTestResolution = 0.001f;
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 float 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 fReflectionPenalty = -10 * log10f( 0.8 ); //Level reduction of a reflection with reflection factor rho = 0.8 from ISO9613-2
const float fReflectionPenalty = -10.0f * log10( 0.8f ); //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)
const int iMaxDiffractionOrder = 2;
const int iMaxReflectionOrder = 2;
const int iMaxCombinedOrder = 4;
cout << "Propagation path algorithm configuration:" << endl;
cout << "\tReflection order : " << iMaxReflectionOrder << endl;
cout << "\tDiffraction order : " << iMaxReflectionOrder << endl;
cout << "\tMaximum order : " << iMaxCombinedOrder << endl;
cout << endl;
// Simulation
ITAStopWatch sw;
int i = 1;
for( auto& scene : vGRAS_5_1_Scenes )
{
cout << "* Starting " << scene.sName << " (" << i++ << "/" << vGRAS_5_1_Scenes.size() << ")" << endl;
sw.start();
cout << " #### " << scene.sName << " #### " << endl;
// Path finding
auto pPathEngine = make_shared<CombinedModel::CPathEngine>();
cout << "Calculation time initialization path engine: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->Configure( bOnlyNeighbouredEdgeDiffraction, bDiffractionOnlyIntoShadowedEdges, bFilterNotVisiblePathsBetweenEdges, bFilterNotVisiblePointToEdge, bFilterNotVisiblePointToEdge, bFilterNotVisiblePaths, iNumIterations, fIntersectionTestResolution );
pPathEngine->SetAbortionCriteria( iMaxDiffractionOrder, iMaxReflectionOrder, iMaxCombinedOrder, fLevelDropThreshhold, fReflectionPenalty, fDiffractionPenalty, fMaxAccumulatedDiffractionAngle );
cout << "Calculation time configuring filter: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->InitializePathEnvironment( pMeshModelList );
cout << "Calculation time initialization path environment: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->ApplyEmitter( scene.pEmitter );
cout << "Calculation time applying emitter: " << timeToString( sw.stop() ) << endl;
cout << "Number propagation path candidates after source insertion: " << pPathEngine->GetNumberPropagationPathCandidates() << endl;
sw.start();
pPathEngine->ApplySensor( scene.pSensor );
cout << "Calculation time applying sensor: " << timeToString( sw.stop() ) << endl;
CPropagationPathList oPathList;
cout << "Calculation time applying sensor: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->ConstructPropagationPaths( oPathList );
//pPathEngine->ConstructPropagationPathsWithStopWatch(oPathListAll);
cout << "Calculation time propagation path creation: " << timeToString( sw.stop() ) << endl;
cout << "Visible paths: " << to_string( oPathList.size() ) << endl;
cout << "\t -> found " << oPathList.size() << " visible paths" << endl;
// Propagation path list export
string sPropPathFilePath = scene.sName + "_propagation_paths.json";
oPathList.Store( sPropPathFilePath );
cout << "\tExported propagation path list to '" << sPropPathFilePath << "'" << endl;
// Export visualization
SketchUp::CModel oGeoModel_Viz;
if( oGeoModel_Viz.Load( sInFile ) )
try
{
cout << "Successfully loaded '" << sInFile << "'" << endl;
oGeoModel_Viz.Load( sInFile );
}
else
catch( ITAException& e )
{
cerr << "Could not load " << sInFile << endl;
cerr << "\tCould not load '" << sInFile << "' for visualization export: " << e << endl;
return 255;
}
oGeoModel_Viz.AddEmitterVisualization( *scene.pEmitter, scene.pEmitter->sName );
oGeoModel_Viz.AddSensorVisualization( *scene.pSensor, scene.pSensor->sName );
cout << "The path with the longest length is " << oPathList.GetMaxLength() << " m." << endl;
size_t numberOfPaths[ iMaxDiffractionOrder + 1 ][ iMaxReflectionOrder + 1 ] = { 0 };
for( auto& oPath : oPathList )
{
......@@ -209,9 +196,14 @@ int main( int iNumInArgs, char* pcInArgs[] )
oGeoModel_Viz.AddPropagationPathVisualization( oPath, sPathName );
}
oPathList.Store( scene.sName + "_propagation_paths.json" );
string sVizFilePath = scene.sName + "_visualization.skp";
oGeoModel_Viz.Store( sVizFilePath );
cout << "\tExported visualization file list to '" << sVizFilePath << "'" << endl;
auto fRuntime = sw.stop();
cout << "\tFinished simulation in " << timeToString( fRuntime ) << endl;
oGeoModel_Viz.Store( scene.sName + "_visualization.skp" );
cout << endl;
}
return 0;
......
/*
* ----------------------------------------------------------------
*
* ITA geometrical acoustics
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
* GRAS scene 6
*
*/
* ----------------------------------------------------------------
*
* ITA geometrical acoustics
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
* GRAS scene 6
*
*/
#include <ITAStopWatch.h>
#include <ITAStringUtils.h>
......@@ -28,26 +28,25 @@
#include <ITAGeo/Material/Material.h>
#include <ITAGeo/Material/Manager.h>
#include <cassert>
using namespace std;
using namespace ITAGeo;
using namespace ITAPropagationPathSim;
#if 1 //#ifdef WITH_JSON_SUPPORT
#include <libjson.h>
#endif
int main( int iNumInArgs, char* pcInArgs[] )
int main( int, char** )
{
std::string sInFile = "GRAS_scene6_geometry.skp";
cout << " - - - - - GRAS scene 6 - - - - - " << endl << endl;
// Geo input
auto pMeshModelList = make_shared< ITAGeo::Halfedge::CMeshModelList>();
string sInFile = "GRAS_scene6_geometry.skp";
if( pMeshModelList->Load( sInFile ) )
{
cout << "Successfully loaded '" << sInFile << "'" << endl;
cout << "Successfully loaded geometry mesh from input file '" << sInFile << "'" << endl << endl;
}
else
{
......@@ -55,20 +54,21 @@ int main( int iNumInArgs, char* pcInArgs[] )
return 255;
}
// Scene
struct CGRASScene
{
inline CGRASScene( const std::string& sName, std::shared_ptr< CEmitter > pEmitter, std::shared_ptr< CSensor > pSensor )
inline CGRASScene( const string& sName, shared_ptr< CEmitter > pEmitter, shared_ptr< CSensor > pSensor )
: sName( sName )
, pEmitter( pEmitter )
, pSensor( pSensor )
{
};
std::shared_ptr< CSensor > pSensor;
std::shared_ptr< CEmitter > pEmitter;
std::string sName;
shared_ptr< CSensor > pSensor;
shared_ptr< CEmitter > pEmitter;
string sName;
};
auto pMP01 = make_shared< CSensor >( VistaVector3D( 8.512f, 2.985f, 0.006f ) );
......@@ -86,7 +86,7 @@ int main( int iNumInArgs, char* pcInArgs[] )
pLS03->sName = "LS03_Genelec8020c";
std::vector< CGRASScene > vGRAS_6_Scenes = {
vector< CGRASScene > vGRAS_6_Scenes = {
CGRASScene( "GRAS_6_LS01_MP01", pLS01, pMP01 ),
CGRASScene( "GRAS_6_LS02_MP01", pLS02, pMP01 ),
CGRASScene( "GRAS_6_LS03_MP01", pLS03, pMP01 ),
......@@ -98,6 +98,7 @@ int main( int iNumInArgs, char* pcInArgs[] )
CGRASScene( "GRAS_6_LS03_MP03", pLS03, pMP03 ),
};
// Configuration
const bool bOnlyNeighbouredEdgeDiffraction = false;
......@@ -105,80 +106,67 @@ int main( int iNumInArgs, char* pcInArgs[] )
const bool bFilterNotVisiblePathsBetweenEdges = false; //Intersection test between edges(expensive)
const bool bFilterNotVisiblePointToEdge = false; //Intersection test between emitter/sensor and edges
const bool bFilterNotVisiblePaths = true; //Intersection test of calculated sub paths
const float fIntersectionTestResolution = 0.001;
const float fIntersectionTestResolution = 0.001f;
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 float 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 fReflectionPenalty = -10 * log10f( 0.8 ); //Level reduction of a reflection with reflection factor rho = 0.8 from ISO9613-2
const float fReflectionPenalty = -10.0f * log10( 0.8f ); //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)
const int iMaxDiffractionOrder = 2;
const int iMaxReflectionOrder = 2;
const int iMaxCombinedOrder = 4;
cout << "Propagation path algorithm configuration:" << endl;
cout << "\tReflection order : " << iMaxReflectionOrder << endl;
cout << "\tDiffraction order : " << iMaxReflectionOrder << endl;
cout << "\tMaximum order : " << iMaxCombinedOrder << endl;
cout << endl;
// Simulation
ITAStopWatch sw;
int i = 1;
for( auto& scene : vGRAS_6_Scenes )
{
cout << "* Starting " << scene.sName << " (" << i++ << "/" << vGRAS_6_Scenes.size() << ")" << endl;
sw.start();
cout << " #### " << scene.sName << " #### " << endl;
// Path finding
auto pPathEngine = make_shared<CombinedModel::CPathEngine>();
cout << "Calculation time initialization path engine: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->Configure( bOnlyNeighbouredEdgeDiffraction, bDiffractionOnlyIntoShadowedEdges, bFilterNotVisiblePathsBetweenEdges, bFilterNotVisiblePointToEdge, bFilterNotVisiblePointToEdge, bFilterNotVisiblePaths, iNumIterations, fIntersectionTestResolution );
pPathEngine->SetAbortionCriteria( iMaxDiffractionOrder, iMaxReflectionOrder, iMaxCombinedOrder, fLevelDropThreshhold, fReflectionPenalty, fDiffractionPenalty, fMaxAccumulatedDiffractionAngle );
cout << "Calculation time configuring filter: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->InitializePathEnvironment( pMeshModelList );
cout << "Calculation time initialization path environment: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->ApplyEmitter( scene.pEmitter );
cout << "Calculation time applying emitter: " << timeToString( sw.stop() ) << endl;
cout << "Number propagation path candidates after source insertion: " << pPathEngine->GetNumberPropagationPathCandidates() << endl;
sw.start();
pPathEngine->ApplySensor( scene.pSensor );
cout << "Calculation time applying sensor: " << timeToString( sw.stop() ) << endl;
CPropagationPathList oPathList;
cout << "Calculation time applying sensor: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->ConstructPropagationPaths( oPathList );
//pPathEngine->ConstructPropagationPathsWithStopWatch(oPathListAll);
cout << "Calculation time propagation path creation: " << timeToString( sw.stop() ) << endl;
cout << "Visible paths: " << to_string( oPathList.size() ) << endl;
cout << "\t -> found " << oPathList.size() << " visible paths" << endl;
// Propagation path list export
string sPropPathFilePath = scene.sName + "_propagation_paths.json";
oPathList.Store( sPropPathFilePath );
cout << "\tExported propagation path list to '" << sPropPathFilePath << "'" << endl;
// Export visualization
SketchUp::CModel oGeoModel_Viz;
if( oGeoModel_Viz.Load( sInFile ) )
try
{
cout << "Successfully loaded '" << sInFile << "'" << endl;
oGeoModel_Viz.Load( sInFile );
}
else
catch( ITAException& e )
{
cerr << "Could not load " << sInFile << endl;
cerr << "\tCould not load '" << sInFile << "' for visualization export: " << e << endl;
return 255;
}
oGeoModel_Viz.AddEmitterVisualization( *scene.pEmitter, scene.pEmitter->sName );
oGeoModel_Viz.AddSensorVisualization( *scene.pSensor, scene.pSensor->sName );
cout << "The path with the longest length is " << oPathList.GetMaxLength() << " m." << endl;
size_t numberOfPaths[ iMaxDiffractionOrder + 1 ][ iMaxReflectionOrder + 1 ] = { 0 };
for( auto& oPath : oPathList )
{
......@@ -197,9 +185,14 @@ int main( int iNumInArgs, char* pcInArgs[] )
oGeoModel_Viz.AddPropagationPathVisualization( oPath, sPathName );
}
oPathList.Store( scene.sName + "_propagation_paths.json" );
string sVizFilePath = scene.sName + "_visualization.skp";
oGeoModel_Viz.Store( sVizFilePath );
cout << "\tExported visualization file list to '" << sVizFilePath << "'" << endl;
auto fRuntime = sw.stop();
cout << "\tFinished simulation in " << timeToString( fRuntime ) << endl;
oGeoModel_Viz.Store( scene.sName + "_visualization.skp" );
cout << endl;
}
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