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

ART - EigenrayWorker

- now only tracks the minimum receiver distance for a certain reflection order
- maximum reflection order is limited to 1 by now
parent e9c0d336
......@@ -7,23 +7,30 @@ using namespace ITAPropagationPathSim::AtmosphericRayTracing;
#pragma region EigenraySearchWatcher
EigenraySearch::CEigenraySearchWatcher::CEigenraySearchWatcher(const V3DConstPtrVector& vv3ReceiverPositions, const double& tMax, const int& maxReflOrder)
: m_vpReceiverPositions(vv3ReceiverPositions)
EigenraySearch::CEigenraySearchWatcher::CEigenraySearchWatcher(const ReceiverDataVector& vReceiverData, const double& tMax)
: m_vReceiverData(vReceiverData)
, m_dTMax(tMax)
, m_iMaxReflectionOrder(maxReflOrder)
{
int maxReflOrder = 0;
for each (const CReceiverData& receiverData in m_vReceiverData)
std::max(maxReflOrder, receiverData.iReflectionOrder);
m_iMaxReflectionOrderRTAbort = maxReflOrder + 1; //Abort Ray Tracing only if the reflection order is 2 above the maximum eigenray reflection order
}
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;
return pRay->LastTimeStamp() >= m_dTMax || pRay->ReflectionOrder() > m_iMaxReflectionOrderRTAbort;
}
void EigenraySearch::CEigenraySearchWatcher::ProcessRay(std::shared_ptr<CRay> pRay) const
{
for each (const VistaVector3D* pReceiverPos in m_vpReceiverPositions)
pRay->UpdateMinimumReceiverDistance(*pReceiverPos);
for each (const CReceiverData& receiverData in m_vReceiverData)
{
if (pRay->ReflectionOrder() == receiverData.iReflectionOrder || pRay->ReflectionOrder() == receiverData.iReflectionOrder-1)
pRay->UpdateMinimumReceiverDistance(receiverData.v3Position);
}
}
void EigenraySearch::CEigenraySearchWatcher::FinalizeRay(std::shared_ptr<CRay> pRay) const
......@@ -74,8 +81,8 @@ 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)
{
V3DConstPtrVector receiverPositions = { &ReceiverPosition(), &MirroredReceiverPosition() };
m_pSimulationWatcher = std::make_shared<CEigenraySearchWatcher>(receiverPositions, rayTracingAbortSettings.maxTime, rayTracingAbortSettings.maxReflectionOrder + 1);
ReceiverDataVector receiverData = { CReceiverData(ReceiverPosition(), 0) , CReceiverData(MirroredReceiverPosition(), 1) };
m_pSimulationWatcher = std::make_shared<CEigenraySearchWatcher>(receiverData, rayTracingAbortSettings.maxTime);
simulationEngine.pExternalWatcher = m_pSimulationWatcher;
}
......@@ -94,20 +101,21 @@ CRayGrid EigenraySearch::CInitialWorker::InitRayGrid(const ITAGeo::CStratifiedAt
}
void EigenraySearch::CInitialWorker::FindMinimumDistanceRays(const std::set<RayPtr>& rays)
{
int maxReflOrder = 0;
for each (const RayPtr & ray in rays)
{
const CRayReceiverData* rayReceiverDistanceData = ray->ReceiverDistanceData( ReceiverPosition() );
if (rayReceiverDistanceData)
maxReflOrder = std::max( rayReceiverDistanceData->reflectionOrder, maxReflOrder );
//NOTE: For now this Worker can only find eigenrays up to reflection order 1
//int maxReflOrder = 0;
//for each (const RayPtr & ray in rays)
//{
// const CRayReceiverData* rayReceiverDistanceData = ray->ReceiverDistanceData( ReceiverPosition() );
// if (rayReceiverDistanceData)
// maxReflOrder = std::max( rayReceiverDistanceData->reflectionOrder, maxReflOrder );
rayReceiverDistanceData = ray->ReceiverDistanceData( MirroredReceiverPosition() );
if (rayReceiverDistanceData)
maxReflOrder = std::max( rayReceiverDistanceData->reflectionOrder, maxReflOrder );
}
maxReflOrder = std::min(maxReflOrder, rayTracingAbortSettings.maxReflectionOrder);
// rayReceiverDistanceData = ray->ReceiverDistanceData( MirroredReceiverPosition() );
// if (rayReceiverDistanceData)
// maxReflOrder = std::max( rayReceiverDistanceData->reflectionOrder, maxReflOrder );
//}
//maxReflOrder = std::min(maxReflOrder, rayTracingAbortSettings.maxReflectionOrder);
//maxReflOrder = std::min(1U, rayTracingAbortSettings.maxReflectionOrder);
int maxReflOrder = std::min(1, rayTracingAbortSettings.maxReflectionOrder);
vpMinDistanceRays.resize(maxReflOrder + 1);
for (int reflOrder = 0; reflOrder <= maxReflOrder; reflOrder++)
......@@ -135,8 +143,8 @@ EigenraySearch::CAdaptiveWorker::CAdaptiveWorker(const CRayGrid& rayGrid, const
fReceiverRadius = fmin(rayAdaptationSettings.accuracy.maxReceiverRadius, fReceiverRadius);
//TODO: Track whether distance increased and use this for abortion
V3DConstPtrVector receiverPositions = { &VirtualReceiverPosition() };
m_pSimulationWatcher = std::make_shared<CEigenraySearchWatcher>(receiverPositions, rayTracingAbortSettings.maxTime, iActiveReflexionOrder + 1);
ReceiverDataVector receiverData = { CReceiverData(VirtualReceiverPosition(), iActiveReflexionOrder) };
m_pSimulationWatcher = std::make_shared<CEigenraySearchWatcher>(receiverData, rayTracingAbortSettings.maxTime);
simulationEngine.pExternalWatcher = m_pSimulationWatcher;
}
......
......@@ -38,7 +38,6 @@
// STD
#include <vector>
#include <set>
#include <map>
#include <memory>
......@@ -50,16 +49,28 @@ namespace ITAPropagationPathSim
typedef std::shared_ptr<CRay> RayPtr;
typedef std::vector< RayPtr > RayVector;
typedef std::vector<const VistaVector3D* > V3DConstPtrVector;
class CReceiverData {
public:
const VistaVector3D& v3Position;
const int iReflectionOrder;
inline CReceiverData(const VistaVector3D& pos, const int reflOrder): v3Position(pos), iReflectionOrder(reflOrder) {};
inline CReceiverData& operator=(const CReceiverData& other)
{
if(this != &other)
*this = CReceiverData(other.v3Position, other.iReflectionOrder);
return *this;
};
};
typedef std::vector<CReceiverData> ReceiverDataVector;
class CEigenraySearchWatcher : public Simulation::IExternalWatcher
{
private:
V3DConstPtrVector m_vpReceiverPositions;
const double m_dTMax;
const int m_iMaxReflectionOrder;
ReceiverDataVector m_vReceiverData;
double m_dTMax;
int m_iMaxReflectionOrderRTAbort;
public:
CEigenraySearchWatcher(const V3DConstPtrVector& vv3ReceiverPositions, const double& tMax, const int& maxReflOrder);
CEigenraySearchWatcher(const ReceiverDataVector& vReceiverData, const double& tMax);
public:
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
......
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