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
a9e6dcb0
Commit
a9e6dcb0
authored
Dec 05, 2016
by
James Willis
Browse files
Created a secondary cache structure to store particle interactions.
parent
f7f6b528
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cache.h
View file @
a9e6dcb0
...
...
@@ -28,6 +28,10 @@
#include
"cell.h"
#include
"error.h"
#define NUM_VEC_PROC 2
#define C2_CACHE_SIZE (NUM_VEC_PROC * VEC_SIZE * 6) + (NUM_VEC_PROC * VEC_SIZE)
#define C2_CACHE_ALIGN sizeof(float) * VEC_SIZE
/* Cache struct to hold a local copy of a cells' particle
* properties required for density/force calculations.*/
struct
cache
{
...
...
@@ -61,6 +65,34 @@ struct cache {
};
/* Secondary cache struct to hold a list of interactions between two particles.*/
struct
c2_cache
{
/* Separation between two particles squared. */
float
r2q
[
C2_CACHE_SIZE
]
__attribute__
((
aligned
(
C2_CACHE_ALIGN
)));
/* x separation between two particles. */
float
dxq
[
C2_CACHE_SIZE
]
__attribute__
((
aligned
(
C2_CACHE_ALIGN
)));
/* y separation between two particles. */
float
dyq
[
C2_CACHE_SIZE
]
__attribute__
((
aligned
(
C2_CACHE_ALIGN
)));
/* z separation between two particles. */
float
dzq
[
C2_CACHE_SIZE
]
__attribute__
((
aligned
(
C2_CACHE_ALIGN
)));
/* Mass of particle pj. */
float
mq
[
C2_CACHE_SIZE
]
__attribute__
((
aligned
(
C2_CACHE_ALIGN
)));
/* x velocity of particle pj. */
float
vxq
[
C2_CACHE_SIZE
]
__attribute__
((
aligned
(
C2_CACHE_ALIGN
)));
/* y velocity of particle pj. */
float
vyq
[
C2_CACHE_SIZE
]
__attribute__
((
aligned
(
C2_CACHE_ALIGN
)));
/* z velocity of particle pj. */
float
vzq
[
C2_CACHE_SIZE
]
__attribute__
((
aligned
(
C2_CACHE_ALIGN
)));
};
/**
* @brief Allocate memory and initialise cache.
*
...
...
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