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
85efcc54
Commit
85efcc54
authored
May 13, 2019
by
Loic Hausammann
Browse files
Add init_parts
parent
08d81da1
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
85efcc54
...
...
@@ -64,6 +64,7 @@
#include
"scheduler.h"
#include
"space.h"
#include
"space_getsid.h"
#include
"star_formation.h"
#include
"stars.h"
#include
"timers.h"
#include
"tools.h"
...
...
@@ -4207,6 +4208,7 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
if
(
part_is_active
(
p
,
e
))
{
hydro_init_part
(
p
,
&
e
->
s
->
hs
);
chemistry_init_part
(
p
,
e
->
chemistry
);
star_formation_init_part
(
p
,
e
->
star_formation
);
tracers_after_init
(
p
,
xp
,
e
->
internal_units
,
e
->
physical_constants
,
with_cosmology
,
e
->
cosmology
,
e
->
hydro_properties
,
e
->
cooling_func
,
e
->
time
);
...
...
src/runner.c
View file @
85efcc54
...
...
@@ -1926,6 +1926,9 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
const
struct
cosmology
*
cosmo
=
e
->
cosmology
;
const
struct
chemistry_global_data
*
chemistry
=
e
->
chemistry
;
const
struct
star_formation
*
star_formation
=
e
->
star_formation
;
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
const
float
hydro_h_max
=
e
->
hydro_properties
->
h_max
;
const
float
hydro_h_min
=
e
->
hydro_properties
->
h_min
;
const
float
eps
=
e
->
hydro_properties
->
h_tolerance
;
...
...
@@ -2071,7 +2074,6 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
/* Calculate the time-step for passing to hydro_prepare_force, used
* for the evolution of alpha factors (i.e. those involved in the
* artificial viscosity and thermal conduction terms) */
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
const
double
time_base
=
e
->
time_base
;
const
integertime_t
ti_current
=
e
->
ti_current
;
double
dt_alpha
;
...
...
@@ -2168,6 +2170,9 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
hydro_init_part
(
p
,
hs
);
chemistry_init_part
(
p
,
chemistry
);
star_formation_init_part
(
p
,
star_formation
);
tracers_after_init
(
p
,
xp
,
e
->
internal_units
,
e
->
physical_constants
,
with_cosmology
,
e
->
cosmology
,
e
->
hydro_properties
,
e
->
cooling_func
,
e
->
time
);
/* Off we go ! */
continue
;
...
...
@@ -2222,7 +2227,6 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
/* Calculate the time-step for passing to hydro_prepare_force, used for
* the evolution of alpha factors (i.e. those involved in the artificial
* viscosity and thermal conduction terms) */
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
const
double
time_base
=
e
->
time_base
;
const
integertime_t
ti_current
=
e
->
ti_current
;
double
dt_alpha
;
...
...
src/space.c
View file @
85efcc54
...
...
@@ -4333,8 +4333,21 @@ void space_init_parts_mapper(void *restrict map_data, int count,
void
*
restrict
extra_data
)
{
struct
part
*
restrict
parts
=
(
struct
part
*
)
map_data
;
const
struct
hydro_space
*
restrict
hs
=
(
struct
hydro_space
*
)
extra_data
;
for
(
int
k
=
0
;
k
<
count
;
k
++
)
hydro_init_part
(
&
parts
[
k
],
hs
);
const
struct
engine
*
restrict
e
=
(
struct
engine
*
)
extra_data
;
const
struct
hydro_space
*
restrict
hs
=
&
e
->
s
->
hs
;
const
int
with_cosmology
=
(
e
->
policy
&
engine_policy_cosmology
);
size_t
ind
=
parts
-
e
->
s
->
parts
;
struct
xpart
*
restrict
xparts
=
e
->
s
->
xparts
+
ind
;
for
(
int
k
=
0
;
k
<
count
;
k
++
)
{
hydro_init_part
(
&
parts
[
k
],
hs
);
chemistry_init_part
(
&
parts
[
k
],
e
->
chemistry
);
star_formation_init_part
(
&
parts
[
k
],
e
->
star_formation
);
tracers_after_init
(
&
parts
[
k
],
&
xparts
[
k
],
e
->
internal_units
,
e
->
physical_constants
,
with_cosmology
,
e
->
cosmology
,
e
->
hydro_properties
,
e
->
cooling_func
,
e
->
time
);
}
}
/**
...
...
@@ -4349,7 +4362,7 @@ void space_init_parts(struct space *s, int verbose) {
if
(
s
->
nr_parts
>
0
)
threadpool_map
(
&
s
->
e
->
threadpool
,
space_init_parts_mapper
,
s
->
parts
,
s
->
nr_parts
,
sizeof
(
struct
part
),
0
,
&
s
->
hs
);
s
->
nr_parts
,
sizeof
(
struct
part
),
0
,
&
s
->
e
);
if
(
verbose
)
message
(
"took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
...
...
Peter W. Draper
@pdraper
mentioned in issue
#582 (closed)
·
May 15, 2019
mentioned in issue
#582 (closed)
mentioned in issue #582
Toggle commit list
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