Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
bca39cac
Commit
bca39cac
authored
8 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
cell_drift_part should only drift cells and sub-cells marked with do_drift.
parent
0e5fab52
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!343
Subset sorting
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cell.c
+23
-17
23 additions, 17 deletions
src/cell.c
src/cell.h
+3
-3
3 additions, 3 deletions
src/cell.h
with
26 additions
and
20 deletions
src/cell.c
+
23
−
17
View file @
bca39cac
...
@@ -1791,7 +1791,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
...
@@ -1791,7 +1791,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
if
(
l
==
NULL
)
error
(
"Missing link to send_ti task."
);
if
(
l
==
NULL
)
error
(
"Missing link to send_ti task."
);
scheduler_activate
(
s
,
l
->
t
);
scheduler_activate
(
s
,
l
->
t
);
}
}
}
}
else
if
(
t
->
type
==
task_type_pair
)
{
/* ci and cj on same node */
else
if
(
t
->
type
==
task_type_pair
)
{
/* ci and cj on same node */
scheduler_activate
(
s
,
ci
->
drift_part
);
scheduler_activate
(
s
,
ci
->
drift_part
);
...
@@ -1857,8 +1857,9 @@ void cell_set_super(struct cell *c, struct cell *super) {
...
@@ -1857,8 +1857,9 @@ void cell_set_super(struct cell *c, struct cell *super) {
*
*
* @param c The #cell.
* @param c The #cell.
* @param e The #engine (to get ti_current).
* @param e The #engine (to get ti_current).
* @param force Drift the particles irrespective of the #cell flags.
*/
*/
void
cell_drift_part
(
struct
cell
*
c
,
const
struct
engine
*
e
)
{
void
cell_drift_part
(
struct
cell
*
c
,
const
struct
engine
*
e
,
int
force
)
{
const
float
hydro_h_max
=
e
->
hydro_properties
->
h_max
;
const
float
hydro_h_max
=
e
->
hydro_properties
->
h_max
;
const
double
timeBase
=
e
->
timeBase
;
const
double
timeBase
=
e
->
timeBase
;
...
@@ -1873,6 +1874,9 @@ void cell_drift_part(struct cell *c, const struct engine *e) {
...
@@ -1873,6 +1874,9 @@ void cell_drift_part(struct cell *c, const struct engine *e) {
float
dx_max_sort
=
0
.
0
f
,
dx2_max_sort
=
0
.
f
;
float
dx_max_sort
=
0
.
0
f
,
dx2_max_sort
=
0
.
f
;
float
cell_h_max
=
0
.
f
;
float
cell_h_max
=
0
.
f
;
/* Drift irrespective of cell flags? */
force
|=
c
->
do_drift
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
/* Check that we only drift local cells. */
/* Check that we only drift local cells. */
if
(
c
->
nodeID
!=
engine_rank
)
error
(
"Drifting a foreign cell is nope."
);
if
(
c
->
nodeID
!=
engine_rank
)
error
(
"Drifting a foreign cell is nope."
);
...
@@ -1882,7 +1886,7 @@ void cell_drift_part(struct cell *c, const struct engine *e) {
...
@@ -1882,7 +1886,7 @@ void cell_drift_part(struct cell *c, const struct engine *e) {
#endif // SWIFT_DEBUG_CHECKS
#endif // SWIFT_DEBUG_CHECKS
/* Are we not in a leaf ? */
/* Are we not in a leaf ? */
if
(
c
->
split
)
{
if
(
c
->
split
&&
(
force
||
c
->
do_sub_drift
)
)
{
/* Loop over the progeny and collect their data. */
/* Loop over the progeny and collect their data. */
for
(
int
k
=
0
;
k
<
8
;
k
++
)
for
(
int
k
=
0
;
k
<
8
;
k
++
)
...
@@ -1890,7 +1894,7 @@ void cell_drift_part(struct cell *c, const struct engine *e) {
...
@@ -1890,7 +1894,7 @@ void cell_drift_part(struct cell *c, const struct engine *e) {
struct
cell
*
cp
=
c
->
progeny
[
k
];
struct
cell
*
cp
=
c
->
progeny
[
k
];
/* Collect */
/* Collect */
cell_drift_part
(
cp
,
e
);
cell_drift_part
(
cp
,
e
,
force
);
/* Update */
/* Update */
dx_max
=
max
(
dx_max
,
cp
->
dx_max_part
);
dx_max
=
max
(
dx_max
,
cp
->
dx_max_part
);
...
@@ -1898,7 +1902,15 @@ void cell_drift_part(struct cell *c, const struct engine *e) {
...
@@ -1898,7 +1902,15 @@ void cell_drift_part(struct cell *c, const struct engine *e) {
cell_h_max
=
max
(
cell_h_max
,
cp
->
h_max
);
cell_h_max
=
max
(
cell_h_max
,
cp
->
h_max
);
}
}
}
else
if
(
ti_current
>
ti_old_part
)
{
/* Store the values */
c
->
h_max
=
cell_h_max
;
c
->
dx_max_part
=
dx_max
;
c
->
dx_max_sort
=
dx_max_sort
;
/* Update the time of the last drift */
c
->
ti_old_part
=
ti_current
;
}
else
if
(
force
&&
ti_current
>
ti_old_part
)
{
/* Loop over all the gas particles in the cell */
/* Loop over all the gas particles in the cell */
const
size_t
nr_parts
=
c
->
count
;
const
size_t
nr_parts
=
c
->
count
;
...
@@ -1937,20 +1949,14 @@ void cell_drift_part(struct cell *c, const struct engine *e) {
...
@@ -1937,20 +1949,14 @@ void cell_drift_part(struct cell *c, const struct engine *e) {
dx_max
=
sqrtf
(
dx2_max
);
dx_max
=
sqrtf
(
dx2_max
);
dx_max_sort
=
sqrtf
(
dx2_max_sort
);
dx_max_sort
=
sqrtf
(
dx2_max_sort
);
}
else
{
/* Store the values */
c
->
h_max
=
cell_h_max
;
c
->
dx_max_part
=
dx_max
;
c
->
dx_max_sort
=
dx_max_sort
;
cell_h_max
=
c
->
h_max
;
/* Update the time of the last drift */
dx_max
=
c
->
dx_max_part
;
c
->
ti_old_part
=
ti_current
;
dx_max_sort
=
c
->
dx_max_sort
;
}
}
/* Store the values */
c
->
h_max
=
cell_h_max
;
c
->
dx_max_part
=
dx_max
;
c
->
dx_max_sort
=
dx_max_sort
;
/* Update the time of the last drift */
c
->
ti_old_part
=
ti_current
;
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/cell.h
+
3
−
3
View file @
bca39cac
...
@@ -333,10 +333,10 @@ struct cell {
...
@@ -333,10 +333,10 @@ struct cell {
/* Will this cell do anything that relies on its sorts being set correctly? */
/* Will this cell do anything that relies on its sorts being set correctly? */
integertime_t
requires_sorts
;
integertime_t
requires_sorts
;
/*! Does this cell need to be drifted? */
/*! Does this cell need to be drifted? */
char
do_drift
;
char
do_drift
;
/*! Does any of this cell's sub-cells need to be drifted? */
/*! Does any of this cell's sub-cells need to be drifted? */
char
do_sub_drift
;
char
do_sub_drift
;
...
@@ -387,7 +387,7 @@ void cell_reset_task_counters(struct cell *c);
...
@@ -387,7 +387,7 @@ void cell_reset_task_counters(struct cell *c);
int
cell_is_drift_needed
(
struct
cell
*
c
,
const
struct
engine
*
e
);
int
cell_is_drift_needed
(
struct
cell
*
c
,
const
struct
engine
*
e
);
int
cell_unskip_tasks
(
struct
cell
*
c
,
struct
scheduler
*
s
);
int
cell_unskip_tasks
(
struct
cell
*
c
,
struct
scheduler
*
s
);
void
cell_set_super
(
struct
cell
*
c
,
struct
cell
*
super
);
void
cell_set_super
(
struct
cell
*
c
,
struct
cell
*
super
);
void
cell_drift_part
(
struct
cell
*
c
,
const
struct
engine
*
e
);
void
cell_drift_part
(
struct
cell
*
c
,
const
struct
engine
*
e
,
int
force
);
void
cell_drift_gpart
(
struct
cell
*
c
,
const
struct
engine
*
e
);
void
cell_drift_gpart
(
struct
cell
*
c
,
const
struct
engine
*
e
);
void
cell_drift_multipole
(
struct
cell
*
c
,
const
struct
engine
*
e
);
void
cell_drift_multipole
(
struct
cell
*
c
,
const
struct
engine
*
e
);
void
cell_drift_all_multipoles
(
struct
cell
*
c
,
const
struct
engine
*
e
);
void
cell_drift_all_multipoles
(
struct
cell
*
c
,
const
struct
engine
*
e
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment