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
af2ad857
Commit
af2ad857
authored
9 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
fix the cell linking in cell_split.
parent
693b07d6
No related branches found
No related tags found
1 merge request
!118
One major change to replace all gpart id/parts with the new id_or_neg_offset.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cell.c
+4
-2
4 additions, 2 deletions
src/cell.c
src/cell.h
+4
-1
4 additions, 1 deletion
src/cell.h
src/space.c
+1
-1
1 addition, 1 deletion
src/space.c
with
9 additions
and
4 deletions
src/cell.c
+
4
−
2
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. */
...
...
This diff is collapsed.
Click to expand it.
src/cell.h
+
4
−
1
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
);
...
...
This diff is collapsed.
Click to expand it.
src/space.c
+
1
−
1
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
++
)
...
...
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