Skip to content
GitLab
Menu
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
8ac800e5
Commit
8ac800e5
authored
Jul 20, 2016
by
Matthieu Schaller
Browse files
Better initialisation of particles
parent
0dd9426f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
8ac800e5
...
...
@@ -638,11 +638,11 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset) {
*/
void
cell_init_parts
(
struct
cell
*
c
,
void
*
data
)
{
struct
part
*
p
=
c
->
parts
;
struct
xpart
*
xp
=
c
->
xparts
;
const
in
t
count
=
c
->
count
;
struct
part
*
restrict
p
=
c
->
parts
;
struct
xpart
*
restrict
xp
=
c
->
xparts
;
const
size_
t
count
=
c
->
count
;
for
(
in
t
i
=
0
;
i
<
count
;
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
count
;
++
i
)
{
p
[
i
].
ti_begin
=
0
;
p
[
i
].
ti_end
=
0
;
xp
[
i
].
v_full
[
0
]
=
p
[
i
].
v
[
0
];
...
...
@@ -665,13 +665,14 @@ void cell_init_parts(struct cell *c, void *data) {
*/
void
cell_init_gparts
(
struct
cell
*
c
,
void
*
data
)
{
struct
gpart
*
gp
=
c
->
gparts
;
const
in
t
gcount
=
c
->
gcount
;
struct
gpart
*
restrict
gp
=
c
->
gparts
;
const
size_
t
gcount
=
c
->
gcount
;
for
(
in
t
i
=
0
;
i
<
gcount
;
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
gcount
;
++
i
)
{
gp
[
i
].
ti_begin
=
0
;
gp
[
i
].
ti_end
=
0
;
gravity_first_init_gpart
(
&
gp
[
i
]);
gravity_init_gpart
(
&
gp
[
i
]);
}
c
->
ti_end_min
=
0
;
c
->
ti_end_max
=
0
;
...
...
src/gravity/Default/gravity.h
View file @
8ac800e5
...
...
@@ -82,7 +82,7 @@ __attribute__((always_inline)) INLINE static void gravity_first_init_gpart(
*
* @param gp The particle to act upon
*/
__attribute__
((
always_inline
))
INLINE
static
void
gravity_init_part
(
__attribute__
((
always_inline
))
INLINE
static
void
gravity_init_
g
part
(
struct
gpart
*
gp
)
{
/* Zero the acceleration */
...
...
src/runner.c
View file @
8ac800e5
...
...
@@ -408,7 +408,7 @@ void runner_do_init(struct runner *r, struct cell *c, int timer) {
if
(
gp
->
ti_end
<=
ti_current
)
{
/* Get ready for a density calculation */
gravity_init_part
(
gp
);
gravity_init_
g
part
(
gp
);
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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