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
967a0af8
Commit
967a0af8
authored
Jul 20, 2016
by
Matthieu Schaller
Browse files
Better pointer aliasing rules
parent
01483714
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/drift.h
View file @
967a0af8
...
...
@@ -37,7 +37,8 @@
* @param ti_current Integer end of time-step
*/
__attribute__
((
always_inline
))
INLINE
static
void
drift_gpart
(
struct
gpart
*
gp
,
float
dt
,
double
timeBase
,
int
ti_old
,
int
ti_current
)
{
struct
gpart
*
restrict
gp
,
float
dt
,
double
timeBase
,
int
ti_old
,
int
ti_current
)
{
/* Drift... */
gp
->
x
[
0
]
+=
gp
->
v_full
[
0
]
*
dt
;
gp
->
x
[
1
]
+=
gp
->
v_full
[
1
]
*
dt
;
...
...
@@ -60,8 +61,8 @@ __attribute__((always_inline)) INLINE static void drift_gpart(
* @param ti_current Integer end of time-step
*/
__attribute__
((
always_inline
))
INLINE
static
void
drift_part
(
struct
part
*
p
,
struct
xpart
*
xp
,
float
dt
,
double
timeBase
,
int
ti_old
,
int
ti_current
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
,
double
timeBase
,
int
ti_old
,
int
ti_current
)
{
/* Useful quantity */
const
float
h_inv
=
1
.
0
f
/
p
->
h
;
...
...
src/hydro/Default/hydro.h
View file @
967a0af8
...
...
@@ -28,8 +28,8 @@
*
*/
__attribute__
((
always_inline
))
INLINE
static
float
hydro_compute_timestep
(
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
const
struct
hydro_props
*
hydro_properties
)
{
const
struct
part
*
restrict
p
,
const
struct
xpart
*
restrict
xp
,
const
struct
hydro_props
*
restrict
hydro_properties
)
{
const
float
CFL_condition
=
hydro_properties
->
CFL_condition
;
...
...
@@ -55,7 +55,7 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
* @param xp The extended particle data to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_first_init_part
(
struct
part
*
p
,
struct
xpart
*
xp
)
{}
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{}
/**
* @brief Prepares a particle for the density calculation.
...
...
@@ -66,7 +66,7 @@ __attribute__((always_inline)) INLINE static void hydro_first_init_part(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_init_part
(
struct
part
*
p
)
{
struct
part
*
restrict
p
)
{
p
->
density
.
wcount
=
0
.
f
;
p
->
density
.
wcount_dh
=
0
.
f
;
p
->
rho
=
0
.
f
;
...
...
@@ -87,7 +87,7 @@ __attribute__((always_inline)) INLINE static void hydro_init_part(
* @param time The current time
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_end_density
(
struct
part
*
p
,
float
time
)
{
struct
part
*
restrict
p
,
float
time
)
{
/* Some smoothing length multiples. */
const
float
h
=
p
->
h
;
...
...
@@ -122,7 +122,8 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
* @param time The current time
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_prepare_force
(
struct
part
*
p
,
struct
xpart
*
xp
,
int
ti_current
,
double
timeBase
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
int
ti_current
,
double
timeBase
)
{
/* Some smoothing length multiples. */
const
float
h
=
p
->
h
;
...
...
@@ -171,7 +172,7 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_reset_acceleration
(
struct
part
*
p
)
{
struct
part
*
restrict
p
)
{
/* Reset the acceleration. */
p
->
a_hydro
[
0
]
=
0
.
0
f
;
...
...
@@ -194,7 +195,8 @@ __attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
* @param timeBase The minimal time-step size
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_predict_extra
(
struct
part
*
p
,
struct
xpart
*
xp
,
int
t0
,
int
t1
,
double
timeBase
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
int
t0
,
int
t1
,
double
timeBase
)
{
float
u
,
w
;
const
float
dt
=
(
t1
-
t0
)
*
timeBase
;
...
...
@@ -218,7 +220,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_end_force
(
struct
part
*
p
)
{}
struct
part
*
restrict
p
)
{}
/**
* @brief Kick the additional variables
...
...
@@ -229,17 +231,18 @@ __attribute__((always_inline)) INLINE static void hydro_end_force(
* @param half_dt The half time-step for this kick
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_kick_extra
(
struct
part
*
p
,
struct
xpart
*
xp
,
float
dt
,
float
half_dt
)
{}
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
,
float
half_dt
)
{}
/**
* @brief Converts hydro quantity of a particle
*
@brief Converts hydro quantity of a particle
at the start of a run
*
* Requires the density to be known
*
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_convert_quantities
(
struct
part
*
p
)
{}
struct
part
*
restrict
p
)
{}
/**
* @brief Returns the internal energy of a particle
...
...
@@ -248,7 +251,7 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
* @param dt Time since the last kick
*/
__attribute__
((
always_inline
))
INLINE
static
float
hydro_get_internal_energy
(
const
struct
part
*
p
,
float
dt
)
{
const
struct
part
*
restrict
p
,
float
dt
)
{
return
p
->
u
;
}
src/hydro/Gadget2/hydro.h
View file @
967a0af8
...
...
@@ -27,8 +27,8 @@
*
*/
__attribute__
((
always_inline
))
INLINE
static
float
hydro_compute_timestep
(
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
const
struct
hydro_props
*
hydro_properties
)
{
const
struct
part
*
restrict
p
,
const
struct
xpart
*
restrict
xp
,
const
struct
hydro_props
*
restrict
hydro_properties
)
{
const
float
CFL_condition
=
hydro_properties
->
CFL_condition
;
...
...
@@ -49,7 +49,7 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
* @param xp The extended particle data to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_first_init_part
(
struct
part
*
p
,
struct
xpart
*
xp
)
{}
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{}
/**
* @brief Prepares a particle for the density calculation.
...
...
@@ -60,7 +60,7 @@ __attribute__((always_inline)) INLINE static void hydro_first_init_part(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_init_part
(
struct
part
*
p
)
{
struct
part
*
restrict
p
)
{
p
->
density
.
wcount
=
0
.
f
;
p
->
density
.
wcount_dh
=
0
.
f
;
p
->
rho
=
0
.
f
;
...
...
@@ -81,7 +81,7 @@ __attribute__((always_inline)) INLINE static void hydro_init_part(
* @param ti_current The current time (on the integer timeline)
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_end_density
(
struct
part
*
p
,
int
ti_current
)
{
struct
part
*
restrict
p
,
int
ti_current
)
{
/* Some smoothing length multiples. */
const
float
h
=
p
->
h
;
...
...
@@ -125,7 +125,8 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
* @param timeBase The minimal time-step size
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_prepare_force
(
struct
part
*
p
,
struct
xpart
*
xp
,
int
ti_current
,
double
timeBase
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
int
ti_current
,
double
timeBase
)
{
/* Compute the norm of the curl */
p
->
force
.
curl_v
=
sqrtf
(
p
->
density
.
rot_v
[
0
]
*
p
->
density
.
rot_v
[
0
]
+
...
...
@@ -149,7 +150,7 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_reset_acceleration
(
struct
part
*
p
)
{
struct
part
*
restrict
p
)
{
/* Reset the acceleration. */
p
->
a_hydro
[
0
]
=
0
.
0
f
;
...
...
@@ -175,7 +176,8 @@ __attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
* @param timeBase The minimal time-step size
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_predict_extra
(
struct
part
*
p
,
struct
xpart
*
xp
,
int
t0
,
int
t1
,
double
timeBase
)
{
struct
part
*
restrict
p
,
const
struct
xpart
*
restrict
xp
,
int
t0
,
int
t1
,
double
timeBase
)
{
/* Drift the pressure */
const
float
dt_entr
=
(
t1
-
(
p
->
ti_begin
+
p
->
ti_end
)
/
2
)
*
timeBase
;
...
...
@@ -194,7 +196,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_end_force
(
struct
part
*
p
)
{
struct
part
*
restrict
p
)
{
p
->
entropy_dt
*=
hydro_gamma_minus_one
*
pow_minus_gamma_minus_one
(
p
->
rho
);
}
...
...
@@ -208,7 +210,8 @@ __attribute__((always_inline)) INLINE static void hydro_end_force(
* @param half_dt The half time-step for this kick
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_kick_extra
(
struct
part
*
p
,
struct
xpart
*
xp
,
float
dt
,
float
half_dt
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
,
float
half_dt
)
{
/* Do not decrease the entropy (temperature) by more than a factor of 2*/
const
float
entropy_change
=
p
->
entropy_dt
*
dt
;
...
...
@@ -223,14 +226,14 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
}
/**
* @brief Converts hydro quantity of a particle
*
@brief Converts hydro quantity of a particle
at the start of a run
*
* Requires the density to be known
*
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_convert_quantities
(
struct
part
*
p
)
{
struct
part
*
restrict
p
)
{
p
->
entropy
=
hydro_gamma_minus_one
*
p
->
entropy
*
pow_minus_gamma_minus_one
(
p
->
rho
);
...
...
@@ -243,7 +246,7 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
* @param dt Time since the last kick
*/
__attribute__
((
always_inline
))
INLINE
static
float
hydro_get_internal_energy
(
const
struct
part
*
p
,
float
dt
)
{
const
struct
part
*
restrict
p
,
float
dt
)
{
const
float
entropy
=
p
->
entropy
+
p
->
entropy_dt
*
dt
;
...
...
src/hydro/Minimal/hydro.h
View file @
967a0af8
...
...
@@ -32,8 +32,8 @@
*
*/
__attribute__
((
always_inline
))
INLINE
static
float
hydro_compute_timestep
(
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
const
struct
hydro_props
*
hydro_properties
)
{
const
struct
part
*
restrict
p
,
const
struct
xpart
*
restrict
xp
,
const
struct
hydro_props
*
restrict
hydro_properties
)
{
const
float
CFL_condition
=
hydro_properties
->
CFL_condition
;
...
...
@@ -55,7 +55,7 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
* @param xp The extended particle data to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_first_init_part
(
struct
part
*
p
,
struct
xpart
*
xp
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
xp
->
u_full
=
p
->
u
;
}
...
...
@@ -70,7 +70,7 @@ __attribute__((always_inline)) INLINE static void hydro_first_init_part(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_init_part
(
struct
part
*
p
)
{
struct
part
*
restrict
p
)
{
p
->
density
.
wcount
=
0
.
f
;
p
->
density
.
wcount_dh
=
0
.
f
;
p
->
rho
=
0
.
f
;
...
...
@@ -90,7 +90,7 @@ __attribute__((always_inline)) INLINE static void hydro_init_part(
* @param time The current time
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_end_density
(
struct
part
*
p
,
float
time
)
{
struct
part
*
restrict
p
,
float
time
)
{
/* Some smoothing length multiples. */
const
float
h
=
p
->
h
;
...
...
@@ -131,7 +131,8 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
* @param timeBase The minimal time-step size
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_prepare_force
(
struct
part
*
p
,
struct
xpart
*
xp
,
int
ti_current
,
double
timeBase
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
int
ti_current
,
double
timeBase
)
{
p
->
force
.
pressure
=
p
->
rho
*
p
->
u
*
hydro_gamma_minus_one
;
}
...
...
@@ -145,7 +146,7 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_reset_acceleration
(
struct
part
*
p
)
{
struct
part
*
restrict
p
)
{
/* Reset the acceleration. */
p
->
a_hydro
[
0
]
=
0
.
0
f
;
...
...
@@ -171,7 +172,8 @@ __attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
* @param timeBase The minimal time-step size
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_predict_extra
(
struct
part
*
p
,
struct
xpart
*
xp
,
int
t0
,
int
t1
,
double
timeBase
)
{
struct
part
*
restrict
p
,
const
struct
xpart
*
restrict
xp
,
int
t0
,
int
t1
,
double
timeBase
)
{
p
->
u
=
xp
->
u_full
;
...
...
@@ -189,7 +191,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_end_force
(
struct
part
*
p
)
{}
struct
part
*
restrict
p
)
{}
/**
* @brief Kick the additional variables
...
...
@@ -203,7 +205,8 @@ __attribute__((always_inline)) INLINE static void hydro_end_force(
* @param half_dt The half time-step for this kick
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_kick_extra
(
struct
part
*
p
,
struct
xpart
*
xp
,
float
dt
,
float
half_dt
)
{
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
,
float
half_dt
)
{
/* Kick in momentum space */
xp
->
u_full
+=
p
->
u_dt
*
dt
;
...
...
@@ -223,7 +226,7 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
* @param p The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
hydro_convert_quantities
(
struct
part
*
p
)
{}
struct
part
*
restrict
p
)
{}
/**
* @brief Returns the internal energy of a particle
...
...
@@ -236,7 +239,7 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
* @param dt Time since the last kick
*/
__attribute__
((
always_inline
))
INLINE
static
float
hydro_get_internal_energy
(
const
struct
part
*
p
,
float
dt
)
{
const
struct
part
*
restrict
p
,
float
dt
)
{
return
p
->
u
;
}
src/kick.h
View file @
967a0af8
...
...
@@ -33,9 +33,8 @@
* @param new_dti The (integer) time-step for this kick.
* @param timeBase The minimal allowed time-step size.
*/
__attribute__
((
always_inline
))
INLINE
static
void
kick_gpart
(
struct
gpart
*
gp
,
int
new_dti
,
double
timeBase
)
{
__attribute__
((
always_inline
))
INLINE
static
void
kick_gpart
(
struct
gpart
*
restrict
gp
,
int
new_dti
,
double
timeBase
)
{
/* Compute the time step for this kick */
const
int
ti_start
=
(
gp
->
ti_begin
+
gp
->
ti_end
)
/
2
;
...
...
@@ -64,10 +63,9 @@ __attribute__((always_inline)) INLINE static void kick_gpart(struct gpart* gp,
* @param new_dti The (integer) time-step for this kick.
* @param timeBase The minimal allowed time-step size.
*/
__attribute__
((
always_inline
))
INLINE
static
void
kick_part
(
struct
part
*
p
,
struct
xpart
*
xp
,
int
new_dti
,
double
timeBase
)
{
__attribute__
((
always_inline
))
INLINE
static
void
kick_part
(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
int
new_dti
,
double
timeBase
)
{
/* Compute the time step for this kick */
const
int
ti_start
=
(
p
->
ti_begin
+
p
->
ti_end
)
/
2
;
...
...
src/runner.c
View file @
967a0af8
...
...
@@ -119,7 +119,7 @@ void runner_do_grav_external(struct runner *r, struct cell *c, int timer) {
for
(
int
i
=
0
;
i
<
gcount
;
i
++
)
{
/* Get a direct pointer on the part. */
struct
gpart
*
cons
t
g
=
&
gparts
[
i
];
struct
gpart
*
restric
t
g
=
&
gparts
[
i
];
/* Is this part within the time step? */
if
(
g
->
ti_end
<=
ti_current
)
{
...
...
@@ -371,8 +371,8 @@ void runner_do_sort(struct runner *r, struct cell *c, int flags, int clock) {
*/
void
runner_do_init
(
struct
runner
*
r
,
struct
cell
*
c
,
int
timer
)
{
struct
part
*
cons
t
parts
=
c
->
parts
;
struct
gpart
*
cons
t
gparts
=
c
->
gparts
;
struct
part
*
restric
t
parts
=
c
->
parts
;
struct
gpart
*
restric
t
gparts
=
c
->
gparts
;
const
int
count
=
c
->
count
;
const
int
gcount
=
c
->
gcount
;
const
int
ti_current
=
r
->
e
->
ti_current
;
...
...
@@ -390,7 +390,7 @@ void runner_do_init(struct runner *r, struct cell *c, int timer) {
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
/* Get a direct pointer on the part. */
struct
part
*
cons
t
p
=
&
parts
[
i
];
struct
part
*
restric
t
p
=
&
parts
[
i
];
if
(
p
->
ti_end
<=
ti_current
)
{
...
...
@@ -403,7 +403,7 @@ void runner_do_init(struct runner *r, struct cell *c, int timer) {
for
(
int
i
=
0
;
i
<
gcount
;
i
++
)
{
/* Get a direct pointer on the part. */
struct
gpart
*
cons
t
gp
=
&
gparts
[
i
];
struct
gpart
*
restric
t
gp
=
&
gparts
[
i
];
if
(
gp
->
ti_end
<=
ti_current
)
{
...
...
@@ -588,9 +588,9 @@ void runner_do_drift(struct runner *r, struct cell *c, int timer) {
const
double
dt
=
(
r
->
e
->
ti_current
-
r
->
e
->
ti_old
)
*
timeBase
;
const
int
ti_old
=
r
->
e
->
ti_old
;
const
int
ti_current
=
r
->
e
->
ti_current
;
struct
part
*
cons
t
parts
=
c
->
parts
;
struct
xpart
*
cons
t
xparts
=
c
->
xparts
;
struct
gpart
*
cons
t
gparts
=
c
->
gparts
;
struct
part
*
restric
t
parts
=
c
->
parts
;
struct
xpart
*
restric
t
xparts
=
c
->
xparts
;
struct
gpart
*
restric
t
gparts
=
c
->
gparts
;
float
dx_max
=
0
.
f
,
dx2_max
=
0
.
f
,
h_max
=
0
.
f
;
double
e_kin
=
0
.
0
,
e_int
=
0
.
0
,
e_pot
=
0
.
0
,
mass
=
0
.
0
;
...
...
@@ -611,7 +611,7 @@ void runner_do_drift(struct runner *r, struct cell *c, int timer) {
for
(
size_t
k
=
0
;
k
<
nr_gparts
;
k
++
)
{
/* Get a handle on the gpart. */
struct
gpart
*
cons
t
gp
=
&
gparts
[
k
];
struct
gpart
*
restric
t
gp
=
&
gparts
[
k
];
/* Drift... */
drift_gpart
(
gp
,
dt
,
timeBase
,
ti_old
,
ti_current
);
...
...
@@ -628,8 +628,8 @@ void runner_do_drift(struct runner *r, struct cell *c, int timer) {
for
(
size_t
k
=
0
;
k
<
nr_parts
;
k
++
)
{
/* Get a handle on the part. */
struct
part
*
cons
t
p
=
&
parts
[
k
];
struct
xpart
*
cons
t
xp
=
&
xparts
[
k
];
struct
part
*
restric
t
p
=
&
parts
[
k
];
struct
xpart
*
restric
t
xp
=
&
xparts
[
k
];
/* Drift... */
drift_part
(
p
,
xp
,
dt
,
timeBase
,
ti_old
,
ti_current
);
...
...
@@ -684,7 +684,7 @@ void runner_do_drift(struct runner *r, struct cell *c, int timer) {
if
(
c
->
progeny
[
k
]
!=
NULL
)
{
/* Recurse */
struct
cell
*
cp
=
c
->
progeny
[
k
];
struct
cell
*
restrict
cp
=
c
->
progeny
[
k
];
runner_do_drift
(
r
,
cp
,
0
);
/* Collect */
...
...
@@ -734,9 +734,9 @@ void runner_do_kick_fixdt(struct runner *r, struct cell *c, int timer) {
const
double
timeBase
=
r
->
e
->
timeBase
;
const
int
count
=
c
->
count
;
const
int
gcount
=
c
->
gcount
;
struct
part
*
cons
t
parts
=
c
->
parts
;
struct
xpart
*
cons
t
xparts
=
c
->
xparts
;
struct
gpart
*
cons
t
gparts
=
c
->
gparts
;
struct
part
*
restric
t
parts
=
c
->
parts
;
struct
xpart
*
restric
t
xparts
=
c
->
xparts
;
struct
gpart
*
restric
t
gparts
=
c
->
gparts
;
int
updated
=
0
,
g_updated
=
0
;
int
ti_end_min
=
max_nr_timesteps
,
ti_end_max
=
0
;
...
...
@@ -757,7 +757,7 @@ void runner_do_kick_fixdt(struct runner *r, struct cell *c, int timer) {
for
(
int
k
=
0
;
k
<
gcount
;
k
++
)
{
/* Get a handle on the part. */
struct
gpart
*
cons
t
gp
=
&
gparts
[
k
];
struct
gpart
*
restric
t
gp
=
&
gparts
[
k
];
/* If the g-particle has no counterpart */
if
(
gp
->
id_or_neg_offset
>
0
)
{
...
...
@@ -783,8 +783,8 @@ void runner_do_kick_fixdt(struct runner *r, struct cell *c, int timer) {
for
(
int
k
=
0
;
k
<
count
;
k
++
)
{
/* Get a handle on the part. */
struct
part
*
cons
t
p
=
&
parts
[
k
];
struct
xpart
*
cons
t
xp
=
&
xparts
[
k
];
struct
part
*
restric
t
p
=
&
parts
[
k
];
struct
xpart
*
restric
t
xp
=
&
xparts
[
k
];
/* First, finish the force loop */
p
->
h_dt
*=
p
->
h
*
0
.
333333333
f
;
...
...
@@ -812,7 +812,7 @@ void runner_do_kick_fixdt(struct runner *r, struct cell *c, int timer) {
/* Loop over the progeny. */
for
(
int
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
{
struct
cell
*
cons
t
cp
=
c
->
progeny
[
k
];
struct
cell
*
restric
t
cp
=
c
->
progeny
[
k
];
/* Recurse */
runner_do_kick_fixdt
(
r
,
cp
,
0
);
...
...
@@ -849,9 +849,9 @@ void runner_do_kick(struct runner *r, struct cell *c, int timer) {
const
int
ti_current
=
r
->
e
->
ti_current
;
const
int
count
=
c
->
count
;
const
int
gcount
=
c
->
gcount
;
struct
part
*
cons
t
parts
=
c
->
parts
;
struct
xpart
*
cons
t
xparts
=
c
->
xparts
;
struct
gpart
*
cons
t
gparts
=
c
->
gparts
;
struct
part
*
restric
t
parts
=
c
->
parts
;
struct
xpart
*
restric
t
xparts
=
c
->
xparts
;
struct
gpart
*
restric
t
gparts
=
c
->
gparts
;
int
updated
=
0
,
g_updated
=
0
;
int
ti_end_min
=
max_nr_timesteps
,
ti_end_max
=
0
;
...
...
@@ -869,7 +869,7 @@ void runner_do_kick(struct runner *r, struct cell *c, int timer) {
for
(
int
k
=
0
;
k
<
gcount
;
k
++
)
{
/* Get a handle on the part. */
struct
gpart
*
cons
t
gp
=
&
gparts
[
k
];
struct
gpart
*
restric
t
gp
=
&
gparts
[
k
];
/* If the g-particle has no counterpart and needs to be kicked */
if
(
gp
->
id_or_neg_offset
>
0
)
{
...
...
@@ -901,8 +901,8 @@ void runner_do_kick(struct runner *r, struct cell *c, int timer) {
for
(
int
k
=
0
;
k
<
count
;
k
++
)
{
/* Get a handle on the part. */
struct
part
*
cons
t
p
=
&
parts
[
k
];
struct
xpart
*
cons
t
xp
=
&
xparts
[
k
];
struct
part
*
restric
t
p
=
&
parts
[
k
];
struct
xpart
*
restric
t
xp
=
&
xparts
[
k
];
/* If particle needs to be kicked */
if
(
p
->
ti_end
<=
ti_current
)
{
...
...
@@ -937,7 +937,7 @@ void runner_do_kick(struct runner *r, struct cell *c, int timer) {
/* Loop over the progeny. */
for
(
int
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
{
struct
cell
*
cons
t
cp
=
c
->
progeny
[
k
];
struct
cell
*
restric
t
cp
=
c
->
progeny
[
k
];
/* Recurse */
runner_do_kick
(
r
,
cp
,
0
);
...
...
@@ -968,8 +968,8 @@ void runner_do_kick(struct runner *r, struct cell *c, int timer) {
*/
void
runner_do_recv_cell
(
struct
runner
*
r
,
struct
cell
*
c
,
int
timer
)
{
const
struct
part
*
cons
t
parts
=
c
->
parts
;
const
struct
gpart
*
cons
t
gparts
=
c
->
gparts
;
const
struct
part
*
restric
t
parts
=
c
->
parts
;
const
struct
gpart
*
restric
t
gparts
=
c
->
gparts
;
const
size_t
nr_parts
=
c
->
count
;
const
size_t
nr_gparts
=
c
->
gcount
;
// const int ti_current = r->e->ti_current;
...
...
src/timestep.h
View file @
967a0af8
...
...
@@ -66,7 +66,7 @@ __attribute__((always_inline)) INLINE static int get_integer_timestep(
* @param e The #engine (used to get some constants).
*/
__attribute__
((
always_inline
))
INLINE
static
int
get_gpart_timestep
(
const
struct
gpart
*
gp
,
const
struct
engine
*
e
)
{
const
struct
gpart
*
restrict
gp
,
const
struct
engine
*
restrict
e
)
{
const
float
new_dt_external
=
gravity_compute_timestep_external
(
e
->
external_potential
,
e
->
physical_constants
,
gp
);
...
...
@@ -94,7 +94,8 @@ __attribute__((always_inline)) INLINE static int get_gpart_timestep(
* @param e The #engine (used to get some constants).
*/
__attribute__
((
always_inline
))
INLINE
static
int
get_part_timestep
(
const
struct
part
*
p
,
const
struct
xpart
*
xp
,
const
struct
engine
*
e
)
{
const
struct
part
*
restrict
p
,
const
struct
xpart
*
restrict
xp
,
const
struct
engine
*
restrict
e
)
{
/* Compute the next timestep (hydro condition) */
const
float
new_dt_hydro
=
hydro_compute_timestep
(
p
,
xp
,
e
->
hydro_properties
);
...
...
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