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
ed945100
Commit
ed945100
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
space_split() now does its job correctly even with 0 parts
parent
72ae8ff1
No related branches found
No related tags found
2 merge requests
!136
Master
,
!116
Basic implementation of gparts
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/space.c
+10
-6
10 additions, 6 deletions
src/space.c
with
10 additions
and
6 deletions
src/space.c
+
10
−
6
View file @
ed945100
...
@@ -1003,7 +1003,9 @@ void space_map_cells_pre(struct space *s, int full,
...
@@ -1003,7 +1003,9 @@ void space_map_cells_pre(struct space *s, int full,
void
space_do_split
(
struct
space
*
s
,
struct
cell
*
c
)
{
void
space_do_split
(
struct
space
*
s
,
struct
cell
*
c
)
{
int
k
,
count
=
c
->
count
,
gcount
=
c
->
gcount
,
maxdepth
=
0
;
const
int
count
=
c
->
count
;
const
int
gcount
=
c
->
gcount
;
int
maxdepth
=
0
;
float
h
,
h_max
=
0
.
0
f
;
float
h
,
h_max
=
0
.
0
f
;
int
ti_end_min
=
max_nr_timesteps
,
ti_end_max
=
0
,
ti_end
;
int
ti_end_min
=
max_nr_timesteps
,
ti_end_max
=
0
,
ti_end
;
struct
cell
*
temp
;
struct
cell
*
temp
;
...
@@ -1020,7 +1022,7 @@ void space_do_split(struct space *s, struct cell *c) {
...
@@ -1020,7 +1022,7 @@ void space_do_split(struct space *s, struct cell *c) {
c
->
split
=
1
;
c
->
split
=
1
;
/* Create the cell's progeny. */
/* Create the cell's progeny. */
for
(
k
=
0
;
k
<
8
;
k
++
)
{
for
(
int
k
=
0
;
k
<
8
;
k
++
)
{
temp
=
space_getcell
(
s
);
temp
=
space_getcell
(
s
);
temp
->
count
=
0
;
temp
->
count
=
0
;
temp
->
gcount
=
0
;
temp
->
gcount
=
0
;
...
@@ -1047,7 +1049,7 @@ void space_do_split(struct space *s, struct cell *c) {
...
@@ -1047,7 +1049,7 @@ void space_do_split(struct space *s, struct cell *c) {
cell_split
(
c
);
cell_split
(
c
);
/* Remove any progeny with zero parts. */
/* Remove any progeny with zero parts. */
for
(
k
=
0
;
k
<
8
;
k
++
)
for
(
int
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
->
count
==
0
&&
c
->
progeny
[
k
]
->
gcount
==
0
)
{
if
(
c
->
progeny
[
k
]
->
count
==
0
&&
c
->
progeny
[
k
]
->
gcount
==
0
)
{
space_recycle
(
s
,
c
->
progeny
[
k
]);
space_recycle
(
s
,
c
->
progeny
[
k
]);
c
->
progeny
[
k
]
=
NULL
;
c
->
progeny
[
k
]
=
NULL
;
...
@@ -1077,8 +1079,7 @@ void space_do_split(struct space *s, struct cell *c) {
...
@@ -1077,8 +1079,7 @@ void space_do_split(struct space *s, struct cell *c) {
c
->
maxdepth
=
c
->
depth
;
c
->
maxdepth
=
c
->
depth
;
/* Get dt_min/dt_max. */
/* Get dt_min/dt_max. */
for
(
int
k
=
0
;
k
<
count
;
k
++
)
{
for
(
k
=
0
;
k
<
count
;
k
++
)
{
p
=
&
parts
[
k
];
p
=
&
parts
[
k
];
xp
=
&
xparts
[
k
];
xp
=
&
xparts
[
k
];
xp
->
x_old
[
0
]
=
p
->
x
[
0
];
xp
->
x_old
[
0
]
=
p
->
x
[
0
];
...
@@ -1096,7 +1097,10 @@ void space_do_split(struct space *s, struct cell *c) {
...
@@ -1096,7 +1097,10 @@ void space_do_split(struct space *s, struct cell *c) {
}
}
/* Set ownership according to the start of the parts array. */
/* Set ownership according to the start of the parts array. */
c
->
owner
=
((
c
->
parts
-
s
->
parts
)
%
s
->
nr_parts
)
*
s
->
nr_queues
/
s
->
nr_parts
;
if
(
count
>
0
)
c
->
owner
=
((
c
->
parts
-
s
->
parts
)
%
s
->
nr_parts
)
*
s
->
nr_queues
/
s
->
nr_parts
;
else
c
->
owner
=
((
c
->
gparts
-
s
->
gparts
)
%
s
->
nr_gparts
)
*
s
->
nr_queues
/
s
->
nr_gparts
;
}
}
/**
/**
...
...
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