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

ART

- changed shared_ptr<CRay>& to shared_ptr<CRay>
parent 31172913
......@@ -56,11 +56,11 @@ namespace ITAPropagationPathSim
const std::set< std::shared_ptr<CRay> >& NewRaysOfLastAdaptation() const { return 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);
void ZoomIntoRay(const std::shared_ptr<CRay> pRay);
//! Advanced adaptation method: Further reduces the angular limits using additional information compared to simple method before doubling the angular resolution.
void ZoomIntoRay(const std::shared_ptr<CRay>& pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold);
void ZoomIntoRay(const std::shared_ptr<CRay> pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold);
//! Zooms into the given ray using a specific angular resolution by creating up to 8 new rays surrounding the given one.
void ZoomIntoRay(const std::shared_ptr<CRay>& pRay, const double& deltaTheta, const double& deltaPhi);
void ZoomIntoRay(const std::shared_ptr<CRay> pRay, const double& deltaTheta, const double& deltaPhi);
private:
//! Further reduces the limits of the ray grid using additional information on given rays and the receiver position
......@@ -76,7 +76,7 @@ namespace ITAPropagationPathSim
*
* Also works for a 1D ray grid (NTheta == 1 or NPhi() == 1)
*/
void SetAdvancedRayGridLimits(const std::shared_ptr<CRay>& pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold);
void SetAdvancedRayGridLimits(const std::shared_ptr<CRay> pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold);
//! By comparing the vector from three rays to the receiver, this decides between which two rays the eigenray is located and returns their indices
std::vector<int> FindAdvancedRayGridLimits1D(const std::vector< std::shared_ptr<CRay> >& pRays, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold) const;
void DoubleRayResolution();
......
......@@ -78,27 +78,27 @@ namespace ITAPropagationPathSim
void FilterDirections(const std::vector<int>& thetaIdxVec, const std::vector<int>& phiIdxVec, const bool circularPhi = false);
//! Returns a vector with all rays having the same initial elevation as the given ray. Throws an exception if the ray is not part of this grid.
const RayVector& GetRaysWithSameTheta(const std::shared_ptr<CRay>& pRay);
const RayVector& GetRaysWithSameTheta(const std::shared_ptr<CRay> pRay);
//! Returns a vector with all rays having the same initial azimuth as the given ray. Throws an exception if the ray is not part of this grid.
RayVector GetRaysWithSamePhi(const std::shared_ptr<CRay>& pRay);
RayVector GetRaysWithSamePhi(const std::shared_ptr<CRay> pRay);
//---Indicing Functions---
protected:
int GetIndex(const std::shared_ptr<CRay>& pRay) const;
int GetIndex(const std::shared_ptr<CRay> pRay) const;
int IndexToThetaIndex(const int idx) const;
int IndexToPhiIndex(const int idx) const;
void GetNeighboringAngleIndices(const std::shared_ptr<CRay>& pRay, std::vector<int>& thetaIdxVec, std::vector<int>& phiIdxVec) const;
void GetNeighboringAngleIndices(const std::shared_ptr<CRay> pRay, std::vector<int>& thetaIdxVec, std::vector<int>& phiIdxVec) const;
//---Booleans---
protected:
bool IsPoleDirection(const double& thetaDeg) const;
bool HasPoleDirection(const std::shared_ptr<CRay>& pRay) const;
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; };
bool IsEmpty() const;
bool Is2D() const;
bool Contains(const std::shared_ptr<CRay>& pRay) const;
bool Contains(const std::shared_ptr<CRay> pRay) const;
//---GET Functions---
protected:
......@@ -112,7 +112,7 @@ namespace ITAPropagationPathSim
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::shared_ptr<CRay> At(int idxTheta, int idxPhi) const { return 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;
......@@ -123,12 +123,12 @@ namespace ITAPropagationPathSim
/**
* Throws an exception if the given ray is not part of this ray grid.
*/
CRayGrid SurroundingGrid(const std::shared_ptr<CRay>& pRay) const;
CRayGrid SurroundingGrid(const std::shared_ptr<CRay> pRay) const;
//! Sets the boundaries of this ray grid to the rays surrounding the given ray (including this ray).
/**
* Throws an exception if the given ray is not part of this ray grid.
*/
void SetToSurroundingGrid(const std::shared_ptr<CRay>& pRay);
void SetToSurroundingGrid(const std::shared_ptr<CRay> pRay);
//! Creates a ray grid with the same initial ray directions but new rays
CRayGrid CopyWithNewRays() const;
......
......@@ -47,7 +47,7 @@ void CAdaptiveRayGrid::Reset(const CRayGrid& rayGrid)
#pragma region RAY ZOOMING - public
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pRay)
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay> pRay)
{
if(!Contains(pRay))
ITA_EXCEPT_INVALID_PARAMETER("Given ray is not part of the adaptive ray grid.");
......@@ -56,7 +56,7 @@ void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pRay)
DoubleRayResolution();
}
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold)
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay> pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold)
{
if (!Contains(pRay))
ITA_EXCEPT_INVALID_PARAMETER("Given ray is not part of the adapted grid.");
......@@ -66,7 +66,7 @@ void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pRay, const int
DoubleRayResolution();
}
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pZoomRay, const double& deltaTheta, const double& deltaPhi)
void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay> pZoomRay, const double& deltaTheta, const double& deltaPhi)
{
const int idx = GetIndex(pZoomRay);
if (idx < 0)
......@@ -118,7 +118,7 @@ void CAdaptiveRayGrid::ZoomIntoRay(const std::shared_ptr<CRay>& pZoomRay, const
#pragma endregion
#pragma region NEW RAY LIMITS - private
void CAdaptiveRayGrid::SetAdvancedRayGridLimits(const std::shared_ptr<CRay>& pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold)
void CAdaptiveRayGrid::SetAdvancedRayGridLimits(const std::shared_ptr<CRay> pRay, const int idxMinDist, const VistaVector3D& receiverPosition, const double& threshold)
{
if (NPhi() > 3) // There can be more than three rays if pRay is located at a pole
return;
......
......@@ -129,7 +129,7 @@ void CRayGrid::FilterDirections(const std::vector<int>& thetaIdxVec, const std::
UpdateDependentRayContainers();
}
const CRayGrid::RayVector& CRayGrid::GetRaysWithSameTheta(const std::shared_ptr<CRay>& pRay)
const CRayGrid::RayVector& CRayGrid::GetRaysWithSameTheta(const std::shared_ptr<CRay> pRay)
{
const int idxTheta = IndexToThetaIndex( GetIndex(pRay) );
if (idxTheta < 0)
......@@ -137,7 +137,7 @@ const CRayGrid::RayVector& CRayGrid::GetRaysWithSameTheta(const std::shared_ptr<
return vvpRayMatrix[idxTheta];
}
CRayGrid::RayVector CRayGrid::GetRaysWithSamePhi(const std::shared_ptr<CRay>& pRay)
CRayGrid::RayVector CRayGrid::GetRaysWithSamePhi(const std::shared_ptr<CRay> pRay)
{
const int idxPhi = IndexToPhiIndex(GetIndex(pRay));
if (idxPhi < 0)
......@@ -256,7 +256,7 @@ double CRayGrid::WavefrontSurfaceReference() const
// --- NEIGHBORING RAYS ---
// ------------------------
#pragma region NEIGHBORING RAYS - public
CRayGrid CRayGrid::SurroundingGrid(const std::shared_ptr<CRay>& pRay) const
CRayGrid CRayGrid::SurroundingGrid(const std::shared_ptr<CRay> pRay) const
{
if (!Contains(pRay))
ITA_EXCEPT_INVALID_PARAMETER("Given ray is not part of this ray grid.");
......@@ -284,7 +284,7 @@ CRayGrid CRayGrid::SurroundingGrid(const std::shared_ptr<CRay>& pRay) const
return CRayGrid(newRayMatrix, newThetaDeg, newPhiDeg, newGridHasCircularPhi);
}
void CRayGrid::SetToSurroundingGrid(const std::shared_ptr<CRay>& pRay)
void CRayGrid::SetToSurroundingGrid(const std::shared_ptr<CRay> pRay)
{
*this = SurroundingGrid(pRay);
}
......@@ -303,7 +303,7 @@ CRayGrid CRayGrid::CopyWithNewRays() const
// -------------------------
#pragma region INDICING - protected
int CRayGrid::GetIndex(const std::shared_ptr<CRay>& pRay) const
int CRayGrid::GetIndex(const std::shared_ptr<CRay> pRay) const
{
auto it = std::find(vpRays.cbegin(), vpRays.cend(), pRay);
if (it == vpRays.cend())
......@@ -326,7 +326,7 @@ int CRayGrid::IndexToPhiIndex(const int idx) const
return idx % NPhi();
}
void CRayGrid::GetNeighboringAngleIndices(const std::shared_ptr<CRay>& pRay, std::vector<int>& thetaIdxVec, std::vector<int>& phiIdxVec) const
void CRayGrid::GetNeighboringAngleIndices(const std::shared_ptr<CRay> pRay, std::vector<int>& thetaIdxVec, std::vector<int>& phiIdxVec) const
{
thetaIdxVec.clear();
phiIdxVec.clear();
......@@ -368,7 +368,7 @@ bool CRayGrid::IsPoleDirection(const double& thetaDeg) const
return abs(thetaDeg) < DBL_EPSILON || abs(thetaDeg - 180.0) < DBL_EPSILON;
}
bool CRayGrid::HasPoleDirection(const std::shared_ptr<CRay>& pRay) const
bool CRayGrid::HasPoleDirection(const std::shared_ptr<CRay> pRay) const
{
const VistaVector3D n0 = pRay->InitialDirection();
return abs(n0[Vista::X]) < FLT_EPSILON && abs(n0[Vista::Y]) < FLT_EPSILON; //x- and y- component are zero
......@@ -384,7 +384,7 @@ bool CRayGrid::Is2D() const
return NTheta() > 1 && NPhi() > 1;
}
bool CRayGrid::Contains(const std::shared_ptr<CRay>& pRay) const
bool CRayGrid::Contains(const std::shared_ptr<CRay> pRay) const
{
return std::find(vpRays.cbegin(), vpRays.cend(), pRay) != vpRays.cend();
}
......
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