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
IAbortCriterion& iAbortCriterion; //!< Reference to externally defined abort criterion.
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:
CEngine(IAbortCriterion& abortCriterion = CAbortAtMaxTime()): iAbortCriterion(abortCriterion) {}
virtual ~CEngine() {}
public:
std::vector<std::shared_ptr<CRay>> Run(const ITAGeo::CStratifiedAtmosphere& atmosphere);
private:
void InitRays();
std::vector<std::shared_ptr<CRay>> Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& v3SourcePosition, const std::vector<VistaVector3D>& v3RayDirections);
void Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const std::vector<std::shared_ptr<CRay>>& rays);
};
}
}
......
......@@ -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++)
{
//CRay& ray = rays[idx];
auto worker = CWorker(rays[idx], settings, iAbortCriterion);
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
engine.settings.dIntegrationTimeStep = dt;
engine.v3RayDirections.push_back(rayDirection);
engine.v3SourcePosition = VistaVector3D(0, 0, sourceAltitude);
VistaVector3D sourcePosition = VistaVector3D(0, 0, sourceAltitude);
cout << fileSuffix << ":" << endl;
cout << "Starting Simulation-Engine..." << endl;
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;
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;
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