Commit 6194eb80 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Merging manually

parents 504aaf16 f1d4e649
*.exe
HTML
*.bat
set_path*.bat
*.mat
*.pdf
*.dll
......
......@@ -80,10 +80,6 @@ if( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE )
add_definitions( -DRAVENNET_SERVER_SHOW_RAW_TRAFFIC )
endif( )
# Deploy
install( DIRECTORY "examples/Raven" DESTINATION "." )
endif( )
......@@ -134,16 +130,10 @@ set_property( TARGET ITASimulationScheduler PROPERTY FOLDER "ITASimulationSchedu
# apps
if( ITA_SIMULATION_SCHEDULER_APPS )
add_subdirectory( "apps" )
if( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE )
add_subdirectory( "apps/raven/ravenegg" )
add_subdirectory( "apps/raven/ravennest" )
if( VMPI_FOUND )
add_subdirectory( "apps/raven/unkindness" )
endif( VMPI_FOUND )
add_subdirectory( "apps/raven/ravenegg" )
endif( )
......@@ -153,25 +143,12 @@ endif( )
# tests
if( ITA_SIMULATION_SCHEDULER_TESTS )
add_subdirectory( "tests/simsched_add_task" )
add_subdirectory( "tests/all_tests" )
if( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE )
add_subdirectory( "tests/raven/RavenNetSchedulerTest" )
add_subdirectory( "tests/raven/RavenNetTestClient" )
add_subdirectory( "tests/raven/RavenNetTestServer" )
add_subdirectory( "tests/raven/RavenSimulationServerTest" )
add_subdirectory( "tests/raven/RavenTest" )
add_subdirectory( "tests/raven/CSimulator_Test" )
add_subdirectory( "tests/raven/Tiny" )
add_subdirectory( "tests/raven/VistaNetTest" )
add_subdirectory( "tests/raven/raven_multi_instance_test" )
if( VMPI_FOUND )
add_subdirectory( "tests/raven/LinuxRavenClusterNodeTest" )
add_subdirectory( "tests/raven/RavenMPICluster" )
endif( )
add_subdirectory( "tests/raven/OpenMPTest" )
endif( )
......@@ -184,9 +161,6 @@ if( ITA_SIMULATION_SCHEDULER_BENCHMARKS )
add_subdirectory( "benchmarks/basic_bench_with_profiler" )
if( ITA_SIMULATION_SCHEDULER_RAVEN_MODULE )
add_subdirectory( "benchmarks/raven/AddTask" )
add_subdirectory( "benchmarks/raven/DummyServer" )
add_subdirectory( "benchmarks/raven/Scheduler" )
endif( )
endif( )
%% clear
clear
clc
%% Set the data
% Data from Blauert - Spatial Hearing and Damaske & Wagener - Directional Hearing Tests by the Aid of a Dummy Head
% horizontal plane [ percieved phi delta, uncertanty]
horizontalPlane = [ 0, 359, 3.6;
90, 80.7, 9.2;
180, 179.3, 5.5;
270, 281.6, 10.0];
interHorizontalPlane = interp1(horizontalPlane(:,1), horizontalPlane(:,2), 0:359, 'linear' );
%% plot
errorbar(horizontalPlane(:,1))
plot(interHorizontalPlane,'-*')
hold on;
plot(horizontalPlane(:,2),horizontalPlane(:,1) ,'o')
%%
grid = ita_generateSampling_equiangular(10,10);
grid = grid.n(grid.theta_deg <= 90);
grid = grid.n(grid.phi_deg <= 180);
grid.r = linspace(0,0,grid.nPoints);
imagesc([min(grid.phi_deg), max(grid.phi_deg)],[min(grid.theta_deg), max(grid.theta_deg)],grid.r);
colorbar;
xlabel('azimuth in ');
ylabel('elevation in ');
hold on
scatter([0,45],[0,45],'ro');
......@@ -3,6 +3,91 @@
ITASimulationScheduler is a C++ library and application collection to run distributed acoustic simulations.
It comes with scheduling features for real-time and sequential (offline) task procedures using threads and/or MPI.
### Possible Filter Configs
Listed below are the possible filter configs with all their respective keys.
Common Keys are:
- **Name** : The name by which the filter can be referred to.
- **Type** : The type of filter to be used.
- **NextFilter** : Name of the next filter to be evaluated after this filter.
Multiple comma separated names are supported to created branches in the evaluation.
- **UsageMode** : How the filter should be used: As a filter (0) or condition (1).
- **InvertCondition** : In case the filter is used as a condition, the result can be inverted.
```json
{
"Filter0" : {
"@Name" : "Unknown",
"@Type" : "PerceptiveRotationFilter",
"@NextFilter" : "",
"@UsageMode" : 0,
"@InvertCondition" : false,
"@StrengthFactor" : 1
},
"Filter1" : {
"@Name" : "Unknown",
"@Type" : "RateFilter",
"@NextFilter" : "",
"@UsageMode" : 0,
"@InvertCondition" : false,
"@Rate" : 1
},
"Filter2" : {
"@Name" : "Unknown",
"@Type" : "ReverberationRadiusFilter",
"@NextFilter" : "",
"@UsageMode" : 0,
"@InvertCondition" : false,
"@ReverberationRadius" : 5
},
"Filter3" : {
"@Name" : "Unknown",
"@Type" : "RotationFilter",
"@NextFilter" : "",
"@UsageMode" : 0,
"@InvertCondition" : false,
"@ReceiverThreshold" : 2.5,
"@SourceThreshold" : 2.5,
"@RotationMode" : 1
},
"Filter4" : {
"@Name" : "Unknown",
"@Type" : "TranslationFilter",
"@NextFilter" : "",
"@UsageMode" : 0,
"@InvertCondition" : false,
"@MinimumTranslation" : 5,
"@TranslationMode" : 1
},
"Filter5" : {
"@Name" : "Unknown",
"@Type" : "ZoneFilter",
"@NextFilter" : "",
"@UsageMode" : 0,
"@InvertCondition" : false,
"Zones" : {
"Zone0first" : [0, 0, 0],
"Zone0second" : [1, 1, 1]
}
}
}
```
### Adding Filters Or Workers
To add filters or worker to this project, derive your from the fitting interface class and add a corresponding config struct, also derived from the fitting interface config.
In order to use the new filter or worker, it can be added to their corresponding factory class
- at compile time by adding it to the map in the correspoding cpp file.
- at run time by calling the register function of the factory.
### License
......
cmake_minimum_required( VERSION 2.8 )
project( ITASimulationSchedulerApps )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( ITASimulationScheduler REQUIRED FIND_DEPENDENCIES )
set( ProjectSources "simsched_cli.cpp" )
add_executable( simsched_cli ${ProjectSources} )
target_link_libraries( simsched_cli ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_set_target_msvc_arguments( simsched_cli "localhost:12350" )
vista_configure_app( simsched_cli )
vista_install( simsched_cli )
vista_create_default_info_file( simsched_cli )
set_property( TARGET simsched_cli PROPERTY FOLDER "ITASimulationScheduler/Apps" )
[Task]
# General settings for scheduling
# Unique identifier of this task
ID = 0
# Reference to an internal object, i.e. tasks of same reference may be replacing each other, hence be discarded
ReferenceID = 0
# The simulation type requested, may be
# DS (direct sound) or
# ER_IS (early reflections using image sources) or
# DD_RT (diffuse decay using ray tracing) or
# DD_AR (diffuse decay using artificial reverberation)
# the combination [DS+ER_IS] is also available
Simulation = ER_IS
#Simulation = DD_RT
[Scene]
# Describes entities of a scene of sources, receivers and portals
# use $(RavenDataBasePath) macro for pathes and provide same structure on
# remote machine(s)
# Sources
# pattern: Source'ID' = PosX,PosY,PosZ, ViewX,ViewY,ViewZ, FilePathToDirectivity.daff
Source0 = 5, 1.85, -5.000, 0,0,-1, 0,1,0,
# Receivers
# pattern: Receiver'ID' = PosX,PosY,PosZ, ViewX,ViewY,ViewZ, FilePathToHRIR.daff
Receiver13 = 1.7, 1.7,-1.7, 0,0,-1, 0,1,0, $(RavenDataBasePath)/ITA_Artificial_Head_5x5_44kHz_128.v17.ir.daff
......@@ -25,10 +25,15 @@
#ifndef __GNU_LIBRARY__
#define __GNU_LIBRARY__
#endif
#include <conio.h>
#include "getopt.h"
#include <ITASimulationScheduler/Raven/Simulator.h>
#include <ITASimulationScheduler/Utils.h>
#include <ITA/SimulationScheduler/types.h>
#include <ITA/SimulationScheduler/RoomAcoustics/raven/simulator.h>
#include <ITA/SimulationScheduler/RoomAcoustics/raven/simulation_task.h>
#include <ITA/SimulationScheduler/RoomAcoustics/raven/raven_simulation_result.h>
#include <ITA/SimulationScheduler/profiler/profiler.h>
#include <RG_Vector.h>
#include <ITAAudiofileWriter.h>
......@@ -49,12 +54,19 @@
using namespace std;
using namespace ITA::SimulationScheduler;
using namespace RoomAcoustics;
using namespace Raven;
void normalize_0dB( ITASampleFrame* );
void LoadTask ( CSimulationTask& oTask, const std::string& sPath );
FieldOfDuty ParseSimulationType ( const std::string& sShortSimType );
void syntax_error()
{
cout << "Syntax: ravenegg -d DATABASEPATH -t TASKFILE -r RESULTFILE [-n (normalize)]" << endl;
cout << "Syntax: ravenegg -i RPFFILE -t TASKFILE -r RESULTFILE [-n (normalize)]" << endl;
cout << "Scene of task file may only include a single source and a single receiver" << endl;
}
......@@ -67,16 +79,16 @@ int main( int argc, char* argv[] )
return 255;
}
string sRavenDataBasePath, sTaskPath, sResultPath;
string sRPFFile, sTaskPath, sResultPath;
bool bNormalize = false;
int c;
while( ( c = getopt( argc, argv, "d:nr:t:" ) ) != -1 )
while( ( c = getopt( argc, argv, "i:nr:t:" ) ) != -1 )
{
switch( c )
{
case 'd':
sRavenDataBasePath = optarg;
case 'i':
sRPFFile = optarg;
break;
case 'n':
bNormalize = true;
......@@ -96,70 +108,52 @@ int main( int argc, char* argv[] )
return 255;
}
}
if( doesDirectoryExist( sRavenDataBasePath ) == false )
{
cerr << "Given Raven data base path '" << sRavenDataBasePath << "' not found on this machine" << endl;
return 255;
}
try
{
cout << "Raven data base path is set to '" << sRavenDataBasePath << "'" << endl;
auto pRavenSimulator = std::make_shared< ITASimulationScheduler::RAVEN::CRavenSimulator >( sRavenDataBasePath );
ITASimulationScheduler::CSimulationTask oTask;
ITASimulationScheduler::CSimulationResult oResult;
CSimulationTask oTask;
CRavenSimulationResult oResult;
cout << "Loading task from file with path '" << sTaskPath << "'" << endl;
LoadTask( oTask, sTaskPath );
if( oTask.oScene.m_mSources.size() != 1 )
if( oTask.oScene.GetSourceMap().size() != 1 )
{
cerr << "[ERROR] Please provide a single source in task file" << endl;
return 255;
}
if( oTask.oScene.m_mReceivers.size() != 1 )
if( oTask.oScene.GetReceiverMap().size() != 1 )
{
cerr << "[ERROR] Please provide a single receiver in task file, portals are not supported by simulator yet" << endl;
return 255;
}
if( oTask.oScene.m_mPortals.size() != 0 )
{
cerr << "[ERROR] Please do not provide portals in task file" << endl;
return 255;
}
cout << "Task acknowledged" << endl;
cout << " --- Task configuration: " << endl << oTask.oConfig.ToString() << endl;
cout << " --- Task scene: " << endl << oTask.oScene.ToString() << endl;
int iDifference = 0;
if( ( iDifference = oTask.oConfig.Validate() ) > 0 )
cout << "[WARNING] Detected odd configuration settings in Task1, bit vector was " << iDifference << endl;
auto pRavenSimulator = std::make_shared< CSimulator > ( oTask.eSimulationType, sRPFFile );
cout << "Performing simulation" << endl;
pRavenSimulator->Compute( &oTask, &oResult );
cout << "Exporting result to '" << sResultPath << "'" << endl;
if( bNormalize )
normalize_0dB( oResult.vcspResult[0]->psfResult );
if( oTask.iSimulationType | ITASimulationScheduler::CSimulationTask::SIM_DS )
cout << "Direct sound was " << ( oResult.vcspResult[0]->bDirectSoundAudible ? "audible" : "inaudible" ) << endl;
if( oTask.iSimulationType != ITASimulationScheduler::CSimulationTask::SIM_DS )
writeAudiofile( sResultPath, oResult.vcspResult[ 0 ]->psfResult, oTask.oConfig.oSimulationSettings.dSampleRate );
normalize_0dB( oResult.vcspResult[ 0 ]->psfResult.get() );
writeAudiofile( sResultPath, oResult.vcspResult[ 0 ]->psfResult.get(), 44100.0 );
if( oResult.vcspResult[0]->bEntitiesInSameRoom )
cout << "Entities (source and receiver) were in the same room." << endl;
else
cout << "Entities (source and receiver) were not in the same room." << endl;
ITASimulationScheduler::ISimulationInterface::CProfiler oStatus;
pRavenSimulator->GetProfilerStatus( oStatus );
cout << "Raven simulation profiler: " << oStatus << endl;
cout << "Store Profile data";
int c = _getch ( );
if ( c == 'y' )
StoreProfilerData ( "SimulationProfile.json" );
}
catch( ITAException& err )
{
......@@ -185,3 +179,27 @@ void normalize_0dB( ITASampleFrame* p )
if( fGlobalPeak != 0.0f )
p->mul_scalar( 1/fGlobalPeak );
}
void LoadTask ( CSimulationTask& oTask, const std::string& sPath )
{
oTask.uiID = INIFileReadUInt ( sPath, "Task", "ID", 0 );
oTask.uiReferenceID = INIFileReadUInt ( sPath, "Task", "ReferenceID", 0 );
std::string sSimulationType = INIFileReadString ( sPath, "Task", "Simulation", "DS+ER_IS+DD_RT" );
auto eSimulationType = ParseSimulationType ( sSimulationType );
oTask.eSimulationType = eSimulationType;
oTask.oScene.LoadFormIni( sPath );
return;
}
FieldOfDuty ParseSimulationType ( const std::string& sShortSimType )
{
if ( sShortSimType == "DS" )
return FieldOfDuty::directSound;
else if ( sShortSimType == "ER_IS" )
return FieldOfDuty::earlyReflections;
else if ( sShortSimType == "DD_RT" )
return FieldOfDuty::diffuseDecay;
ITA_EXCEPT_INVALID_PARAMETER ( "Simulation Type not supported." );
}
@rem ravenegg syntax:
@rem -t PATH path to raven task file (includes geometry and scene information)
@rem -i PATH path to rpf file
@rem -r PATH path and nmae of exported BRIR file
.\bin\ravenegg -t example_task.rtask -i ..\..\..\..\RAVEN\RavenProjects\TestShoeboxRoom\TestShoeboxRoom.rpf -r ravenegg_result_quader.brir.wav
cmake_minimum_required( VERSION 2.8 )
project( ravennest )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( ITABase REQUIRED FIND_DEPENDENCIES )
vista_use_package( ITASimulationScheduler REQUIRED FIND_DEPENDENCIES )
if( NOT DEFINED ITA_RAVENNEST_INSTALL_WITH_DLLS )
set( ITA_RAVENNEST_INSTALL_WITH_DLLS ON CACHE BOOL "Install ravennest with depending DLLs (use this switch with care)" )
endif( NOT DEFINED ITA_RAVENNEST_INSTALL_WITH_DLLS )
if( NOT DEFINED ITA_RAVEN_DATA_PATH )
set( ITA_RAVEN_DATA_PATH "" CACHE PATH "RAVEN data base path (where to find models, HRTFs, etc. ...)" )
endif( NOT DEFINED ITA_RAVEN_DATA_PATH )
set( ProjectSources "getopt.c" "getopt.h" "ravennest.cpp" )
add_executable( ravennest ${ProjectSources} )
target_link_libraries( ravennest ${VISTA_USE_PACKAGE_LIBRARIES} )
add_definitions( "-DRAVENNEST_VERSION_MAJOR=1")
add_definitions( "-DRAVENNEST_VERSION_MINOR=0")
if( EXISTS "${ITA_RAVEN_DATA_PATH}" )
vista_set_target_msvc_arguments( ravennest "-rv -d ${ITA_RAVEN_DATA_PATH}" )
else( )
vista_set_target_msvc_arguments( ravennest "-h" )
endif( )
vista_configure_app( ravennest )
vista_install( ravennest )
vista_create_default_info_file( ravennest )
set_property( TARGET ravennest PROPERTY FOLDER "ITASimulationScheduler/Apps/Raven" )
if( ITA_RAVENNEST_INSTALL_WITH_DLLS OR ITA_RAVEN_INSTALL_WITH_DLLS )
vista_install_all_dlls( bin )
endif()
if( WIN32 )
install( FILES "run_ravennest_realtime.bat" DESTINATION "." )
else( )
install( FILES "run_ravennest_realtime.sh" DESTINATION "." )
endif( )
This diff is collapsed.
/* getopt.h */
/* Declarations for getopt.
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software
Foundation, Inc. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute
it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software
Foundation; either version 2.1 of the License, or
(at your option) any later version.
The GNU C Library is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General
Public License along with the GNU C Library; if not, write
to the Free Software Foundation, Inc., 59 Temple Place,
Suite 330, Boston, MA 02111-1307 USA. */
#ifndef _GETOPT_H
#ifndef __need_getopt
# define _GETOPT_H 1
#endif
/* If __GNU_LIBRARY__ is not already defined, either we are being used
standalone, or this is the first header included in the source file.
If we are being used with glibc, we need to include <features.h>, but
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
not defined, include <ctype.h>, which will pull in <features.h> for us
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
doesn't flood the namespace with stuff the way some other headers do.) */
#if !defined __GNU_LIBRARY__
# include <ctype.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
#ifndef __need_getopt
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
# if (defined __STDC__ && __STDC__) || defined __cplusplus
const char *name;
# else
char *name;
# endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
# define no_argument 0
# define required_argument 1
# define optional_argument 2
#endif /* need getopt */
/* Get definitions and prototypes for functions to process the
arguments in ARGV (ARGC of them, minus the program name) for
options given in OPTS.
Return the option character from OPTS just read. Return -1 when
there are no more options. For unrecognized options, or options
missing arguments, `optopt' is set to the option letter, and '?' is