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
c76866d5
Commit
c76866d5
authored
Aug 10, 2019
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Fix the debugging checks in the gravity calculation to use the maximal softening length as well.
parent
0a234e1b
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!884
Support for multiple softening lengths in the gravity solver
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/runner_doiact_grav.h
+28
-24
28 additions, 24 deletions
src/runner_doiact_grav.h
with
28 additions
and
24 deletions
src/runner_doiact_grav.h
+
28
−
24
View file @
c76866d5
...
@@ -219,8 +219,14 @@ static INLINE void runner_dopair_grav_pp_full(
...
@@ -219,8 +219,14 @@ static INLINE void runner_dopair_grav_pp_full(
const
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
const
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
/* Pick the maximal softening length of i and j */
const
float
h
=
max
(
h_i
,
h_j
);
const
float
h2
=
h
*
h
;
const
float
h_inv
=
1
.
f
/
h
;
const
float
h_inv_3
=
h_inv
*
h_inv
*
h_inv
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
if
(
r2
==
0
.
f
&&
h2
_i
==
0
.)
if
(
r2
==
0
.
f
&&
h2
==
0
.)
error
(
"Interacting particles with 0 distance and 0 softening."
);
error
(
"Interacting particles with 0 distance and 0 softening."
);
/* Check that particles have been drifted to the current time */
/* Check that particles have been drifted to the current time */
...
@@ -244,11 +250,6 @@ static INLINE void runner_dopair_grav_pp_full(
...
@@ -244,11 +250,6 @@ static INLINE void runner_dopair_grav_pp_full(
error
(
"Adding forces to an un-initialised gpart."
);
error
(
"Adding forces to an un-initialised gpart."
);
#endif
#endif
const
float
h
=
max
(
h_i
,
h_j
);
const
float
h2
=
h
*
h
;
const
float
h_inv
=
1
.
f
/
h
;
const
float
h_inv_3
=
h_inv
*
h_inv
*
h_inv
;
/* Interact! */
/* Interact! */
float
f_ij
,
pot_ij
;
float
f_ij
,
pot_ij
;
runner_iact_grav_pp_full
(
r2
,
h2
,
h_inv
,
h_inv_3
,
mass_j
,
&
f_ij
,
&
pot_ij
);
runner_iact_grav_pp_full
(
r2
,
h2
,
h_inv
,
h_inv_3
,
mass_j
,
&
f_ij
,
&
pot_ij
);
...
@@ -361,8 +362,14 @@ static INLINE void runner_dopair_grav_pp_truncated(
...
@@ -361,8 +362,14 @@ static INLINE void runner_dopair_grav_pp_truncated(
const
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
const
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
/* Pick the maximal softening length of i and j */
const
float
h
=
max
(
h_i
,
h_j
);
const
float
h2
=
h
*
h
;
const
float
h_inv
=
1
.
f
/
h
;
const
float
h_inv_3
=
h_inv
*
h_inv
*
h_inv
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
if
(
r2
==
0
.
f
&&
h2
_i
==
0
.)
if
(
r2
==
0
.
f
&&
h2
==
0
.)
error
(
"Interacting particles with 0 distance and 0 softening."
);
error
(
"Interacting particles with 0 distance and 0 softening."
);
/* Check that particles have been drifted to the current time */
/* Check that particles have been drifted to the current time */
...
@@ -386,11 +393,6 @@ static INLINE void runner_dopair_grav_pp_truncated(
...
@@ -386,11 +393,6 @@ static INLINE void runner_dopair_grav_pp_truncated(
error
(
"Adding forces to an un-initialised gpart."
);
error
(
"Adding forces to an un-initialised gpart."
);
#endif
#endif
const
float
h
=
max
(
h_i
,
h_j
);
const
float
h2
=
h
*
h
;
const
float
h_inv
=
1
.
f
/
h
;
const
float
h_inv_3
=
h_inv
*
h_inv
*
h_inv
;
/* Interact! */
/* Interact! */
float
f_ij
,
pot_ij
;
float
f_ij
,
pot_ij
;
runner_iact_grav_pp_truncated
(
r2
,
h2
,
h_inv
,
h_inv_3
,
mass_j
,
r_s_inv
,
runner_iact_grav_pp_truncated
(
r2
,
h2
,
h_inv
,
h_inv_3
,
mass_j
,
r_s_inv
,
...
@@ -952,8 +954,14 @@ static INLINE void runner_doself_grav_pp_full(
...
@@ -952,8 +954,14 @@ static INLINE void runner_doself_grav_pp_full(
const
float
dz
=
z_j
-
z_i
;
const
float
dz
=
z_j
-
z_i
;
const
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
const
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
/* Pick the maximal softening length of i and j */
const
float
h
=
max
(
h_i
,
h_j
);
const
float
h2
=
h
*
h
;
const
float
h_inv
=
1
.
f
/
h
;
const
float
h_inv_3
=
h_inv
*
h_inv
*
h_inv
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
if
(
r2
==
0
.
f
&&
h2
_i
==
0
.)
if
(
r2
==
0
.
f
&&
h2
==
0
.)
error
(
"Interacting particles with 0 distance and 0 softening."
);
error
(
"Interacting particles with 0 distance and 0 softening."
);
/* Check that particles have been drifted to the current time */
/* Check that particles have been drifted to the current time */
...
@@ -976,11 +984,6 @@ static INLINE void runner_doself_grav_pp_full(
...
@@ -976,11 +984,6 @@ static INLINE void runner_doself_grav_pp_full(
error
(
"Adding forces to an un-initialised gpart."
);
error
(
"Adding forces to an un-initialised gpart."
);
#endif
#endif
const
float
h
=
max
(
h_i
,
h_j
);
const
float
h2
=
h
*
h
;
const
float
h_inv
=
1
.
f
/
h
;
const
float
h_inv_3
=
h_inv
*
h_inv
*
h_inv
;
/* Interact! */
/* Interact! */
float
f_ij
,
pot_ij
;
float
f_ij
,
pot_ij
;
runner_iact_grav_pp_full
(
r2
,
h2
,
h_inv
,
h_inv_3
,
mass_j
,
&
f_ij
,
&
pot_ij
);
runner_iact_grav_pp_full
(
r2
,
h2
,
h_inv
,
h_inv_3
,
mass_j
,
&
f_ij
,
&
pot_ij
);
...
@@ -1077,8 +1080,14 @@ static INLINE void runner_doself_grav_pp_truncated(
...
@@ -1077,8 +1080,14 @@ static INLINE void runner_doself_grav_pp_truncated(
const
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
const
float
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
/* Pick the maximal softening length of i and j */
const
float
h
=
max
(
h_i
,
h_j
);
const
float
h2
=
h
*
h
;
const
float
h_inv
=
1
.
f
/
h
;
const
float
h_inv_3
=
h_inv
*
h_inv
*
h_inv
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
if
(
r2
==
0
.
f
&&
h2
_i
==
0
.)
if
(
r2
==
0
.
f
&&
h2
==
0
.)
error
(
"Interacting particles with 0 distance and 0 softening."
);
error
(
"Interacting particles with 0 distance and 0 softening."
);
/* Check that particles have been drifted to the current time */
/* Check that particles have been drifted to the current time */
...
@@ -1101,11 +1110,6 @@ static INLINE void runner_doself_grav_pp_truncated(
...
@@ -1101,11 +1110,6 @@ static INLINE void runner_doself_grav_pp_truncated(
error
(
"Adding forces to an un-initialised gpart."
);
error
(
"Adding forces to an un-initialised gpart."
);
#endif
#endif
const
float
h
=
max
(
h_i
,
h_j
);
const
float
h2
=
h
*
h
;
const
float
h_inv
=
1
.
f
/
h
;
const
float
h_inv_3
=
h_inv
*
h_inv
*
h_inv
;
/* Interact! */
/* Interact! */
float
f_ij
,
pot_ij
;
float
f_ij
,
pot_ij
;
runner_iact_grav_pp_truncated
(
r2
,
h2
,
h_inv
,
h_inv_3
,
mass_j
,
r_s_inv
,
runner_iact_grav_pp_truncated
(
r2
,
h2
,
h_inv
,
h_inv_3
,
mass_j
,
r_s_inv
,
...
...
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