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
78d2bc09
Commit
78d2bc09
authored
Aug 14, 2017
by
Matthieu Schaller
Browse files
Better opening angle definition.
parent
2ab13a3e
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
78d2bc09
...
...
@@ -1726,7 +1726,7 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements,
const
int
cdim
[
3
]
=
{
s
->
cdim
[
0
],
s
->
cdim
[
1
],
s
->
cdim
[
2
]};
const
int
cdim_ghost
[
3
]
=
{
s
->
cdim
[
0
]
/
4
+
1
,
s
->
cdim
[
1
]
/
4
+
1
,
s
->
cdim
[
2
]
/
4
+
1
};
const
double
theta_crit
_inv
=
e
->
gravity_properties
->
theta_crit
_inv
;
const
double
theta_crit
=
e
->
gravity_properties
->
theta_crit
;
struct
cell
*
cells
=
s
->
cells_top
;
const
int
n_ghosts
=
cdim_ghost
[
0
]
*
cdim_ghost
[
1
]
*
cdim_ghost
[
2
]
*
2
;
...
...
@@ -1782,7 +1782,7 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements,
if
(
cj
->
nodeID
!=
nodeID
)
continue
;
// MATTHIEU
/* Recover the multipole information */
struct
gravity_tensors
*
const
multi_j
=
cj
->
multipole
;
const
struct
gravity_tensors
*
const
multi_j
=
cj
->
multipole
;
/* Get the distance between the CoMs */
double
dx
=
CoM_i
[
0
]
-
multi_j
->
CoM
[
0
];
...
...
@@ -1798,8 +1798,8 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements,
const
double
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
/* Are the cells too close for a MM interaction ? */
if
(
!
gravity_multipole_accept_rebuild
(
multi_i
,
multi_j
,
theta_crit_inv
,
r2
))
{
if
(
!
gravity_multipole_accept_rebuild
(
multi_i
,
multi_j
,
theta_crit
,
r2
))
{
/* Ok, we need to add a direct pair calculation */
scheduler_addtask
(
sched
,
task_type_pair
,
task_subtype_grav
,
0
,
0
,
...
...
src/multipole.h
View file @
78d2bc09
...
...
@@ -2646,17 +2646,17 @@ INLINE static void gravity_L2P(const struct grav_tensor *lb,
*
* @param ma The #multipole of the first #cell.
* @param mb The #multipole of the second #cell.
* @param theta_crit
_inv The inverse of t
he critical opening angle.
* @param theta_crit
T
he critical opening angle.
* @param r2 Square of the distance (periodically wrapped) between the
* multipoles.
*/
__attribute__
((
always_inline
))
INLINE
static
int
gravity_multipole_accept_rebuild
(
const
struct
gravity_tensors
*
const
ma
,
const
struct
gravity_tensors
*
const
mb
,
double
theta_crit
_inv
,
double
r2
)
{
double
theta_crit
,
double
r2
)
{
const
double
r_crit_a
=
ma
->
r_max_rebuild
*
theta_crit
_inv
;
const
double
r_crit_b
=
mb
->
r_max_rebuild
*
theta_crit
_inv
;
const
double
r_crit_a
=
ma
->
r_max_rebuild
*
theta_crit
;
const
double
r_crit_b
=
mb
->
r_max_rebuild
*
theta_crit
;
// MATTHIEU: Make this mass-dependent ?
...
...
@@ -2673,16 +2673,16 @@ gravity_multipole_accept_rebuild(const struct gravity_tensors *const ma,
*
* @param ma The #multipole of the first #cell.
* @param mb The #multipole of the second #cell.
* @param theta_crit
_inv The inverse of t
he critical opening angle.
* @param theta_crit
T
he critical opening angle.
* @param r2 Square of the distance (periodically wrapped) between the
* multipoles.
*/
__attribute__
((
always_inline
))
INLINE
static
int
gravity_multipole_accept
(
const
struct
gravity_tensors
*
const
ma
,
const
struct
gravity_tensors
*
const
mb
,
double
theta_crit
_inv
,
double
r2
)
{
const
struct
gravity_tensors
*
const
mb
,
double
theta_crit
,
double
r2
)
{
const
double
r_crit_a
=
ma
->
r_max
*
theta_crit
_inv
;
const
double
r_crit_b
=
mb
->
r_max
*
theta_crit
_inv
;
const
double
r_crit_a
=
ma
->
r_max
*
theta_crit
;
const
double
r_crit_b
=
mb
->
r_max
*
theta_crit
;
// MATTHIEU: Make this mass-dependent ?
...
...
src/runner_doiact_grav.h
View file @
78d2bc09
...
...
@@ -1408,7 +1408,7 @@ void runner_dopair_grav(struct runner *r, struct cell *ci, struct cell *cj,
const
double
cell_width
=
s
->
width
[
0
];
const
double
dim
[
3
]
=
{
s
->
dim
[
0
],
s
->
dim
[
1
],
s
->
dim
[
2
]};
const
struct
gravity_props
*
props
=
e
->
gravity_properties
;
const
double
theta_crit
_inv
=
props
->
theta_crit
_inv
;
const
double
theta_crit
=
props
->
theta_crit
;
const
double
max_distance
=
props
->
a_smooth
*
props
->
r_cut_max
*
cell_width
;
const
double
max_distance2
=
max_distance
*
max_distance
;
...
...
@@ -1469,7 +1469,7 @@ void runner_dopair_grav(struct runner *r, struct cell *ci, struct cell *cj,
* option... */
/* Can we use M-M interactions ? */
if
(
gravity_multipole_accept
(
multi_i
,
multi_j
,
theta_crit
_inv
,
r2
))
{
if
(
gravity_multipole_accept
(
multi_i
,
multi_j
,
theta_crit
,
r2
))
{
/* MATTHIEU: make a symmetric M-M interaction function ! */
runner_dopair_grav_mm
(
r
,
ci
,
cj
);
...
...
@@ -1634,7 +1634,7 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) {
const
int
periodic
=
s
->
periodic
;
const
double
cell_width
=
s
->
width
[
0
];
const
double
dim
[
3
]
=
{
s
->
dim
[
0
],
s
->
dim
[
1
],
s
->
dim
[
2
]};
const
double
theta_crit
_inv
=
props
->
theta_crit
_inv
;
const
double
theta_crit
=
props
->
theta_crit
;
const
double
max_distance
=
props
->
a_smooth
*
props
->
r_cut_max
*
cell_width
;
const
double
max_distance2
=
max_distance
*
max_distance
;
...
...
@@ -1693,7 +1693,7 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) {
}
/* Check the multipole acceptance criterion */
if
(
gravity_multipole_accept
(
multi_i
,
multi_j
,
theta_crit
_inv
,
r2
))
{
if
(
gravity_multipole_accept
(
multi_i
,
multi_j
,
theta_crit
,
r2
))
{
/* Go for a (non-symmetric) M-M calculation */
runner_dopair_grav_mm
(
r
,
ci
,
cj
);
...
...
@@ -1716,7 +1716,7 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) {
const
double
r2_rebuild
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
/* Is the criterion violated now but was OK at the last rebuild ? */
if
(
gravity_multipole_accept_rebuild
(
multi_i
,
multi_j
,
theta_crit
_inv
,
if
(
gravity_multipole_accept_rebuild
(
multi_i
,
multi_j
,
theta_crit
,
r2_rebuild
))
{
/* Alright, we have to take charge of that pair in a different way. */
...
...
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