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
5c8a03e3
Commit
5c8a03e3
authored
Mar 10, 2016
by
Pedro Gonnet
Browse files
sorting indices don't actually have to be size_t, changing back to int.
parent
3e0e0c69
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
5c8a03e3
...
...
@@ -154,7 +154,7 @@ void engine_redistribute(struct engine *e) {
getting the counts. The counts array is indexed as
count[from * nr_nodes + to]. */
int
*
counts
;
size_
t
*
dest
;
in
t
*
dest
;
double
ih
[
3
],
dim
[
3
];
ih
[
0
]
=
s
->
ih
[
0
];
ih
[
1
]
=
s
->
ih
[
1
];
...
...
@@ -163,7 +163,7 @@ void engine_redistribute(struct engine *e) {
dim
[
1
]
=
s
->
dim
[
1
];
dim
[
2
]
=
s
->
dim
[
2
];
if
((
counts
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
nr_nodes
*
nr_nodes
))
==
NULL
||
(
dest
=
(
size_
t
*
)
malloc
(
sizeof
(
size_
t
)
*
s
->
nr_parts
))
==
NULL
)
(
dest
=
(
in
t
*
)
malloc
(
sizeof
(
in
t
)
*
s
->
nr_parts
))
==
NULL
)
error
(
"Failed to allocate count and dest buffers."
);
bzero
(
counts
,
sizeof
(
int
)
*
nr_nodes
*
nr_nodes
);
struct
part
*
parts
=
s
->
parts
;
...
...
@@ -595,7 +595,7 @@ void engine_exchange_cells(struct engine *e) {
* @return The number of arrived parts copied to parts and xparts.
*/
int
engine_exchange_strays
(
struct
engine
*
e
,
int
offset
,
size_
t
*
ind
,
size_t
N
)
{
int
engine_exchange_strays
(
struct
engine
*
e
,
int
offset
,
in
t
*
ind
,
size_t
N
)
{
#ifdef WITH_MPI
...
...
src/engine.h
View file @
5c8a03e3
...
...
@@ -182,7 +182,7 @@ void engine_init_particles(struct engine *e);
void
engine_step
(
struct
engine
*
e
);
void
engine_maketasks
(
struct
engine
*
e
);
void
engine_split
(
struct
engine
*
e
,
struct
partition
*
initial_partition
);
int
engine_exchange_strays
(
struct
engine
*
e
,
int
offset
,
size_
t
*
ind
,
size_t
N
);
int
engine_exchange_strays
(
struct
engine
*
e
,
int
offset
,
in
t
*
ind
,
size_t
N
);
void
engine_rebuild
(
struct
engine
*
e
);
void
engine_repartition
(
struct
engine
*
e
);
void
engine_makeproxies
(
struct
engine
*
e
);
...
...
src/space.c
View file @
5c8a03e3
...
...
@@ -311,7 +311,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
int
j
,
k
,
cdim
[
3
],
nr_parts
=
s
->
nr_parts
,
nr_gparts
=
s
->
nr_gparts
;
struct
cell
*
restrict
c
,
*
restrict
cells
;
struct
part
*
restrict
p
;
size_
t
*
ind
;
in
t
*
ind
;
double
ih
[
3
],
dim
[
3
];
ticks
tic
=
getticks
();
...
...
@@ -325,7 +325,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
/* Run through the particles and get their cell index. */
// tic = getticks();
const
size_t
ind_size
=
s
->
size_parts
;
if
((
ind
=
(
size_
t
*
)
malloc
(
sizeof
(
size_
t
)
*
ind_size
))
==
NULL
)
if
((
ind
=
(
in
t
*
)
malloc
(
sizeof
(
in
t
)
*
ind_size
))
==
NULL
)
error
(
"Failed to allocate temporary particle indices."
);
ih
[
0
]
=
s
->
ih
[
0
];
ih
[
1
]
=
s
->
ih
[
1
];
...
...
@@ -376,8 +376,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
/* Re-allocate the index array if needed.. */
if
(
s
->
nr_parts
>
ind_size
)
{
size_
t
*
ind_new
;
if
((
ind_new
=
(
size_
t
*
)
malloc
(
sizeof
(
size_
t
)
*
s
->
nr_parts
))
==
NULL
)
in
t
*
ind_new
;
if
((
ind_new
=
(
in
t
*
)
malloc
(
sizeof
(
in
t
)
*
s
->
nr_parts
))
==
NULL
)
error
(
"Failed to allocate temporary particle indices."
);
memcpy
(
ind_new
,
ind
,
sizeof
(
size_t
)
*
nr_parts
);
free
(
ind
);
...
...
@@ -419,7 +419,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
/* Run through the gravity particles and get their cell index. */
// tic = getticks();
if
((
ind
=
(
size_
t
*
)
malloc
(
sizeof
(
size_
t
)
*
s
->
size_gparts
))
==
NULL
)
if
((
ind
=
(
in
t
*
)
malloc
(
sizeof
(
in
t
)
*
s
->
size_gparts
))
==
NULL
)
error
(
"Failed to allocate temporary particle indices."
);
for
(
k
=
0
;
k
<
nr_gparts
;
k
++
)
{
struct
gpart
*
gp
=
&
s
->
gparts
[
k
];
...
...
@@ -506,7 +506,7 @@ void space_split(struct space *s, struct cell *cells, int verbose) {
* @param verbose Are we talkative ?
*/
void
space_parts_sort
(
struct
space
*
s
,
size_
t
*
ind
,
size_t
N
,
int
min
,
int
max
,
void
space_parts_sort
(
struct
space
*
s
,
in
t
*
ind
,
size_t
N
,
int
min
,
int
max
,
int
verbose
)
{
ticks
tic
=
getticks
();
...
...
@@ -554,7 +554,7 @@ void space_parts_sort(struct space *s, size_t *ind, size_t N, int min, int max,
void
space_do_parts_sort
()
{
/* Pointers to the sorting data. */
size_
t
*
ind
=
space_sort_struct
.
ind
;
in
t
*
ind
=
space_sort_struct
.
ind
;
struct
part
*
parts
=
space_sort_struct
.
parts
;
struct
xpart
*
xparts
=
space_sort_struct
.
xparts
;
...
...
@@ -676,7 +676,7 @@ void space_do_parts_sort() {
}
/* main loop. */
}
void
space_gparts_sort
(
struct
gpart
*
gparts
,
size_
t
*
ind
,
size_t
N
,
int
min
,
void
space_gparts_sort
(
struct
gpart
*
gparts
,
in
t
*
ind
,
size_t
N
,
int
min
,
int
max
)
{
struct
qstack
{
...
...
src/space.h
View file @
5c8a03e3
...
...
@@ -117,7 +117,7 @@ struct qstack {
struct
parallel_sort
{
struct
part
*
parts
;
struct
xpart
*
xparts
;
size_
t
*
ind
;
in
t
*
ind
;
struct
qstack
*
stack
;
unsigned
int
stack_size
;
volatile
unsigned
int
first
,
last
,
waiting
;
...
...
@@ -125,9 +125,9 @@ struct parallel_sort {
extern
struct
parallel_sort
space_sort_struct
;
/* function prototypes. */
void
space_parts_sort
(
struct
space
*
s
,
size_
t
*
ind
,
size_t
N
,
int
min
,
int
max
,
void
space_parts_sort
(
struct
space
*
s
,
in
t
*
ind
,
size_t
N
,
int
min
,
int
max
,
int
verbose
);
void
space_gparts_sort
(
struct
gpart
*
gparts
,
size_
t
*
ind
,
size_t
N
,
int
min
,
int
max
);
void
space_gparts_sort
(
struct
gpart
*
gparts
,
in
t
*
ind
,
size_t
N
,
int
min
,
int
max
);
struct
cell
*
space_getcell
(
struct
space
*
s
);
int
space_getsid
(
struct
space
*
s
,
struct
cell
**
ci
,
struct
cell
**
cj
,
double
*
shift
);
...
...
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