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

Atmospheric Ray Tracing - Simulation Engine

- now takes parameters for rays as function input instead of using member variables
parent 50948827
...@@ -45,20 +45,12 @@ namespace ITAPropagationPathSim ...@@ -45,20 +45,12 @@ namespace ITAPropagationPathSim
IAbortCriterion& iAbortCriterion; //!< Reference to externally defined abort criterion. IAbortCriterion& iAbortCriterion; //!< Reference to externally defined abort criterion.
SimulationSettings settings; SimulationSettings settings;
VistaVector3D v3SourcePosition;
std::vector<VistaVector3D> v3RayDirections;
private:
std::vector<std::shared_ptr<CRay>> rays;
//const IAbortCriterion& iAbortCriterion; //!< Reference to externally defined abort criterion.
public: public:
CEngine(IAbortCriterion& abortCriterion = CAbortAtMaxTime()): iAbortCriterion(abortCriterion) {} CEngine(IAbortCriterion& abortCriterion = CAbortAtMaxTime()): iAbortCriterion(abortCriterion) {}
virtual ~CEngine() {}
public: public:
std::vector<std::shared_ptr<CRay>> Run(const ITAGeo::CStratifiedAtmosphere& atmosphere); std::vector<std::shared_ptr<CRay>> Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& v3SourcePosition, const std::vector<VistaVector3D>& v3RayDirections);
private: void Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const std::vector<std::shared_ptr<CRay>>& rays);
void InitRays();
}; };
} }
} }
......
...@@ -118,20 +118,21 @@ class CWorker ...@@ -118,20 +118,21 @@ class CWorker
}}} }}}
std::vector<std::shared_ptr<CRay>> CEngine::Run(const ITAGeo::CStratifiedAtmosphere& atmosphere) std::vector<std::shared_ptr<CRay>> CEngine::Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& v3SourcePosition, const std::vector<VistaVector3D>& v3RayDirections)
{
std::vector<std::shared_ptr<CRay>> rays;
for each (const VistaVector3D & v3Direction in v3RayDirections)
rays.push_back(std::make_shared<CRay>(v3SourcePosition, v3Direction));
Run(atmosphere, rays);
return rays;
}
void CEngine::Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const std::vector<std::shared_ptr<CRay>>& rays)
{ {
InitRays();
for (int idx = 0; idx < rays.size(); idx++) for (int idx = 0; idx < rays.size(); idx++)
{ {
//CRay& ray = rays[idx]; //CRay& ray = rays[idx];
auto worker = CWorker(rays[idx], settings, iAbortCriterion); auto worker = CWorker(rays[idx], settings, iAbortCriterion);
worker.TraceRay(atmosphere); worker.TraceRay(atmosphere);
} }
return rays;
}
void CEngine::InitRays()
{
rays.clear();
for each (const VistaVector3D & v3Direction in v3RayDirections)
rays.push_back( std::make_shared<CRay>(v3SourcePosition, v3Direction) );
} }
\ No newline at end of file
...@@ -55,15 +55,14 @@ void runTest(const CStratifiedAtmosphere& atmosphere, const double& sourceAltitu ...@@ -55,15 +55,14 @@ void runTest(const CStratifiedAtmosphere& atmosphere, const double& sourceAltitu
engine.settings.dIntegrationTimeStep = dt; engine.settings.dIntegrationTimeStep = dt;
engine.v3RayDirections.push_back(rayDirection); VistaVector3D sourcePosition = VistaVector3D(0, 0, sourceAltitude);
engine.v3SourcePosition = VistaVector3D(0, 0, sourceAltitude);
cout << fileSuffix << ":" << endl; cout << fileSuffix << ":" << endl;
cout << "Starting Simulation-Engine..." << endl; cout << "Starting Simulation-Engine..." << endl;
engine.settings.solverMethod = Simulation::EULER; engine.settings.solverMethod = Simulation::EULER;
std::vector<std::shared_ptr<CRay>> resultEuler = engine.Run(atmosphere); std::vector<std::shared_ptr<CRay>> resultEuler = engine.Run(atmosphere, sourcePosition, { rayDirection });
engine.settings.solverMethod = Simulation::RUNGE_KUTTA; engine.settings.solverMethod = Simulation::RUNGE_KUTTA;
std::vector<std::shared_ptr<CRay>> resultRunge = engine.Run(atmosphere); std::vector<std::shared_ptr<CRay>> resultRunge = engine.Run(atmosphere, sourcePosition, { rayDirection });
cout << "Starting export..." << endl; cout << "Starting export..." << endl;
Export::ToPropagationPath(*resultEuler[0]).Store("SimulationEngineTest_Euler_" + fileSuffix + ".json"); Export::ToPropagationPath(*resultEuler[0]).Store("SimulationEngineTest_Euler_" + fileSuffix + ".json");
......
Supports Markdown
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