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
1c99b529
Commit
1c99b529
authored
Mar 10, 2016
by
Pedro Gonnet
Browse files
first batch of fixes in space.c.
parent
1802f8f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/space.c
View file @
1c99b529
...
...
@@ -113,15 +113,15 @@ int space_getsid(struct space *s, struct cell **ci, struct cell **cj,
/* Get the sorting index. */
int
sid
=
0
;
for
(
k
=
0
;
k
<
3
;
k
++
)
for
(
int
k
=
0
;
k
<
3
;
k
++
)
sid
=
3
*
sid
+
((
dx
[
k
]
<
0
.
0
)
?
0
:
((
dx
[
k
]
>
0
.
0
)
?
2
:
1
));
/* Switch the cells around? */
if
(
runner_flip
[
sid
])
{
cons
t
cell
*
temp
=
*
ci
;
struc
t
cell
*
temp
=
*
ci
;
*
ci
=
*
cj
;
*
cj
=
temp
;
for
(
k
=
0
;
k
<
3
;
k
++
)
shift
[
k
]
=
-
shift
[
k
];
for
(
int
k
=
0
;
k
<
3
;
k
++
)
shift
[
k
]
=
-
shift
[
k
];
}
sid
=
sortlistID
[
sid
];
...
...
@@ -187,7 +187,7 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
if
(
verbose
)
message
(
"h_max is %.3e (cell_max=%.3e)."
,
h_max
,
cell_max
);
/* Get the new putative cell dimensions. */
int
cdim
[
3
]
int
cdim
[
3
]
;
for
(
int
k
=
0
;
k
<
3
;
k
++
)
cdim
[
k
]
=
floor
(
s
->
dim
[
k
]
/
fmax
(
h_max
*
kernel_gamma
*
space_stretch
,
cell_max
));
...
...
@@ -233,7 +233,7 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
s
->
nr_cells
*
sizeof
(
struct
cell
))
!=
0
)
error
(
"Failed to allocate cells."
);
bzero
(
s
->
cells
,
s
->
nr_cells
*
sizeof
(
struct
cell
));
for
(
k
=
0
;
k
<
s
->
nr_cells
;
k
++
)
for
(
int
k
=
0
;
k
<
s
->
nr_cells
;
k
++
)
if
(
lock_init
(
&
s
->
cells
[
k
].
lock
)
!=
0
)
error
(
"Failed to init spinlock."
);
/* Set the cell location and sizes. */
...
...
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