Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITAPropagationPathSim
Commits
616b87fb
Commit
616b87fb
authored
May 27, 2020
by
Philipp Schäfer
Browse files
ART
- renamed many private/protected member variables - fixed some missing ; for inline methods
parent
52a3cb30
Changes
14
Hide whitespace changes
Inline
Side-by-side
include/ITAPropagationPathSim/AtmosphericRayTracing/EigenraySearch/AdaptiveRayGrid.h
View file @
616b87fb
...
...
@@ -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
);
...
...
include/ITAPropagationPathSim/AtmosphericRayTracing/EigenraySearch/Engine.h
View file @
616b87fb
...
...
@@ -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
);
};
...
...
include/ITAPropagationPathSim/AtmosphericRayTracing/RayGrid.h
View file @
616b87fb
...
...
@@ -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
;
...
...
include/ITAPropagationPathSim/AtmosphericRayTracing/Rays.h
View file @
616b87fb
...
...
@@ -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_v
iReflectionIndices
;
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_v
iReflectionIndices
;
};
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_v
iReflectionIndices
.
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
;
...
...
include/ITAPropagationPathSim/AtmosphericRayTracing/Simulation/Engine.h
View file @
616b87fb
...
...
@@ -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
;
...
...
include/ITAPropagationPathSim/AtmosphericRayTracing/Utils/RayToPropagationPath.h
View file @
616b87fb
...
...
@@ -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
;
}
}
;
}
}
}
...
...
src/ITAPropagationPathSim/AtmosphericRayTracing/EigenraySearch/AdaptiveRayGrid.cpp
View file @
616b87fb
...
...
@@ -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
src/ITAPropagationPathSim/AtmosphericRayTracing/EigenraySearch/Worker.cpp
View file @
616b87fb
...
...
@@ -42,22 +42,22 @@ void EigenraySearch::CEigenraySearchWatcher::FinalizeRay(std::shared_ptr<CRay> p
#pragma region WORKERBASE
EigenraySearch
::
CWorkerBase
::
CWorkerBase
(
const
VistaVector3D
&
sourcePosition
,
const
VistaVector3D
&
receiverPosition
,
const
Simulation
::
Settings
&
simSettings
,
const
RayTracingAbortSettings
&
abortSettings
)
:
v3SourcePosition
(
sourcePosition
)
,
v3ReceiverPosition
(
receiverPosition
)
,
rayTracingAbortSettings
(
abortSettings
)
,
v3MirroredReceiverPosition
(
receiverPosition
)
:
m_
v3SourcePosition
(
sourcePosition
)
,
m_
v3ReceiverPosition
(
receiverPosition
)
,
m_
rayTracingAbortSettings
(
abortSettings
)
,
m_
v3MirroredReceiverPosition
(
receiverPosition
)
{
simulationEngine
.
settings
=
simSettings
;
v3MirroredReceiverPosition
[
Vista
::
Z
]
=
-
v3MirroredReceiverPosition
[
Vista
::
Z
];
m_
simulationEngine
.
settings
=
simSettings
;
m_
v3MirroredReceiverPosition
[
Vista
::
Z
]
=
-
m_
v3MirroredReceiverPosition
[
Vista
::
Z
];
}
const
VistaVector3D
&
EigenraySearch
::
CWorkerBase
::
VirtualReceiverPosition
(
const
int
reflectionOrder
)
const
{
if
(
reflectionOrder
%
2
!=
0
)
//On uneven reflection order
return
v3MirroredReceiverPosition
;
return
v3ReceiverPosition
;
return
m_
v3MirroredReceiverPosition
;
return
m_
v3ReceiverPosition
;
}
EigenraySearch
::
RayPtr
EigenraySearch
::
CWorkerBase
::
FindMinimumDistanceRay
(
const
std
::
set
<
RayPtr
>&
rays
,
const
int
reflectionOrder
)
EigenraySearch
::
RayPtr
EigenraySearch
::
CWorkerBase
::
FindMinimumDistanceRay
(
const
std
::
set
<
RayPtr
>&
rays
,
const
int
reflectionOrder
)
const
{
float
dMin
=
FLT_MAX
;
const
VistaVector3D
&
receiverPos
=
VirtualReceiverPosition
(
reflectionOrder
);
...
...
@@ -82,21 +82,21 @@ EigenraySearch::CInitialWorker::CInitialWorker(const VistaVector3D& sourcePositi
:
CWorkerBase
(
sourcePosition
,
receiverPosition
,
simSettings
,
abortSettings
)
{
ReceiverDataVector
receiverData
=
{
CReceiverData
(
ReceiverPosition
(),
0
)
,
CReceiverData
(
MirroredReceiverPosition
(),
1
)
};
m_pSimulationWatcher
=
std
::
make_shared
<
CEigenraySearchWatcher
>
(
receiverData
,
rayTracingAbortSettings
.
maxTime
);
simulationEngine
.
pExternalWatcher
=
m_pSimulationWatcher
;
m_pSimulationWatcher
=
std
::
make_shared
<
CEigenraySearchWatcher
>
(
receiverData
,
m_
rayTracingAbortSettings
.
maxTime
);
m_
simulationEngine
.
pExternalWatcher
=
m_pSimulationWatcher
;
}
std
::
vector
<
CRayGrid
>
EigenraySearch
::
CInitialWorker
::
Run
(
const
ITAGeo
::
CStratifiedAtmosphere
&
atmosphere
)
{
CRayGrid
rayGrid
=
InitRayGrid
(
atmosphere
);
simulationEngine
.
Run
(
atmosphere
,
rayGrid
.
UniqueRays
());
m_
simulationEngine
.
Run
(
atmosphere
,
rayGrid
.
UniqueRays
());
FindMinimumDistanceRays
(
rayGrid
.
UniqueRays
());
return
FinalizeResult
(
rayGrid
);
}
CRayGrid
EigenraySearch
::
CInitialWorker
::
InitRayGrid
(
const
ITAGeo
::
CStratifiedAtmosphere
&
atmosphere
)
{
return
CEquiangularRayDistribution
(
v3SourcePosition
,
7
,
10
);
return
CEquiangularRayDistribution
(
m_
v3SourcePosition
,
7
,
10
);
//TODO: Set limits for additional directions according to atmosphere if possible
}
void
EigenraySearch
::
CInitialWorker
::
FindMinimumDistanceRays
(
const
std
::
set
<
RayPtr
>&
rays
)
...
...
@@ -115,16 +115,16 @@ void EigenraySearch::CInitialWorker::FindMinimumDistanceRays(const std::set<RayP
//}
//maxReflOrder = std::min(maxReflOrder, rayTracingAbortSettings.maxReflectionOrder);
int
maxReflOrder
=
std
::
min
(
1
,
rayTracingAbortSettings
.
maxReflectionOrder
);
int
maxReflOrder
=
std
::
min
(
1
,
m_
rayTracingAbortSettings
.
maxReflectionOrder
);
vpMinDistanceRays
.
resize
(
maxReflOrder
+
1
);
m_
vpMinDistanceRays
.
resize
(
maxReflOrder
+
1
);
for
(
int
reflOrder
=
0
;
reflOrder
<=
maxReflOrder
;
reflOrder
++
)
vpMinDistanceRays
[
reflOrder
]
=
FindMinimumDistanceRay
(
rays
,
reflOrder
);
m_
vpMinDistanceRays
[
reflOrder
]
=
FindMinimumDistanceRay
(
rays
,
reflOrder
);
}
std
::
vector
<
CRayGrid
>
EigenraySearch
::
CInitialWorker
::
FinalizeResult
(
const
CRayGrid
&
initialRayGrid
)
{
std
::
vector
<
CRayGrid
>
rayGridsOfReflectionOrder
;
for
each
(
RayPtr
pRay
in
vpMinDistanceRays
)
for
each
(
RayPtr
pRay
in
m_
vpMinDistanceRays
)
rayGridsOfReflectionOrder
.
push_back
(
initialRayGrid
.
SurroundingGrid
(
pRay
).
CopyWithNewRays
());
return
rayGridsOfReflectionOrder
;
...
...
@@ -136,43 +136,43 @@ std::vector<CRayGrid> EigenraySearch::CInitialWorker::FinalizeResult(const CRayG
EigenraySearch
::
CAdaptiveWorker
::
CAdaptiveWorker
(
const
CRayGrid
&
rayGrid
,
const
VistaVector3D
&
receiverPosition
,
const
Simulation
::
Settings
&
simSettings
,
const
Settings
&
eigenraySettings
,
const
int
activeReflectionOrder
)
:
CWorkerBase
(
rayGrid
.
SourcePosition
(),
receiverPosition
,
simSettings
,
eigenraySettings
.
rayTracing
),
adaptiveRayGrid
(
rayGrid
),
iActiveReflexionOrder
(
activeReflectionOrder
),
rayAdaptationSettings
(
eigenraySettings
.
rayAdaptation
)
m_
adaptiveRayGrid
(
rayGrid
),
m_
iActiveReflexionOrder
(
activeReflectionOrder
),
m_
rayAdaptationSettings
(
eigenraySettings
.
rayAdaptation
)
{
const
float
sourceReceiverDistance
=
(
VirtualReceiverPosition
()
-
rayGrid
.
SourcePosition
()).
GetLength
();
fReceiverRadius
=
tan
(
rayAdaptationSettings
.
accuracy
.
maxSourceReceiverAngle
*
M_PI
/
180.0
)
*
sourceReceiverDistance
;
fReceiverRadius
=
fmin
(
rayAdaptationSettings
.
accuracy
.
maxReceiverRadius
,
fReceiverRadius
);
m_
fReceiverRadius
=
tan
(
m_
rayAdaptationSettings
.
accuracy
.
maxSourceReceiverAngle
*
M_PI
/
180.0
)
*
sourceReceiverDistance
;
m_
fReceiverRadius
=
fmin
(
m_
rayAdaptationSettings
.
accuracy
.
maxReceiverRadius
,
m_
fReceiverRadius
);
//TODO: Track whether distance increased and use this for abortion
ReceiverDataVector
receiverData
=
{
CReceiverData
(
VirtualReceiverPosition
(),
iActiveReflexionOrder
)
};
m_pSimulationWatcher
=
std
::
make_shared
<
CEigenraySearchWatcher
>
(
receiverData
,
rayTracingAbortSettings
.
maxTime
);
simulationEngine
.
pExternalWatcher
=
m_pSimulationWatcher
;
ReceiverDataVector
receiverData
=
{
CReceiverData
(
VirtualReceiverPosition
(),
m_
iActiveReflexionOrder
)
};
m_pSimulationWatcher
=
std
::
make_shared
<
CEigenraySearchWatcher
>
(
receiverData
,
m_
rayTracingAbortSettings
.
maxTime
);
m_
simulationEngine
.
pExternalWatcher
=
m_pSimulationWatcher
;
}
EigenraySearch
::
RayPtr
EigenraySearch
::
CAdaptiveWorker
::
Run
(
const
ITAGeo
::
CStratifiedAtmosphere
&
atmosphere
)
{
simulationEngine
.
Run
(
atmosphere
,
adaptiveRayGrid
.
UniqueRays
());
pMinDistanceRay
=
FindMinimumDistanceRay
(
adaptiveRayGrid
.
UniqueRays
(),
iActiveReflexionOrder
);
m_
simulationEngine
.
Run
(
atmosphere
,
m_
adaptiveRayGrid
.
UniqueRays
());
m_
pMinDistanceRay
=
FindMinimumDistanceRay
(
m_
adaptiveRayGrid
.
UniqueRays
(),
m_
iActiveReflexionOrder
);
while
(
!
EigenrayAccuracyReached
())
{
adaptiveRayGrid
.
ZoomIntoRay
(
pMinDistanceRay
);
simulationEngine
.
Run
(
atmosphere
,
adaptiveRayGrid
.
NewRaysOfLastAdaptation
());
pMinDistanceRay
=
FindMinimumDistanceRay
(
adaptiveRayGrid
.
UniqueRays
(),
iActiveReflexionOrder
);
nAdaptations
++
;
m_
adaptiveRayGrid
.
ZoomIntoRay
(
m_
pMinDistanceRay
);
m_
simulationEngine
.
Run
(
atmosphere
,
m_
adaptiveRayGrid
.
NewRaysOfLastAdaptation
());
m_
pMinDistanceRay
=
FindMinimumDistanceRay
(
m_
adaptiveRayGrid
.
UniqueRays
(),
m_
iActiveReflexionOrder
);
m_
nAdaptations
++
;
}
PostProcessEigenray
(
atmosphere
);
return
pMinDistanceRay
;
return
m_
pMinDistanceRay
;
}
bool
EigenraySearch
::
CAdaptiveWorker
::
EigenrayAccuracyReached
()
{
const
CRayReceiverData
*
receiverData
=
pMinDistanceRay
->
ReceiverDistanceData
(
VirtualReceiverPosition
());
if
(
receiverData
&&
receiverData
->
distance
<=
fReceiverRadius
)
const
CRayReceiverData
*
receiverData
=
m_
pMinDistanceRay
->
ReceiverDistanceData
(
VirtualReceiverPosition
());
if
(
receiverData
&&
receiverData
->
distance
<=
m_
fReceiverRadius
)
return
true
;
bool
abort
=
nAdaptations
>
rayAdaptationSettings
.
abort
.
maxNAdaptations
||
adaptiveRayGrid
.
MaxAngularResolution
()
<
rayAdaptationSettings
.
abort
.
minAngleResolutionDeg
;
bool
abort
=
m_
nAdaptations
>
m_
rayAdaptationSettings
.
abort
.
maxNAdaptations
||
m_
adaptiveRayGrid
.
MaxAngularResolution
()
<
m_
rayAdaptationSettings
.
abort
.
minAngleResolutionDeg
;
if
(
abort
)
std
::
cout
<<
"WARNING: EigenraySearch::Engine: Could not find eigenray with proper accuracy. Abort criterion reached."
<<
std
::
endl
;
return
abort
;
...
...
@@ -184,42 +184,42 @@ void EigenraySearch::CAdaptiveWorker::PostProcessEigenray(const ITAGeo::CStratif
}
void
EigenraySearch
::
CAdaptiveWorker
::
SetEigenrayEndPoint
()
{
const
CRayReceiverData
*
receiverData
=
pMinDistanceRay
->
ReceiverDistanceData
(
VirtualReceiverPosition
());
const
CRayReceiverData
*
receiverData
=
m_
pMinDistanceRay
->
ReceiverDistanceData
(
VirtualReceiverPosition
());
const
int
idxBeforeMin
=
receiverData
->
idxMinDist
;
const
VistaVector3D
&
rMin
=
receiverData
->
posMinDist
;
//Interpolate to new point of minimum
const
VistaVector3D
&
r1
=
pMinDistanceRay
->
at
(
idxBeforeMin
).
position
;
const
VistaVector3D
&
r2
=
pMinDistanceRay
->
at
(
idxBeforeMin
+
1
).
position
;
const
VistaVector3D
&
r1
=
m_
pMinDistanceRay
->
at
(
idxBeforeMin
).
position
;
const
VistaVector3D
&
r2
=
m_
pMinDistanceRay
->
at
(
idxBeforeMin
+
1
).
position
;
const
float
pathFraction
=
(
rMin
-
r1
).
GetLength
()
/
(
r2
-
r1
).
GetLength
();
CRayElement
newRayElement
=
pMinDistanceRay
->
at
(
idxBeforeMin
).
Interpolate
(
pMinDistanceRay
->
at
(
idxBeforeMin
+
1
),
pathFraction
);
CRayElement
newRayElement
=
m_
pMinDistanceRay
->
at
(
idxBeforeMin
).
Interpolate
(
m_
pMinDistanceRay
->
at
(
idxBeforeMin
+
1
),
pathFraction
);
//Remove all points before and add new point
pMinDistanceRay
->
resize
(
idxBeforeMin
+
2
);
pMinDistanceRay
->
back
()
=
newRayElement
;