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
38d5b94b
Commit
38d5b94b
authored
Aug 08, 2018
by
Loic Hausammann
Browse files
start cleanup star_density
parent
9d162bad
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/active.h
View file @
38d5b94b
...
...
@@ -195,7 +195,7 @@ __attribute__((always_inline)) INLINE static int cell_is_all_active_gravity(
* @param e The #engine containing information about the current time.
* @return 1 if the #cell contains at least an active particle, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_active_star
(
__attribute__
((
always_inline
))
INLINE
static
int
cell_is_active_star
s
(
const
struct
cell
*
c
,
const
struct
engine
*
e
)
{
return
1
;
...
...
src/cell.c
View file @
38d5b94b
...
...
@@ -2326,9 +2326,9 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) {
if
(
c
->
ghost_in
!=
NULL
)
scheduler_activate
(
s
,
c
->
ghost_in
);
if
(
c
->
ghost_out
!=
NULL
)
scheduler_activate
(
s
,
c
->
ghost_out
);
if
(
c
->
ghost
!=
NULL
)
scheduler_activate
(
s
,
c
->
ghost
);
if
(
c
->
star_ghost_in
!=
NULL
)
scheduler_activate
(
s
,
c
->
star_ghost_in
);
if
(
c
->
star_ghost_out
!=
NULL
)
scheduler_activate
(
s
,
c
->
star_ghost_out
);
if
(
c
->
star_ghost
!=
NULL
)
scheduler_activate
(
s
,
c
->
star_ghost
);
if
(
c
->
star
s
_ghost_in
!=
NULL
)
scheduler_activate
(
s
,
c
->
star
s
_ghost_in
);
if
(
c
->
star
s
_ghost_out
!=
NULL
)
scheduler_activate
(
s
,
c
->
star
s
_ghost_out
);
if
(
c
->
star
s
_ghost
!=
NULL
)
scheduler_activate
(
s
,
c
->
star
s
_ghost
);
if
(
c
->
kick1
!=
NULL
)
scheduler_activate
(
s
,
c
->
kick1
);
if
(
c
->
kick2
!=
NULL
)
scheduler_activate
(
s
,
c
->
kick2
);
if
(
c
->
timestep
!=
NULL
)
scheduler_activate
(
s
,
c
->
timestep
);
...
...
@@ -2876,7 +2876,7 @@ void cell_drift_gpart(struct cell *c, const struct engine *e, int force) {
/* Drift... */
drift_spart
(
sp
,
dt_drift
,
ti_old_gpart
,
ti_current
);
if
(
spart_is_active
(
sp
,
e
))
star_init_spart
(
sp
);
star
s
_init_spart
(
sp
);
/* Note: no need to compute dx_max as all spart have a gpart */
}
...
...
src/cell.h
View file @
38d5b94b
...
...
@@ -283,16 +283,16 @@ struct cell {
struct
task
*
grav_down
;
/*! Dependency implicit task for the star ghost (in->ghost->out)*/
struct
task
*
star_ghost_in
;
struct
task
*
star
s
_ghost_in
;
/*! Dependency implicit task for the star ghost (in->ghost->out)*/
struct
task
*
star_ghost_out
;
struct
task
*
star
s
_ghost_out
;
/*! The star ghost task itself */
struct
task
*
star_ghost
;
struct
task
*
star
s
_ghost
;
/*! Linked list of the tasks computing this cell's star density. */
struct
link
*
star_density
;
struct
link
*
star
s
_density
;
/*! Task for cooling */
struct
task
*
cooling
;
...
...
src/engine.c
View file @
38d5b94b
...
...
@@ -152,23 +152,23 @@ void engine_addlink(struct engine *e, struct link **l, struct task *t) {
/**
* @brief Recursively add non-implicit star ghost tasks to a cell hierarchy.
*/
void
engine_add_star_ghosts
(
struct
engine
*
e
,
struct
cell
*
c
,
struct
task
*
star_ghost_in
,
struct
task
*
star_ghost_out
)
{
void
engine_add_star
s
_ghosts
(
struct
engine
*
e
,
struct
cell
*
c
,
struct
task
*
star
s
_ghost_in
,
struct
task
*
star
s
_ghost_out
)
{
/* If we have reached the leaf OR have to few particles to play with*/
if
(
!
c
->
split
||
c
->
scount
<
engine_max_sparts_per_ghost
)
{
/* Add the ghost task and its dependencies */
struct
scheduler
*
s
=
&
e
->
sched
;
c
->
star_ghost
=
scheduler_addtask
(
s
,
task_type_star_ghost
,
task_subtype_none
,
0
,
0
,
c
,
NULL
);
scheduler_addunlock
(
s
,
star_ghost_in
,
c
->
star_ghost
);
scheduler_addunlock
(
s
,
c
->
star_ghost
,
star_ghost_out
);
c
->
star
s
_ghost
=
scheduler_addtask
(
s
,
task_type_star
s
_ghost
,
task_subtype_none
,
0
,
0
,
c
,
NULL
);
scheduler_addunlock
(
s
,
star
s
_ghost_in
,
c
->
star
s
_ghost
);
scheduler_addunlock
(
s
,
c
->
star
s
_ghost
,
star
s
_ghost_out
);
}
else
{
/* Keep recursing */
for
(
int
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
engine_add_star_ghosts
(
e
,
c
->
progeny
[
k
],
star_ghost_in
,
star_ghost_out
);
engine_add_star
s
_ghosts
(
e
,
c
->
progeny
[
k
],
star
s
_ghost_in
,
star
s
_ghost_out
);
}
}
...
...
@@ -436,13 +436,13 @@ void engine_make_hierarchical_tasks_stars(struct engine *e, struct cell *c) {
if
(
c
->
nodeID
==
e
->
nodeID
)
{
/* Generate the ghost tasks. */
c
->
star_ghost_in
=
scheduler_addtask
(
s
,
task_type_star_ghost_in
,
task_subtype_none
,
0
,
c
->
star
s
_ghost_in
=
scheduler_addtask
(
s
,
task_type_star
s
_ghost_in
,
task_subtype_none
,
0
,
/* implicit = */
1
,
c
,
NULL
);
c
->
star_ghost_out
=
scheduler_addtask
(
s
,
task_type_star_ghost_out
,
task_subtype_none
,
0
,
c
->
star
s
_ghost_out
=
scheduler_addtask
(
s
,
task_type_star
s
_ghost_out
,
task_subtype_none
,
0
,
/* implicit = */
1
,
c
,
NULL
);
engine_add_star_ghosts
(
e
,
c
,
c
->
star_ghost_in
,
c
->
star_ghost_out
);
engine_add_star
s
_ghosts
(
e
,
c
,
c
->
star
s
_ghost_in
,
c
->
star
s
_ghost_out
);
}
}
else
{
/* We are above the super-cell so need to go deeper */
...
...
@@ -2670,7 +2670,7 @@ void engine_make_hydroloop_tasks_mapper(void *map_data, int num_elements,
* @param num_elements Number of cells to traverse.
* @param extra_data The #engine.
*/
void
engine_make_starloop_tasks_mapper
(
void
*
map_data
,
int
num_elements
,
void
engine_make_star
s
loop_tasks_mapper
(
void
*
map_data
,
int
num_elements
,
void
*
extra_data
)
{
/* Extract the engine pointer. */
...
...
@@ -2699,7 +2699,7 @@ void engine_make_starloop_tasks_mapper(void *map_data, int num_elements,
/* If the cells is local build a self-interaction */
if
(
ci
->
nodeID
==
nodeID
)
scheduler_addtask
(
sched
,
task_type_self
,
task_subtype_star_density
,
0
,
0
,
ci
,
scheduler_addtask
(
sched
,
task_type_self
,
task_subtype_star
s
_density
,
0
,
0
,
ci
,
NULL
);
/* Now loop over all the neighbours of this cell */
...
...
@@ -2727,7 +2727,7 @@ void engine_make_starloop_tasks_mapper(void *map_data, int num_elements,
/* Construct the pair task */
const
int
sid
=
sortlistID
[(
kk
+
1
)
+
3
*
((
jj
+
1
)
+
3
*
(
ii
+
1
))];
scheduler_addtask
(
sched
,
task_type_pair
,
task_subtype_star_density
,
sid
,
0
,
scheduler_addtask
(
sched
,
task_type_pair
,
task_subtype_star
s
_density
,
sid
,
0
,
ci
,
cj
);
}
}
...
...
@@ -2775,8 +2775,8 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements,
}
else
if
(
t_subtype
==
task_subtype_external_grav
)
{
engine_addlink
(
e
,
&
ci
->
grav
,
t
);
}
if
(
t
->
subtype
==
task_subtype_star_density
)
{
engine_addlink
(
e
,
&
ci
->
star_density
,
t
);
if
(
t
->
subtype
==
task_subtype_star
s
_density
)
{
engine_addlink
(
e
,
&
ci
->
star
s
_density
,
t
);
}
/* Link pair tasks to cells. */
...
...
@@ -2796,9 +2796,9 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements,
error
(
"Found a pair/external-gravity task..."
);
}
#endif
if
(
t
->
subtype
==
task_subtype_star_density
)
{
engine_addlink
(
e
,
&
ci
->
star_density
,
t
);
engine_addlink
(
e
,
&
cj
->
star_density
,
t
);
if
(
t
->
subtype
==
task_subtype_star
s
_density
)
{
engine_addlink
(
e
,
&
ci
->
star
s
_density
,
t
);
engine_addlink
(
e
,
&
cj
->
star
s
_density
,
t
);
}
/* Link sub-self tasks to cells. */
...
...
@@ -2812,8 +2812,8 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements,
}
else
if
(
t_subtype
==
task_subtype_external_grav
)
{
engine_addlink
(
e
,
&
ci
->
grav
,
t
);
}
if
(
t
->
subtype
==
task_subtype_star_density
)
{
engine_addlink
(
e
,
&
ci
->
star_density
,
t
);
if
(
t
->
subtype
==
task_subtype_star
s
_density
)
{
engine_addlink
(
e
,
&
ci
->
star
s
_density
,
t
);
}
/* Link sub-pair tasks to cells. */
...
...
@@ -2828,16 +2828,12 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements,
engine_addlink
(
e
,
&
ci
->
grav
,
t
);
engine_addlink
(
e
,
&
cj
->
grav
,
t
);
}
<<<<<<<
HEAD
if
(
t
->
subtype
==
task_subtype_stars_density
)
{
engine_addlink
(
e
,
&
ci
->
stars_density
,
t
);
engine_addlink
(
e
,
&
cj
->
stars_density
,
t
);
}
#ifdef SWIFT_DEBUG_CHECKS
else
if
(
t_subtype
==
task_subtype_external_grav
)
{
=======
if
(
t
->
subtype
==
task_subtype_star_density
)
{
engine_addlink
(
e
,
&
ci
->
star_density
,
t
);
engine_addlink
(
e
,
&
cj
->
star_density
,
t
);
}
if
(
t
->
subtype
==
task_subtype_external_grav
)
{
>>>>>>>
star
smoothing
length
close
to
be
implemented
error
(
"Found a sub-pair/external-gravity task..."
);
}
#endif
...
...
@@ -3051,11 +3047,11 @@ static inline void engine_make_hydro_loops_dependencies(struct scheduler *sched,
* @param density The density task to link.
* @param c The cell.
*/
static
inline
void
engine_make_star_loops_dependencies
(
struct
scheduler
*
sched
,
static
inline
void
engine_make_star
s
_loops_dependencies
(
struct
scheduler
*
sched
,
struct
task
*
density
,
struct
cell
*
c
)
{
/* density loop --> ghost */
scheduler_addunlock
(
sched
,
density
,
c
->
super
->
star_ghost_in
);
scheduler_addunlock
(
sched
,
density
,
c
->
super
->
star
s
_ghost_in
);
}
/**
...
...
@@ -3320,7 +3316,7 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
* With all the relevant tasks for a given cell available, we construct
* all the dependencies for that cell.
*/
void
engine_link_star_tasks_mapper
(
void
*
map_data
,
int
num_elements
,
void
engine_link_star
s
_tasks_mapper
(
void
*
map_data
,
int
num_elements
,
void
*
extra_data
)
{
struct
engine
*
e
=
(
struct
engine
*
)
extra_data
;
...
...
@@ -3331,18 +3327,18 @@ void engine_link_star_tasks_mapper(void *map_data, int num_elements,
struct
task
*
t
=
&
((
struct
task
*
)
map_data
)[
ind
];
/* Self-interaction? */
if
(
t
->
type
==
task_type_self
&&
t
->
subtype
==
task_subtype_star_density
)
{
if
(
t
->
type
==
task_type_self
&&
t
->
subtype
==
task_subtype_star
s
_density
)
{
/* Make the self-density tasks depend on the drift only. */
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
drift_part
,
t
);
/* Now, build all the dependencies for the hydro */
engine_make_star_loops_dependencies
(
sched
,
t
,
t
->
ci
);
scheduler_addunlock
(
sched
,
t
->
ci
->
star_ghost_out
,
t
->
ci
->
super
->
end_force
);
engine_make_star
s
_loops_dependencies
(
sched
,
t
,
t
->
ci
);
scheduler_addunlock
(
sched
,
t
->
ci
->
star
s
_ghost_out
,
t
->
ci
->
super
->
end_force
);
}
/* Otherwise, pair interaction? */
else
if
(
t
->
type
==
task_type_pair
&&
t
->
subtype
==
task_subtype_star_density
)
{
else
if
(
t
->
type
==
task_type_pair
&&
t
->
subtype
==
task_subtype_star
s
_density
)
{
/* Make all density tasks depend on the drift and the sorts. */
if
(
t
->
ci
->
nodeID
==
engine_rank
)
...
...
@@ -3357,18 +3353,18 @@ void engine_link_star_tasks_mapper(void *map_data, int num_elements,
/* Now, build all the dependencies for the hydro for the cells */
/* that are local and are not descendant of the same super_hydro-cells */
if
(
t
->
ci
->
nodeID
==
nodeID
)
{
engine_make_star_loops_dependencies
(
sched
,
t
,
t
->
ci
);
engine_make_star
s
_loops_dependencies
(
sched
,
t
,
t
->
ci
);
}
if
(
t
->
cj
->
nodeID
==
nodeID
)
{
if
(
t
->
ci
->
super_hydro
!=
t
->
cj
->
super
)
engine_make_star_loops_dependencies
(
sched
,
t
,
t
->
cj
);
engine_make_star
s
_loops_dependencies
(
sched
,
t
,
t
->
cj
);
}
}
/* Otherwise, sub-self interaction? */
else
if
(
t
->
type
==
task_type_sub_self
&&
t
->
subtype
==
task_subtype_star_density
)
{
t
->
subtype
==
task_subtype_star
s
_density
)
{
/* Make all density tasks depend on the drift and sorts. */
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
drift_part
,
t
);
...
...
@@ -3377,14 +3373,14 @@ void engine_link_star_tasks_mapper(void *map_data, int num_elements,
/* Now, build all the dependencies for the hydro for the cells */
/* that are local and are not descendant of the same super_hydro-cells */
if
(
t
->
ci
->
nodeID
==
nodeID
)
{
engine_make_star_loops_dependencies
(
sched
,
t
,
t
->
ci
);
engine_make_star
s
_loops_dependencies
(
sched
,
t
,
t
->
ci
);
}
else
error
(
"oo"
);
}
/* Otherwise, sub-pair interaction? */
else
if
(
t
->
type
==
task_type_sub_pair
&&
t
->
subtype
==
task_subtype_star_density
)
{
t
->
subtype
==
task_subtype_star
s
_density
)
{
/* Make all density tasks depend on the drift. */
if
(
t
->
ci
->
nodeID
==
engine_rank
)
...
...
@@ -3399,11 +3395,11 @@ void engine_link_star_tasks_mapper(void *map_data, int num_elements,
/* Now, build all the dependencies for the hydro for the cells */
/* that are local and are not descendant of the same super_hydro-cells */
if
(
t
->
ci
->
nodeID
==
nodeID
)
{
engine_make_star_loops_dependencies
(
sched
,
t
,
t
->
ci
);
engine_make_star
s
_loops_dependencies
(
sched
,
t
,
t
->
ci
);
}
if
(
t
->
cj
->
nodeID
==
nodeID
)
{
if
(
t
->
ci
->
super
!=
t
->
cj
->
super
)
engine_make_star_loops_dependencies
(
sched
,
t
,
t
->
cj
);
engine_make_star
s
_loops_dependencies
(
sched
,
t
,
t
->
cj
);
}
}
}
...
...
@@ -3425,15 +3421,10 @@ void engine_maketasks(struct engine *e) {
/* Re-set the scheduler. */
scheduler_reset
(
sched
,
engine_estimate_nr_tasks
(
e
));
<<<<<<<
HEAD
ticks
tic2
=
getticks
();
/* Construct the firt hydro loop over neighbours */
if
(
e
->
policy
&
engine_policy_hydro
)
=======
/* Construct the first hydro loop over neighbours */
if
(
e
->
policy
&
engine_policy_hydro
)
{
>>>>>>>
star
smoothing
length
close
to
be
implemented
if
(
e
->
policy
&
engine_policy_hydro
)
threadpool_map
(
&
e
->
threadpool
,
engine_make_hydroloop_tasks_mapper
,
NULL
,
s
->
nr_cells
,
1
,
0
,
e
);
...
...
@@ -3445,7 +3436,7 @@ void engine_maketasks(struct engine *e) {
/* Construct the star hydro loop over neighbours */
if
(
e
->
policy
&
engine_policy_stars
)
{
threadpool_map
(
&
e
->
threadpool
,
engine_make_starloop_tasks_mapper
,
NULL
,
threadpool_map
(
&
e
->
threadpool
,
engine_make_star
s
loop_tasks_mapper
,
NULL
,
s
->
nr_cells
,
1
,
0
,
e
);
}
...
...
@@ -3479,7 +3470,7 @@ void engine_maketasks(struct engine *e) {
#endif
const
size_t
self_grav_tasks_per_cell
=
125
;
const
size_t
ext_grav_tasks_per_cell
=
1
;
const
size_t
star_tasks_per_cell
=
1
;
const
size_t
star
s
_tasks_per_cell
=
1
;
if
(
e
->
policy
&
engine_policy_hydro
)
e
->
size_links
+=
s
->
tot_cells
*
hydro_tasks_per_cell
;
...
...
@@ -3488,7 +3479,7 @@ void engine_maketasks(struct engine *e) {
if
(
e
->
policy
&
engine_policy_self_gravity
)
e
->
size_links
+=
s
->
tot_cells
*
self_grav_tasks_per_cell
;
if
(
e
->
policy
&
engine_policy_stars
)
e
->
size_links
+=
s
->
tot_cells
*
star_tasks_per_cell
;
e
->
size_links
+=
s
->
tot_cells
*
star
s
_tasks_per_cell
;
/* Allocate the new link list */
if
((
e
->
links
=
(
struct
link
*
)
malloc
(
sizeof
(
struct
link
)
*
e
->
size_links
))
==
...
...
@@ -3565,15 +3556,20 @@ void engine_maketasks(struct engine *e) {
if
(
e
->
policy
&
(
engine_policy_self_gravity
|
engine_policy_external_gravity
))
engine_link_gravity_tasks
(
e
);
<<<<<<<
HEAD
if
(
e
->
verbose
)
message
(
"Linking gravity tasks took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic2
),
clocks_getunit
());
=======
tic2
=
getticks
();
if
(
e
->
policy
&
engine_policy_stars
)
threadpool_map
(
&
e
->
threadpool
,
engine_link_star_tasks_mapper
,
sched
->
tasks
,
threadpool_map
(
&
e
->
threadpool
,
engine_link_star
s
_tasks_mapper
,
sched
->
tasks
,
sched
->
nr_tasks
,
sizeof
(
struct
task
),
0
,
e
);
>>>>>>>
star
smoothing
length
close
to
be
implemented
if
(
e
->
verbose
)
message
(
"Linking stars tasks took %.3f %s (including reweight)."
,
clocks_from_ticks
(
getticks
()
-
tic2
),
clocks_getunit
());
#ifdef WITH_MPI
if
(
e
->
policy
&
engine_policy_stars
)
...
...
@@ -3737,7 +3733,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Activate the star density */
else
if
(
t
->
type
==
task_type_self
&&
t
->
subtype
==
task_subtype_star_density
)
{
t
->
subtype
==
task_subtype_star
s
_density
)
{
if
(
cell_is_active_star
(
ci
,
e
))
{
scheduler_activate
(
s
,
t
);
cell_activate_drift_part
(
ci
,
s
);
...
...
@@ -3746,7 +3742,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Store current values of dx_max and h_max. */
else
if
(
t
->
type
==
task_type_sub_self
&&
t
->
subtype
==
task_subtype_star_density
)
{
t
->
subtype
==
task_subtype_star
s
_density
)
{
if
(
cell_is_active_star
(
ci
,
e
))
{
scheduler_activate
(
s
,
t
);
cell_activate_subcell_hydro_tasks
(
ci
,
NULL
,
s
);
...
...
@@ -3792,7 +3788,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
if
((
t
->
subtype
==
task_subtype_density
||
t
->
subtype
==
task_subtype_gradient
||
t
->
subtype
==
task_subtype_force
||
t
->
subtype
==
task_subtype_star_density
)
&&
t
->
subtype
==
task_subtype_star
s
_density
)
&&
((
ci_active_hydro
&&
ci
->
nodeID
==
engine_rank
)
||
(
cj_active_hydro
&&
cj
->
nodeID
==
engine_rank
)))
{
...
...
@@ -3800,7 +3796,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Set the correct sorting flags */
if
(
t
->
type
==
task_type_pair
&&
(
t
->
subtype
==
task_subtype_density
||
t
->
subtype
==
task_subtype_star_density
))
{
t
->
subtype
==
task_subtype_star
s
_density
))
{
/* Store some values. */
atomic_or
(
&
ci
->
requires_sorts
,
1
<<
t
->
flags
);
...
...
@@ -3821,7 +3817,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Store current values of dx_max and h_max. */
else
if
(
t
->
type
==
task_type_sub_pair
&&
(
t
->
subtype
==
task_subtype_density
||
t
->
subtype
==
task_subtype_star_density
))
{
t
->
subtype
==
task_subtype_star
s
_density
))
{
cell_activate_subcell_hydro_tasks
(
t
->
ci
,
t
->
cj
,
s
);
}
}
...
...
@@ -3939,8 +3935,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
#endif
}
/* Only interested in star_density tasks as of here. */
if
(
t
->
subtype
==
task_subtype_star_density
)
{
/* Only interested in star
s
_density tasks as of here. */
if
(
t
->
subtype
==
task_subtype_star
s
_density
)
{
/* Too much particle movement? */
if
(
cell_need_rebuild_for_pair
(
ci
,
cj
))
*
rebuild_space
=
1
;
...
...
@@ -4125,8 +4121,8 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
}
/* Star ghost tasks ? */
else
if
(
t
->
type
==
task_type_star_ghost
||
t
->
type
==
task_type_star_ghost_in
||
t
->
type
==
task_type_star_ghost_out
)
{
else
if
(
t
->
type
==
task_type_star
s
_ghost
||
t
->
type
==
task_type_star
s
_ghost_in
||
t
->
type
==
task_type_star
s
_ghost_out
)
{
if
(
cell_is_active_star
(
t
->
ci
,
e
))
scheduler_activate
(
s
,
t
);
}
...
...
src/part.h
View file @
38d5b94b
...
...
@@ -86,7 +86,7 @@
#endif
/* Import the right star particle definition */
#include
"./stars/Default/star_part.h"
#include
"./stars/Default/star
s
_part.h"
void
part_relink_gparts_to_parts
(
struct
part
*
parts
,
size_t
N
,
ptrdiff_t
offset
);
...
...
src/runner.c
View file @
38d5b94b
...
...
@@ -96,8 +96,8 @@
/* Import the gravity loop functions. */
#include
"runner_doiact_grav.h"
/* Import the star loop functions. */
#include
"runner_doiact_star.h"
/* Import the star
s
loop functions. */
#include
"runner_doiact_star
s
.h"
/**
* @brief Perform source terms
...
...
@@ -143,15 +143,15 @@ void runner_do_sourceterms(struct runner *r, struct cell *c, int timer) {
* @param c The cell.
* @param timer Are we timing this ?
*/
void
runner_do_star_ghost
(
struct
runner
*
r
,
struct
cell
*
c
,
int
timer
)
{
void
runner_do_star
s
_ghost
(
struct
runner
*
r
,
struct
cell
*
c
,
int
timer
)
{
struct
spart
*
restrict
sparts
=
c
->
sparts
;
const
struct
engine
*
e
=
r
->
e
;
const
struct
cosmology
*
cosmo
=
e
->
cosmology
;
const
struct
stars_props
*
stars_properties
=
e
->
stars_properties
;
const
float
star_h_max
=
stars_properties
->
h_max
;
const
float
star
s
_h_max
=
stars_properties
->
h_max
;
const
float
eps
=
stars_properties
->
h_tolerance
;
const
float
star_eta_dim
=
const
float
star
s
_eta_dim
=
pow_dimension
(
stars_properties
->
eta_neighbours
);
const
int
max_smoothing_iter
=
stars_properties
->
max_smoothing_iterations
;
int
redo
=
0
,
scount
=
0
;
...
...
@@ -159,12 +159,12 @@ void runner_do_star_ghost(struct runner *r, struct cell *c, int timer) {
TIMER_TIC
;
/* Anything to do here? */
if
(
!
cell_is_active_star
(
c
,
e
))
return
;
if
(
!
cell_is_active_star
s
(
c
,
e
))
return
;
/* Recurse? */
if
(
c
->
split
)
{
for
(
int
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
runner_do_star_ghost
(
r
,
c
->
progeny
[
k
],
0
);
if
(
c
->
progeny
[
k
]
!=
NULL
)
runner_do_star
s
_ghost
(
r
,
c
->
progeny
[
k
],
0
);
}
else
{
/* Init the list of active particles that have to be updated. */
...
...
@@ -212,11 +212,11 @@ void runner_do_star_ghost(struct runner *r, struct cell *c, int timer) {
}
else
{
/* Finish the density calculation */
star_end_density
(
sp
,
cosmo
);
star
s
_end_density
(
sp
,
cosmo
);
/* Compute one step of the Newton-Raphson scheme */
const
float
n_sum
=
sp
->
wcount
*
h_old_dim
;
const
float
n_target
=
star_eta_dim
;
const
float
n_target
=
star
s
_eta_dim
;
const
float
f
=
n_sum
-
n_target
;
const
float
f_prime
=
sp
->
wcount_dh
*
h_old_dim
+
...
...
@@ -242,14 +242,14 @@ void runner_do_star_ghost(struct runner *r, struct cell *c, int timer) {
sp
->
h
=
h_new
;
/* If below the absolute maximum, try again */
if
(
sp
->
h
<
star_h_max
)
{
if
(
sp
->
h
<
star
s
_h_max
)
{
/* Flag for another round of fun */
sid
[
redo
]
=
sid
[
i
];
redo
+=
1
;
/* Re-initialise everything */
star_init_spart
(
sp
);
star
s
_init_spart
(
sp
);
/* Off we go ! */
continue
;
...
...
@@ -257,11 +257,11 @@ void runner_do_star_ghost(struct runner *r, struct cell *c, int timer) {
}
else
{
/* Ok, this particle is a lost cause... */
sp
->
h
=
star_h_max
;
sp
->
h
=
star
s
_h_max
;
/* Do some damage control if no neighbours at all were found */
if
(
has_no_neighbours
)
{
star_spart_has_no_neighbours
(
sp
,
cosmo
);
star
s
_spart_has_no_neighbours
(
sp
,
cosmo
);
}
}
}
...
...
@@ -271,13 +271,13 @@ void runner_do_star_ghost(struct runner *r, struct cell *c, int timer) {
/* As of here, particle force variables will be set. */
/* Compute variables required for the force loop */
star_prepare_force
(
sp
,
cosmo
);
star
s
_prepare_force
(
sp
,
cosmo
);
/* The particle force values are now set. Do _NOT_
try to read any particle density variables! */
/* Prepare the particle for the force loop over neighbours */
star_reset_acceleration
(
sp
);
star
s
_reset_acceleration
(
sp
);
}
...
...
@@ -301,23 +301,23 @@ void runner_do_star_ghost(struct runner *r, struct cell *c, int timer) {
/* Self-interaction? */
if
(
l
->
t
->
type
==
task_type_self
)
runner_doself_subset_branch_star_density
(
r
,
finger
,
sparts
,
sid
,
scount
);
runner_doself_subset_branch_star
s
_density
(
r
,
finger
,
sparts
,
sid
,
scount
);
/* Otherwise, pair interaction? */
else
if
(
l
->
t
->
type
==
task_type_pair
)
{
/* Left or right? */
if
(
l
->
t
->
ci
==
finger
)
runner_dopair_subset_branch_star_density
(
r
,
finger
,
sparts
,
sid
,
runner_dopair_subset_branch_star
s
_density
(
r
,
finger
,
sparts
,
sid
,
scount
,
l
->
t
->
cj
);
else
runner_dopair_subset_branch_star_density
(
r
,
finger
,
sparts
,
sid
,
runner_dopair_subset_branch_star
s
_density
(
r
,
finger
,
sparts
,
sid
,
scount
,
l
->
t
->
ci
);
}
/* Otherwise, sub-self interaction? */
else
if
(
l
->
t
->
type
==
task_type_sub_self
)
runner_dosub_subset_star_density
(
r
,
finger
,
sparts
,
sid
,
scount
,
NULL
,
runner_dosub_subset_star
s
_density
(
r
,
finger
,
sparts
,
sid
,
scount
,
NULL
,
-
1
,
1
);
/* Otherwise, sub-pair interaction? */
...
...
@@ -325,10 +325,10 @@ void runner_do_star_ghost(struct runner *r, struct cell *c, int timer) {
/* Left or right? */
if
(
l
->
t
->
ci
==
finger
)
runner_dosub_subset_star_density
(
r
,
finger
,
sparts
,
sid
,
scount
,
runner_dosub_subset_star
s
_density
(
r
,
finger
,
sparts
,
sid
,
scount
,
l
->
t
->
cj
,
-
1
,
1
);
else
runner_dosub_subset_star_density
(
r
,
finger
,
sparts
,
sid
,
scount
,
runner_dosub_subset_star
s
_density
(
r
,
finger
,
sparts
,
sid
,
scount
,
l
->
t
->
ci
,
-
1
,
1
);
}
}
...
...
@@ -344,7 +344,7 @@ void runner_do_star_ghost(struct runner *r, struct cell *c, int timer) {
free
(
sid
);
}
if
(
timer
)
TIMER_TOC
(
timer_do_star_ghost
);
if
(
timer
)
TIMER_TOC
(
timer_do_star
s
_ghost
);
}
...
...
@@ -1428,7 +1428,7 @@ void runner_do_kick1(struct runner *r, struct cell *c, int timer) {
}
}
/* Loop over the star particles in this cell. */
/* Loop over the star
s
particles in this cell. */
for
(
int
k
=
0
;
k
<
scount
;
k
++
)
{
/* Get a handle on the s-part. */
...
...
@@ -1640,7 +1640,7 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
#endif
/* Prepare the values to be drifted */
star_reset_predicted_values
(
sp
);
star
s
_reset_predicted_values
(
sp
);
}
}
}
...
...
@@ -1855,7 +1855,7 @@ void runner_do_timestep(struct runner *r, struct cell *c, int timer) {
/* What is the next starting point for this cell ? */
ti_gravity_beg_max
=
max
(
ti_current
,
ti_gravity_beg_max
);
}
else
{
/* star particle is inactive */
}
else
{
/* star
s
particle is inactive */
const
integertime_t
ti_end
=
get_integer_time_end
(
ti_current
,
sp
->
time_bin
);
...
...
@@ -1987,7 +1987,7 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) {
long
long
id
=
0
;
if
(
gp
->
type
==
swift_type_gas
)
id
=
e
->
s
->
parts
[
-
gp
->
id_or_neg_offset
].
id
;
else
if
(
gp
->
type
==
swift_type_star
)
else
if
(
gp
->
type
==
swift_type_star
s
)
id
=
e
->
s
->
sparts
[
-
gp
->
id_or_neg_offset
].
id
;
else
if
(
gp
->
type
==
swift_type_black_hole
)
error
(
"Unexisting type"
);
...
...
@@ -2018,7 +2018,7 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) {
long
long
my_id
=
0
;
if
(
gp
->
type
==
swift_type_gas
)
my_id
=
e
->
s
->
parts
[
-
gp
->
id_or_neg_offset
].
id
;
else
if
(
gp
->
type
==
swift_type_star
)
else
if
(
gp
->
type
==
swift_type_star
s
)
my_id
=
e
->
s
->
sparts
[
-
gp
->
id_or_neg_offset
].
id
;
else
if
(
gp
->
type
==
swift_type_black_hole
)
error
(
"Unexisting type"
);
...
...
@@ -2038,7 +2038,7 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) {
}
}
/* Loop over the star particles in this cell. */
/* Loop over the star
s
particles in this cell. */
for
(
int
k
=
0
;
k
<
scount
;
k
++
)
{
/* Get a handle on the spart. */
...
...
@@ -2046,7 +2046,7 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) {