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
af2ad857
Commit
af2ad857
authored
Mar 17, 2016
by
Pedro Gonnet
Browse files
fix the cell linking in cell_split.
parent
693b07d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
af2ad857
...
...
@@ -339,9 +339,11 @@ void cell_gunlocktree(struct cell *c) {
* @brief Sort the parts into eight bins along the given pivots.
*
* @param c The #cell array to be sorted.
* @param parts_offset Offset of the cell parts array relative to the
* space's parts array, i.e. c->parts - s->parts.
*/
void
cell_split
(
struct
cell
*
c
)
{
void
cell_split
(
struct
cell
*
c
,
ptrdiff_t
parts_offset
)
{
int
i
,
j
;
const
int
count
=
c
->
count
,
gcount
=
c
->
gcount
;
...
...
@@ -452,7 +454,7 @@ void cell_split(struct cell *c) {
/* Re-link the gparts. */
for
(
int
k
=
0
;
k
<
count
;
k
++
)
if
(
parts
[
k
].
gpart
!=
NULL
)
{
parts
[
k
].
gpart
->
id_or_neg_offset
=
-
k
;
parts
[
k
].
gpart
->
id_or_neg_offset
=
-
(
k
+
parts_offset
)
;
}
/* Verify that _all_ the parts have been assigned to a cell. */
...
...
src/cell.h
View file @
af2ad857
...
...
@@ -20,6 +20,9 @@
#define SWIFT_CELL_H
/* Includes. */
#include
<stddef.h>
/* Local includes. */
#include
"lock.h"
#include
"multipole.h"
#include
"part.h"
...
...
@@ -167,7 +170,7 @@ struct cell {
((int)(k) + (cdim)[2] * ((int)(j) + (cdim)[1] * (int)(i)))
/* Function prototypes. */
void
cell_split
(
struct
cell
*
c
);
void
cell_split
(
struct
cell
*
c
,
ptrdiff_t
parts_offset
);
int
cell_locktree
(
struct
cell
*
c
);
void
cell_unlocktree
(
struct
cell
*
c
);
int
cell_glocktree
(
struct
cell
*
c
);
...
...
src/space.c
View file @
af2ad857
...
...
@@ -1100,7 +1100,7 @@ void space_do_split(struct space *s, struct cell *c) {
}
/* Split the cell data. */
cell_split
(
c
);
cell_split
(
c
,
c
->
parts
-
s
->
parts
);
/* Remove any progeny with zero parts. */
for
(
int
k
=
0
;
k
<
8
;
k
++
)
...
...
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