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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
5106ef95
Commit
5106ef95
authored
Jun 30, 2018
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Do not compute the high-order softened derivatives as the resulting term is 0 anyway.
parent
37b66011
No related branches found
No related tags found
1 merge request
!566
Periodic gravity calculation
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/kernel_gravity.h
+13
-29
13 additions, 29 deletions
src/kernel_gravity.h
with
13 additions
and
29 deletions
src/kernel_gravity.h
+
13
−
29
View file @
5106ef95
...
...
@@ -170,14 +170,14 @@ __attribute__((always_inline)) INLINE static void kernel_grav_eval_force_double(
__attribute__
((
always_inline
))
INLINE
static
float
D_soft_1
(
float
u
,
float
u_inv
)
{
/* phi(u) =
-
3u^7
+
15u^6
-
28u^5
+
21u^4
-
7u^2
+
3 */
float
phi
=
-
3
.
f
*
u
+
15
.
f
;
phi
=
phi
*
u
-
28
.
f
;
phi
=
phi
*
u
+
21
.
f
;
/* phi(u) = 3u^7
-
15u^6
+
28u^5
-
21u^4
+
7u^2
-
3 */
float
phi
=
3
.
f
*
u
-
15
.
f
;
phi
=
phi
*
u
+
28
.
f
;
phi
=
phi
*
u
-
21
.
f
;
phi
=
phi
*
u
;
phi
=
phi
*
u
-
7
.
f
;
phi
=
phi
*
u
+
7
.
f
;
phi
=
phi
*
u
;
phi
=
phi
*
u
+
3
.
f
;
phi
=
phi
*
u
-
3
.
f
;
return
phi
;
}
...
...
@@ -198,43 +198,27 @@ __attribute__((always_inline)) INLINE static float D_soft_3(float u,
__attribute__
((
always_inline
))
INLINE
static
float
D_soft_5
(
float
u
,
float
u_inv
)
{
/* (phi'(u)/u)'/u =
-
105u^3
+
360u^2
-
420u
+
168 */
float
phi
=
-
105
.
f
*
u
+
360
.
f
;
phi
=
phi
*
u
-
420
.
f
;
phi
=
phi
*
u
+
168
.
f
;
/* (phi'(u)/u)'/u = 105u^3
-
360u^2
+
420u
-
168 */
float
phi
=
105
.
f
*
u
-
360
.
f
;
phi
=
phi
*
u
+
420
.
f
;
phi
=
phi
*
u
-
168
.
f
;
return
phi
;
}
__attribute__
((
always_inline
))
INLINE
static
float
D_soft_7
(
float
u
,
float
u_inv
)
{
/* ((phi'(u)/u)'/u)'/u = 315u - 720 + 420u^-1 */
return
315
.
f
*
u
-
720
.
f
+
420
.
f
*
u_inv
;
return
0
.
f
;
}
__attribute__
((
always_inline
))
INLINE
static
float
D_soft_9
(
float
u
,
float
u_inv
)
{
/* (((phi'(u)/u)'/u)'/u)'/u = -315u^-1 + 420u^-3 */
float
phi
=
420
.
f
*
u_inv
;
phi
=
phi
*
u_inv
-
315
.
f
;
phi
=
phi
*
u_inv
;
return
phi
;
return
0
.
f
;
}
__attribute__
((
always_inline
))
INLINE
static
float
D_soft_11
(
float
u
,
float
u_inv
)
{
/* ((((phi'(u)/u)'/u)'/u)'/u)'/u = 315u^-3 - 1260u^-5 */
float
phi
=
-
1260
.
f
*
u_inv
;
phi
=
phi
*
u_inv
+
315
.
f
;
phi
=
phi
*
u_inv
;
phi
=
phi
*
u_inv
;
phi
=
phi
*
u_inv
;
return
phi
;
return
0
.
f
;
}
#endif
/* SWIFT_KERNEL_GRAVITY_H */
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
sign in
to comment