Skip to content
GitLab
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
59928bd0
Commit
59928bd0
authored
Apr 23, 2016
by
Matthieu Schaller
Browse files
Initialise the cell properties (ti and h_max) when receiving particles.
parent
f97e8c3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/runner.c
View file @
59928bd0
...
...
@@ -899,13 +899,12 @@ void runner_dodrift(struct runner *r, struct cell *c, int timer) {
}
/**
* @brief
Combined second and first kick for fixed dt.
* @brief
Kick particles in momentum space and collect statistics
*
* @param r The runner thread.
* @param c The cell.
* @param timer
The timer
* @param timer
Are we timing this ?
*/
void
runner_dokick
(
struct
runner
*
r
,
struct
cell
*
c
,
int
timer
)
{
const
float
global_dt_min
=
r
->
e
->
dt_min
;
...
...
@@ -1220,12 +1219,48 @@ void runner_dokick(struct runner *r, struct cell *c, int timer) {
if
(
timer
)
TIMER_TOC
(
timer_kick
);
}
/**
* @brief Construct the cell properties from the received particles
*
* @param r The runner thread.
* @param c The cell.
* @param timer Are we timing this ?
*/
void
runner_dorecv_cell
(
struct
runner
*
r
,
struct
cell
*
c
,
int
timer
)
{
const
struct
part
*
const
parts
=
c
->
parts
;
const
struct
gpart
*
const
gparts
=
c
->
gparts
;
const
size_t
nr_parts
=
c
->
count
;
const
size_t
nr_gparts
=
c
->
gcount
;
TIMER_TIC
;
int
ti_end_min
=
max_nr_timesteps
;
int
ti_end_max
=
0
;
float
h_max
=
0
.
f
;
for
(
size_t
k
=
0
;
k
<
nr_parts
;
k
++
)
{
ti_end_min
=
min
(
ti_end_min
,
parts
[
k
].
ti_end
);
ti_end_max
=
max
(
ti_end_max
,
parts
[
k
].
ti_end
);
h_max
=
fmaxf
(
h_max
,
parts
[
k
].
h
);
}
for
(
size_t
k
=
0
;
k
<
nr_gparts
;
k
++
)
{
ti_end_min
=
min
(
ti_end_min
,
gparts
[
k
].
ti_end
);
ti_end_max
=
max
(
ti_end_max
,
gparts
[
k
].
ti_end
);
}
c
->
ti_end_min
=
ti_end_min
;
c
->
ti_end_max
=
ti_end_max
;
c
->
h_max
=
h_max
;
if
(
timer
)
TIMER_TOC
(
timer_dorecv_cell
);
}
/**
* @brief The #runner main thread routine.
*
* @param data A pointer to this thread's data.
*/
void
*
runner_main
(
void
*
data
)
{
struct
runner
*
r
=
(
struct
runner
*
)
data
;
...
...
@@ -1307,14 +1342,9 @@ void *runner_main(void *data) {
break
;
case
task_type_send
:
break
;
case
task_type_recv
:
{
struct
part
*
parts
=
ci
->
parts
;
size_t
nr_parts
=
ci
->
count
;
ci
->
ti_end_min
=
ci
->
ti_end_max
=
max_nr_timesteps
;
for
(
size_t
k
=
0
;
k
<
nr_parts
;
k
++
)
parts
[
k
].
ti_end
=
max_nr_timesteps
;
case
task_type_recv
:
runner_dorecv_cell
(
r
,
ci
,
1
);
break
;
}
case
task_type_grav_pp
:
if
(
t
->
cj
==
NULL
)
runner_doself_grav
(
r
,
t
->
ci
);
...
...
src/timers.h
View file @
59928bd0
...
...
@@ -46,6 +46,7 @@ enum {
timer_dosub_grav
,
timer_dopair_subset
,
timer_doghost
,
timer_dorecv_cell
,
timer_gettask
,
timer_qget
,
timer_qsteal
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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