...
 
Commits (2)
......@@ -28,3 +28,4 @@ svnaccess
*.exp
*.skp
*.skb
*.json
......@@ -35,11 +35,11 @@ namespace ITAPropagationPathSim
class ITA_PROPAGATION_PATH_SIM_API CAdaptiveRayGrid : public CRayGrid
{
private:
double dMaxDeltaTheta = -1;
double dMaxDeltaPhi = -1;
std::set< std::shared_ptr<CRay> > vpNewRaysOfLastAdaptation;
double m_dMaxDeltaTheta = -1;
double m_dMaxDeltaPhi = -1;
std::set< std::shared_ptr<CRay> > m_vpNewRaysOfLastAdaptation;
public:
CAdaptiveRayGrid() {}
inline CAdaptiveRayGrid() {};
CAdaptiveRayGrid(const CRayGrid& rayGrid);
public:
......@@ -47,13 +47,13 @@ namespace ITAPropagationPathSim
void Reset(const CRayGrid& rayGrid);
//! Maximum angular resolution in degrees
const double& MaxAngularResolution() { return dMaxDeltaTheta < dMaxDeltaPhi ? dMaxDeltaPhi : dMaxDeltaTheta; }
inline const double& MaxAngularResolution() { return m_dMaxDeltaTheta < m_dMaxDeltaPhi ? m_dMaxDeltaPhi : m_dMaxDeltaTheta; };
//! Maximum elevation resolution in degrees
const double& MaxDeltaTheta() { return dMaxDeltaTheta; }
inline const double& MaxDeltaTheta() { return m_dMaxDeltaTheta; };
//! Maximum azimuth resolution in degrees
const double& MaxDeltaPhi() { return dMaxDeltaPhi; }
inline const double& MaxDeltaPhi() { return m_dMaxDeltaPhi; };
//! Returns a unique set of the rays which were adding during the last adaptation
const std::set< std::shared_ptr<CRay> >& NewRaysOfLastAdaptation() const { return vpNewRaysOfLastAdaptation; }
inline const std::set< std::shared_ptr<CRay> >& NewRaysOfLastAdaptation() const { return m_vpNewRaysOfLastAdaptation; };
//! Simple adaptation method: Setting the limits to neighboring rays and shoots additional rays to double the angular resolution of the grid.
void ZoomIntoRay(const std::shared_ptr<CRay> pRay);
......
......@@ -48,7 +48,7 @@ namespace ITAPropagationPathSim
Simulation::Settings simulationSettings;
public:
CEngine() {}
inline CEngine() {};
std::vector<std::shared_ptr<CRay>> Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& sourcePosition, const VistaVector3D& receiverPosition);
};
......
......@@ -47,20 +47,20 @@ namespace ITAPropagationPathSim
typedef std::vector< RayPtr > RayVector;
typedef std::vector<RayVector> RayMatrix;
VistaVector3D v3SourcePos; //< Origin of all rays in this ray grid.
std::vector<double> vdThetaDeg; //< Sorted vector of elevation angles in degrees.
std::vector<double> vdPhiDeg; //< Sorted vector of azimuth angles in degrees.
VistaVector3D m_v3SourcePos; //< Origin of all rays in this ray grid.
std::vector<double> m_vdThetaDeg; //< Sorted vector of elevation angles in degrees.
std::vector<double> m_vdPhiDeg; //< Sorted vector of azimuth angles in degrees.
private:
RayMatrix vvpRayMatrix; //< Matrix of pointers to ray. First index refers to elevation (theta), second to azimuth (phi) angle.
RayVector vpRays; //< Vector of all rays contained by vvpRayMatrix. May contain duplicates at poles (theta = 0 or 180°).
std::set<RayPtr> vpUniqueRays; // Unique set of all rays contained by vvpRayMatrix.
bool bCircularPhi = false; //< Indicates whether the azimuth vector is considered to be circular (phi covers full 360 degrees) or not.
RayMatrix m_vvpRayMatrix; //< Matrix of pointers to ray. First index refers to elevation (theta), second to azimuth (phi) angle.
RayVector m_vpRays; //< Vector of all rays contained by vvpRayMatrix. May contain duplicates at poles (theta = 0 or 180°).
std::set<RayPtr> m_vpUniqueRays; // Unique set of all rays contained by vvpRayMatrix.
bool m_bCircularPhi = false; //< Indicates whether the azimuth vector is considered to be circular (phi covers full 360 degrees) or not.
private:
CRayGrid(const RayMatrix& rayMatrix, const std::vector<double>& thetaDeg, const std::vector<double>& phiDeg, const bool circularPhi = false);
void UpdateDependentRayContainers();
protected:
inline CRayGrid(bool circularPhi = false) : bCircularPhi(circularPhi) {};
inline CRayGrid(bool circularPhi = false) : m_bCircularPhi(circularPhi) {};
//! Creates new rays using the angles of initial directions and inserts them into the ray matrix
void InitRays();
public:
......@@ -95,24 +95,24 @@ namespace ITAPropagationPathSim
bool HasPoleDirection(const std::shared_ptr<CRay> pRay) const;
public:
//! Returns true if the phi angles are defined circular (covering a full circle)
inline bool IsCircular() const { return bCircularPhi; };
inline bool IsCircular() const { return m_bCircularPhi; };
bool IsEmpty() const;
bool Is2D() const;
bool Contains(const std::shared_ptr<CRay> pRay) const;
//---GET Functions---
protected:
inline const std::vector<std::shared_ptr<CRay>>& Rays() const { return vpRays; };
inline const RayMatrix& Matrix() const { return vvpRayMatrix; };
inline const std::vector<std::shared_ptr<CRay>>& Rays() const { return m_vpRays; };
inline const RayMatrix& Matrix() const { return m_vvpRayMatrix; };
public:
inline const std::vector<double>& ThetaDeg() const { return vdThetaDeg; };
inline const std::vector<double>& PhiDeg() const { return vdPhiDeg; };
inline int NTheta() const { return vdThetaDeg.size(); };
inline int NPhi() const { return vdPhiDeg.size(); };
inline int NRays() const { return vpRays.size(); };
inline const VistaVector3D& SourcePosition() const { return v3SourcePos; };
inline const std::set<std::shared_ptr<CRay>>& UniqueRays() const { return vpUniqueRays; };
inline const std::shared_ptr<CRay> At(int idxTheta, int idxPhi) const { return vvpRayMatrix[idxTheta][idxPhi]; };
inline const std::vector<double>& ThetaDeg() const { return m_vdThetaDeg; };
inline const std::vector<double>& PhiDeg() const { return m_vdPhiDeg; };
inline int NTheta() const { return m_vdThetaDeg.size(); };
inline int NPhi() const { return m_vdPhiDeg.size(); };
inline int NRays() const { return m_vpRays.size(); };
inline const VistaVector3D& SourcePosition() const { return m_v3SourcePos; };
inline const std::set<std::shared_ptr<CRay>>& UniqueRays() const { return m_vpUniqueRays; };
inline const std::shared_ptr<CRay> At(int idxTheta, int idxPhi) const { return m_vvpRayMatrix[idxTheta][idxPhi]; };
//! Calculates and returns an approximation for the surface area of the wavefront at given time by spanning triangles between rays
double WavefrontSurface(const double& time) const;
......
......@@ -64,12 +64,12 @@ namespace ITAPropagationPathSim
{
private:
std::vector<int> iReflectionIndices;
double dSpreadingLoss = -1; //!< Spreadingloss at last point of ray (receiver), calculated at the end of Eigenray search.
std::vector<int> m_viReflectionIndices;
double m_dSpreadingLoss = -1; //!< Spreadingloss at last point of ray (receiver), calculated at the end of Eigenray search.
typedef const VistaVector3D* ReceiverPositionPtr;
typedef std::map<ReceiverPositionPtr, CRayReceiverData> ReceiverDistanceMap;
ReceiverDistanceMap mReceiverDistanceMap;
ReceiverDistanceMap m_mReceiverDistanceMap;
public:
CRay(const VistaVector3D& v3SourcePos, const double& thetaDeg, const double& phiDeg);
......@@ -78,9 +78,9 @@ namespace ITAPropagationPathSim
public:
#pragma region Get Functions
const std::vector<int>& ReflectionIndices() const { return iReflectionIndices; };
inline const std::vector<int>& ReflectionIndices() const { return m_viReflectionIndices; };
inline int NumPoints() const { return size(); }
inline int NumPoints() const { return size(); };
inline const VistaVector3D& SourcePoint() const { return front().position; };
inline const VistaVector3D& InitialDirection() const { return front().wavefrontNormal; };
......@@ -88,19 +88,19 @@ namespace ITAPropagationPathSim
inline const VistaVector3D& LastWavefrontNormal() const { return back().wavefrontNormal; };
inline const double& LastTimeStamp() const { return back().timeStamp; };
inline int ReflectionOrder() const { return iReflectionIndices.size(); };
inline int ReflectionOrder() const { return m_viReflectionIndices.size(); };
//! Returns the reflection order of the ray element with given index
int ReflectionOrder(const int idx) const;
//! Returns the spreading loss at end point of receiver. If this has not been calculated yet, this returns -1.
inline double SpreadingLoss() const { return dSpreadingLoss; };
inline double SpreadingLoss() const { return m_dSpreadingLoss; };
#pragma endregion
//! Appends a new element with position, wavefront normal and timestamp to the ray
void Append(const VistaVector3D& position, const VistaVector3D& wavefrontNormal, const double& timeStamp);
//! Appends a new element to the ray and adds its index to iReflectionIndices
void AppendReflection(const VistaVector3D& position, const VistaVector3D& wavefrontNormal, const double& timeStamp);
inline void SetSpreadingLoss(const double& spreadingLoss) { dSpreadingLoss = spreadingLoss; };
inline void SetSpreadingLoss(const double& spreadingLoss) { m_dSpreadingLoss = spreadingLoss; };
//! Returns true, if both rays have the same initial direction
bool SameDirection(const CRay& other) const;
......
......@@ -54,7 +54,7 @@ namespace ITAPropagationPathSim
inline CEngine(std::shared_ptr<IExternalWatcher> pWatcher) : pExternalWatcher(pWatcher) {};
public:
std::vector<std::shared_ptr<CRay>> Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& v3SourcePosition, const std::vector<VistaVector3D>& v3RayDirections) const;
std::vector<std::shared_ptr<CRay>> Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& m_v3SourcePosition, const std::vector<VistaVector3D>& v3RayDirections) const;
void Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const std::set<std::shared_ptr<CRay>>& rays) const;
private:
void TraceRays(const ITAGeo::CStratifiedAtmosphere& atmosphere, const std::vector<std::shared_ptr<CRay>>& rays) const;
......
......@@ -38,13 +38,13 @@ namespace ITAPropagationPathSim
{
namespace Utils
{
ITAGeo::CPropagationPath ToPropagationPath(const CRay& ray)
ITA_PROPAGATION_PATH_SIM_API inline ITAGeo::CPropagationPath ToPropagationPath(const CRay& ray)
{
ITAGeo::CPropagationPath propagationPath;
propagationPath.reserve(ray.size());
VistaVector3D position, wavefrontNormal;
propagationPath.push_back( std::make_shared<ITAGeo::CEmitterInhomogeneous>(ray.SourcePoint(), ray.InitialDirection()) );
propagationPath.push_back(std::make_shared<ITAGeo::CEmitterInhomogeneous>(ray.SourcePoint(), ray.InitialDirection()));
for (int idx = 1; idx < ray.size(); idx++)
{
position = ray[idx].position;
......@@ -72,9 +72,9 @@ namespace ITAPropagationPathSim
}
return propagationPath;
}
};
ITAGeo::CPropagationPathList ToPropagationPath(const std::vector<std::shared_ptr<CRay>>& vpRays)
ITA_PROPAGATION_PATH_SIM_API inline ITAGeo::CPropagationPathList ToPropagationPath(const std::vector<std::shared_ptr<CRay>>& vpRays)
{
ITAGeo::CPropagationPathList propagationPathList;
propagationPathList.reserve(vpRays.size());
......@@ -83,11 +83,11 @@ namespace ITAPropagationPathSim
if (!pRay)
continue;
propagationPathList.push_back( ToPropagationPath(*pRay) );
propagationPathList.push_back(ToPropagationPath(*pRay));
}
return propagationPathList;
}
};
}
}
}
......
......@@ -17,21 +17,21 @@ EigenraySearch::CAdaptiveRayGrid::CAdaptiveRayGrid(const CRayGrid& rayGrid) : CR
void EigenraySearch::CAdaptiveRayGrid::Init()
{
vpNewRaysOfLastAdaptation.clear();
for (int idx = 1; idx < vdThetaDeg.size(); idx++)
m_vpNewRaysOfLastAdaptation.clear();
for (int idx = 1; idx < m_vdThetaDeg.size(); idx++)
{
double deltaTheta = vdThetaDeg[idx] - vdThetaDeg[idx - 1];
if (dMaxDeltaTheta < deltaTheta)
dMaxDeltaTheta = deltaTheta;
double deltaTheta = m_vdThetaDeg[idx] - m_vdThetaDeg[idx - 1];
if (m_dMaxDeltaTheta < deltaTheta)
m_dMaxDeltaTheta = deltaTheta;
}
for (int idx = 1; idx < vdPhiDeg.size(); idx++)
for (int idx = 1; idx < m_vdPhiDeg.size(); idx++)
{
double deltaPhi = vdPhiDeg[idx] - vdPhiDeg[idx - 1];
double deltaPhi = m_vdPhiDeg[idx] - m_vdPhiDeg[idx - 1];
if (deltaPhi < 0)
deltaPhi += 360;
if (dMaxDeltaPhi < deltaPhi)
dMaxDeltaPhi = deltaPhi;
if (m_dMaxDeltaPhi < deltaPhi)
m_dMaxDeltaPhi = deltaPhi;
}
}
......@@ -74,30 +74,30 @@ void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay> pZoomRay, const d
if (deltaTheta <= 0 || deltaPhi <= 0)
ITA_EXCEPT_INVALID_PARAMETER("Delta angles must be positive numbers > 0.");
const double thetaDeg = vdThetaDeg[ IndexToThetaIndex(idx) ];
const double phiDeg = vdPhiDeg[ IndexToPhiIndex(idx) ];
const double thetaDeg = m_vdThetaDeg[ IndexToThetaIndex(idx) ];
const double phiDeg = m_vdPhiDeg[ IndexToPhiIndex(idx) ];
int idxRayTheta = 1; int idxRayPhi = 1;
vdThetaDeg = { thetaDeg - deltaTheta, thetaDeg, thetaDeg + deltaTheta };
vdPhiDeg = { phiDeg - deltaPhi, phiDeg, phiDeg + deltaPhi };
if (vdThetaDeg.front() < 0)
m_vdThetaDeg = { thetaDeg - deltaTheta, thetaDeg, thetaDeg + deltaTheta };
m_vdPhiDeg = { phiDeg - deltaPhi, phiDeg, phiDeg + deltaPhi };
if (m_vdThetaDeg.front() < 0)
{
vdThetaDeg.erase(vdThetaDeg.begin());
m_vdThetaDeg.erase(m_vdThetaDeg.begin());
idxRayTheta = 0;
}
if (vdThetaDeg.back() > 180)
vdThetaDeg.pop_back();
if (m_vdThetaDeg.back() > 180)
m_vdThetaDeg.pop_back();
RayMatrix newRayMatrix(NTheta(), RayVector(NPhi()));
vpNewRaysOfLastAdaptation.clear();
for (int idxTheta = 0; idxTheta < vdThetaDeg.size(); idxTheta++)
m_vpNewRaysOfLastAdaptation.clear();
for (int idxTheta = 0; idxTheta < m_vdThetaDeg.size(); idxTheta++)
{
for (int idxPhi = 0; idxPhi < vdPhiDeg.size(); idxPhi++)
for (int idxPhi = 0; idxPhi < m_vdPhiDeg.size(); idxPhi++)
{
RayPtr pCurrentRay;
if (idxRayTheta == idxTheta && idxRayPhi == idxPhi)
pCurrentRay = pZoomRay;
else if ( IsPoleDirection(vdThetaDeg[idxTheta]) && (idxRayTheta==idxTheta || idxPhi > 0) )
else if ( IsPoleDirection(m_vdThetaDeg[idxTheta]) && (idxRayTheta==idxTheta || idxPhi > 0) )
{
if (idxTheta == idxRayTheta)
pCurrentRay = pZoomRay;
......@@ -106,8 +106,8 @@ void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay> pZoomRay, const d
}
else
{
pCurrentRay = std::make_shared<CRay>(v3SourcePos, vdThetaDeg[idxTheta], vdPhiDeg[idxPhi]);
vpNewRaysOfLastAdaptation.insert(pCurrentRay);
pCurrentRay = std::make_shared<CRay>(m_v3SourcePos, m_vdThetaDeg[idxTheta], m_vdPhiDeg[idxPhi]);
m_vpNewRaysOfLastAdaptation.insert(pCurrentRay);
}
newRayMatrix[idxTheta][idxPhi] = pCurrentRay;
......@@ -167,21 +167,21 @@ void CAdaptiveRayGrid::DoubleRayResolution()
DoublePhiResolution();
RayMatrix newRayMatrix( NTheta(), RayVector( NPhi() ) );
vpNewRaysOfLastAdaptation.clear();
m_vpNewRaysOfLastAdaptation.clear();
RayVector::const_iterator iteratorOldRays = Rays().cbegin();
for (int idxTheta = 0; idxTheta < vdThetaDeg.size(); idxTheta++)
for (int idxTheta = 0; idxTheta < m_vdThetaDeg.size(); idxTheta++)
{
const bool isNewTheta = (idxTheta % 2) == 1;
for (int idxPhi = 0; idxPhi < vdPhiDeg.size(); idxPhi++)
for (int idxPhi = 0; idxPhi < m_vdPhiDeg.size(); idxPhi++)
{
const bool isNewPhi = (idxPhi % 2) == 1;
RayPtr pRay;
if (IsPoleDirection(vdThetaDeg[idxTheta]))
if (IsPoleDirection(m_vdThetaDeg[idxTheta]))
pRay = Matrix()[idxTheta/2].front(); //Int-Division to convert to theta index of old matrix
else if (isNewTheta || isNewPhi)
{
pRay = std::make_shared<CRay>(v3SourcePos, vdThetaDeg[idxTheta], vdPhiDeg[idxPhi]);
vpNewRaysOfLastAdaptation.insert(pRay);
pRay = std::make_shared<CRay>(m_v3SourcePos, m_vdThetaDeg[idxTheta], m_vdPhiDeg[idxPhi]);
m_vpNewRaysOfLastAdaptation.insert(pRay);
}
else
pRay = *iteratorOldRays;
......@@ -197,36 +197,36 @@ void CAdaptiveRayGrid::DoubleRayResolution()
void CAdaptiveRayGrid::DoubleThetaResolution()
{
if (vdThetaDeg.size() < 2)
if (m_vdThetaDeg.size() < 2)
return;
std::vector<double> newAngleVector;
newAngleVector.reserve(2 * vdThetaDeg.size() - 1);
newAngleVector.push_back(vdThetaDeg.front());
for (int idxAngle = 1; idxAngle < vdThetaDeg.size(); idxAngle++)
newAngleVector.reserve(2 * m_vdThetaDeg.size() - 1);
newAngleVector.push_back(m_vdThetaDeg.front());
for (int idxAngle = 1; idxAngle < m_vdThetaDeg.size(); idxAngle++)
{
const double& angle1 = vdThetaDeg[idxAngle - 1];
const double& angle2 = vdThetaDeg[idxAngle];
const double& angle1 = m_vdThetaDeg[idxAngle - 1];
const double& angle2 = m_vdThetaDeg[idxAngle];
newAngleVector.push_back((angle1 + angle2) / 2);
newAngleVector.push_back(angle2);
}
vdThetaDeg = newAngleVector;
dMaxDeltaTheta /= 2;
m_vdThetaDeg = newAngleVector;
m_dMaxDeltaTheta /= 2;
}
void CAdaptiveRayGrid::DoublePhiResolution()
{
if (vdPhiDeg.size() < 2)
if (m_vdPhiDeg.size() < 2)
return;
std::vector<double> newAngleVector;
newAngleVector.reserve(2 * vdPhiDeg.size() - 1 + IsCircular());
newAngleVector.push_back(vdPhiDeg.front());
for (int idxAngle = 1; idxAngle < vdPhiDeg.size(); idxAngle++)
newAngleVector.reserve(2 * m_vdPhiDeg.size() - 1 + IsCircular());
newAngleVector.push_back(m_vdPhiDeg.front());
for (int idxAngle = 1; idxAngle < m_vdPhiDeg.size(); idxAngle++)
{
const double& angle1 = vdPhiDeg[idxAngle - 1];
const double& angle2 = vdPhiDeg[idxAngle];
const double& angle1 = m_vdPhiDeg[idxAngle - 1];
const double& angle2 = m_vdPhiDeg[idxAngle];
double newAngle = (angle1 + angle2) / 2;
if (angle2 < angle1)
newAngle = std::fmod(newAngle + 180, 360);
......@@ -235,13 +235,13 @@ void CAdaptiveRayGrid::DoublePhiResolution()
}
if (IsCircular())
{
double newAngle = (vdPhiDeg.front() + vdPhiDeg.back()) / 2;
if (vdPhiDeg.front() < vdPhiDeg.back())
double newAngle = (m_vdPhiDeg.front() + m_vdPhiDeg.back()) / 2;
if (m_vdPhiDeg.front() < m_vdPhiDeg.back())
newAngle = std::fmod(newAngle + 180, 360);
newAngleVector.push_back(newAngle);
}
vdPhiDeg = newAngleVector;
dMaxDeltaPhi /= 2;
m_vdPhiDeg = newAngleVector;
m_dMaxDeltaPhi /= 2;
}
#pragma endregion
\ No newline at end of file
......@@ -84,29 +84,29 @@ namespace ITAPropagationPathSim
{
protected:
std::shared_ptr<CEigenraySearchWatcher> m_pSimulationWatcher;
Simulation::CEngine simulationEngine;
RayTracingAbortSettings rayTracingAbortSettings;
VistaVector3D v3SourcePosition;
Simulation::CEngine m_simulationEngine;
RayTracingAbortSettings m_rayTracingAbortSettings;
VistaVector3D m_v3SourcePosition;
private:
VistaVector3D v3ReceiverPosition;
VistaVector3D v3MirroredReceiverPosition;
VistaVector3D m_v3ReceiverPosition;
VistaVector3D m_v3MirroredReceiverPosition;
public:
CWorkerBase(const VistaVector3D& sourcePosition, const VistaVector3D& receiverPosition, const Simulation::Settings& simSettings, const RayTracingAbortSettings& abortSettings);
protected:
inline const VistaVector3D& ReceiverPosition() const { return v3ReceiverPosition; };
inline const VistaVector3D& MirroredReceiverPosition() const { return v3MirroredReceiverPosition; };
inline const VistaVector3D& ReceiverPosition() const { return m_v3ReceiverPosition; };
inline const VistaVector3D& MirroredReceiverPosition() const { return m_v3MirroredReceiverPosition; };
const VistaVector3D& VirtualReceiverPosition(const int reflectionOrder) const;
RayPtr FindMinimumDistanceRay(const std::set<RayPtr>& rays, const int reflectionOrder);
RayPtr FindMinimumDistanceRay(const std::set<RayPtr>& rays, const int reflectionOrder) const;
};
//! Does a rough search for potential eigenrays directions for multiple reflection orders
class CInitialWorker : public CWorkerBase
{
private:
RayVector vpMinDistanceRays; //< Vector containing the current ray of minimum receiver distance for each reflection order
RayVector m_vpMinDistanceRays; //< Vector containing the current ray of minimum receiver distance for each reflection order
public:
CInitialWorker(const VistaVector3D& sourcePosition, const VistaVector3D& receiverPosition, const Simulation::Settings& simSettings, const RayTracingAbortSettings& abortSettings);
......@@ -122,20 +122,20 @@ namespace ITAPropagationPathSim
class CAdaptiveWorker : public CWorkerBase
{
private:
CAdaptiveRayGrid adaptiveRayGrid;
const int iActiveReflexionOrder;
RayAdaptationSettings rayAdaptationSettings;
float fReceiverRadius;
CAdaptiveRayGrid m_adaptiveRayGrid;
const int m_iActiveReflexionOrder;
RayAdaptationSettings m_rayAdaptationSettings;
float m_fReceiverRadius;
RayPtr pMinDistanceRay;
int nAdaptations = 0;
RayPtr m_pMinDistanceRay;
int m_nAdaptations = 0;
public:
CAdaptiveWorker(const CRayGrid& rayGrid, const VistaVector3D& receiverPosition, const Simulation::Settings& simSettings, const Settings& eigenraySettings, const int activeReflectionOrder);
RayPtr Run(const ITAGeo::CStratifiedAtmosphere& atmosphere);
private:
inline const VistaVector3D& VirtualReceiverPosition() const { return CWorkerBase::VirtualReceiverPosition(iActiveReflexionOrder); };
inline const VistaVector3D& VirtualReceiverPosition() const { return CWorkerBase::VirtualReceiverPosition(m_iActiveReflexionOrder); };
bool EigenrayAccuracyReached();
void PostProcessEigenray(const ITAGeo::CStratifiedAtmosphere& atmosphere);
......
......@@ -52,7 +52,7 @@ void CRay::Append(const VistaVector3D& position, const VistaVector3D& wavefrontN
void CRay::AppendReflection(const VistaVector3D& position, const VistaVector3D& wavefrontNormal, const double& timeStamp)
{
Append(position, wavefrontNormal, timeStamp);
iReflectionIndices.push_back(NumPoints() - 1);
m_viReflectionIndices.push_back(NumPoints() - 1);
}
......@@ -63,7 +63,7 @@ bool CRay::SameDirection(const CRay& other) const
bool CRay::IsReflectionIdx(const int idx) const
{
return std::find(iReflectionIndices.begin(), iReflectionIndices.end(), idx) != iReflectionIndices.end();
return std::find(m_viReflectionIndices.begin(), m_viReflectionIndices.end(), idx) != m_viReflectionIndices.end();
}
......@@ -120,8 +120,8 @@ CRay::const_iterator CRay::IteratorAfterTime(const double& time) const
#pragma region Receiver distance
const CRayReceiverData* CRay::ReceiverDistanceData(const VistaVector3D& receiverPos) const
{
ReceiverDistanceMap::const_iterator receiverDataIt = mReceiverDistanceMap.find(&receiverPos);
if (receiverDataIt == mReceiverDistanceMap.cend()) //Receiver not yet in map
ReceiverDistanceMap::const_iterator receiverDataIt = m_mReceiverDistanceMap.find(&receiverPos);
if (receiverDataIt == m_mReceiverDistanceMap.cend()) //Receiver not yet in map
return nullptr;
return &receiverDataIt->second;
......@@ -131,13 +131,13 @@ const CRayReceiverData* CRay::ReceiverDistanceData(const VistaVector3D& receiver
bool CRay::UpdateMinimumReceiverDistance(const VistaVector3D& receiverPos)
{
float distance = (LastPoint() - receiverPos).GetLength();
if (mReceiverDistanceMap.find(&receiverPos) == mReceiverDistanceMap.cend()) //Receiver not yet in map
if (m_mReceiverDistanceMap.find(&receiverPos) == m_mReceiverDistanceMap.cend()) //Receiver not yet in map
{
mReceiverDistanceMap[&receiverPos] = CRayReceiverData(NumPoints() - 1, distance, ReflectionOrder());
m_mReceiverDistanceMap[&receiverPos] = CRayReceiverData(NumPoints() - 1, distance, ReflectionOrder());
return true;
}
CRayReceiverData& receiverDistanceData = mReceiverDistanceMap[&receiverPos];
CRayReceiverData& receiverDistanceData = m_mReceiverDistanceMap[&receiverPos];
if (distance >= receiverDistanceData.distance)
return false;
......@@ -149,7 +149,7 @@ bool CRay::UpdateMinimumReceiverDistance(const VistaVector3D& receiverPos)
void CRay::FinalizeMinimumReceiverDistances()
{
for (auto const& element: mReceiverDistanceMap)
for (auto const& element: m_mReceiverDistanceMap)
InterpolateToRealMinimumPosition(*element.first);
}
......@@ -167,8 +167,8 @@ inline VistaVector3D ClosestPointOnLineSegmentToReceiver(const VistaVector3D& se
};
void CRay::InterpolateToRealMinimumPosition(const VistaVector3D& receiverPos)
{
int& iMinReceiverDistance = mReceiverDistanceMap[&receiverPos].idxMinDist;
float& dMin = mReceiverDistanceMap[&receiverPos].distance;
int& iMinReceiverDistance = m_mReceiverDistanceMap[&receiverPos].idxMinDist;
float& dMin = m_mReceiverDistanceMap[&receiverPos].distance;
const VistaVector3D& rTmpMin = at(iMinReceiverDistance).position;
......@@ -187,9 +187,9 @@ void CRay::InterpolateToRealMinimumPosition(const VistaVector3D& receiverPos)
{
iMinReceiverDistance--;
dMin = dMinBefore;
mReceiverDistanceMap[&receiverPos].posMinDist = rBefore;
m_mReceiverDistanceMap[&receiverPos].posMinDist = rBefore;
}
else
mReceiverDistanceMap[&receiverPos].posMinDist = rAfter;
m_mReceiverDistanceMap[&receiverPos].posMinDist = rAfter;
}
#pragma endregion
\ No newline at end of file
......@@ -11,14 +11,14 @@
using namespace ITAPropagationPathSim::AtmosphericRayTracing;
Simulation::CAdaptiveSolver::CAdaptiveSolver(const Settings& settings)
: rSettings(settings)
, maxDtPortion( (unsigned long int) 1 << std::min(rSettings.adaptiveIntegration.iMaxAdaptationLevel, MaxAllowedAdaptationLevel) )
: m_settings(settings)
, m_iMaxDtPortion( (unsigned long int) 1 << std::min(m_settings.adaptiveIntegration.iMaxAdaptationLevel, MaxAllowedAdaptationLevel) )
{
}
void Simulation::CAdaptiveSolver::Process(const VistaVector3D& r, const VistaVector3D& s, const ITAGeo::CStratifiedAtmosphere& atmosphere, VistaVector3D& rNew, VistaVector3D& sNew)
{
if (rSettings.adaptiveIntegration.bActive)
if (m_settings.adaptiveIntegration.bActive)
AdaptiveIntegrationStep(r, s, atmosphere, rNew, sNew);
else
IntegrationStep(r, s, atmosphere, rNew, sNew);
......@@ -27,13 +27,13 @@ void Simulation::CAdaptiveSolver::Process(const VistaVector3D& r, const VistaVec
void Simulation::CAdaptiveSolver::IntegrationStep(const VistaVector3D& r, const VistaVector3D& s, const ITAGeo::CStratifiedAtmosphere& atmosphere, VistaVector3D& rNew, VistaVector3D& sNew) const
{
switch (rSettings.solverMethod)
switch (m_settings.solverMethod)
{
case SolverMethod::EULER:
ODESolver::Euler(r, s, dCurrentDt, atmosphere, rNew, sNew);
ODESolver::Euler(r, s, m_dCurrentDt, atmosphere, rNew, sNew);
break;
case SolverMethod::RUNGE_KUTTA:
ODESolver::RungeKutta(r, s, dCurrentDt, atmosphere, rNew, sNew);
ODESolver::RungeKutta(r, s, m_dCurrentDt, atmosphere, rNew, sNew);
break;
default:
ITA_EXCEPT_INVALID_PARAMETER("Unknown solver method.");
......@@ -43,7 +43,7 @@ void Simulation::CAdaptiveSolver::IntegrationStep(const VistaVector3D& r, const
void Simulation::CAdaptiveSolver::AdaptiveIntegrationStep(const VistaVector3D& r, const VistaVector3D& s, const ITAGeo::CStratifiedAtmosphere& atmosphere, VistaVector3D& rNew, VistaVector3D& sNew)
{
if (bIncreaseDtInNextStep)
if (m_bIncreaseDtInNextStep)
TryIncreaseTimeStep();
while (1)
......@@ -55,9 +55,9 @@ void Simulation::CAdaptiveSolver::AdaptiveIntegrationStep(const VistaVector3D& r
const VistaVector3D nNew = ODESolver::SlownessToNormal(sNew);
const double error = EstimateIntegrationError(rz, rzNew, nNew, atmosphere);
if (error <= rSettings.adaptiveIntegration.dMaxError)
if (error <= m_settings.adaptiveIntegration.dMaxError)
{
bIncreaseDtInNextStep = error < rSettings.adaptiveIntegration.dUncriticalError;
m_bIncreaseDtInNextStep = error < m_settings.adaptiveIntegration.dUncriticalError;
break;
}
......@@ -77,33 +77,33 @@ double Simulation::CAdaptiveSolver::EstimateIntegrationError(const double& rz1,
bool Simulation::CAdaptiveSolver::TryIncreaseTimeStep()
{
if (iDtAdaptationLevel <= 0 || !IncreasedDtFitsInRestOfTimeFrame())
if (m_iDtAdaptationLevel <= 0 || !IncreasedDtFitsInRestOfTimeFrame())
return false;
dCurrentDt *= 2;
iDtAdaptationLevel--;
m_dCurrentDt *= 2;
m_iDtAdaptationLevel--;
return true;
}
bool Simulation::CAdaptiveSolver::TryDecreaseTimeStep()
{
if (iDtAdaptationLevel >= rSettings.adaptiveIntegration.iMaxAdaptationLevel)
if (m_iDtAdaptationLevel >= m_settings.adaptiveIntegration.iMaxAdaptationLevel)
return false;
dCurrentDt /= 2;
iDtAdaptationLevel++;
m_dCurrentDt /= 2;
m_iDtAdaptationLevel++;
return true;
}
void Simulation::CAdaptiveSolver::UpdateTimeFramePortion()
{
iTimeFramePortion += (unsigned long int)1 << (rSettings.adaptiveIntegration.iMaxAdaptationLevel - iDtAdaptationLevel);
if (iTimeFramePortion >= maxDtPortion)
iTimeFramePortion = 0;
m_iTimeFramePortion += (unsigned long int)1 << (m_settings.adaptiveIntegration.iMaxAdaptationLevel - m_iDtAdaptationLevel);
if (m_iTimeFramePortion >= m_iMaxDtPortion)
m_iTimeFramePortion = 0;
}
bool Simulation::CAdaptiveSolver::IncreasedDtFitsInRestOfTimeFrame() const
{
const unsigned long int newDtPortion = (unsigned long int) 1 << (rSettings.adaptiveIntegration.iMaxAdaptationLevel - (iDtAdaptationLevel - 1));
const unsigned long int leftDtPortion = (maxDtPortion - iTimeFramePortion);
const unsigned long int newDtPortion = (unsigned long int) 1 << (m_settings.adaptiveIntegration.iMaxAdaptationLevel - (m_iDtAdaptationLevel - 1));
const unsigned long int leftDtPortion = (m_iMaxDtPortion - m_iTimeFramePortion);
const unsigned long int moduloDtPortion = leftDtPortion % newDtPortion;
return moduloDtPortion == 0;
//return ((maxDtPortion - iTimeFramePortion) % newDtPortion) == 0;
......
......@@ -36,19 +36,19 @@ namespace ITAPropagationPathSim
public:
static const unsigned int MaxAllowedAdaptationLevel = 31; //! Maximum allowed value for Simulation::AdaptiveIntegrationSettings.iMaxAdaptationLevel. TODO: Move to Simulation::Settings?
private:
const Settings rSettings;
double dCurrentDt = rSettings.dIntegrationTimeStep;
unsigned int iDtAdaptationLevel = 0;
const Settings m_settings;
double m_dCurrentDt = m_settings.dIntegrationTimeStep;
unsigned int m_iDtAdaptationLevel = 0;
const unsigned long int maxDtPortion; //! = 2 ^ iMaxAdaptionLevel
unsigned long int iTimeFramePortion = 0; //! Portion of processed time of an unadapted time step. Integer between 0 and maxDtPortion.
bool bIncreaseDtInNextStep = false; //! Indicates whether the error is small enough that the timestep can be increased during next step.
const unsigned long int m_iMaxDtPortion; //! = 2 ^ iMaxAdaptionLevel
unsigned long int m_iTimeFramePortion = 0; //! Portion of processed time of an unadapted time step. Integer between 0 and maxDtPortion.
bool m_bIncreaseDtInNextStep = false; //! Indicates whether the error is small enough that the timestep can be increased during next step.
public:
CAdaptiveSolver(const Settings& settings);
public:
double CurrentStepSize() const { return dCurrentDt; }
double CurrentStepSize() const { return m_dCurrentDt; }
//! Performs a single integration step based on the given simulation settings.
void Process(const VistaVector3D& r, const VistaVector3D& s, const ITAGeo::CStratifiedAtmosphere& atmosphere, VistaVector3D& rNew, VistaVector3D& sNew);
......
......@@ -137,12 +137,12 @@ class CWorker
}}}
std::vector<std::shared_ptr<CRay>> CEngine::Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& v3SourcePosition, const std::vector<VistaVector3D>& v3RayDirections) const
std::vector<std::shared_ptr<CRay>> CEngine::Run(const ITAGeo::CStratifiedAtmosphere& atmosphere, const VistaVector3D& m_v3SourcePosition, const std::vector<VistaVector3D>& v3RayDirections) const
{
std::vector<std::shared_ptr<CRay>> rays;
rays.reserve(v3RayDirections.size());
for each (const VistaVector3D & v3Direction in v3RayDirections)
rays.push_back(std::make_shared<CRay>(v3SourcePosition, v3Direction));
rays.push_back(std::make_shared<CRay>(m_v3SourcePosition, v3Direction));
TraceRays(atmosphere, rays);
return rays;
......