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
44bdf773
Commit
44bdf773
authored
May 08, 2020
by
Philipp Schäfer
Browse files
ART - SimulationEngine
- now uses OpenMP to parallelize ray tracing
parent
697da52a
Changes
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
44bdf773
...
...
@@ -6,10 +6,16 @@ project( ITAPropagationPathSim )
list
(
APPEND CMAKE_MODULE_PATH
"$ENV{VISTA_CMAKE_COMMON}"
)
include
(
VistaCommon
)
if
(
NOT DEFINED ITA_PROPAGATION_PATH_SIM_WITH_OPENMP
)
set
(
ITA_PROPAGATION_PATH_SIM_WITH_OPENMP ON CACHE BOOL
"Build ITA propagation path sim using OpenMP parallelization."
)
endif
(
)
# dependencies
vista_use_package
(
ITABase REQUIRED FIND_DEPENDENCIES
)
vista_use_package
(
ITAGeo REQUIRED FIND_DEPENDENCIES
)
if
(
ITA_PROPAGATION_PATH_SIM_WITH_OPENMP
)
vista_use_package
(
OpenMP REQUIRED
)
endif
(
)
# includes
include_directories
(
"include"
)
...
...
include/ITAPropagationPathSim/AtmosphericRayTracing/Simulation/Engine.h
View file @
44bdf773
...
...
@@ -52,6 +52,8 @@ namespace ITAPropagationPathSim
public:
std
::
vector
<
std
::
shared_ptr
<
CRay
>>
Run
(
const
ITAGeo
::
CStratifiedAtmosphere
&
atmosphere
,
const
VistaVector3D
&
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
;
};
}
}
...
...
src/ITAPropagationPathSim/AtmosphericRayTracing/Simulation/Engine.cpp
View file @
44bdf773
...
...
@@ -4,12 +4,14 @@
#include "AdaptiveSolver.h"
#include <ITAPropagationPathSim/AtmosphericRayTracing/ODESolver/ODESolver.h>
// Vista includes
//#include <VistaInterProcComm/Concurrency/VistaThread.h>
// STD
#include <cmath>
// OMP
#ifdef _OPENMP
#include <omp.h>
#endif
using
namespace
ITAPropagationPathSim
::
AtmosphericRayTracing
;
using
namespace
ITAPropagationPathSim
::
AtmosphericRayTracing
::
Simulation
;
...
...
@@ -130,21 +132,23 @@ std::vector<std::shared_ptr<CRay>> CEngine::Run(const ITAGeo::CStratifiedAtmosph
for
each
(
const
VistaVector3D
&
v3Direction
in
v3RayDirections
)
rays
.
push_back
(
std
::
make_shared
<
CRay
>
(
v3SourcePosition
,
v3Direction
));
for
each
(
std
::
shared_ptr
<
CRay
>
pRay
in
rays
)
{
auto
worker
=
CWorker
(
pRay
,
settings
,
externalWatcher
);
worker
.
TraceRay
(
atmosphere
);
}
TraceRays
(
atmosphere
,
rays
);
return
rays
;
}
void
CEngine
::
Run
(
const
ITAGeo
::
CStratifiedAtmosphere
&
atmosphere
,
const
std
::
set
<
std
::
shared_ptr
<
CRay
>>&
rays
)
const
{
for
each
(
std
::
shared_ptr
<
CRay
>
pRay
in
rays
)
TraceRays
(
atmosphere
,
std
::
vector
<
std
::
shared_ptr
<
CRay
>>
(
rays
.
begin
(),
rays
.
end
()));
}
void
CEngine
::
TraceRays
(
const
ITAGeo
::
CStratifiedAtmosphere
&
atmosphere
,
const
std
::
vector
<
std
::
shared_ptr
<
CRay
>>&
rays
)
const
{
#pragma omp parallel for schedule(static)
for
(
int
idx
=
0
;
idx
<
rays
.
size
();
idx
++
)
{
if
(
pRay
==
nullptr
)
if
(
rays
[
idx
]
==
nullptr
)
continue
;
auto
worker
=
CWorker
(
pRay
,
settings
,
externalWatcher
);
auto
worker
=
CWorker
(
rays
[
idx
]
,
settings
,
externalWatcher
);
worker
.
TraceRay
(
atmosphere
);
}
}
\ No newline at end of file
}
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