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
3348cd78
Commit
3348cd78
authored
Mar 22, 2016
by
Matthieu Schaller
Browse files
Save a sqrtf() call per particle in drift task
parent
bbc67d7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/runner.c
View file @
3348cd78
...
...
@@ -709,16 +709,18 @@ void runner_dodrift(struct runner *r, struct cell *c, int timer) {
/* Predict the values of the extra fields */
hydro_predict_extra
(
p
,
xp
,
ti_old
,
ti_current
,
timeBase
);
/* Compute motion since last cell construction */
const
float
dx
=
sqrtf
((
p
->
x
[
0
]
-
xp
->
x_old
[
0
])
*
(
p
->
x
[
0
]
-
xp
->
x_old
[
0
])
+
(
p
->
x
[
1
]
-
xp
->
x_old
[
1
])
*
(
p
->
x
[
1
]
-
xp
->
x_old
[
1
])
+
(
p
->
x
[
2
]
-
xp
->
x_old
[
2
])
*
(
p
->
x
[
2
]
-
xp
->
x_old
[
2
]));
/* Compute (square of) motion since last cell construction */
const
float
dx
=
(
p
->
x
[
0
]
-
xp
->
x_old
[
0
])
*
(
p
->
x
[
0
]
-
xp
->
x_old
[
0
])
+
(
p
->
x
[
1
]
-
xp
->
x_old
[
1
])
*
(
p
->
x
[
1
]
-
xp
->
x_old
[
1
])
+
(
p
->
x
[
2
]
-
xp
->
x_old
[
2
])
*
(
p
->
x
[
2
]
-
xp
->
x_old
[
2
]);
dx_max
=
fmaxf
(
dx_max
,
dx
);
/* Maximal smoothing length */
h_max
=
fmaxf
(
p
->
h
,
h_max
);
}
/* Now, get the maximal particle motion from its square */
dx_max
=
sqrtf
(
dx_max
);
}
/* Otherwise, aggregate data from children. */
...
...
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