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
fabeb932
Commit
fabeb932
authored
9 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
fix and format space.c, forgot one field in space.h.
parent
943b0e1f
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!136
Master
,
!114
size_t
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/space.c
+15
-13
15 additions, 13 deletions
src/space.c
src/space.h
+1
-1
1 addition, 1 deletion
src/space.h
with
16 additions
and
14 deletions
src/space.c
+
15
−
13
View file @
fabeb932
...
...
@@ -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
;
in
t
*
ind
;
size_
t
*
ind
;
double
ih
[
3
],
dim
[
3
];
ticks
tic
=
getticks
();
...
...
@@ -324,8 +324,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
/* Run through the particles and get their cell index. */
// tic = getticks();
const
in
t
ind_size
=
s
->
size_parts
;
if
((
ind
=
(
in
t
*
)
malloc
(
sizeof
(
in
t
)
*
ind_size
))
==
NULL
)
const
size_
t
ind_size
=
s
->
size_parts
;
if
((
ind
=
(
size_
t
*
)
malloc
(
sizeof
(
size_
t
)
*
ind_size
))
==
NULL
)
error
(
"Failed to allocate temporary particle indices."
);
ih
[
0
]
=
s
->
ih
[
0
];
ih
[
1
]
=
s
->
ih
[
1
];
...
...
@@ -376,10 +376,10 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
/* Re-allocate the index array if needed.. */
if
(
s
->
nr_parts
>
ind_size
)
{
in
t
*
ind_new
;
if
((
ind_new
=
(
in
t
*
)
malloc
(
sizeof
(
in
t
)
*
s
->
nr_parts
))
==
NULL
)
size_
t
*
ind_new
;
if
((
ind_new
=
(
size_
t
*
)
malloc
(
sizeof
(
size_
t
)
*
s
->
nr_parts
))
==
NULL
)
error
(
"Failed to allocate temporary particle indices."
);
memcpy
(
ind_new
,
ind
,
sizeof
(
in
t
)
*
nr_parts
);
memcpy
(
ind_new
,
ind
,
sizeof
(
size_
t
)
*
nr_parts
);
free
(
ind
);
ind
=
ind_new
;
}
...
...
@@ -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
=
(
in
t
*
)
malloc
(
sizeof
(
in
t
)
*
s
->
size_gparts
))
==
NULL
)
if
((
ind
=
(
size_
t
*
)
malloc
(
sizeof
(
size_
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
,
in
t
*
ind
,
in
t
N
,
int
min
,
int
max
,
void
space_parts_sort
(
struct
space
*
s
,
size_
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, int *ind, int N, int min, int max,
void
space_do_parts_sort
()
{
/* Pointers to the sorting data. */
in
t
*
ind
=
space_sort_struct
.
ind
;
size_
t
*
ind
=
space_sort_struct
.
ind
;
struct
part
*
parts
=
space_sort_struct
.
parts
;
struct
xpart
*
xparts
=
space_sort_struct
.
xparts
;
...
...
@@ -676,11 +676,12 @@ void space_do_parts_sort() {
}
/* main loop. */
}
void
space_gparts_sort
(
struct
gpart
*
gparts
,
in
t
*
ind
,
in
t
N
,
int
min
,
void
space_gparts_sort
(
struct
gpart
*
gparts
,
size_
t
*
ind
,
size_
t
N
,
int
min
,
int
max
)
{
struct
qstack
{
volatile
int
i
,
j
,
min
,
max
;
volatile
size_t
i
,
j
;
volatile
int
min
,
max
;
volatile
int
ready
;
};
struct
qstack
*
qstack
;
...
...
@@ -688,7 +689,8 @@ void space_gparts_sort(struct gpart *gparts, int *ind, int N, int min,
volatile
unsigned
int
first
,
last
,
waiting
;
int
pivot
;
int
i
,
ii
,
j
,
jj
,
temp_i
,
qid
;
size_t
i
,
ii
,
j
,
jj
,
temp_i
;
int
qid
;
struct
gpart
temp_p
;
/* for ( int k = 0 ; k < N ; k++ )
...
...
@@ -1186,7 +1188,7 @@ struct cell *space_getcell(struct space *s) {
* recursively.
*/
void
space_init
(
struct
space
*
s
,
double
dim
[
3
],
struct
part
*
parts
,
in
t
N
,
void
space_init
(
struct
space
*
s
,
double
dim
[
3
],
struct
part
*
parts
,
size_
t
N
,
int
periodic
,
double
h_max
,
int
verbose
)
{
/* Store everything in the space. */
...
...
This diff is collapsed.
Click to expand it.
src/space.h
+
1
−
1
View file @
fabeb932
...
...
@@ -114,7 +114,7 @@ struct qstack {
struct
parallel_sort
{
struct
part
*
parts
;
struct
xpart
*
xparts
;
in
t
*
ind
;
size_
t
*
ind
;
struct
qstack
*
stack
;
unsigned
int
stack_size
;
volatile
unsigned
int
first
,
last
,
waiting
;
...
...
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