Commit 1dc9ca85 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Moved the sorting entry structure to a separate file following @jwillis' work...

Moved the sorting entry structure to a separate file following @jwillis' work in the vectorisation branch.
parent 176aebc3
...@@ -46,7 +46,7 @@ include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \ ...@@ -46,7 +46,7 @@ include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
hydro_properties.h riemann.h threadpool.h cooling.h cooling_struct.h sourceterms.h \ hydro_properties.h riemann.h threadpool.h cooling.h cooling_struct.h sourceterms.h \
sourceterms_struct.h statistics.h memswap.h cache.h runner_doiact_vec.h profiler.h \ sourceterms_struct.h statistics.h memswap.h cache.h runner_doiact_vec.h profiler.h \
dump.h logger.h active.h timeline.h xmf.h gravity_properties.h gravity_derivatives.h \ dump.h logger.h active.h timeline.h xmf.h gravity_properties.h gravity_derivatives.h \
vector_power.h hydro_space.h vector_power.h hydro_space.h sort_part.h
# Common source files # Common source files
AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \ AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include "minmax.h" #include "minmax.h"
#include "runner_doiact_vec.h" #include "runner_doiact_vec.h"
#include "scheduler.h" #include "scheduler.h"
#include "sort_part.h"
#include "sourceterms.h" #include "sourceterms.h"
#include "space.h" #include "space.h"
#include "stars.h" #include "stars.h"
...@@ -62,39 +63,6 @@ ...@@ -62,39 +63,6 @@
#include "timers.h" #include "timers.h"
#include "timestep.h" #include "timestep.h"
/**
* @brief Entry in a list of sorted indices.
*/
struct entry {
/*! Distance on the axis */
float d;
/*! Particle index */
int i;
};
/* Orientation of the cell pairs */
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},
{7.071067811865475e-01, 0.0, 7.071067811865475e-01},
{1.0, 0.0, 0.0},
{7.071067811865475e-01, 0.0, -7.071067811865475e-01},
{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},
{0.0, 7.071067811865475e-01, 7.071067811865475e-01},
{0.0, 1.0, 0.0},
{0.0, 7.071067811865475e-01, -7.071067811865475e-01},
{0.0, 0.0, 1.0},
};
/* 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};
/* Import the density loop functions. */ /* Import the density loop functions. */
#define FUNCTION density #define FUNCTION density
#include "runner_doiact.h" #include "runner_doiact.h"
......
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2017 James S. Wills (james.s.willis@durham.ac.uk)
* Matthieu Schaller (matthieu.schaller@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_SORT_PART_H
#define SWIFT_SORT_PART_H
/**
* @brief Entry in a list of sorted indices.
*/
struct entry {
/*! Distance on the axis */
float d;
/*! Particle index */
int i;
};
/* Orientation of the cell pairs */
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},
{7.071067811865475e-01, 0.0, 7.071067811865475e-01},
{1.0, 0.0, 0.0},
{7.071067811865475e-01, 0.0, -7.071067811865475e-01},
{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},
{0.0, 7.071067811865475e-01, 7.071067811865475e-01},
{0.0, 1.0, 0.0},
{0.0, 7.071067811865475e-01, -7.071067811865475e-01},
{0.0, 0.0, 1.0},
};
/* 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};
/**
* @brief Determines whether a pair of cells are corner to corner.
*
* @param sid sort ID
*
* @return 1 if corner to corner, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int sort_is_corner(int sid) {
return (sid == 0 || sid == 2 || sid == 6 || sid == 8);
}
/**
* @brief Determines whether a pair of cells are edge to edge.
*
* @param sid sort ID
*
* @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);
}
/**
* @brief Determines whether a pair of cells are face to face.
*
* @param sid sort ID
*
* @return 1 if face to face, 0 otherwise.
*/
__attribute__((always_inline)) INLINE static int sort_is_face(int sid) {
return (sid == 4 || sid == 10 || sid == 12);
}
#endif /* SWIFT_SORT_PART_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment