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
83175268
Commit
83175268
authored
Apr 01, 2017
by
Matthieu Schaller
Browse files
Move all static arrays related to sorting along cell-linking axis to the sort_part.h file.
parent
1dc9ca85
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
83175268
...
...
@@ -66,6 +66,7 @@
#include
"runner.h"
#include
"serial_io.h"
#include
"single_io.h"
#include
"sort_part.h"
#include
"statistics.h"
#include
"timers.h"
#include
"tools.h"
...
...
src/runner.h
View file @
83175268
...
...
@@ -23,10 +23,11 @@
#ifndef SWIFT_RUNNER_H
#define SWIFT_RUNNER_H
#include
"cache.h"
/* Config parameters. */
#include
"../config.h"
extern
const
double
runner_shift
[
13
][
3
];
extern
const
char
runner_flip
[
27
];
/* Includes. */
#include
"cache.h"
struct
cell
;
struct
engine
;
...
...
src/scheduler.c
View file @
83175268
...
...
@@ -46,6 +46,7 @@
#include
"intrinsics.h"
#include
"kernel_hydro.h"
#include
"queue.h"
#include
"sort_part.h"
#include
"space.h"
#include
"task.h"
#include
"timers.h"
...
...
@@ -229,7 +230,7 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) {
/* Replace by a single sub-task? */
if
(
scheduler_dosub
&&
ci
->
count
*
sid_scale
[
sid
]
<
space_subsize
/
cj
->
count
&&
sid
!=
0
&&
sid
!=
2
&&
sid
!=
6
&&
sid
!=
8
)
{
!
sort_is_corner
(
sid
)
)
{
/* Make this task a sub task. */
t
->
type
=
task_type_sub_pair
;
...
...
src/sort_part.h
View file @
83175268
...
...
@@ -33,7 +33,7 @@ struct entry {
};
/* Orientation of the cell pairs */
const
double
runner_shift
[
13
][
3
]
=
{
static
const
double
runner_shift
[
13
][
3
]
=
{
{
5.773502691896258e-01
,
5.773502691896258e-01
,
5.773502691896258e-01
},
{
7.071067811865475e-01
,
7.071067811865475e-01
,
0
.
0
},
{
5.773502691896258e-01
,
5.773502691896258e-01
,
-
5.773502691896258e-01
},
...
...
@@ -50,8 +50,38 @@ const double runner_shift[13][3] = {
};
/* Does the axis need flipping ? */
const
char
runner_flip
[
27
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
static
const
char
runner_flip
[
27
]
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
/* Map shift vector to sortlist. */
static
const
int
sortlistID
[
27
]
=
{
/* ( -1 , -1 , -1 ) */
0
,
/* ( -1 , -1 , 0 ) */
1
,
/* ( -1 , -1 , 1 ) */
2
,
/* ( -1 , 0 , -1 ) */
3
,
/* ( -1 , 0 , 0 ) */
4
,
/* ( -1 , 0 , 1 ) */
5
,
/* ( -1 , 1 , -1 ) */
6
,
/* ( -1 , 1 , 0 ) */
7
,
/* ( -1 , 1 , 1 ) */
8
,
/* ( 0 , -1 , -1 ) */
9
,
/* ( 0 , -1 , 0 ) */
10
,
/* ( 0 , -1 , 1 ) */
11
,
/* ( 0 , 0 , -1 ) */
12
,
/* ( 0 , 0 , 0 ) */
0
,
/* ( 0 , 0 , 1 ) */
12
,
/* ( 0 , 1 , -1 ) */
11
,
/* ( 0 , 1 , 0 ) */
10
,
/* ( 0 , 1 , 1 ) */
9
,
/* ( 1 , -1 , -1 ) */
8
,
/* ( 1 , -1 , 0 ) */
7
,
/* ( 1 , -1 , 1 ) */
6
,
/* ( 1 , 0 , -1 ) */
5
,
/* ( 1 , 0 , 0 ) */
4
,
/* ( 1 , 0 , 1 ) */
3
,
/* ( 1 , 1 , -1 ) */
2
,
/* ( 1 , 1 , 0 ) */
1
,
/* ( 1 , 1 , 1 ) */
0
};
/**
* @brief Determines whether a pair of cells are corner to corner.
...
...
@@ -72,7 +102,8 @@ __attribute__((always_inline)) INLINE static int sort_is_corner(int sid) {
* @return 1 if edge to edge, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
sort_is_edge
(
int
sid
)
{
return
(
sid
==
1
||
sid
==
3
||
sid
==
5
||
sid
==
7
||
sid
==
9
||
sid
==
11
);
return
(
sid
==
1
||
sid
==
3
||
sid
==
5
||
sid
==
7
||
sid
==
9
||
sid
==
11
);
}
/**
...
...
@@ -86,5 +117,4 @@ __attribute__((always_inline)) INLINE static int sort_is_face(int sid) {
return
(
sid
==
4
||
sid
==
10
||
sid
==
12
);
}
#endif
/* SWIFT_SORT_PART_H */
src/space.c
View file @
83175268
...
...
@@ -53,6 +53,7 @@
#include
"minmax.h"
#include
"multipole.h"
#include
"runner.h"
#include
"sort_part.h"
#include
"stars.h"
#include
"threadpool.h"
#include
"tools.h"
...
...
@@ -63,36 +64,6 @@ int space_subsize = space_subsize_default;
int
space_maxsize
=
space_maxsize_default
;
int
space_maxcount
=
space_maxcount_default
;
/* Map shift vector to sortlist. */
const
int
sortlistID
[
27
]
=
{
/* ( -1 , -1 , -1 ) */
0
,
/* ( -1 , -1 , 0 ) */
1
,
/* ( -1 , -1 , 1 ) */
2
,
/* ( -1 , 0 , -1 ) */
3
,
/* ( -1 , 0 , 0 ) */
4
,
/* ( -1 , 0 , 1 ) */
5
,
/* ( -1 , 1 , -1 ) */
6
,
/* ( -1 , 1 , 0 ) */
7
,
/* ( -1 , 1 , 1 ) */
8
,
/* ( 0 , -1 , -1 ) */
9
,
/* ( 0 , -1 , 0 ) */
10
,
/* ( 0 , -1 , 1 ) */
11
,
/* ( 0 , 0 , -1 ) */
12
,
/* ( 0 , 0 , 0 ) */
0
,
/* ( 0 , 0 , 1 ) */
12
,
/* ( 0 , 1 , -1 ) */
11
,
/* ( 0 , 1 , 0 ) */
10
,
/* ( 0 , 1 , 1 ) */
9
,
/* ( 1 , -1 , -1 ) */
8
,
/* ( 1 , -1 , 0 ) */
7
,
/* ( 1 , -1 , 1 ) */
6
,
/* ( 1 , 0 , -1 ) */
5
,
/* ( 1 , 0 , 0 ) */
4
,
/* ( 1 , 0 , 1 ) */
3
,
/* ( 1 , 1 , -1 ) */
2
,
/* ( 1 , 1 , 0 ) */
1
,
/* ( 1 , 1 , 1 ) */
0
};
/**
* @brief Interval stack necessary for parallel particle sorting.
*/
...
...
src/space.h
View file @
83175268
...
...
@@ -56,9 +56,6 @@ extern int space_maxsize;
extern
int
space_subsize
;
extern
int
space_maxcount
;
/* Map shift vector to sortlist. */
extern
const
int
sortlistID
[
27
];
/**
* @brief The space in which the cells and particles reside.
*/
...
...
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