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

Atmospheric Ray Tracing

- renaming of Eigenray related Classes - Part 2: Namespaces and classes
- Moved Eigenray-Settings to own file
- renames Simulation::SimulationSettings to Simulation::Settings
parent ceb26e49
......@@ -16,8 +16,8 @@
*
*/
#ifndef IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_EIGENRAYFINDER
#define IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_EIGENRAYFINDER
#ifndef IW_ITA_PROPAGATIONPATHSIM_ART_EIGENRAYSEARCH_ENGINE
#define IW_ITA_PROPAGATIONPATHSIM_ART_EIGENRAYSEARCH_ENGINE
#include <ITAPropagationPathSim/Definitions.h>
......@@ -25,8 +25,9 @@
#include <VistaBase/VistaVector3D.h>
// ITA includes
#include <ITAPropagationPathSim/AtmosphericRayTracing/Rays.h>
#include <ITAPropagationPathSim/AtmosphericRayTracing/EigenraySearch/Settings.h>
#include <ITAPropagationPathSim/AtmosphericRayTracing/Simulation/Settings.h>
#include <ITAPropagationPathSim/AtmosphericRayTracing/Rays.h>
#include <ITAGeo/Atmosphere/StratifiedAtmosphere.h>
// STD
......@@ -38,41 +39,16 @@ namespace ITAPropagationPathSim
{
namespace AtmosphericRayTracing
{
namespace Simulation {
struct ITA_PROPAGATION_PATH_SIM_API RayAdaptationSettings {
struct {
unsigned int maxNAdaptations = 15; //< Abort after X adaptations of the ray resolution
//double minAngleResolutionDeg = 0.001; //< []
} abort;
struct {
double maxReceiverRadius = 1; //< [m]
double maxSourceReceiverAngle = 1; //< []
double maxAngleForGeomSpreading = 0.01; //< []
} accuracy;
struct {
double threshold = 0.1; //< [0 1]
} advancedRayZooming;
};
struct ITA_PROPAGATION_PATH_SIM_API RayTracingAbortSettings {
unsigned int maxReflectionOrder = 3; //< Maximum considered order of reflections
double maxTime = 30; //< [s]
};
struct ITA_PROPAGATION_PATH_SIM_API EigenraySettings {
RayTracingAbortSettings rayTracing;
RayAdaptationSettings rayAdaptation;
};
class ITA_PROPAGATION_PATH_SIM_API CEigenrayFinder
namespace EigenraySearch {
class ITA_PROPAGATION_PATH_SIM_API CEngine
{
public:
EigenraySettings eigenraySettings;
SimulationSettings simulationSettings;
EigenraySearch::Settings eigenraySettings;
Simulation::Settings simulationSettings;
public:
CEigenrayFinder() {}
CEngine() {}
std::vector<std::shared_ptr<CRay>> Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& sourcePosition, const VistaVector3D& receiverPosition);
};
......@@ -80,4 +56,4 @@ namespace ITAPropagationPathSim
}
}
#endif //IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_EIGENRAYFINDER
\ No newline at end of file
#endif //IW_ITA_PROPAGATIONPATHSIM_ART_EIGENRAYSEARCH_ENGINE
\ No newline at end of file
......@@ -16,58 +16,43 @@
*
*/
#ifndef IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_SETTINGS
#define IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_SETTINGS
#ifndef IW_ITA_PROPAGATIONPATHSIM_ART_EIGENRAYSEARCH_SETTINGS
#define IW_ITA_PROPAGATIONPATHSIM_ART_EIGENRAYSEARCH_SETTINGS
#include <ITAPropagationPathSim/Definitions.h>
// ITA includes
#include <ITAPropagationPathSim/AtmosphericRayTracing/Rays.h>
// STD
#include <memory>
namespace ITAPropagationPathSim
{
namespace AtmosphericRayTracing
{
namespace Simulation {
class ITA_PROPAGATION_PATH_SIM_API IAbortCriterion
{
public:
//! Returns true if the abort criterion for tracing the given ray is reached
virtual bool AbortRequested(const std::shared_ptr<CRay>& pRay) = 0;
};
class ITA_PROPAGATION_PATH_SIM_API CAbortAtMaxTime : public IAbortCriterion
{
private:
double dTMax;
public:
CAbortAtMaxTime(double tMax = 30) : dTMax(tMax) {}
bool AbortRequested(const std::shared_ptr<CRay>& pRay) { return pRay->LastTimeStamp() >= dTMax; }
namespace EigenraySearch {
struct ITA_PROPAGATION_PATH_SIM_API RayAdaptationSettings {
struct {
unsigned int maxNAdaptations = 15; //< Abort after X adaptations of the ray resolution
//double minAngleResolutionDeg = 0.001; //< []
} abort;
struct {
double maxReceiverRadius = 1; //< [m]
double maxSourceReceiverAngle = 1; //< []
double maxAngleForGeomSpreading = 0.01; //< []
} accuracy;
struct {
double threshold = 0.1; //< [0 1]
} advancedRayZooming;
};
enum ITA_PROPAGATION_PATH_SIM_API SolverMethod
{
EULER = 0, //!< Euler method
RUNGE_KUTTA //!< Classical Runge_Kutta method (RK4)
struct ITA_PROPAGATION_PATH_SIM_API RayTracingAbortSettings {
unsigned int maxReflectionOrder = 3; //< Maximum considered order of reflections
double maxTime = 30; //< [s]
};
struct ITA_PROPAGATION_PATH_SIM_API AdaptiveIntegrationSettings {
bool bActive = true; //!< If this is set to false, the adaptation is bypassed and the integration step size is therefore constant
double dMaxError = 0.015;
double dUncriticalError = 0.005;
unsigned int iMaxAdaptationLevel = 32; //! Maximum times, the time step is halfed
};
struct ITA_PROPAGATION_PATH_SIM_API SimulationSettings {
SolverMethod solverMethod = SolverMethod::EULER;
double dIntegrationTimeStep = 0.1;
AdaptiveIntegrationSettings adaptiveIntegration;
struct ITA_PROPAGATION_PATH_SIM_API Settings {
RayTracingAbortSettings rayTracing;
RayAdaptationSettings rayAdaptation;
};
}
}
}
#endif //IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_SETTINGS
\ No newline at end of file
#endif //IW_ITA_PROPAGATIONPATHSIM_ART_EIGENRAYSEARCH_SETTINGS
\ No newline at end of file
......@@ -43,7 +43,7 @@ namespace ITAPropagationPathSim
{
public:
IAbortCriterion& iAbortCriterion; //!< Reference to externally defined abort criterion.
SimulationSettings settings;
Simulation::Settings settings;
public:
CEngine(IAbortCriterion& abortCriterion = CAbortAtMaxTime()): iAbortCriterion(abortCriterion) {}
......
......@@ -61,7 +61,7 @@ namespace ITAPropagationPathSim
unsigned int iMaxAdaptationLevel = 32; //! Maximum times, the time step is halfed
};
struct ITA_PROPAGATION_PATH_SIM_API SimulationSettings {
struct ITA_PROPAGATION_PATH_SIM_API Settings {
SolverMethod solverMethod = SolverMethod::EULER;
double dIntegrationTimeStep = 0.1;
AdaptiveIntegrationSettings adaptiveIntegration;
......
#include <ITAPropagationPathSim/AtmosphericRayTracing/Simulation/EigenrayFinder.h>
#include <ITAPropagationPathSim/AtmosphericRayTracing/EigenraySearch/Engine.h>
// ITA includes
#include <ITAPropagationPathSim/AtmosphericRayTracing/Simulation/Engine.h>
......@@ -9,24 +9,23 @@
//#include <VistaInterProcComm/Concurrency/VistaThread.h>
// STD
//#include <cmath>
using namespace ITAPropagationPathSim::AtmosphericRayTracing;
using namespace ITAPropagationPathSim::AtmosphericRayTracing::Simulation;
using namespace ITAPropagationPathSim::AtmosphericRayTracing::EigenraySearch;
namespace ITAPropagationPathSim
{
namespace AtmosphericRayTracing
{
namespace Simulation {
namespace EigenraySearch {
typedef std::shared_ptr<CRay> RayPtr;
typedef std::vector< RayPtr > RayVector;
class CEigenrayWorkerBase : public IAbortCriterion
class CEigenrayWorkerBase : public Simulation::IAbortCriterion
{
protected:
CEngine simulationEngine;
Simulation::CEngine simulationEngine;
RayTracingAbortSettings rayTracingAbortSettings;
VistaVector3D v3ReceiverPosition;
......@@ -44,7 +43,7 @@ namespace ITAPropagationPathSim
}
public:
CEigenrayWorkerBase(const VistaVector3D& receiverPosition, const SimulationSettings& simSettings, const RayTracingAbortSettings& rtSettings)
CEigenrayWorkerBase(const VistaVector3D& receiverPosition, const Simulation::Settings& simSettings, const RayTracingAbortSettings& rtSettings)
: v3ReceiverPosition(receiverPosition), rayTracingAbortSettings(rtSettings) { simulationEngine.settings = simSettings; }
protected:
......@@ -103,7 +102,7 @@ namespace ITAPropagationPathSim
return rayGridsOfReflectionOrder;
}
public:
CMinDistanceRayInitializer(const VistaVector3D& sourcePosition, const VistaVector3D& receiverPosition, const SimulationSettings& simSettings, const RayTracingAbortSettings& abortSettings)
CMinDistanceRayInitializer(const VistaVector3D& sourcePosition, const VistaVector3D& receiverPosition, const Simulation::Settings& simSettings, const RayTracingAbortSettings& abortSettings)
: CEigenrayWorkerBase(receiverPosition, simSettings, abortSettings) , v3SourcePosition(sourcePosition) {}
std::vector<CRayGrid> Run(const ITAGeo::CStratifiedAtmosphere& atmosphere)
......@@ -153,7 +152,7 @@ namespace ITAPropagationPathSim
pMinDistanceRay = pRay;
}
public:
CEigenrayWorker(const CRayGrid& rayGrid, const VistaVector3D& receiverPosition, const SimulationSettings& simSettings, const EigenraySettings& eigenraySettings, const int& activeReflectionOrder)
CEigenrayWorker(const CRayGrid& rayGrid, const VistaVector3D& receiverPosition, const Simulation::Settings& simSettings, const Settings& eigenraySettings, const int& activeReflectionOrder)
: CEigenrayWorkerBase(receiverPosition, simSettings, eigenraySettings.rayTracing), iActiveReflexionOrder(activeReflectionOrder), rayAdaptationSettings(eigenraySettings.rayAdaptation) {}
void Init()
......@@ -171,9 +170,9 @@ namespace ITAPropagationPathSim
}
std::vector<std::shared_ptr<CRay>> CEigenrayFinder::Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& sourcePosition, const VistaVector3D& receiverPosition)
std::vector<std::shared_ptr<CRay>> CEngine::Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& sourcePosition, const VistaVector3D& receiverPosition)
{
SimulationSettings initialSettings = simulationSettings;
Simulation::Settings initialSettings = simulationSettings;
initialSettings.dIntegrationTimeStep *= 10;
CMinDistanceRayInitializer initialRayTracing(sourcePosition, receiverPosition, initialSettings, eigenraySettings.rayTracing);
std::vector<CRayGrid> initialRayGrids = initialRayTracing.Run(atmosphere);
......
#include "RayResolutionAdapter.h"
// ITA includes
//#include <ITAException.h>
// STD
//#include <cmath>
using namespace ITAPropagationPathSim::AtmosphericRayTracing;
using namespace ITAPropagationPathSim::AtmosphericRayTracing::EigenraySearch;
bool Simulation::CRayResolutionAdapter::ZoomIntoRay(std::shared_ptr<CRay> pRay)
bool CRayResolutionAdapter::ZoomIntoRay(std::shared_ptr<CRay> pRay)
{
vpNewRaysOfLastAdaptation.clear();
......@@ -23,7 +18,7 @@ bool Simulation::CRayResolutionAdapter::ZoomIntoRay(std::shared_ptr<CRay> pRay)
return true;
}
void Simulation::CRayResolutionAdapter::DoubleRayResolution()
void CRayResolutionAdapter::DoubleRayResolution()
{
if (ConstRayVectorReference().size() <= 1)
return;
......@@ -57,7 +52,7 @@ void Simulation::CRayResolutionAdapter::DoubleRayResolution()
InitRayVectorFromRayMatrix();
}
std::vector<double> Simulation::CRayResolutionAdapter::DoubleAngularResolution(const std::vector<double>& angleVector) const
std::vector<double> CRayResolutionAdapter::DoubleAngularResolution(const std::vector<double>& angleVector) const
{
if (angleVector.size() < 2)
return angleVector;
......
......@@ -16,8 +16,8 @@
*
*/
#ifndef IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_RAYRESOLUTIONADAPTER
#define IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_RAYRESOLUTIONADAPTER
#ifndef IW_ITA_PROPAGATIONPATHSIM_ART_EIGENRAYSEARCH_RAYRESOLUTIONADAPTER
#define IW_ITA_PROPAGATIONPATHSIM_ART_EIGENRAYSEARCH_RAYRESOLUTIONADAPTER
#include <ITAPropagationPathSim/AtmosphericRayTracing/RayGrid.h>
......@@ -26,7 +26,7 @@ namespace ITAPropagationPathSim
{
namespace AtmosphericRayTracing
{
namespace Simulation
namespace EigenraySearch
{
class CRayResolutionAdapter : public CRayGrid
{
......@@ -49,4 +49,4 @@ namespace ITAPropagationPathSim
}
}
#endif //IW_ITA_PROPAGATIONPATHSIM_ART_SIMULATION_RAYRESOLUTIONADAPTER
\ No newline at end of file
#endif //IW_ITA_PROPAGATIONPATHSIM_ART_EIGENRAYSEARCH_RAYRESOLUTIONADAPTER
\ No newline at end of file
......@@ -34,7 +34,7 @@ namespace ITAPropagationPathSim
class CAdaptiveSolver
{
private:
const SimulationSettings rSettings;
const Settings rSettings;
double dCurrentDt = rSettings.dIntegrationTimeStep;
unsigned int iDtAdaptationLevel = 0;
......@@ -43,7 +43,7 @@ namespace ITAPropagationPathSim
bool bIncreaseDtInNextStep = false; //! Indicates whether the error is small enough that the timestep can be increased during next step.
public:
CAdaptiveSolver(const SimulationSettings& settings) : rSettings(settings) {}
CAdaptiveSolver(const Settings& settings) : rSettings(settings) {}
public:
double CurrentStepSize() const { return dCurrentDt; }
......
......@@ -22,7 +22,7 @@ class CWorker
IAbortCriterion& rAbortCriterion; //!< Reference to externally defined abort criterion.
CAdaptiveSolver mSolver;
public:
CWorker(std::shared_ptr<CRay> ray, const SimulationSettings& simSettings, IAbortCriterion& abortCriterion) :
CWorker(std::shared_ptr<CRay> ray, const Settings& simSettings, IAbortCriterion& abortCriterion) :
pRay(ray), rAbortCriterion(abortCriterion), mSolver(CAdaptiveSolver(simSettings)) {}
private:
......
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