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
1f6760a5
Commit
1f6760a5
authored
Sep 09, 2015
by
Pedro Gonnet
Browse files
fix formatting in space.c.
Former-commit-id: 4da1a205ca6b45f348a6de27aba04b1608b6dd5c
parent
cc16a063
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/space.c
View file @
1f6760a5
...
...
@@ -778,7 +778,6 @@ void space_map_clearsort(struct cell *c, void *data) {
}
}
/**
* @brief Map a function to all particles in a cell recursively.
*
...
...
@@ -787,23 +786,23 @@ void space_map_clearsort(struct cell *c, void *data) {
* @param data Data passed to the function fun.
*/
static
void
rec_map_parts
(
struct
cell
*
c
,
void
(
*
fun
)(
struct
part
*
p
,
struct
cell
*
c
,
void
*
data
),
void
*
data
)
{
static
void
rec_map_parts
(
struct
cell
*
c
,
void
(
*
fun
)(
struct
part
*
p
,
struct
cell
*
c
,
void
*
data
),
void
*
data
)
{
int
k
;
/* No progeny? */
if
(
!
c
->
split
)
for
(
k
=
0
;
k
<
c
->
count
;
k
++
)
fun
(
&
c
->
parts
[
k
],
c
,
data
);
/* Otherwise, recurse. */
else
for
(
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
rec_map_parts
(
c
->
progeny
[
k
],
fun
,
data
);
}
/**
* @brief Map a function to all particles in a space.
*
...
...
@@ -819,10 +818,10 @@ void space_map_parts(struct space *s,
int
cid
=
0
;
/* Call the recursive function on all higher-level cells. */
for
(
cid
=
0
;
cid
<
s
->
nr_cells
;
cid
++
)
rec_map_parts
(
&
s
->
cells
[
cid
],
fun
,
data
);
for
(
cid
=
0
;
cid
<
s
->
nr_cells
;
cid
++
)
rec_map_parts
(
&
s
->
cells
[
cid
],
fun
,
data
);
}
/**
* @brief Map a function to all particles in a cell recursively.
*
...
...
@@ -832,22 +831,22 @@ void space_map_parts(struct space *s,
* @param data Data passed to the function fun.
*/
static
void
rec_map_cells_post
(
struct
cell
*
c
,
int
full
,
void
(
*
fun
)(
struct
cell
*
c
,
void
*
data
),
void
*
data
)
{
static
void
rec_map_cells_post
(
struct
cell
*
c
,
int
full
,
void
(
*
fun
)(
struct
cell
*
c
,
void
*
data
),
void
*
data
)
{
int
k
;
/* Recurse. */
if
(
c
->
split
)
for
(
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
rec_map_cells_post
(
c
->
progeny
[
k
],
full
,
fun
,
data
);
if
(
c
->
progeny
[
k
]
!=
NULL
)
rec_map_cells_post
(
c
->
progeny
[
k
],
full
,
fun
,
data
);
/* No progeny? */
if
(
full
||
!
c
->
split
)
fun
(
c
,
data
);
}
/**
* @brief Map a function to all particles in a aspace.
*
...
...
@@ -858,45 +857,41 @@ static void rec_map_cells_post(struct cell * c, int full,
*/
void
space_map_cells_post
(
struct
space
*
s
,
int
full
,
void
(
*
fun
)(
struct
cell
*
c
,
void
*
data
),
void
*
data
)
{
void
(
*
fun
)(
struct
cell
*
c
,
void
*
data
),
void
*
data
)
{
int
cid
=
0
;
/* Call the recursive function on all higher-level cells. */
for
(
cid
=
0
;
cid
<
s
->
nr_cells
;
cid
++
)
rec_map_cells_post
(
&
s
->
cells
[
cid
],
full
,
fun
,
data
);
for
(
cid
=
0
;
cid
<
s
->
nr_cells
;
cid
++
)
rec_map_cells_post
(
&
s
->
cells
[
cid
],
full
,
fun
,
data
);
}
static
void
rec_map_cells_pre
(
struct
cell
*
c
,
int
full
,
void
(
*
fun
)(
struct
cell
*
c
,
void
*
data
),
void
*
data
)
{
static
void
rec_map_cells_pre
(
struct
cell
*
c
,
int
full
,
void
(
*
fun
)(
struct
cell
*
c
,
void
*
data
),
void
*
data
)
{
int
k
;
/* No progeny? */
if
(
full
||
!
c
->
split
)
fun
(
c
,
data
);
/* Recurse. */
if
(
c
->
split
)
for
(
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
rec_map_cells_pre
(
c
->
progeny
[
k
],
full
,
fun
,
data
);
if
(
c
->
progeny
[
k
]
!=
NULL
)
rec_map_cells_pre
(
c
->
progeny
[
k
],
full
,
fun
,
data
);
}
void
space_map_cells_pre
(
struct
space
*
s
,
int
full
,
void
(
*
fun
)(
struct
cell
*
c
,
void
*
data
),
void
*
data
)
{
void
(
*
fun
)(
struct
cell
*
c
,
void
*
data
),
void
*
data
)
{
int
cid
=
0
;
/* Call the recursive function on all higher-level cells. */
for
(
cid
=
0
;
cid
<
s
->
nr_cells
;
cid
++
)
rec_map_cells_pre
(
&
s
->
cells
[
cid
],
full
,
fun
,
data
);
for
(
cid
=
0
;
cid
<
s
->
nr_cells
;
cid
++
)
rec_map_cells_pre
(
&
s
->
cells
[
cid
],
full
,
fun
,
data
);
}
/**
* @brief Split cells that contain too many particles.
*
...
...
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