Commit 5c4808f0 authored by Philipp Schäfer's avatar Philipp Schäfer
Browse files

merge 'ma2020_palenda' into develop

parents c00ade1a 01fcaba4
......@@ -88,7 +88,7 @@ int main ( )
update->SetSourceReceiverPair ( std::move ( source ),
std::move ( receiver ) );
masterController->PostUpdate ( std::move ( update ) );
masterController->PushUpdate ( std::move ( update ) );
// We need to wait a bit for the workers to start working
VistaTimeUtils::Sleep ( 500 );
......
#ifndef INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_RAVEN_SCENE
#define INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_RAVEN_SCENE
#ifdef WITH_RAVEN
// std includes
#include <string>
#include <vector>
......@@ -12,7 +10,7 @@
#include <ITA/SimulationScheduler/definitions.h>
// simulation scheduler includes
#include "../src/ITA/SimulationScheduler/utils.h"
#include <ITA/SimulationScheduler/Utils/utils.h>
// RAVEN includes
#include "RG_Vector.h"
......@@ -236,6 +234,4 @@ namespace ITA
} // namespace SimulationScheduler
} // namespace ITA
#endif
#endif // INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_RAVEN_SCENE
\ No newline at end of file
#ifndef INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_RAVEN_SIMULATION_RESULT
#define INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_RAVEN_SIMULATION_RESULT
#ifdef WITH_RAVEN
// API includes
#include <ITA/SimulationScheduler/definitions.h>
......@@ -118,6 +116,4 @@ namespace ITA
} // namespace SimulationScheduler
} // namespace ITA
#endif
#endif // INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_RAVEN_SIMULATION_RESULT
\ No newline at end of file
#ifndef INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_RAVEN_WORKER_INTERFACE
#define INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_RAVEN_WORKER_INTERFACE
#ifdef WITH_RAVEN
// API includes
#include <ITA/SimulationScheduler/definitions.h>
......@@ -79,6 +77,4 @@ namespace ITA
} // namespace SimulationScheduler
} // namespace ITA
#endif
#endif // INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_RAVEN_WORKER_INTERFACE
\ No newline at end of file
#ifndef INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_SIMULATION_TASK
#define INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_SIMULATION_TASK
#ifdef WITH_RAVEN
// API includes
#include <ITA/SimulationScheduler/definitions.h>
......@@ -93,6 +91,4 @@ namespace ITA
} // namespace SimulationScheduler
} // namespace ITA
#endif
#endif // INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_SIMULATION_TASK
\ No newline at end of file
#ifndef INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_SIMULATOR
#define INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_SIMULATOR
#ifdef WITH_RAVEN
// API includes
#include <ITA/SimulationScheduler/definitions.h>
......@@ -323,6 +321,4 @@ namespace ITA
} // namespace SimulationScheduler
} // namespace ITA
#endif
#endif // INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_SIMULATOR
\ No newline at end of file
#ifndef INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_SIMULATOR_INTERFACE
#define INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_SIMULATOR_INTERFACE
#ifdef WITH_RAVEN
// API includes
#include <ITA/SimulationScheduler/definitions.h>
......@@ -47,6 +45,4 @@ namespace ITA
} // namespace SimulationScheduler
} // namespace ITA
#endif
#endif // INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_SIMULATOR_INTERFACE
\ No newline at end of file
#ifndef INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_WORKER_THREAD
#define INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_WORKER_THREAD
#ifdef WITH_RAVEN
// std include
#include <string>
#include <memory>
......@@ -66,23 +64,23 @@ namespace ITA
~CWorkerThread ( );
///
/// \copydoc IWorkerInterface::isBusy
/// \copydoc IWorkerInterface::IsBusy
///
bool IsBusy ( ) override;
///
/// \copydoc IWorkerInterface::postUpdate
/// \copydoc IWorkerInterface::PushUpdate
///
void PostUpdate ( std::unique_ptr<CUpdateScene> pUpdate ) override;
void PushUpdate ( std::unique_ptr<CUpdateScene> pUpdate ) override;
///
/// \copydoc IWorkerInterface::reset
/// \copydoc IWorkerInterface::Reset
/// \detail With the reset, the simulator get reset.
///
void Reset ( ) override;
///
/// \copydoc IWorkerInterface::shutdown
/// \copydoc IWorkerInterface::Shutdown
///
void Shutdown() override;
......@@ -170,6 +168,4 @@ namespace ITA
} // namespace SimulationScheduler
} // namespace ITA
#endif
#endif // INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_ROOM_ACOUSTICS_RAVEN_WORKER_THREAD
\ No newline at end of file
......@@ -37,7 +37,7 @@ namespace ITA
///
/// This class represents the interface with which external software should interact with the simulation scheduler for room acoustic simulations.
/// It allows for easy interaction and configuration of the system.
/// - Updates can be issued via postUpdate().
/// - Updates can be issued via PushUpdate().
/// - A IResultHandler can be registered via attachResultHandler.
/// - A simple replacement filter can be enabled for the CMasterSimulationController.
///
......@@ -82,12 +82,12 @@ namespace ITA
~CMasterSimulationController ( );
///
/// \brief Post a new update to the CMasterSimulationController.
/// \brief Push a new update to the CMasterSimulationController.
///
/// \note This method takes ownership of the update.
/// \param pUpdateMessage the new update for the CMasterSimulationController.
///
void PostUpdate ( std::unique_ptr<IUpdateMessage> pUpdateMessage );
void PushUpdate ( std::unique_ptr<IUpdateMessage> pUpdateMessage );
///
/// \brief Attach a IResultHandler to the controller.
......@@ -166,7 +166,7 @@ namespace ITA
///
/// \brief Update queue for the controller.
///
/// postUpdate() adds new updates to this queue before they get passed to the schedulers in LoopBody().
/// PushUpdate() adds new updates to this queue before they get passed to the schedulers in LoopBody().
///
tbb::concurrent_queue<std::unique_ptr<IUpdateMessage>> m_qUpdateQueue;
......
......@@ -7,7 +7,7 @@
// simulation scheduler includes
#include <ITA/SimulationScheduler/types.h>
#include <ITA/SimulationScheduler/worker_interface.h>
#include "../src/ITA/SimulationScheduler/utils.h"
#include <ITA/SimulationScheduler/Utils/utils.h>
namespace ITA
......
......@@ -6,6 +6,7 @@
#include <complex>
#include <fstream>
#include <array>
#include <type_traits>
// API includes
#include <ITA/SimulationScheduler/definitions.h>
......@@ -262,4 +263,187 @@ namespace ITA
} // namespace SimulationScheduler
} // namespace ITA
template <typename Enumeration>
auto AsInteger ( Enumeration const value )
-> typename std::underlying_type<Enumeration>::type
{
return static_cast< typename std::underlying_type<Enumeration>::type >( value );
}
///
/// The use of scoped enums for bit flags requires some additional overloads.
/// The ideas for this implementation were taken from
/// - http://blog.bitwigglers.org/using-enum-classes-as-type-safe-bitmasks/
/// - https://github.com//grisumbras/enum-flags
/// To work correctly this need C++17!! Update the compiler?
///
template<class Enum>
struct EnableBitMaskOperators : public std::false_type
{
};
/*struct empty_t
{
explicit empty_t ( ) = default;
};
template <class Enum> class Flag
{
public:
static_assert( EnableBitMaskOperators<Enum>::value,
"Flags are not allowed for this type; "
"use ENABLE_BITMASK_OPERATORS macro." );
using enum_t = typename std::decay<Enum>::type;
using underlying_t = typename std::underlying_type_t<enum_t>;
using impl_t = typename std::make_unsigned<underlying_t>::type;
Flag ( ) = default;
Flag ( const Flag& fl ) = default;
Flag& operator=( const Flag& fl ) = default;
explicit Flag ( empty_t t ) : underlyingVal ( 0 )
{ }
Flag ( enum_t e )
: underlyingVal ( static_cast< impl_t >( e ) )
{ }
Flag& operator=( enum_t e )
{
underlyingVal = static_cast< impl_t >( e );
return *this;
}
explicit operator bool ( ) const
{
return underlyingVal != 0;
}
bool operator!( ) const
{
return !underlyingVal;
}
friend bool operator==( Flag fl1, Flag fl2 )
{
return fl1.underlyingVal == fl2.underlyingVal;
}
friend bool operator!=( Flag fl1, Flag fl2 )
{
return fl1.underlyingVal != fl2.underlyingVal;
}
Flag operator~( )
{
return Flag ( ~underlyingVal );
}
Flag& operator|=( const Flag& fl )
{
underlyingVal |= fl.underlyingVal;
return *this;
}
Flag& operator&=( const Flag& fl )
{
underlyingVal &= fl.underlyingVal;
return *this;
}
Flag& operator^=( const Flag& fl )
{
underlyingVal ^= fl.underlyingVal;
return *this;
}
Flag& operator|=( enum_t e )
{
underlyingVal |= static_cast< underlying_t >( e );
return *this;
}
Flag& operator&=( enum_t e )
{
underlyingVal &= static_cast< underlying_t >( e );
return *this;
}
Flag& operator^=( enum_t e )
{
underlyingVal ^= static_cast< underlying_t >( e );
return *this;
}
friend Flag operator|( Flag f1, Flag f2 )
{
return static_cast< enum_t > ( static_cast< underlying_t >( f1.underlyingVal | f2.underlyingVal ) );
}
friend Flag operator&( Flag f1, Flag f2 )
{
return static_cast< enum_t > ( static_cast< underlying_t >( f1.underlyingVal & f2.underlyingVal ) );
}
friend Flag operator^( Flag f1, Flag f2 )
{
return static_cast< enum_t > ( static_cast< underlying_t >( f1.underlyingVal ^ f2.underlyingVal ) );
}
private:
explicit Flag ( impl_t val ) : underlyingVal ( val )
{ }
impl_t underlyingVal;
};*/
template<typename Enum>
auto operator |( Enum lhs, Enum rhs ) -> typename std::enable_if<EnableBitMaskOperators<Enum>::value, Enum>::type
{
using Underlying = typename std::underlying_type<Enum>::type;
return static_cast< Enum > (
static_cast< Underlying >( lhs ) |
static_cast< Underlying >( rhs )
);
}
template<typename Enum>
auto operator &( Enum lhs, Enum rhs ) -> typename std::enable_if<EnableBitMaskOperators<Enum>::value, Enum>::type
{
using Underlying = typename std::underlying_type<Enum>::type;
return static_cast< Enum > (
static_cast< Underlying >( lhs ) &
static_cast< Underlying >( rhs )
);
}
template<typename Enum>
auto operator |=( Enum& lhs, const Enum& rhs ) -> typename std::enable_if<EnableBitMaskOperators<Enum>::value, Enum>::type&
{
using Underlying = typename std::underlying_type<Enum>::type;
auto lhsTmp = static_cast< Underlying >( lhs ) |
static_cast< Underlying >( rhs );
return lhs = static_cast< Enum > ( lhsTmp );
}
template<typename Enum>
auto operator &=( Enum& lhs, const Enum& rhs ) -> typename std::enable_if<EnableBitMaskOperators<Enum>::value, Enum>::type&
{
using Underlying = typename std::underlying_type<Enum>::type;
auto lhsTmp = static_cast< Underlying >( lhs ) &
static_cast< Underlying >( rhs );
return lhs = static_cast< Enum > ( lhsTmp );
}
template<typename Enum>
auto IsSet ( const Enum& enumToTest, const Enum& enumForTest ) -> typename std::enable_if<EnableBitMaskOperators<Enum>::value,
bool >::type
{
return ( enumToTest & enumForTest ) == enumForTest;
}
#define ENABLE_BITMASK_OPERATORS(x) template<> struct EnableBitMaskOperators<x> : std::true_type {};
#endif // INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_UTILS_DATA_TYPE_UTILS
\ No newline at end of file
......@@ -46,7 +46,7 @@ namespace ITA
/// This scheduler runs local to where it was created.
///
/// It allows for easy interaction and configuration of the system.
/// - Updates can be issued via postUpdate().
/// - Updates can be issued via PushUpdate().
/// - A IResultHandler can be registered via attachResultHandler.
/// - A simple replacement filter can be enabled for the CScheduler.
///
......@@ -97,22 +97,22 @@ namespace ITA
virtual ~CScheduler ( );
///
/// \copydoc ISchedulerInterface::postUpdate()
/// \copydoc ISchedulerInterface::PushUpdate()
///
virtual void PostUpdate ( std::unique_ptr<IUpdateMessage> pUpdateMessage ) override;
virtual void PushUpdate ( std::unique_ptr<IUpdateMessage> pUpdateMessage ) override;
///
/// \copydoc ISchedulerInterface::attachResultHandler()
/// \copydoc ISchedulerInterface::AttachResultHandler()
///
virtual void AttachResultHandler ( IResultHandler* pResultHandler ) override;
///
/// \copydoc ISchedulerInterface::detachResultHandler()
/// \copydoc ISchedulerInterface::DetachResultHandler()
///
virtual void DetachResultHandler ( IResultHandler* pResultHandler ) override;
///
/// \copydoc ISchedulerInterface::handleSimulationFinished()
/// \copydoc ISchedulerInterface::HandleSimulationFinished()
///
virtual void HandleSimulationFinished ( std::unique_ptr<CSimulationResult> pResult ) override;
......
......@@ -11,9 +11,9 @@
#include <ITA/SimulationScheduler/update_message.h>
#include <ITA/SimulationScheduler/simulation_result.h>
#include <ITA/SimulationScheduler/config_interface.h>
#include <ITA/SimulationScheduler/Utils/utils.h>
#include "../../../src/ITA/SimulationScheduler/configuration_keys.h"
#include "../src/ITA/SimulationScheduler/Utils.h"
namespace ITA
{
......@@ -55,12 +55,12 @@ namespace ITA
virtual ~ISchedulerInterface ( ) = default;
///
/// \brief Post a new update to the scheduler.
/// \brief Push a new update to the scheduler.
///
/// \note This method takes ownership of the update.
/// \param pUpdateMessage the new update for the scheduler.
///
virtual void PostUpdate ( std::unique_ptr<IUpdateMessage> pUpdateMessage ) = 0;
virtual void PushUpdate ( std::unique_ptr<IUpdateMessage> pUpdateMessage ) = 0;
///
/// \brief Attach a IResultHandler to the scheduler.
......
......@@ -80,13 +80,13 @@ namespace ITA
virtual bool IsBusy ( ) = 0;
///
/// \brief Post a new update to the worker.
/// \brief Push a new update to the worker.
///
/// After a new Update is posted to a worker, the update gets simulated immediately.
/// After a new Update is pushed to a worker, the update gets simulated immediately.
/// \note This method takes ownership of the update.
/// \param pUpdateMessage the new update for the scheduler.
///
virtual void PostUpdate ( std::unique_ptr<CUpdateScene> pUpdateMessage ) = 0;
virtual void PushUpdate ( std::unique_ptr<CUpdateScene> pUpdateMessage ) = 0;
///
/// \brief Reset the worker.
......
......@@ -5,7 +5,7 @@
#include <cmath>
// simulation scheduler include
#include "../src/ITA/SimulationScheduler/utils.h"
#include <ITA/SimulationScheduler/Utils/utils.h>
// Vista include
#include <VistaAspects/VistaSerializer.h>
......
......@@ -9,13 +9,12 @@
#include <ITA/SimulationScheduler/AudibilityFilter/translation_filter.h>
#include <ITA/SimulationScheduler/AudibilityFilter/zone_filter.h>
#include <ITA/SimulationScheduler/AudibilityFilter/perceptive_rotation_filter.h>
#include <ITA/SimulationScheduler/Utils/utils.h>
// ITA includes
#include <ITAException.h>
#include <ITAStringUtils.h>
#include "../utils.h"
namespace ITA
{
namespace SimulationScheduler
......
......@@ -5,7 +5,6 @@
#include <ITA/SimulationScheduler/utils/utils.h>
#include <ITA/SimulationScheduler/profiler/profiler.h>
#include "../configuration_keys.h"
#include "../utils.h"
#include <ITA/SimulationScheduler/utils/utils.h>
#include "ITAException.h"
......
......@@ -4,7 +4,7 @@
#include <ITA/SimulationScheduler/update_scene.h>
#include <ITA/SimulationScheduler/Profiler/profiler.h>
#include "../configuration_keys.h"
#include "../utils.h"
#include <ITA/SimulationScheduler/Utils/utils.h>
#include "ITAException.h"
......
......@@ -2,7 +2,7 @@
#include <ITA/SimulationScheduler/RoomAcoustics/Raven/simulator.h>
#include <ITA/SimulationScheduler/Profiler/profiler.h>
#include "../src/ITA/SimulationScheduler/utils.h"
#include <ITA/SimulationScheduler/Utils/utils.h>
#include <RD_DebugPrintf.h>
......
......@@ -71,7 +71,7 @@ namespace ITA
return m_pCurrentTask.get ( ) != nullptr;
}
void CWorkerThread::PostUpdate ( std::unique_ptr<CUpdateScene> pUpdate )
void CWorkerThread::PushUpdate ( std::unique_ptr<CUpdateScene> pUpdate )
{
//PROFILER_FUNCTION ( );
PROFILER_VALUE ( "Update to Worker", pUpdate->GetID ( ) );
......
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