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
11e86485
Commit
11e86485
authored
12 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
modified pairs_single slightly, now looks for a particle of the given ID.
Former-commit-id: 10c32ce7415e6887b399c5469c048093d8d14a59
parent
a4597f03
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/test.c
+15
-8
15 additions, 8 deletions
examples/test.c
with
15 additions
and
8 deletions
examples/test.c
+
15
−
8
View file @
11e86485
...
...
@@ -508,18 +508,24 @@ void pairs_n2 ( double *dim , struct part *__restrict__ parts , int N , int peri
}
void
pairs_single
(
double
*
dim
,
int
pid
,
struct
part
*
__restrict__
parts
,
int
N
,
int
periodic
)
{
void
pairs_single
(
double
*
dim
,
long
long
int
pid
,
struct
part
*
__restrict__
parts
,
int
N
,
int
periodic
)
{
int
i
,
k
;
// int mj, mk;
// double maxratio = 1.0;
double
r2
,
dx
[
3
];
struct
part
*
p
=
&
parts
[
pid
];
double
ih
=
15
.
0
/
6
.
25
;
struct
part
*
p
;
double
ih
=
15
.
0
/
6
.
25
;
/* Find "our" part. */
for
(
k
=
0
;
k
<
N
&&
parts
[
k
].
id
!=
pid
;
k
++
);
if
(
k
==
N
)
error
(
"Part not found."
);
p
=
&
parts
[
k
];
/* Loop over all particle pairs. */
for
(
k
=
0
;
k
<
N
;
k
++
)
{
if
(
k
==
p
id
)
if
(
&
parts
[
k
]
==
p
)
continue
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
dx
[
i
]
=
p
->
x
[
i
]
-
parts
[
k
].
x
[
i
];
...
...
@@ -533,9 +539,10 @@ void pairs_single ( double *dim , int pid , struct part *__restrict__ parts , in
r2
=
dx
[
0
]
*
dx
[
0
]
+
dx
[
1
]
*
dx
[
1
]
+
dx
[
2
]
*
dx
[
2
];
if
(
r2
<
p
->
h
*
p
->
h
)
{
runner_iact_density
(
r2
,
NULL
,
p
->
h
,
parts
[
k
].
h
,
p
,
&
parts
[
k
]
);
printf
(
"runner_dopair: interacting particles %i [%i,%i,%i] and %lli [%i,%i,%i].
\n
"
,
pid
,
(
int
)(
parts
[
pid
].
x
[
0
]
*
ih
)
,
(
int
)(
parts
[
pid
].
x
[
1
]
*
ih
)
,
(
int
)(
parts
[
pid
].
x
[
2
]
*
ih
)
,
parts
[
k
].
id
,
(
int
)(
parts
[
k
].
x
[
0
]
*
ih
)
,
(
int
)(
parts
[
k
].
x
[
1
]
*
ih
)
,
(
int
)(
parts
[
k
].
x
[
2
]
*
ih
)
);
printf
(
"pairs_simple: interacting particles %lli [%i,%i,%i] and %lli [%i,%i,%i], r=%e.
\n
"
,
pid
,
(
int
)(
p
->
x
[
0
]
*
ih
)
,
(
int
)(
p
->
x
[
1
]
*
ih
)
,
(
int
)(
p
->
x
[
2
]
*
ih
)
,
parts
[
k
].
id
,
(
int
)(
parts
[
k
].
x
[
0
]
*
ih
)
,
(
int
)(
parts
[
k
].
x
[
1
]
*
ih
)
,
(
int
)(
parts
[
k
].
x
[
2
]
*
ih
)
,
sqrtf
(
r2
)
);
parts
[
k
].
rho
=
0
.
0
;
parts
[
k
].
wcount
=
0
.
0
;
parts
[
k
].
rho_dh
=
0
.
0
;
...
...
@@ -811,7 +818,7 @@ int main ( int argc , char *argv[] ) {
/* Get the brute-force number of pairs. */
// pairs_n2( dim , parts , N , periodic );
// pairs_single( dim , 1
517660
, parts , N , periodic );
// pairs_single( dim , 1
168833436525
, parts , N , periodic );
// fflush( stdout );
/* Set default number of queues. */
...
...
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