ARTSettings.h 2.73 KB
Newer Older
Philipp Schäfer's avatar
Philipp Schäfer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
* ----------------------------------------------------------------
*
*		ITA geometrical acoustics
*		(c) Copyright Institute of Technical Acoustics (ITA)
*		RWTH Aachen University, Germany, 2015-2019
*
* ----------------------------------------------------------------
* 				    ____  __________  _______
*				   //  / //__   ___/ //  _   |
*				  //  /    //  /    //  /_|  |
*				 //  /    //  /    //  ___   |
*				//__/    //__/    //__/   |__|
*
* ----------------------------------------------------------------
*
*/

#ifndef IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_SETTINGS
#define IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_SETTINGS

#include <ITAPropagationPathSim/Definitions.h>

// ITA includes
#include <ITAPropagationPathSim/AtmosphericRayTracing/Rays.h>

Philipp Schäfer's avatar
Philipp Schäfer committed
27
28
29
// STD
#include <memory>

Philipp Schäfer's avatar
Philipp Schäfer committed
30
31
32
33
34
namespace ITAPropagationPathSim
{
	namespace AtmosphericRayTracing
	{
		namespace Simulation {
Philipp Schäfer's avatar
Philipp Schäfer committed
35
			class ITA_PROPAGATION_PATH_SIM_API IExternalWatcher
Philipp Schäfer's avatar
Philipp Schäfer committed
36
37
38
			{
			public:
				//! Returns true if the abort criterion for tracing the given ray is reached
Philipp Schäfer's avatar
Philipp Schäfer committed
39
				virtual bool AbortRequested(const std::shared_ptr<CRay> pRay) const = 0;
Philipp Schäfer's avatar
Philipp Schäfer committed
40
				//! Allows additional proecssing of the ray at the end of each time step.
Philipp Schäfer's avatar
Philipp Schäfer committed
41
				virtual void ProcessRay(std::shared_ptr<CRay>) const = 0;
Philipp Schäfer's avatar
Philipp Schäfer committed
42
				//! This is called after the tracing of a ray is finished.
Philipp Schäfer's avatar
Philipp Schäfer committed
43
				virtual void FinalizeRay(std::shared_ptr<CRay>) const = 0;
Philipp Schäfer's avatar
Philipp Schäfer committed
44
			};
Philipp Schäfer's avatar
Philipp Schäfer committed
45
			class ITA_PROPAGATION_PATH_SIM_API CAbortAtMaxTime : public IExternalWatcher
Philipp Schäfer's avatar
Philipp Schäfer committed
46
47
48
49
			{
			private:
				double dTMax;
			public:
Philipp Schäfer's avatar
Philipp Schäfer committed
50
51
52
53
				inline CAbortAtMaxTime(double tMax = 30) : dTMax(tMax) {};
				inline bool AbortRequested(const std::shared_ptr<CRay> pRay) const { return pRay->LastTimeStamp() >= dTMax; };
				inline virtual void ProcessRay(std::shared_ptr<CRay>) const {};
				inline virtual void FinalizeRay(std::shared_ptr<CRay>) const {};
Philipp Schäfer's avatar
Philipp Schäfer committed
54
55
56
57
58
59
60
61
62
63
			};

			enum ITA_PROPAGATION_PATH_SIM_API SolverMethod
			{
				EULER = 0,	//!< Euler method
				RUNGE_KUTTA	//!< Classical Runge_Kutta method (RK4)
			};


			struct ITA_PROPAGATION_PATH_SIM_API AdaptiveIntegrationSettings {
Philipp Schäfer's avatar
ART    
Philipp Schäfer committed
64
				bool bActive = true;					//!< If this is set to false, the adaptation is bypassed and the integration step size is therefore constant
Philipp Schäfer's avatar
Philipp Schäfer committed
65
66
				double dMaxError = 0.015;				//!< For errors above this threshold the time step is decreased.
				double dUncriticalError = 0.005;		//!< An error below this limit allows to increase the time step again.
Philipp Schäfer's avatar
ART    
Philipp Schäfer committed
67
				unsigned int iMaxAdaptationLevel = 31;	//!< Maximum times, the time step is halfed. Maximum valid value = 31.
Philipp Schäfer's avatar
Philipp Schäfer committed
68
69
			};

Philipp Schäfer's avatar
Philipp Schäfer committed
70
			struct ITA_PROPAGATION_PATH_SIM_API Settings {
Philipp Schäfer's avatar
Philipp Schäfer committed
71
72
				SolverMethod solverMethod = SolverMethod::EULER;
				double dIntegrationTimeStep = 0.1;
Philipp Schäfer's avatar
Philipp Schäfer committed
73
				AdaptiveIntegrationSettings adaptiveIntegration;
Philipp Schäfer's avatar
Philipp Schäfer committed
74
75
76
77
78
79
			};
		}
	}
}

#endif //IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_SETTINGS