Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
7aec67f4
Commit
7aec67f4
authored
Feb 25, 2017
by
Matthieu Schaller
Browse files
Moved the particle drifting mapper from the runner to the engine.
parent
17157f90
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
7aec67f4
...
...
@@ -3136,6 +3136,32 @@ void engine_unskip(struct engine *e) {
clocks_getunit
());
}
/**
* @brief Mapper function to drift ALL particle types and multipoles forward in
* time.
*
* @param map_data An array of #cell%s.
* @param num_elements Chunk size.
* @param extra_data Pointer to an #engine.
*/
void
engine_do_drift_all_mapper
(
void
*
map_data
,
int
num_elements
,
void
*
extra_data
)
{
struct
engine
*
e
=
(
struct
engine
*
)
extra_data
;
struct
cell
*
cells
=
(
struct
cell
*
)
map_data
;
for
(
int
ind
=
0
;
ind
<
num_elements
;
ind
++
)
{
struct
cell
*
c
=
&
cells
[
ind
];
if
(
c
!=
NULL
&&
c
->
nodeID
==
e
->
nodeID
)
{
/* Drift all the particles */
cell_drift_particles
(
c
,
e
);
/* Drift the multipole */
if
(
e
->
policy
&
engine_policy_self_gravity
)
cell_drift_multipole
(
c
,
e
);
}
}
}
/**
* @brief Drift *all* particles forward to the current time.
*
...
...
@@ -3144,7 +3170,7 @@ void engine_unskip(struct engine *e) {
void
engine_drift_all
(
struct
engine
*
e
)
{
const
ticks
tic
=
getticks
();
threadpool_map
(
&
e
->
threadpool
,
run
ne
r
_do_drift_all_mapper
,
e
->
s
->
cells_top
,
threadpool_map
(
&
e
->
threadpool
,
engi
ne_do_drift_all_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
,
e
);
#ifdef SWIFT_DEBUG_CHECKS
...
...
src/runner.c
View file @
7aec67f4
...
...
@@ -819,31 +819,6 @@ void runner_do_drift_particles(struct runner *r, struct cell *c, int timer) {
if
(
timer
)
TIMER_TOC
(
timer_drift
);
}
/**
* @brief Mapper function to drift ALL particle and g-particles forward in time.
*
* @param map_data An array of #cell%s.
* @param num_elements Chunk size.
* @param extra_data Pointer to an #engine.
*/
void
runner_do_drift_all_mapper
(
void
*
map_data
,
int
num_elements
,
void
*
extra_data
)
{
struct
engine
*
e
=
(
struct
engine
*
)
extra_data
;
struct
cell
*
cells
=
(
struct
cell
*
)
map_data
;
for
(
int
ind
=
0
;
ind
<
num_elements
;
ind
++
)
{
struct
cell
*
c
=
&
cells
[
ind
];
if
(
c
!=
NULL
&&
c
->
nodeID
==
e
->
nodeID
)
{
/* Drift all the particles */
cell_drift_particles
(
c
,
e
);
/* Drift the multipole */
if
(
e
->
policy
&
engine_policy_self_gravity
)
cell_drift_multipole
(
c
,
e
);
}
}
}
/**
* @brief Perform the first half-kick on all the active particles in a cell.
*
...
...
Write
Preview
Supports
Markdown
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