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
a98b6b56
Commit
a98b6b56
authored
Sep 11, 2017
by
Matthieu Schaller
Browse files
Do the PAIR interactions in the frame of cj, not in the frame of ci.
parent
84e7fdc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/runner.c
View file @
a98b6b56
...
...
@@ -670,8 +670,8 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
/* Get a direct pointer on the part. */
struct
part
*
restrict
p
=
&
parts
[
pid
[
i
]];
struct
xpart
*
restrict
xp
=
&
xparts
[
pid
[
i
]];
struct
part
*
p
=
&
parts
[
pid
[
i
]];
struct
xpart
*
xp
=
&
xparts
[
pid
[
i
]];
#ifdef SWIFT_DEBUG_CHECKS
/* Is this part within the timestep? */
...
...
src/runner_doiact.h
View file @
a98b6b56
...
...
@@ -158,9 +158,9 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci,
const
int
pi_active
=
part_is_active
(
pi
,
e
);
const
float
hi
=
pi
->
h
;
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
const
float
pix
[
3
]
=
{
pi
->
x
[
0
]
-
(
c
i
->
loc
[
0
]
+
shift
[
0
]),
pi
->
x
[
1
]
-
(
c
i
->
loc
[
1
]
+
shift
[
1
]),
pi
->
x
[
2
]
-
(
c
i
->
loc
[
2
]
+
shift
[
2
])};
const
float
pix
[
3
]
=
{
pi
->
x
[
0
]
-
(
c
j
->
loc
[
0
]
+
shift
[
0
]),
pi
->
x
[
1
]
-
(
c
j
->
loc
[
1
]
+
shift
[
1
]),
pi
->
x
[
2
]
-
(
c
j
->
loc
[
2
]
+
shift
[
2
])};
/* Loop over the parts in cj. */
for
(
int
pjd
=
0
;
pjd
<
count_j
;
pjd
++
)
{
...
...
@@ -172,8 +172,8 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci,
const
int
pj_active
=
part_is_active
(
pj
,
e
);
/* Compute the pairwise distance. */
const
float
pjx
[
3
]
=
{
pj
->
x
[
0
]
-
c
i
->
loc
[
0
],
pj
->
x
[
1
]
-
c
i
->
loc
[
1
],
pj
->
x
[
2
]
-
c
i
->
loc
[
2
]};
const
float
pjx
[
3
]
=
{
pj
->
x
[
0
]
-
c
j
->
loc
[
0
],
pj
->
x
[
1
]
-
c
j
->
loc
[
1
],
pj
->
x
[
2
]
-
c
j
->
loc
[
2
]};
float
dx
[
3
]
=
{
pix
[
0
]
-
pjx
[
0
],
pix
[
1
]
-
pjx
[
1
],
pix
[
2
]
-
pjx
[
2
]};
const
float
r2
=
dx
[
0
]
*
dx
[
0
]
+
dx
[
1
]
*
dx
[
1
]
+
dx
[
2
]
*
dx
[
2
];
...
...
@@ -242,9 +242,9 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci,
const
int
pi_active
=
part_is_active
(
pi
,
e
);
const
float
hi
=
pi
->
h
;
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
const
float
pix
[
3
]
=
{
pi
->
x
[
0
]
-
(
c
i
->
loc
[
0
]
+
shift
[
0
]),
pi
->
x
[
1
]
-
(
c
i
->
loc
[
1
]
+
shift
[
1
]),
pi
->
x
[
2
]
-
(
c
i
->
loc
[
2
]
+
shift
[
2
])};
const
float
pix
[
3
]
=
{
pi
->
x
[
0
]
-
(
c
j
->
loc
[
0
]
+
shift
[
0
]),
pi
->
x
[
1
]
-
(
c
j
->
loc
[
1
]
+
shift
[
1
]),
pi
->
x
[
2
]
-
(
c
j
->
loc
[
2
]
+
shift
[
2
])};
/* Loop over the parts in cj. */
for
(
int
pjd
=
0
;
pjd
<
count_j
;
pjd
++
)
{
...
...
@@ -256,8 +256,8 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci,
const
float
hjg2
=
hj
*
hj
*
kernel_gamma2
;
/* Compute the pairwise distance. */
const
float
pjx
[
3
]
=
{
pj
->
x
[
0
]
-
c
i
->
loc
[
0
],
pj
->
x
[
1
]
-
c
i
->
loc
[
1
],
pj
->
x
[
2
]
-
c
i
->
loc
[
2
]};
const
float
pjx
[
3
]
=
{
pj
->
x
[
0
]
-
c
j
->
loc
[
0
],
pj
->
x
[
1
]
-
c
j
->
loc
[
1
],
pj
->
x
[
2
]
-
c
j
->
loc
[
2
]};
float
dx
[
3
]
=
{
pix
[
0
]
-
pjx
[
0
],
pix
[
1
]
-
pjx
[
1
],
pix
[
2
]
-
pjx
[
2
]};
const
float
r2
=
dx
[
0
]
*
dx
[
0
]
+
dx
[
1
]
*
dx
[
1
]
+
dx
[
2
]
*
dx
[
2
];
...
...
@@ -509,8 +509,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
const
float
hi
=
pi
->
h
;
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
const
double
di
=
hi
*
kernel_gamma
+
dxj
+
pix
*
runner_shift
[
sid
][
0
]
+
piy
*
runner_shift
[
sid
][
1
]
+
piz
*
runner_shift
[
sid
][
2
];
piy
*
runner_shift
[
sid
][
1
]
+
piz
*
runner_shift
[
sid
][
2
];
/* Loop over the parts in cj. */
for
(
int
pjd
=
0
;
pjd
<
count_j
&&
sort_j
[
pjd
].
d
<
di
;
pjd
++
)
{
...
...
@@ -548,9 +547,8 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
const
double
piz
=
pi
->
x
[
2
]
-
(
shift
[
2
]);
const
float
hi
=
pi
->
h
;
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
const
double
di
=
-
hi
*
kernel_gamma
-
dxj
+
pix
*
runner_shift
[
sid
][
0
]
+
piy
*
runner_shift
[
sid
][
1
]
+
piz
*
runner_shift
[
sid
][
2
];
const
double
di
=
-
hi
*
kernel_gamma
-
dxj
+
pix
*
runner_shift
[
sid
][
0
]
+
piy
*
runner_shift
[
sid
][
1
]
+
piz
*
runner_shift
[
sid
][
2
];
/* Loop over the parts in cj. */
for
(
int
pjd
=
count_j
-
1
;
pjd
>=
0
&&
di
<
sort_j
[
pjd
].
d
;
pjd
--
)
{
...
...
@@ -603,8 +601,8 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
/* Get a hold of the ith part in ci. */
struct
part
*
pi
=
&
parts
[
ind
[
pid
]];
const
float
pix
[
3
]
=
{
pi
->
x
[
0
]
-
c
i
->
loc
[
0
],
pi
->
x
[
1
]
-
c
i
->
loc
[
1
],
pi
->
x
[
2
]
-
c
i
->
loc
[
2
]};
const
float
pix
[
3
]
=
{
pi
->
x
[
0
]
-
c
j
->
loc
[
0
],
pi
->
x
[
1
]
-
c
j
->
loc
[
1
],
pi
->
x
[
2
]
-
c
j
->
loc
[
2
]};
const
float
hi
=
pi
->
h
;
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
...
...
@@ -619,8 +617,8 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
struct
part
*
restrict
pj
=
&
parts_j
[
pjd
];
/* Compute the pairwise distance. */
const
float
pjx
[
3
]
=
{
pj
->
x
[
0
]
-
c
i
->
loc
[
0
],
pj
->
x
[
1
]
-
c
i
->
loc
[
1
],
pj
->
x
[
2
]
-
c
i
->
loc
[
2
]};
const
float
pjx
[
3
]
=
{
pj
->
x
[
0
]
-
c
j
->
loc
[
0
],
pj
->
x
[
1
]
-
c
j
->
loc
[
1
],
pj
->
x
[
2
]
-
c
j
->
loc
[
2
]};
float
dx
[
3
]
=
{
pix
[
0
]
-
pjx
[
0
],
pix
[
1
]
-
pjx
[
1
],
pix
[
2
]
-
pjx
[
2
]};
const
float
r2
=
dx
[
0
]
*
dx
[
0
]
+
dx
[
1
]
*
dx
[
1
]
+
dx
[
2
]
*
dx
[
2
];
...
...
@@ -725,9 +723,9 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
/* Get some additional information about pi */
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
const
float
pix
=
pi
->
x
[
0
]
-
(
c
i
->
loc
[
0
]
+
shift
[
0
]);
const
float
piy
=
pi
->
x
[
1
]
-
(
c
i
->
loc
[
1
]
+
shift
[
1
]);
const
float
piz
=
pi
->
x
[
2
]
-
(
c
i
->
loc
[
2
]
+
shift
[
2
]);
const
float
pix
=
pi
->
x
[
0
]
-
(
c
j
->
loc
[
0
]
+
shift
[
0
]);
const
float
piy
=
pi
->
x
[
1
]
-
(
c
j
->
loc
[
1
]
+
shift
[
1
]);
const
float
piz
=
pi
->
x
[
2
]
-
(
c
j
->
loc
[
2
]
+
shift
[
2
]);
/* Loop over the parts in cj. */
for
(
int
pjd
=
0
;
pjd
<
count_j
&&
sort_j
[
pjd
].
d
<
di
;
pjd
++
)
{
...
...
@@ -735,9 +733,9 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
/* Recover pj */
struct
part
*
pj
=
&
parts_j
[
sort_j
[
pjd
].
i
];
const
float
hj
=
pj
->
h
;
const
float
pjx
=
pj
->
x
[
0
]
-
c
i
->
loc
[
0
];
const
float
pjy
=
pj
->
x
[
1
]
-
c
i
->
loc
[
1
];
const
float
pjz
=
pj
->
x
[
2
]
-
c
i
->
loc
[
2
];
const
float
pjx
=
pj
->
x
[
0
]
-
c
j
->
loc
[
0
];
const
float
pjy
=
pj
->
x
[
1
]
-
c
j
->
loc
[
1
];
const
float
pjz
=
pj
->
x
[
2
]
-
c
j
->
loc
[
2
];
/* Compute the pairwise distance. */
float
dx
[
3
]
=
{
pix
-
pjx
,
piy
-
pjy
,
piz
-
pjz
};
...
...
@@ -779,9 +777,9 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
/* Get some additional information about pj */
const
float
hjg2
=
hj
*
hj
*
kernel_gamma2
;
const
float
pjx
=
pj
->
x
[
0
]
-
c
i
->
loc
[
0
];
const
float
pjy
=
pj
->
x
[
1
]
-
c
i
->
loc
[
1
];
const
float
pjz
=
pj
->
x
[
2
]
-
c
i
->
loc
[
2
];
const
float
pjx
=
pj
->
x
[
0
]
-
c
j
->
loc
[
0
];
const
float
pjy
=
pj
->
x
[
1
]
-
c
j
->
loc
[
1
];
const
float
pjz
=
pj
->
x
[
2
]
-
c
j
->
loc
[
2
];
/* Loop over the parts in ci. */
for
(
int
pid
=
count_i
-
1
;
pid
>=
0
&&
sort_i
[
pid
].
d
>
dj
;
pid
--
)
{
...
...
@@ -789,9 +787,9 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
/* Recover pi */
struct
part
*
pi
=
&
parts_i
[
sort_i
[
pid
].
i
];
const
float
hi
=
pi
->
h
;
const
float
pix
=
pi
->
x
[
0
]
-
(
c
i
->
loc
[
0
]
+
shift
[
0
]);
const
float
piy
=
pi
->
x
[
1
]
-
(
c
i
->
loc
[
1
]
+
shift
[
1
]);
const
float
piz
=
pi
->
x
[
2
]
-
(
c
i
->
loc
[
2
]
+
shift
[
2
]);
const
float
pix
=
pi
->
x
[
0
]
-
(
c
j
->
loc
[
0
]
+
shift
[
0
]);
const
float
piy
=
pi
->
x
[
1
]
-
(
c
j
->
loc
[
1
]
+
shift
[
1
]);
const
float
piz
=
pi
->
x
[
2
]
-
(
c
j
->
loc
[
2
]
+
shift
[
2
]);
/* Compute the pairwise distance. */
float
dx
[
3
]
=
{
pjx
-
pix
,
pjy
-
piy
,
pjz
-
piz
};
...
...
@@ -973,9 +971,9 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) {
/* Get some additional information about pi */
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
const
float
pix
=
pi
->
x
[
0
]
-
(
c
i
->
loc
[
0
]
+
shift
[
0
]);
const
float
piy
=
pi
->
x
[
1
]
-
(
c
i
->
loc
[
1
]
+
shift
[
1
]);
const
float
piz
=
pi
->
x
[
2
]
-
(
c
i
->
loc
[
2
]
+
shift
[
2
]);
const
float
pix
=
pi
->
x
[
0
]
-
(
c
j
->
loc
[
0
]
+
shift
[
0
]);
const
float
piy
=
pi
->
x
[
1
]
-
(
c
j
->
loc
[
1
]
+
shift
[
1
]);
const
float
piz
=
pi
->
x
[
2
]
-
(
c
j
->
loc
[
2
]
+
shift
[
2
]);
/* Now loop over the relevant particles in cj */
for
(
int
pjd
=
0
;
pjd
<=
last_pj
;
++
pjd
)
{
...
...
@@ -984,9 +982,9 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) {
struct
part
*
pj
=
&
parts_j
[
sort_j
[
pjd
].
i
];
const
float
hj
=
pj
->
h
;
const
float
hjg2
=
hj
*
hj
*
kernel_gamma2
;
const
float
pjx
=
pj
->
x
[
0
]
-
c
i
->
loc
[
0
];
const
float
pjy
=
pj
->
x
[
1
]
-
c
i
->
loc
[
1
];
const
float
pjz
=
pj
->
x
[
2
]
-
c
i
->
loc
[
2
];
const
float
pjx
=
pj
->
x
[
0
]
-
c
j
->
loc
[
0
];
const
float
pjy
=
pj
->
x
[
1
]
-
c
j
->
loc
[
1
];
const
float
pjz
=
pj
->
x
[
2
]
-
c
j
->
loc
[
2
];
/* Compute the pairwise distance. */
float
dx
[
3
]
=
{
pix
-
pjx
,
piy
-
pjy
,
piz
-
pjz
};
...
...
@@ -1027,9 +1025,9 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) {
/* Get some additional information about pj */
const
float
hjg2
=
hj
*
hj
*
kernel_gamma2
;
const
float
pjx
=
pj
->
x
[
0
]
-
c
i
->
loc
[
0
];
const
float
pjy
=
pj
->
x
[
1
]
-
c
i
->
loc
[
1
];
const
float
pjz
=
pj
->
x
[
2
]
-
c
i
->
loc
[
2
];
const
float
pjx
=
pj
->
x
[
0
]
-
c
j
->
loc
[
0
];
const
float
pjy
=
pj
->
x
[
1
]
-
c
j
->
loc
[
1
];
const
float
pjz
=
pj
->
x
[
2
]
-
c
j
->
loc
[
2
];
/* Now loop over the relevant particles in ci */
for
(
int
pid
=
count_i
-
1
;
pid
>=
first_pi
;
--
pid
)
{
...
...
@@ -1038,9 +1036,9 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) {
struct
part
*
pi
=
&
parts_i
[
sort_i
[
pid
].
i
];
const
float
hi
=
pi
->
h
;
const
float
hig2
=
hi
*
hi
*
kernel_gamma2
;
const
float
pix
=
pi
->
x
[
0
]
-
(
c
i
->
loc
[
0
]
+
shift
[
0
]);
const
float
piy
=
pi
->
x
[
1
]
-
(
c
i
->
loc
[
1
]
+
shift
[
1
]);
const
float
piz
=
pi
->
x
[
2
]
-
(
c
i
->
loc
[
2
]
+
shift
[
2
]);
const
float
pix
=
pi
->
x
[
0
]
-
(
c
j
->
loc
[
0
]
+
shift
[
0
]);
const
float
piy
=
pi
->
x
[
1
]
-
(
c
j
->
loc
[
1
]
+
shift
[
1
]);
const
float
piz
=
pi
->
x
[
2
]
-
(
c
j
->
loc
[
2
]
+
shift
[
2
]);
/* Compute the pairwise distance. */
float
dx
[
3
]
=
{
pjx
-
pix
,
pjy
-
piy
,
pjz
-
piz
};
...
...
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