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
92e3be3a
Commit
92e3be3a
authored
Apr 23, 2020
by
Matthieu Schaller
Browse files
Reinstate the two flavours of cell_can_use_pair_mm()
parent
3ccdea59
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
92e3be3a
...
...
@@ -3332,7 +3332,7 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
if
(
lock_unlock
(
&
cj
->
grav
.
mlock
)
!=
0
)
error
(
"Impossible to unlock m-pole"
);
/* Can we use multipoles ? */
if
(
cell_can_use_pair_mm
(
ci
,
cj
,
e
,
sp
))
{
if
(
cell_can_use_pair_mm
(
ci
,
cj
,
e
,
sp
,
/*use_rebuild_sizes=*/
0
))
{
/* Ok, no need to drift anything */
return
;
}
...
...
@@ -6382,15 +6382,16 @@ void cell_reorder_extra_gparts(struct cell *c, struct part *parts,
/**
* @brief Can we use the MM interactions fo a given pair of cells?
*
* This uses the information from the last tree-build.
*
* @param ci The first #cell.
* @param cj The second #cell.
* @param e The #engine.
* @param s The #space.
* @param use_rebuild_sizes Are we considering the sizes at the last tree-build
* (1) or current sizes (0)?
*/
int
cell_can_use_pair_mm
(
const
struct
cell
*
ci
,
const
struct
cell
*
cj
,
const
struct
engine
*
e
,
const
struct
space
*
s
)
{
const
struct
engine
*
e
,
const
struct
space
*
s
,
const
int
use_rebuild_sizes
)
{
const
struct
gravity_props
*
props
=
e
->
gravity_properties
;
const
int
periodic
=
s
->
periodic
;
...
...
@@ -6414,5 +6415,5 @@ int cell_can_use_pair_mm(const struct cell *ci, const struct cell *cj,
const
double
r2
=
dx
*
dx
+
dy
*
dy
+
dz
*
dz
;
return
gravity_M2L_accept_symmetric
(
props
,
multi_i
,
multi_j
,
r2
,
/*
use_rebuild_sizes
=*/
1
);
use_rebuild_sizes
);
}
src/cell.h
View file @
92e3be3a
...
...
@@ -959,7 +959,8 @@ void cell_reorder_extra_gparts(struct cell *c, struct part *parts,
struct
spart
*
sparts
);
void
cell_reorder_extra_sparts
(
struct
cell
*
c
,
const
ptrdiff_t
sparts_offset
);
int
cell_can_use_pair_mm
(
const
struct
cell
*
ci
,
const
struct
cell
*
cj
,
const
struct
engine
*
e
,
const
struct
space
*
s
);
const
struct
engine
*
e
,
const
struct
space
*
s
,
const
int
use_rebuild_sizes
);
/**
* @brief Compute the square of the minimal distance between any two points in
...
...
src/engine_maketasks.c
View file @
92e3be3a
...
...
@@ -1381,7 +1381,7 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements,
if
(
periodic
&&
min_radius2
>
max_distance2
)
continue
;
/* Are the cells too close for a MM interaction ? */
if
(
!
cell_can_use_pair_mm
(
ci
,
cj
,
e
,
s
))
{
if
(
!
cell_can_use_pair_mm
(
ci
,
cj
,
e
,
s
,
/*use_rebuild_sizes=*/
1
))
{
/* Ok, we need to add a direct pair calculation */
scheduler_addtask
(
sched
,
task_type_pair
,
task_subtype_grav
,
0
,
0
,
...
...
src/scheduler.c
View file @
92e3be3a
...
...
@@ -873,7 +873,7 @@ static void scheduler_splittask_gravity(struct task *t, struct scheduler *s) {
if
(
cj
->
progeny
[
j
]
!=
NULL
)
{
/* Can we use a M-M interaction here? */
if
(
cell_can_use_pair_mm
(
ci
->
progeny
[
i
],
cj
->
progeny
[
j
],
e
,
sp
))
{
sp
,
/*use_rebuild_sizes=*/
1
))
{
/* Flag this pair as being treated by the M-M task.
* We use the 64 bits in the task->flags field to store
...
...
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