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

ART - Eigenray Engine

- Simulation watcher now works with pointers to receiver positions

ART - Simulation::IExternalWatcher
- now works with shared_ptr and not references to shared_ptr
parent 869d3a92
......@@ -36,21 +36,21 @@ namespace ITAPropagationPathSim
{
public:
//! Returns true if the abort criterion for tracing the given ray is reached
virtual bool AbortRequested(const std::shared_ptr<CRay>& pRay) const = 0;
virtual bool AbortRequested(const std::shared_ptr<CRay> pRay) const = 0;
//! Allows additional proecssing of the ray at the end of each time step.
virtual void ProcessRay(std::shared_ptr<CRay>&) const = 0;
virtual void ProcessRay(std::shared_ptr<CRay>) const = 0;
//! This is called after the tracing of a ray is finished.
virtual void FinalizeRay(std::shared_ptr<CRay>&) const = 0;
virtual void FinalizeRay(std::shared_ptr<CRay>) const = 0;
};
class ITA_PROPAGATION_PATH_SIM_API CAbortAtMaxTime : public IExternalWatcher
{
private:
double dTMax;
public:
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 {}
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 {};
};
enum ITA_PROPAGATION_PATH_SIM_API SolverMethod
......
......@@ -7,26 +7,26 @@ using namespace ITAPropagationPathSim::AtmosphericRayTracing;
#pragma region EigenraySearchWatcher
EigenraySearch::CEigenraySearchWatcher::CEigenraySearchWatcher(const std::vector<const VistaVector3D> vv3ReceiverPositions, const double& tMax, const int& maxReflOrder)
: m_vv3ReceiverPositions(vv3ReceiverPositions)
EigenraySearch::CEigenraySearchWatcher::CEigenraySearchWatcher(const V3DConstPtrVector& vv3ReceiverPositions, const double& tMax, const int& maxReflOrder)
: m_vpReceiverPositions(vv3ReceiverPositions)
, m_dTMax(tMax)
, m_iMaxReflectionOrder(maxReflOrder)
{
}
bool EigenraySearch::CEigenraySearchWatcher::AbortRequested(const std::shared_ptr<CRay>& pRay) const
bool EigenraySearch::CEigenraySearchWatcher::AbortRequested(const std::shared_ptr<CRay> pRay) const
{
//TODO: For CAdaptiveWorker: Track whether distance increased and use this for abortion
return pRay->LastTimeStamp() >= m_dTMax || pRay->ReflectionOrder() > m_iMaxReflectionOrder;
}
void EigenraySearch::CEigenraySearchWatcher::ProcessRay(std::shared_ptr<CRay>& pRay) const
void EigenraySearch::CEigenraySearchWatcher::ProcessRay(std::shared_ptr<CRay> pRay) const
{
for each (auto receiverPosRef in m_vv3ReceiverPositions)
pRay->UpdateMinimumReceiverDistance(receiverPosRef);
for each (const VistaVector3D* pReceiverPos in m_vpReceiverPositions)
pRay->UpdateMinimumReceiverDistance(*pReceiverPos);
}
void EigenraySearch::CEigenraySearchWatcher::FinalizeRay(std::shared_ptr<CRay>& pRay) const
void EigenraySearch::CEigenraySearchWatcher::FinalizeRay(std::shared_ptr<CRay> pRay) const
{
pRay->FinalizeMinimumReceiverDistances();
}
......@@ -74,7 +74,7 @@ EigenraySearch::RayPtr EigenraySearch::CWorkerBase::FindMinimumDistanceRay(const
EigenraySearch::CInitialWorker::CInitialWorker(const VistaVector3D& sourcePosition, const VistaVector3D& receiverPosition, const Simulation::Settings& simSettings, const RayTracingAbortSettings& abortSettings)
: CWorkerBase(sourcePosition, receiverPosition, simSettings, abortSettings)
{
std::vector<const VistaVector3D> receiverPositions = { ReceiverPosition(), MirroredReceiverPosition() };
V3DConstPtrVector receiverPositions = { &ReceiverPosition(), &MirroredReceiverPosition() };
m_pSimulationWatcher = std::make_shared<CEigenraySearchWatcher>(receiverPositions, rayTracingAbortSettings.maxTime, rayTracingAbortSettings.maxReflectionOrder + 1);
simulationEngine.pExternalWatcher = m_pSimulationWatcher;
}
......@@ -135,7 +135,7 @@ EigenraySearch::CAdaptiveWorker::CAdaptiveWorker(const CRayGrid& rayGrid, const
fReceiverRadius = fmin(rayAdaptationSettings.accuracy.maxReceiverRadius, fReceiverRadius);
//TODO: Track whether distance increased and use this for abortion
std::vector<const VistaVector3D> receiverPositions = { VirtualReceiverPosition() };
V3DConstPtrVector receiverPositions = { &VirtualReceiverPosition() };
m_pSimulationWatcher = std::make_shared<CEigenraySearchWatcher>(receiverPositions, rayTracingAbortSettings.maxTime, iActiveReflexionOrder + 1);
simulationEngine.pExternalWatcher = m_pSimulationWatcher;
}
......
......@@ -50,20 +50,22 @@ namespace ITAPropagationPathSim
typedef std::shared_ptr<CRay> RayPtr;
typedef std::vector< RayPtr > RayVector;
typedef std::vector<const VistaVector3D* > V3DConstPtrVector;
class CEigenraySearchWatcher : public Simulation::IExternalWatcher
{
private:
std::vector<const VistaVector3D> m_vv3ReceiverPositions;
const double& m_dTMax;
const int& m_iMaxReflectionOrder;
V3DConstPtrVector m_vpReceiverPositions;
const double m_dTMax;
const int m_iMaxReflectionOrder;
public:
CEigenraySearchWatcher(const std::vector<const VistaVector3D> vv3ReceiverPositions, const double& tMax, const int& maxReflOrder);
CEigenraySearchWatcher(const V3DConstPtrVector& vv3ReceiverPositions, const double& tMax, const int& maxReflOrder);
public:
virtual bool AbortRequested(const std::shared_ptr<CRay>& pRay) const;
virtual bool AbortRequested(const std::shared_ptr<CRay> pRay) const;
//! Interface function to Simulation::Engine: Updates the minimum receiver distance of the ray after each processing step
virtual void ProcessRay(std::shared_ptr<CRay>&) const;
virtual void ProcessRay(std::shared_ptr<CRay>) const;
//! Interface function to Simulation::Engine: Called after tracing a ray is finished.
virtual void FinalizeRay(std::shared_ptr<CRay>&) const;
virtual void FinalizeRay(std::shared_ptr<CRay>) const;
};
//! Basis for a worker which tracks the distance between rays and a receiver to find eigenrays
......
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