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
4d84c518
Commit
4d84c518
authored
5 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Prevent FPE in the M2L MAC since we still have size 0 multipoles
parent
528af56a
No related branches found
No related tags found
1 merge request
!1077
Improved multipole acceptance criterion (MAC)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/multipole_accept.h
+7
-5
7 additions, 5 deletions
src/multipole_accept.h
with
7 additions
and
5 deletions
src/multipole_accept.h
+
7
−
5
View file @
4d84c518
...
@@ -57,8 +57,8 @@ __attribute__((nonnull, pure)) INLINE static int gravity_M2L_accept(
...
@@ -57,8 +57,8 @@ __attribute__((nonnull, pure)) INLINE static int gravity_M2L_accept(
const
float
rho_B
=
use_rebuild_sizes
?
B
->
r_max_rebuild
:
B
->
r_max
;
const
float
rho_B
=
use_rebuild_sizes
?
B
->
r_max_rebuild
:
B
->
r_max
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
if
(
rho_A
==
0
.)
error
(
"Size of multipole A is 0!"
);
//
if (rho_A == 0.) error("Size of multipole A is 0!");
if
(
rho_B
==
0
.)
error
(
"Size of multipole B is 0!"
);
//
if (rho_B == 0.) error("Size of multipole B is 0!");
#endif
#endif
/* Compute the error estimator (without the 1/M_B term that cancels out) */
/* Compute the error estimator (without the 1/M_B term that cancels out) */
...
@@ -68,8 +68,10 @@ __attribute__((nonnull, pure)) INLINE static int gravity_M2L_accept(
...
@@ -68,8 +68,10 @@ __attribute__((nonnull, pure)) INLINE static int gravity_M2L_accept(
binomial
(
p
,
n
)
*
B
->
m_pole
.
power
[
n
]
*
integer_powf
(
rho_A
,
p
-
n
);
binomial
(
p
,
n
)
*
B
->
m_pole
.
power
[
n
]
*
integer_powf
(
rho_A
,
p
-
n
);
}
}
E_BA_term
*=
8
.
f
;
E_BA_term
*=
8
.
f
;
E_BA_term
*=
max
(
rho_A
,
rho_B
);
if
(
rho_A
!=
0
.
&&
rho_B
!=
0
.)
{
E_BA_term
/=
(
rho_A
+
rho_B
);
E_BA_term
*=
max
(
rho_A
,
rho_B
);
E_BA_term
/=
(
rho_A
+
rho_B
);
}
/* Compute r^(p+2) */
/* Compute r^(p+2) */
#if SELF_GRAVITY_MULTIPOLE_ORDER % 2 == 1
#if SELF_GRAVITY_MULTIPOLE_ORDER % 2 == 1
...
@@ -171,7 +173,7 @@ __attribute__((nonnull, pure)) INLINE static int gravity_M2P_accept(
...
@@ -171,7 +173,7 @@ __attribute__((nonnull, pure)) INLINE static int gravity_M2P_accept(
const
float
rho_B
=
B
->
r_max
;
const
float
rho_B
=
B
->
r_max
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
if
(
rho_B
==
0
.)
error
(
"Size of multipole B is 0!"
);
//
if (rho_B == 0.) error("Size of multipole B is 0!");
#endif
#endif
/* Compute the error estimator (without the 1/M_B term that cancels out) */
/* Compute the error estimator (without the 1/M_B term that cancels out) */
...
...
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