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
b2d678e4
Commit
b2d678e4
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
engine_collect_kick() now avoids empty top-level cells (issue
#95
)
parent
501b7bd8
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!136
Master
,
!90
Improved multi-timestep SPH
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/engine.c
+32
-24
32 additions, 24 deletions
src/engine.c
with
32 additions
and
24 deletions
src/engine.c
+
32
−
24
View file @
b2d678e4
...
...
@@ -1615,34 +1615,42 @@ void engine_barrier(struct engine *e, int tid) {
void
engine_collect_kick
(
struct
cell
*
c
)
{
int
k
,
updated
=
0
;
int
updated
=
0
;
float
t_end_min
=
FLT_MAX
,
t_end_max
=
0
.
0
f
;
double
ekin
=
0
.
0
,
epot
=
0
.
0
;
float
mom
[
3
]
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
ang
[
3
]
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
};
struct
cell
*
cp
;
/* If I am a super-cell, return immediately. */
if
(
c
->
kick
!=
NULL
||
c
->
count
==
0
)
return
;
/* If this cell is not split, I'm in trouble. */
if
(
!
c
->
split
)
error
(
"Cell has no super-cell."
);
/* Collect the values from the progeny. */
for
(
k
=
0
;
k
<
8
;
k
++
)
if
((
cp
=
c
->
progeny
[
k
])
!=
NULL
)
{
engine_collect_kick
(
cp
);
t_end_min
=
fminf
(
t_end_min
,
cp
->
t_end_min
);
t_end_max
=
fmaxf
(
t_end_max
,
cp
->
t_end_max
);
updated
+=
cp
->
updated
;
ekin
+=
cp
->
ekin
;
epot
+=
cp
->
epot
;
mom
[
0
]
+=
cp
->
mom
[
0
];
mom
[
1
]
+=
cp
->
mom
[
1
];
mom
[
2
]
+=
cp
->
mom
[
2
];
ang
[
0
]
+=
cp
->
ang
[
0
];
ang
[
1
]
+=
cp
->
ang
[
1
];
ang
[
2
]
+=
cp
->
ang
[
2
];
}
/* Skip super-cells (There values are already set) */
if
(
c
->
kick
!=
NULL
)
return
;
/* Only do something is the cell is non-empty */
if
(
c
->
count
!=
0
)
{
/* If this cell is not split, I'm in trouble. */
if
(
!
c
->
split
)
error
(
"Cell has no super-cell."
);
/* Collect the values from the progeny. */
for
(
int
k
=
0
;
k
<
8
;
k
++
)
if
((
cp
=
c
->
progeny
[
k
])
!=
NULL
)
{
/* Recurse */
engine_collect_kick
(
cp
);
/* And update */
t_end_min
=
fminf
(
t_end_min
,
cp
->
t_end_min
);
t_end_max
=
fmaxf
(
t_end_max
,
cp
->
t_end_max
);
updated
+=
cp
->
updated
;
ekin
+=
cp
->
ekin
;
epot
+=
cp
->
epot
;
mom
[
0
]
+=
cp
->
mom
[
0
];
mom
[
1
]
+=
cp
->
mom
[
1
];
mom
[
2
]
+=
cp
->
mom
[
2
];
ang
[
0
]
+=
cp
->
ang
[
0
];
ang
[
1
]
+=
cp
->
ang
[
1
];
ang
[
2
]
+=
cp
->
ang
[
2
];
}
}
/* Store the collected values in the cell. */
c
->
t_end_min
=
t_end_min
;
...
...
@@ -1727,7 +1735,7 @@ void engine_init_particles(struct engine *e) {
TIMER_TOC
(
timer_runners
);
/* Apply some conversions (e.g. internal energy -> entropy)
/* Apply some conversions (e.g. internal energy -> entropy)
*/
space_map_cells_pre
(
s
,
1
,
cell_convert_hydro
,
NULL
);
/* Ready to go */
...
...
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