Skip to content
Snippets Groups Projects
Commit a4b95044 authored by Pascal Palenda's avatar Pascal Palenda
Browse files

Test: add unit tests for new pigeon implementation

parent 42bafe9b
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ ihta_add_library ( ...@@ -26,7 +26,7 @@ ihta_add_library (
IDE_FOLDER "ITAGeometricalAcoustics" IDE_FOLDER "ITAGeometricalAcoustics"
OUT_LIB LIB_TARGET OUT_LIB LIB_TARGET
OUT_TEST TEST_TARGET OUT_TEST TEST_TARGET
TEST_SOURCES tests/UnitTest/image_edge_model.cpp tests/UnitTest/test_definitions.h TEST_SOURCES tests/UnitTest/image_edge_model.cpp tests/UnitTest/pigeon.cpp tests/UnitTest/test_definitions.h
ADD_UNIT_TEST ${ITA_PROPAGATION_PATH_SIM_WITH_TESTS} ADD_UNIT_TEST ${ITA_PROPAGATION_PATH_SIM_WITH_TESTS}
) )
......
#include "test_definitions.h"
#include <ITAGeo/Model.h>
#include <ITAPropagationPathSim/Pigeon/Pigeon.h>
ITAGeo::CPropagationPathList runSimulationPigeon( const SSimulationParameters parameters )
{
auto pModel = std::make_shared<ITAGeo::CModel>( );
auto pMaterialManager = std::make_shared<ITAGeo::Material::CMaterialManager>( );
auto pDirectivityManager = std::make_shared<ITAGeo::Directivity::CDirectivityManager>( );
auto pResourceManager = std::make_shared<ITAGeo::CResourceManager>( pMaterialManager, pDirectivityManager );
pModel->SetMaterialManager( pMaterialManager );
REQUIRE( pModel->Load( parameters.file_path ) );
ITAPropagationPathSim::Pigeon::SPigeonInputData input_data;
input_data.pMesh = pModel->GetOpenMesh( );
input_data.vSensors.push_back( ITAGeo::CSensor( parameters.receiver_position ) );
input_data.vEmitters.push_back( ITAGeo::CEmitter( parameters.source_position ) );
input_data.SConfig.iNumberIterationApexCalculation = 10;
input_data.SAbortion.iMaxDiffractionOrder = parameters.diffraction_order;
input_data.SAbortion.iMaxReflectionOrder = parameters.reflection_order;
input_data.SAbortion.iMaxCombinedOrder = parameters.diffraction_order + parameters.reflection_order;
ITAPropagationPathSim::Pigeon::CPigeon pigeon;
pigeon.InitializeEngine( input_data );
return pigeon.RunSimulation( );
}
TEST_CASE( "ITAPropagationPathSim::pigeon/direct-sound", "[ITAPropagationPathSim][IEM][pigeon][Required]" )
{
const std::vector<std::string> test_mesh_files { "FreeField.skp", "FreeField.dae", "FreeField.obj" };
for( auto&& test_mesh_file: test_mesh_files )
{
DYNAMIC_SECTION( "Testing Mesh " << test_mesh_file )
{
SSimulationParameters parameters;
parameters.file_path = std::string( ITAPROPSIM_TEST_RESOURCE_DIR ) + "/" + test_mesh_file;
parameters.source_position = generateRandomVec3( );
parameters.receiver_position = generateRandomVec3( );
auto oPathList = runSimulationPigeon( parameters );
REQUIRE( oPathList.size( ) == 1 );
const auto direct_path = oPathList.at( 0 );
checkDirectSound( direct_path, parameters );
}
}
}
TEST_CASE( "ITAPropagationPathSim::pigeon/ground-reflection", "[ITAPropagationPathSim][IEM][pigeon][Required]" )
{
const std::vector<std::string> test_mesh_files { "Ground.skp", "Ground.dae", "Ground.obj" };
for( auto&& test_mesh_file: test_mesh_files )
{
DYNAMIC_SECTION( "Testing Mesh " << test_mesh_file )
{
SSimulationParameters parameters;
parameters.file_path = std::string( ITAPROPSIM_TEST_RESOURCE_DIR ) + "/" + test_mesh_file;
parameters.source_position = generateRandomVec3AboveGround( );
parameters.receiver_position = generateRandomVec3AboveGround( );
INFO( "Source position: " << parameters.source_position );
INFO( "Receiver position: " << parameters.receiver_position );
auto oPathList = runSimulationPigeon( parameters );
REQUIRE( oPathList.size( ) == 2 );
const auto direct_path = oPathList.at( 0 );
const auto reflection_path = oPathList.at( 1 );
checkDirectSound( direct_path, parameters );
checkGroundReflection( reflection_path, parameters );
}
}
}
TEST_CASE( "ITAPropagationPathSim::pigeon/wedge-diffraction", "[ITAPropagationPathSim][IEM][pigeon][Required]" )
{
const std::vector<std::string> test_mesh_files { "Wedge.skp", "Wedge.dae", "Wedge.obj" };
for( auto&& test_mesh_file: test_mesh_files )
{
DYNAMIC_SECTION( "Testing Mesh " << test_mesh_file )
{
SSimulationParameters parameters;
parameters.file_path = std::string( ITAPROPSIM_TEST_RESOURCE_DIR ) + "/" + test_mesh_file;
parameters.source_position = generateRandomVec3Wedge( Type::source );
parameters.receiver_position = generateRandomVec3Wedge( Type::receiver );
INFO( "Source position: " << parameters.source_position );
INFO( "Receiver position: " << parameters.receiver_position );
auto oPathList = runSimulationPigeon( parameters );
REQUIRE( oPathList.size( ) == 1 );
const auto diffracted_path = oPathList.at( 0 );
checkDiffraction( diffracted_path, parameters );
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment