Skip to content
Snippets Groups Projects
Select Git revision
  • 740fea3751b9f33fcc053b36a7f124e14a39596c
  • master default protected
  • feature/pynamic-dev
  • feature/reflection
  • propagationParameterCalculation
  • feature/hod-utd-kim
  • feature/python-interface
  • feature/reflectionTest
  • feature/diffraction-fading
  • develop protected
  • feature/runPELICAN
  • feature/propParamExport
  • feature/factory
  • ma_2018/erraji
  • ITAPropagationModels_v2024a
  • VA_v2023b
  • ART_v2023a
  • VA_v2023a
  • VA_v2022a
  • before_cmake_rework
  • v2021.a
  • v2019.a
22 results

FilterEngine.h

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    FilterEngine.h 4.90 KiB
    /*
     * ----------------------------------------------------------------
     *
     *		ITA geometrical acoustics
     *		(c) Copyright Institute of Technical Acoustics (ITA)
     *		RWTH Aachen University, Germany, 2015-2018
     *
     * ----------------------------------------------------------------
     *				    ____  __________  _______
     *				   //  / //__   ___/ //  _   |
     *				  //  /    //  /    //  /_|  |
     *				 //  /    //  /    //  ___   |
     *				//__/    //__/    //__/   |__|
     *
     * ----------------------------------------------------------------
     *
     */
    
    #ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER_ENGINE
    #define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER_ENGINE
    
    // ITAPropagationModel includes
    #include "Base.h"
    #include "Definitions.h"
    
    // ITA includes
    #include <ITAGeo/Base.h>
    #include <ITAGeo/Material//Manager.h>
    #include <ITAHDFTSpectra.h>
    #include <ITAHDFTSpectrum.h>
    
    // STL includes
    #include <vector>
    
    
    namespace ITAPropagationModels
    {
    	using namespace std;
    	
    	//! Transfer function filter generator for propagation paths
    	/**
    	  * Generates transfer functions in the frequency-domain that
    	  * can be used as filters, e.g. for auralization.
    	  *
    	  * @note Not thread safe
    	  */
    	class ITA_PROPAGATION_MODELS_API CFilterEngine
    	{
    	public:
    		CFilterEngine();
    		~CFilterEngine();
    
    		//! Returns number of sensor channels
    		/**
    		  * @param[in] oPathList Propagation path list
    		  *
    		  * @note Throws ITAException if sensors have different number of channels
    		  */
    		static int GetNumSensorChannels( const ITAGeo::CPropagationPathList& oPathList );
    
    		//! Checks if the sensor is the same anchor for all propagation paths		
    		/**
    		  * @param[in] oPathList Propagation path list
    		  *
    		  * @note Throws ITAException if sensors have different number of channels
    		  */
    		static bool HasSameSensorAnchor( const ITAGeo::CPropagationPathList& oPathList );
    
    		//! Applies all acoustic models like reflection diffraction models
    		void ApplyAcousticModels( ITAGeo::CPropagationPathList& oPathList );
    
    		//!Applies diffraction models
    		/**
    		  * @param[out] oPathList Propagation path list
    		  * @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
    		  */
    		void ApplyDiffractionModel( ITAGeo::CPropagationPathList& oPathList, int iModel = -1);
    		
    		//!Applies reflection models
    		/**
    		  * @param[out] oPathList Propagation path list
    		  * @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
    		  */
    		void ApplyReflectionModel( ITAGeo::CPropagationPathList& oPathList, int iModel = -1 );
    
    		//!Applies emitter models
    		/**
    		  * @param[out] oPathList Propagation path list
    		  * @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
    		  */
    		void ApplyEmitterModel(ITAGeo::CPropagationPathList& oPathList, int iModel = -1);
    
    		//!Applies sensor models
    		/**
    		  * @param[out] oPathList Propagation path list
    		  * @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
    		  */
    		void ApplySensorModel(ITAGeo::CPropagationPathList& oPathList, int iModel = -1);
    
    		void ApplyTransmissionModel( ITAGeo::CPropagationPathList& oPathList, int iModel = -1 ); // @todo
    
    		//! Generate multi-channel propagation path (for multi-channel receiver directivity)
    		/**
    		  * @todo AER
    		  */
    		void Generate( const ITAGeo::CPropagationPathList& oPathList, ITABase::CHDFTSpectra& oFilter );
    
    		//! Generate single-channel propagation path (for single-channel receiver directivity)
    		inline void Generate( const ITAGeo::CPropagationPathList& oPathList, ITABase::CHDFTSpectrum& oFilter )
    		{
    			const vector< ITABase::CHDFTSpectrum* > vpSpectra = { &oFilter };
    			ITABase::CHDFTSpectra oTF( vpSpectra );
    			Generate( oPathList, oTF );
    		};
    
    		//! Sets a connection to the material manager
    		void SetMaterialManager( const ITAGeo::CMaterialManager* pMaterialManager );
    
    		// Returns pointer to material manager or null
    		const ITAGeo::CMaterialManager* GetMaterialManager() const;
    
    
    	private:
    		unique_ptr<ITABase::CHDFTSpectra> m_pAccumulatedSpectra; //!< Gathered propagation paths from list
    		unique_ptr<ITABase::CHDFTSpectra> m_pTempPropPathSpectra; //!< Single prop-path spectra
    
    		static struct m_DefaultValues //!< Default values
    		{
    			static const int iReflectionModel = ITAGeo::IAcousticMaterial::SCALAR;
    			static const int iDiffractionModel = ITAGeo::IAcousticMaterial::THIRD_OCTAVE;
    
    			static const int iEmitterModel = ITAGeo::IAcousticMaterial::SCALAR;
    			static const int iSensorModel = ITAGeo::IAcousticMaterial::SCALAR;
    
    
    		};
    
    		const ITAGeo::CMaterialManager* m_pMaterialManager;
    
    		const double m_dHumidity = 80.0;
    		const double m_dTemperature = 20.0;
    		const float m_fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F;
    
    
    		static struct m_DefaultDiffractionModel //!< Default values for diffractions
    		{
    			int iModel = 1;
    		};
    	};
    }
    
    #endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER_ENGINE