Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ITAPropagationPathSim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institute of Technical Acoustics (ITA)
ITAPropagationPathSim
Commits
a4b95044
Commit
a4b95044
authored
1 year ago
by
Pascal Palenda
Browse files
Options
Downloads
Patches
Plain Diff
Test: add unit tests for new pigeon implementation
parent
42bafe9b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
tests/UnitTest/pigeon.cpp
+114
-0
114 additions, 0 deletions
tests/UnitTest/pigeon.cpp
with
115 additions
and
1 deletion
CMakeLists.txt
+
1
−
1
View file @
a4b95044
...
@@ -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
}
)
)
...
...
This diff is collapsed.
Click to expand it.
tests/UnitTest/pigeon.cpp
0 → 100644
+
114
−
0
View file @
a4b95044
#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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment