Commit 69fd2007 authored by Armin Erraji's avatar Armin Erraji

Merge remote-tracking branch 'remotes/origin/develop' into ma_2018/erraji

# Conflicts:
#	tests/CMakeLists.txt
parents 65291b9b b4876295
......@@ -274,7 +274,7 @@ void CDiffractionPath::ConstructDiffractionMatrix()
for (auto &keyBuilding : m_mpBuildings)
{
CITAMesh* pKeyBuildingMesh = keyBuilding.second->GetMesh()->pMesh;
CITAMesh::ConstEdgeRange hKeyBuildingEdges = pKeyBuildingMesh->edges();
CITAMesh::ConstEdgeRangeSkipping hKeyBuildingEdges = pKeyBuildingMesh->edges();
//Create diffraction edges for all edges used as keys in matrix
......@@ -569,7 +569,7 @@ bool CDiffractionPath::IsEdgeIlluminated(const CITAMesh& oEdgeMesh, const CITAMe
{
//Mesh of current building and its face handles
CITAMesh* pCurrentMesh = keyBuildings.second->GetMesh()->pMesh;
CITAMesh::ConstFaceRange hFaces = pCurrentMesh->faces();
CITAMesh::ConstFaceRangeSkipping hFaces = pCurrentMesh->faces();
for (CITAMesh::FaceHandle const &hFace : hFaces)
{
......
......@@ -3,4 +3,5 @@ cmake_minimum_required( VERSION 2.8 )
add_subdirectory( "ImageModel" )
add_subdirectory( "ConvexDiffraction" )
add_subdirectory( "MeshModelList")
add_subdirectory( "UrbanDiffraction")
\ No newline at end of file
add_subdirectory( "UrbanDiffraction" )
#add_subdirectory( "IndoorDiffraction" )
\ No newline at end of file
......@@ -52,7 +52,7 @@ int main( int, char** )
auto pSource = make_shared< CEmitter >();
pSource->sName = "Loudspeaker Source";
pSource->qOrient = VistaQuaternion( 0, -1, 0, 0 ); // irrelevant here, but looking at receiver
pSource->vPos.SetValues( 0.0f, 0.0f, -1.0f );
pSource->vPos.SetValues( 0.0f, 0.0f, 0.0f + ITAConstants::EPS_F_L );
auto pReceiver = make_shared< CSensor >();
pReceiver->sName = "Receiver";
......@@ -79,35 +79,46 @@ int main( int, char** )
oGeoModel.TriangulateMeshes();
if( oGeoModel.IsWaterproof() == false )
cerr << "Model is not waterproof. Trying top level mesh anyway." << endl;
cerr << "[ WARNING ] Model is not waterproof. Trying top level mesh anyway." << endl;
ConvexDiffraction::CEngine* pDiffractionEngine = ConvexDiffraction::CEngine::Create( oGeoModel.GetTopLevelMesh(), pSource, pReceiver );
pDiffractionEngine->SetDefaultAbortionCriteria();
pDiffractionEngine->oAbortionCriteria.iDiffractionPreparationOrder = 2;
pDiffractionEngine->oAbortionCriteria.iNumMaxDiffractions = 6;
pDiffractionEngine->oAbortionCriteria.iDiffractionPreparationOrder = 4;
pDiffractionEngine->oAbortionCriteria.iNumMaxDiffractions = 4;
cout << pDiffractionEngine->oAbortionCriteria << endl;
CPropagationPathList voPaths;
pDiffractionEngine->CalculateDiffractionPaths( voPaths );
int iMaxPropLength = -1;
for( auto oPath : voPaths )
{
cout << oPath << endl;
if( iMaxPropLength < ( int ) oPath.size() )
iMaxPropLength = ( int ) oPath.size();
}
voPaths.Store( sFileBaseName + ".json" );
cout << "Stored propagation paths to '" << sFileBaseName << ".json'" << endl;
if( voPaths.empty() )
cerr << "[ WARNING ] No valid propagation paths found" << endl;
else
{
cout << "Calculated " << voPaths.size() << " diffraction paths at maximum order of " << iMaxPropLength << endl;
voPaths.Store( sFileBaseName + ".json" );
cout << "Stored propagation paths to '" << sFileBaseName << ".json'" << endl;
}
Halfedge::CMeshModel oDiffractionVisualizationMesh;
oDiffractionVisualizationMesh.SetName( "ITA_Vis_AcousticDiffractionGradient" );
pDiffractionEngine->GetCombinedDiffractionGradientVisualization( &oDiffractionVisualizationMesh );
oGeoModel.AddVisualizationMesh( &oDiffractionVisualizationMesh );
oGeoModel.AddVisualizationMesh( &oDiffractionVisualizationMesh, "CombinedDiffractionGradient" );
cout << "Calculated " << voPaths.size() << " diffraction paths at maximum order of ..." << endl;
for( auto oPath : voPaths )
oGeoModel.AddPropagationPathVisualization( oPath, "ITA_Visuals_DiffractionContour" );
oGeoModel.AddPropagationPathVisualization( oPath, "DiffractionContour" );
oGeoModel.Store( sFileBaseName + "_Vis.skp" );
......
{
"class" : "PropagationPathList",
"PropagationPathList" : []
"identifier" : "",
"propagation paths" : []
}
\ No newline at end of file
......
cmake_minimum_required( VERSION 2.8 )
project( ITAPropagationPathSimTest )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITAPropagationPathSim REQUIRED FIND_DEPENDENCIES )
if( ITA_CORE_LIBS_BUILD_STATIC )
add_definitions( -DITA_BASE_STATIC )
endif( )
if( ITA_GEOMETRICAL_ACOUSTICS_BUILD_STATIC )
add_definitions( -DITA_PROPAGATION_PATH_SIM_STATIC -DITA_GEO_STATIC )
endif( )
add_executable( SimpleIndoorDiffractionTest SimpleIndoorDiffractionTest.cpp )
target_link_libraries( SimpleIndoorDiffractionTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( SimpleIndoorDiffractionTest )
vista_install( SimpleIndoorDiffractionTest )
vista_create_default_info_file( SimpleIndoorDiffractionTest )
set_property( TARGET SimpleIndoorDiffractionTest PROPERTY FOLDER "ITAGeometricalAcoustics/Tests/ITAPropagationPathSim/IndoorDiffraction" )
/*
* ----------------------------------------------------------------
*
* ITA geometrical acoustics
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#include <ITAPropagationPathSim/UrbanDiffraction/Engine.h>
#include <ITAPropagationPathSim/MirrorImage/UrbanEngine.h>
#include <ITAGeo/Base.h>
#include <ITAGeo/ModelBase.h>
#include <ITAGeo/Halfedge/MeshModel.h>
#include <ITAGeo/Scene.h>
#include <ITAGeo/SketchUp/Model.h>
#include <VistaBase/VistaVector3D.h>
#include <VistaMath/VistaGeometries.h>
#include <VistaTools/VistaFileSystemFile.h>
using namespace std;
using namespace ITAGeo;
using namespace ITAPropagationPathSim;
int main(int iNumInArgs, char* ppcInArgs[])
{
string sLocalFileBaseName;
if (iNumInArgs > 1)
sLocalFileBaseName = string(ppcInArgs[1]);
else
sLocalFileBaseName = "RoomWithDiffraction";
string sExtension = "skp";
string sSKPFilePathInput = sLocalFileBaseName + "." + sExtension;
VistaFileSystemFile oFile(sSKPFilePathInput);
assert(oFile.Exists());
string sSKPFilePathOutput_Vis = oFile.GetParentDirectory() + "/" + sLocalFileBaseName + "_Vis" + "." + sExtension;
//Source
auto pSource = std::make_shared< CEmitter >();
pSource->sName = "My Diffraction Source";
pSource->qOrient = VistaQuaternion(0, -1, 0, 0);
pSource->vPos.SetValues(1.7f, 0.66f, 0.11f);
//pSource->vPos.SetValues(0.6f, 1.32f, 0.11f);
cout << pSource->ToString() << endl;
//Receiver
auto pReceiver = std::make_shared< CSensor >();
pReceiver->sName = "My Diffraction Receiver";
pReceiver->qOrient = VistaQuaternion(0, 1, 0, 0);
pReceiver->vPos.SetValues(-2.2f, 0.33f, 0.22f);
cout << pReceiver->ToString() << endl;
//Urban model
auto pRoomModel = make_shared<SketchUp::CModel>();
//Load urban model
try
{
cout << "Loading model from file path '" << sSKPFilePathInput << "'" << endl;
if (pRoomModel->Load(oFile.GetName()))
cout << "Successfully loaded file '" << oFile.GetLocalName() << "' as sketchup model" << endl;
else
ITA_EXCEPT1(INVALID_PARAMETER, "Could not load geometry from file " + oFile.GetLocalName());
}
catch (const ITAException& e)
{
cerr << "[ ERROR ] " << e << endl;
return 255;
}
//Sketchup model for saving results in sketchup file
auto pSUModel = make_shared<SketchUp::CModel>();
//Load SU model
try
{
cout << "Loading model from file path '" << sSKPFilePathInput << "'" << endl;
if (pSUModel->Load(oFile.GetName()))
cout << "Successfully loaded file '" << oFile.GetLocalName() << "' as su model" << endl;
else
ITA_EXCEPT1(INVALID_PARAMETER, "Could not load geometry from file " + oFile.GetLocalName());
}
catch (const ITAException& e)
{
cerr << "[ ERROR ] " << e << endl;
return 255;
}
/* Indoor diffraction engine
IndoorPropagation::CEngine oEngine(*pRoomModel, DiffractionOrder::DIFFRACTION_ORDER_3);
oEngine.ConstructDiffractionTree(pSource.get());
CPropagationPathList oPathListAll, oPathListVisible;
oEngine.ConstructDiffractionPaths(pReceiver, oPathListAll);
//Get the visible sound paths
pRoomModel->FilterVisiblePaths(oPathListAll, oPathListVisible);
//Add paths to visualization
for (auto oPath : oPathListVisible)
{
string sOrderSize = to_string(oPath.size() - 2);
pSUModel->AddPropagationPathVisualization(oPath, "DiffractionPath_vis_order_" + sOrderSize);
}
for (auto oPath : oPathListAll)
{
pSUModel->AddPropagationPathVisualization(oPath, "DiffractionPath_all");
}
//Add emitter and sensor to visualization
pSUModel->AddEmitterVisualization(*pSource, "Source A");
pSUModel->AddSensorVisualization(*pReceiver, "Receiver A");
//Store model
pSUModel->Store( sLocalFileBaseName + "_vis." + sExtension);
*/
return 0;
}
\ No newline at end of file
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