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
f4a2f551
Commit
f4a2f551
authored
Apr 27, 2020
by
Philipp Schäfer
Browse files
ART - Rays
- now is derived from std::vector
parent
a3468839
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/ITAPropagationPathSim/AtmosphericRayTracing/Export/ITAGeo.h
View file @
f4a2f551
...
...
@@ -40,25 +40,21 @@ namespace ITAPropagationPathSim
{
ITAGeo
::
CPropagationPath
ToPropagationPath
(
const
CRay
&
ray
)
{
const
std
::
vector
<
VistaVector3D
>
r
=
ray
.
SamplingPoints
();
const
std
::
vector
<
VistaVector3D
>
n
=
ray
.
WavefrontNormals
();
const
std
::
vector
<
double
>
t
=
ray
.
TimeStamps
();
ITAGeo
::
CPropagationPath
propagationPath
;
propagationPath
.
reserve
(
ray
.
size
()
+
2
+
ray
.
ReflectionOrder
());
propagationPath
.
push_back
(
std
::
make_shared
<
ITAGeo
::
CEmitter
>
(
r
[
0
])
);
for
(
int
idx
=
0
;
idx
<
r
.
size
();
idx
++
)
propagationPath
.
push_back
(
std
::
make_shared
<
ITAGeo
::
CEmitter
>
(
r
ay
.
SourcePoint
())
);
for
(
int
idx
=
0
;
idx
<
r
ay
.
size
();
idx
++
)
{
propagationPath
.
push_back
(
std
::
make_shared
<
ITAGeo
::
CInhomogeneity
>
(
r
[
idx
]
,
n
[
idx
],
t
[
idx
]
));
propagationPath
.
push_back
(
std
::
make_shared
<
ITAGeo
::
CInhomogeneity
>
(
r
ay
[
idx
]
.
position
,
ray
[
idx
].
wavefrontNormal
,
ray
[
idx
].
timeStamp
));
if
(
ray
.
IsReflectionIdx
(
idx
))
{
auto
anchor
=
std
::
make_shared
<
ITAGeo
::
CSpecularReflection
>
(
r
[
idx
]);
auto
anchor
=
std
::
make_shared
<
ITAGeo
::
CSpecularReflection
>
(
r
ay
[
idx
]
.
position
);
anchor
->
v3FaceNormal
=
VistaVector3D
(
0
,
0
,
1
);
propagationPath
.
push_back
(
anchor
);
}
}
propagationPath
.
push_back
(
std
::
make_shared
<
ITAGeo
::
CSensor
>
(
r
[
r
.
size
()
-
1
])
);
propagationPath
.
push_back
(
std
::
make_shared
<
ITAGeo
::
CSensor
>
(
r
ay
.
LastPoint
())
);
return
propagationPath
;
}
...
...
include/ITAPropagationPathSim/AtmosphericRayTracing/Rays.h
View file @
f4a2f551
...
...
@@ -35,22 +35,23 @@ namespace ITAPropagationPathSim
{
namespace
AtmosphericRayTracing
{
//
class ITA_PROPAGATION_PATH_SIM_API RayElement {
//
public:
//
VistaVector3D position;
//
VistaVector3D wavefrontNormal;
//
double timeStamp;
class
ITA_PROPAGATION_PATH_SIM_API
RayElement
{
public:
VistaVector3D
position
;
VistaVector3D
wavefrontNormal
;
double
timeStamp
;
// RayElement(const VistaVector3D& r, const VistaVector3D& n, const double& time) : position(r), wavefrontNormal(n), timeStamp(time) {}
//};
RayElement
()
{}
RayElement
(
const
VistaVector3D
&
r
,
const
VistaVector3D
&
n
,
const
double
&
time
)
:
position
(
r
),
wavefrontNormal
(
n
),
timeStamp
(
time
)
{}
};
class
ITA_PROPAGATION_PATH_SIM_API
CRay
class
ITA_PROPAGATION_PATH_SIM_API
CRay
:
public
std
::
vector
<
RayElement
>
{
private:
std
::
vector
<
VistaVector3D
>
v3SamplingPoints
;
std
::
vector
<
VistaVector3D
>
v3WavefrontNormals
;
std
::
vector
<
double
>
dTimeStamps
;
//
std::vector<VistaVector3D> v3SamplingPoints;
//
std::vector<VistaVector3D> v3WavefrontNormals;
//
std::vector<double> dTimeStamps;
std
::
vector
<
unsigned
int
>
iReflectionIndices
;
public:
...
...
@@ -60,18 +61,15 @@ namespace ITAPropagationPathSim
public:
#pragma region Get Functions
std
::
vector
<
VistaVector3D
>
SamplingPoints
()
const
{
return
v3SamplingPoints
;
}
std
::
vector
<
VistaVector3D
>
WavefrontNormals
()
const
{
return
v3WavefrontNormals
;
}
std
::
vector
<
double
>
TimeStamps
()
const
{
return
dTimeStamps
;
}
std
::
vector
<
unsigned
int
>
RelectionIndices
()
const
{
return
iReflectionIndices
;
}
const
std
::
vector
<
unsigned
int
>&
RelectionIndices
()
const
{
return
iReflectionIndices
;
}
unsigned
int
NumPoints
()
const
{
return
v3SamplingPoints
.
size
();
}
VistaVector3D
SourcePoint
()
const
{
return
v3SamplingPoints
[
0
]
;
}
VistaVector3D
InitialDirection
()
const
{
return
v3W
avefrontNormal
s
[
0
]
;
}
unsigned
int
NumPoints
()
const
{
return
size
();
}
const
VistaVector3D
&
SourcePoint
()
const
{
return
front
().
position
;
}
const
VistaVector3D
&
InitialDirection
()
const
{
return
front
().
w
avefrontNormal
;
}
VistaVector3D
LastPoint
()
const
{
return
v3SamplingPoints
[
v3SamplingPoints
.
size
()
-
1
]
;
}
VistaVector3D
LastWavefrontNormal
()
const
{
return
v3WavefrontNormals
[
v3W
avefrontNormal
s
.
size
()
-
1
]
;
}
double
LastTimeStamp
()
const
{
return
dTimeStamps
[
dTimeStamps
.
size
()
-
1
]
;
}
const
VistaVector3D
&
LastPoint
()
const
{
return
back
().
position
;
}
const
VistaVector3D
&
LastWavefrontNormal
()
const
{
return
back
().
w
avefrontNormal
;
}
const
double
&
LastTimeStamp
()
const
{
return
back
().
timeStamp
;
}
unsigned
int
ReflectionOrder
()
const
{
return
iReflectionIndices
.
size
();
}
#pragma endregion
...
...
src/ITAPropagationPathSim/AtmosphericRayTracing/Rays.cpp
View file @
f4a2f551
...
...
@@ -17,16 +17,12 @@ CRay::CRay(const VistaVector3D& v3SourcePos, const double& thetaDeg, const doubl
}
CRay
::
CRay
(
const
VistaVector3D
&
v3SourcePos
,
const
VistaVector3D
&
v3Direction
)
{
v3SamplingPoints
.
push_back
(
v3SourcePos
);
v3WavefrontNormals
.
push_back
(
v3Direction
.
GetNormalized
());
dTimeStamps
.
push_back
(
0
);
Append
(
v3SourcePos
,
v3Direction
.
GetNormalized
(),
0.0
);
}
void
CRay
::
Append
(
const
VistaVector3D
&
position
,
const
VistaVector3D
&
wavefrontNormal
,
const
double
&
timeStamp
)
{
v3SamplingPoints
.
push_back
(
position
);
v3WavefrontNormals
.
push_back
(
wavefrontNormal
);
dTimeStamps
.
push_back
(
timeStamp
);
push_back
(
RayElement
(
position
,
wavefrontNormal
,
timeStamp
)
);
}
void
CRay
::
AppendReflection
(
const
VistaVector3D
&
position
,
const
VistaVector3D
&
wavefrontNormal
,
const
double
&
timeStamp
)
{
...
...
src/ITAPropagationPathSim/AtmosphericRayTracing/Simulation/Engine.cpp
View file @
f4a2f551
...
...
@@ -49,23 +49,23 @@ class CWorker
const
int
idxStartReflection
=
iReflectionIndices
[
reflectionOrder
-
2
];
const
int
idxEndReflection
=
iReflectionIndices
[
reflectionOrder
-
1
];
double
tOffset
=
pRay
->
TimeStamps
()[
idxEndReflection
]
-
pRay
->
TimeStamps
()[
idxStartReflection
]
;
VistaVector3D
rXYOffset
=
pRay
->
SamplingPoints
()[
idxEndReflection
]
-
pRay
->
SamplingPoints
()[
idxStartReflection
]
;
double
tOffset
=
pRay
->
at
(
idxEndReflection
).
timeStamp
-
pRay
->
at
(
idxStartReflection
).
timeStamp
;
VistaVector3D
rXYOffset
=
pRay
->
at
(
idxEndReflection
).
position
-
pRay
->
at
(
idxStartReflection
).
position
;
for
(
int
idx
=
idxStartReflection
+
1
;
idx
<
idxEndReflection
;
idx
++
)
{
const
double
t
=
pRay
->
TimeStamps
()[
idx
]
+
tOffset
;
const
VistaVector3D
r
=
pRay
->
SamplingPoints
()[
idx
]
+
rXYOffset
;
const
VistaVector3D
n
=
pRay
->
W
avefrontNormal
s
()[
idx
]
;
const
double
t
=
pRay
->
at
(
idx
).
timeStamp
+
tOffset
;
const
VistaVector3D
r
=
pRay
->
at
(
idx
).
position
+
rXYOffset
;
const
VistaVector3D
n
=
pRay
->
at
(
idx
).
w
avefrontNormal
;
pRay
->
Append
(
r
,
n
,
t
);
if
(
rAbortCriterion
.
AbortRequested
(
pRay
))
return
;
}
const
double
t
=
pRay
->
TimeStamps
()[
idxEndReflection
]
+
tOffset
;
const
VistaVector3D
r
=
pRay
->
SamplingPoints
()[
idxEndReflection
]
;
const
VistaVector3D
n
=
pRay
->
WavefrontNormals
()[
idxEndReflection
]
;
const
double
t
=
pRay
->
at
(
idxEndReflection
).
timeStamp
+
tOffset
;
const
VistaVector3D
r
=
pRay
->
at
(
idxEndReflection
).
position
+
rXYOffset
;
const
VistaVector3D
n
=
pRay
->
at
(
idxEndReflection
).
wavefrontNormal
;
pRay
->
AppendReflection
(
r
,
n
,
t
);
}
void
ExtendRayPeriodically
()
...
...
tests/AtmosphericRayTracing/SimulationEngineTest.cpp
View file @
f4a2f551
...
...
@@ -42,7 +42,7 @@ using namespace ITAPropagationPathSim::AtmosphericRayTracing::Simulation;
void
runTest
(
const
CStratifiedAtmosphere
&
atmosphere
,
const
double
&
sourceAltitude
,
const
VistaVector3D
&
rayDirection
,
const
string
&
fileSuffix
)
{
double
tMax
=
1
0
;
double
tMax
=
1
5
;
auto
engine
=
Simulation
::
CEngine
(
CAbortAtMaxTime
(
tMax
));
double
dt
=
0.01
;
...
...
tests/AtmosphericRayTracing/SimulationEngineTest.m
View file @
f4a2f551
...
...
@@ -39,7 +39,7 @@ art.source = [0 0 50]; %Can also be a single itaCoordinates
art
.
receiver
=
[
0
0
0
];
%Can also be a single itaCoordinates
art
.
dt
=
0.01
;
%Integration variable [s]
art
.
tMax
=
1
0
;
%Maximum time of tracing [s]
art
.
tMax
=
1
5
;
%Maximum time of tracing [s]
art
.
bAdaptiveDt
=
true
;
art
.
maxErrorV
=
0.015
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment