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
3b8cb588
Commit
3b8cb588
authored
Feb 13, 2018
by
Matthieu Schaller
Committed by
Matthieu Schaller
Mar 02, 2018
Browse files
Add the potential to the gravity cache.
parent
f9d79855
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/gravity_cache.h
View file @
3b8cb588
...
...
@@ -59,6 +59,9 @@ struct gravity_cache {
/*! #gpart z acceleration. */
float
*
restrict
a_z
SWIFT_CACHE_ALIGN
;
/*! #gpart potential. */
float
*
restrict
pot
SWIFT_CACHE_ALIGN
;
/*! Is this #gpart active ? */
int
*
restrict
active
SWIFT_CACHE_ALIGN
;
...
...
@@ -85,6 +88,7 @@ static INLINE void gravity_cache_clean(struct gravity_cache *c) {
free
(
c
->
a_x
);
free
(
c
->
a_y
);
free
(
c
->
a_z
);
free
(
c
->
pot
);
free
(
c
->
active
);
free
(
c
->
use_mpole
);
}
...
...
@@ -120,6 +124,7 @@ static INLINE void gravity_cache_init(struct gravity_cache *c, int count) {
e
+=
posix_memalign
((
void
**
)
&
c
->
a_x
,
SWIFT_CACHE_ALIGNMENT
,
sizeBytesF
);
e
+=
posix_memalign
((
void
**
)
&
c
->
a_y
,
SWIFT_CACHE_ALIGNMENT
,
sizeBytesF
);
e
+=
posix_memalign
((
void
**
)
&
c
->
a_z
,
SWIFT_CACHE_ALIGNMENT
,
sizeBytesF
);
e
+=
posix_memalign
((
void
**
)
&
c
->
pot
,
SWIFT_CACHE_ALIGNMENT
,
sizeBytesF
);
e
+=
posix_memalign
((
void
**
)
&
c
->
active
,
SWIFT_CACHE_ALIGNMENT
,
sizeBytesI
);
e
+=
posix_memalign
((
void
**
)
&
c
->
use_mpole
,
SWIFT_CACHE_ALIGNMENT
,
sizeBytesI
);
...
...
@@ -278,6 +283,7 @@ __attribute__((always_inline)) INLINE void gravity_cache_write_back(
swift_declare_aligned_ptr
(
float
,
a_x
,
c
->
a_x
,
SWIFT_CACHE_ALIGNMENT
);
swift_declare_aligned_ptr
(
float
,
a_y
,
c
->
a_y
,
SWIFT_CACHE_ALIGNMENT
);
swift_declare_aligned_ptr
(
float
,
a_z
,
c
->
a_z
,
SWIFT_CACHE_ALIGNMENT
);
swift_declare_aligned_ptr
(
float
,
pot
,
c
->
pot
,
SWIFT_CACHE_ALIGNMENT
);
swift_declare_aligned_ptr
(
int
,
active
,
c
->
active
,
SWIFT_CACHE_ALIGNMENT
);
/* Write stuff back to the particles */
...
...
@@ -286,6 +292,7 @@ __attribute__((always_inline)) INLINE void gravity_cache_write_back(
gparts
[
i
].
a_grav
[
0
]
+=
a_x
[
i
];
gparts
[
i
].
a_grav
[
1
]
+=
a_y
[
i
];
gparts
[
i
].
a_grav
[
2
]
+=
a_z
[
i
];
gparts
[
i
].
potential
+=
pot
[
i
];
}
}
}
...
...
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