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
25bd066d
Commit
25bd066d
authored
Aug 23, 2016
by
Matthieu Schaller
Browse files
Add a gsuper pointer to the cells.
parent
54aa9fea
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/cell.h
View file @
25bd066d
...
...
@@ -110,9 +110,14 @@ struct cell {
/* Parent cell. */
struct
cell
*
parent
;
/* Super cell, i.e. the highest-level supercell that has interactions. */
/* Super cell, i.e. the highest-level supercell that has hydro interactions.
*/
struct
cell
*
super
;
/* Super cell, i.e. the highest-level supercell that has gravity interactions.
*/
struct
cell
*
gsuper
;
/* The task computing this cell's sorts. */
struct
task
*
sorts
;
int
sortsize
;
...
...
src/engine.c
View file @
25bd066d
...
...
@@ -122,10 +122,10 @@ void engine_addlink(struct engine *e, struct link **l, struct task *t) {
*
* @param e The #engine.
* @param c The #cell.
* @param super The super #cell.
* @param
g
super The
g
super #cell.
*/
void
engine_make_gravity_hierarchical_tasks
(
struct
engine
*
e
,
struct
cell
*
c
,
struct
cell
*
super
)
{
struct
cell
*
g
super
)
{
struct
scheduler
*
s
=
&
e
->
sched
;
const
int
is_with_external_gravity
=
...
...
@@ -134,10 +134,10 @@ void engine_make_gravity_hierarchical_tasks(struct engine *e, struct cell *c,
const
int
is_fixdt
=
(
e
->
policy
&
engine_policy_fixdt
)
==
engine_policy_fixdt
;
/* Is this the super-cell? */
if
(
super
==
NULL
&&
(
c
->
grav
!=
NULL
||
(
!
c
->
split
&&
c
->
gcount
>
0
)))
{
if
(
g
super
==
NULL
&&
(
c
->
grav
!=
NULL
||
(
!
c
->
split
&&
c
->
gcount
>
0
)))
{
/* This is the super cell, i.e. the first with gravity tasks attached. */
super
=
c
;
g
super
=
c
;
/* Local tasks only... */
if
(
c
->
nodeID
==
e
->
nodeID
)
{
...
...
@@ -165,13 +165,13 @@ void engine_make_gravity_hierarchical_tasks(struct engine *e, struct cell *c,
}
/* Set the super-cell. */
c
->
super
=
super
;
c
->
g
super
=
g
super
;
/* Recurse. */
if
(
c
->
split
)
for
(
int
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
engine_make_gravity_hierarchical_tasks
(
e
,
c
->
progeny
[
k
],
super
);
engine_make_gravity_hierarchical_tasks
(
e
,
c
->
progeny
[
k
],
g
super
);
}
/**
...
...
@@ -1428,11 +1428,11 @@ static inline void engine_make_gravity_dependencies(struct scheduler *sched,
struct
cell
*
c
)
{
/* init --> gravity --> kick */
scheduler_addunlock
(
sched
,
c
->
super
->
init
,
gravity
);
scheduler_addunlock
(
sched
,
gravity
,
c
->
super
->
kick
);
scheduler_addunlock
(
sched
,
c
->
g
super
->
init
,
gravity
);
scheduler_addunlock
(
sched
,
gravity
,
c
->
g
super
->
kick
);
/* grav_up --> gravity ( --> kick) */
scheduler_addunlock
(
sched
,
c
->
super
->
grav_up
,
gravity
);
scheduler_addunlock
(
sched
,
c
->
g
super
->
grav_up
,
gravity
);
}
/**
...
...
@@ -1474,10 +1474,10 @@ void engine_link_gravity_tasks(struct engine *e) {
/* Gather the multipoles --> mm interaction --> kick */
scheduler_addunlock
(
sched
,
gather
,
t
);
scheduler_addunlock
(
sched
,
t
,
t
->
ci
->
super
->
kick
);
scheduler_addunlock
(
sched
,
t
,
t
->
ci
->
g
super
->
kick
);
/* init --> mm interaction */
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
init
,
t
);
scheduler_addunlock
(
sched
,
t
->
ci
->
g
super
->
init
,
t
);
}
/* Self-interaction? */
...
...
@@ -1495,7 +1495,7 @@ void engine_link_gravity_tasks(struct engine *e) {
engine_make_gravity_dependencies
(
sched
,
t
,
t
->
ci
);
}
if
(
t
->
cj
->
nodeID
==
nodeID
&&
t
->
ci
->
super
!=
t
->
cj
->
super
)
{
if
(
t
->
cj
->
nodeID
==
nodeID
&&
t
->
ci
->
g
super
!=
t
->
cj
->
g
super
)
{
engine_make_gravity_dependencies
(
sched
,
t
,
t
->
cj
);
}
...
...
@@ -1517,7 +1517,7 @@ void engine_link_gravity_tasks(struct engine *e) {
engine_make_gravity_dependencies
(
sched
,
t
,
t
->
ci
);
}
if
(
t
->
cj
->
nodeID
==
nodeID
&&
t
->
ci
->
super
!=
t
->
cj
->
super
)
{
if
(
t
->
cj
->
nodeID
==
nodeID
&&
t
->
ci
->
g
super
!=
t
->
cj
->
g
super
)
{
engine_make_gravity_dependencies
(
sched
,
t
,
t
->
cj
);
}
...
...
src/scheduler.c
View file @
25bd066d
...
...
@@ -1104,10 +1104,20 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
break
;
case
task_type_pair
:
case
task_type_sub_pair
:
qid
=
t
->
ci
->
super
->
owner
;
if
(
qid
<
0
||
s
->
queues
[
qid
].
count
>
s
->
queues
[
t
->
cj
->
super
->
owner
].
count
)
qid
=
t
->
cj
->
super
->
owner
;
if
(
t
->
subtype
==
task_subtype_grav
)
{
qid
=
t
->
ci
->
gsuper
->
owner
;
if
(
qid
<
0
||
s
->
queues
[
qid
].
count
>
s
->
queues
[
t
->
cj
->
gsuper
->
owner
].
count
)
qid
=
t
->
cj
->
gsuper
->
owner
;
}
else
{
qid
=
t
->
ci
->
super
->
owner
;
if
(
qid
<
0
||
s
->
queues
[
qid
].
count
>
s
->
queues
[
t
->
cj
->
super
->
owner
].
count
)
qid
=
t
->
cj
->
super
->
owner
;
}
break
;
case
task_type_recv
:
#ifdef WITH_MPI
...
...
src/space.c
View file @
25bd066d
...
...
@@ -294,6 +294,7 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
c
->
count
=
0
;
c
->
gcount
=
0
;
c
->
super
=
c
;
c
->
gsuper
=
c
;
lock_init
(
&
c
->
lock
);
}
...
...
@@ -364,6 +365,7 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
s
->
cells
[
k
].
ghost
=
NULL
;
s
->
cells
[
k
].
kick
=
NULL
;
s
->
cells
[
k
].
super
=
&
s
->
cells
[
k
];
s
->
cells
[
k
].
gsuper
=
&
s
->
cells
[
k
];
}
s
->
maxdepth
=
0
;
}
...
...
@@ -1282,6 +1284,8 @@ void space_split_mapper(void *map_data, int num_elements, void *extra_data) {
temp
->
dx_max
=
0
.
f
;
temp
->
nodeID
=
c
->
nodeID
;
temp
->
parent
=
c
;
temp
->
super
=
NULL
;
temp
->
gsuper
=
NULL
;
c
->
progeny
[
k
]
=
temp
;
}
...
...
src/units.h
View file @
25bd066d
...
...
@@ -35,20 +35,19 @@
struct
UnitSystem
{
/*! Conversion factor from grams to internal mass units */
double
UnitMass_in_cgs
;
double
UnitMass_in_cgs
;
/*! Conversion factor from centimeters to internal length unit */
double
UnitLength_in_cgs
;
double
UnitLength_in_cgs
;
/*! Conversion factor from seconds to internal time units */
double
UnitTime_in_cgs
;
double
UnitTime_in_cgs
;
/*! Conversion factor from Ampere to internal current units */
double
UnitCurrent_in_cgs
;
double
UnitCurrent_in_cgs
;
/*! Conversion factor from Kelvins to internal temperature units. */
double
UnitTemperature_in_cgs
;
double
UnitTemperature_in_cgs
;
};
/**
...
...
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