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
f5ee71ff
Commit
f5ee71ff
authored
Mar 10, 2016
by
Matthieu Schaller
Browse files
map_cellcheck() now also checks the position of gparts
parent
c4a2c17e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/map.c
View file @
f5ee71ff
...
...
@@ -96,14 +96,12 @@ void map_cells_plot(struct cell *c, void *data) {
void
map_cellcheck
(
struct
cell
*
c
,
void
*
data
)
{
int
k
,
*
count
=
(
int
*
)
data
;
struct
part
*
p
;
int
*
count
=
(
int
*
)
data
;
__sync_fetch_and_add
(
count
,
c
->
count
);
/* Loop over all parts and check if they are in the cell. */
for
(
k
=
0
;
k
<
c
->
count
;
k
++
)
{
p
=
&
c
->
parts
[
k
];
for
(
int
k
=
0
;
k
<
c
->
count
;
k
++
)
{
struct
part
*
p
=
&
c
->
parts
[
k
];
if
(
p
->
x
[
0
]
<
c
->
loc
[
0
]
||
p
->
x
[
1
]
<
c
->
loc
[
1
]
||
p
->
x
[
2
]
<
c
->
loc
[
2
]
||
p
->
x
[
0
]
>
c
->
loc
[
0
]
+
c
->
h
[
0
]
||
p
->
x
[
1
]
>
c
->
loc
[
1
]
+
c
->
h
[
1
]
||
p
->
x
[
2
]
>
c
->
loc
[
2
]
+
c
->
h
[
2
])
{
...
...
@@ -115,6 +113,22 @@ void map_cellcheck(struct cell *c, void *data) {
error
(
"particle out of bounds!"
);
}
}
/* Loop over all gparts and check if they are in the cell. */
for
(
int
k
=
0
;
k
<
c
->
gcount
;
k
++
)
{
struct
gpart
*
p
=
&
c
->
gparts
[
k
];
if
(
p
->
x
[
0
]
<
c
->
loc
[
0
]
||
p
->
x
[
1
]
<
c
->
loc
[
1
]
||
p
->
x
[
2
]
<
c
->
loc
[
2
]
||
p
->
x
[
0
]
>
c
->
loc
[
0
]
+
c
->
h
[
0
]
||
p
->
x
[
1
]
>
c
->
loc
[
1
]
+
c
->
h
[
1
]
||
p
->
x
[
2
]
>
c
->
loc
[
2
]
+
c
->
h
[
2
])
{
printf
(
"map_cellcheck: g-particle at [ %.16e %.16e %.16e ] outside of cell [ "
"%.16e %.16e %.16e ] - [ %.16e %.16e %.16e ].
\n
"
,
p
->
x
[
0
],
p
->
x
[
1
],
p
->
x
[
2
],
c
->
loc
[
0
],
c
->
loc
[
1
],
c
->
loc
[
2
],
c
->
loc
[
0
]
+
c
->
h
[
0
],
c
->
loc
[
1
]
+
c
->
h
[
1
],
c
->
loc
[
2
]
+
c
->
h
[
2
]);
error
(
"g-particle out of bounds!"
);
}
}
}
/**
...
...
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