1 // --------------------------------------------------------------------------
4 // Markus Wittmann, 2016-2017
5 // RRZE, University of Erlangen-Nuremberg, Germany
6 // markus.wittmann -at- fau.de or hpc -at- rrze.fau.de
9 // LSS, University of Erlangen-Nuremberg, Germany
11 // This file is part of the Lattice Boltzmann Benchmark Kernels (LbmBenchKernels).
13 // LbmBenchKernels is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
18 // LbmBenchKernels is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
23 // You should have received a copy of the GNU General Public License
24 // along with LbmBenchKernels. If not, see <http://www.gnu.org/licenses/>.
26 // --------------------------------------------------------------------------
27 #ifndef __BENCH_KERNEL_D3Q19_AA_VEC_COMMON_H__
28 #define __BENCH_KERNEL_D3Q19_AA_VEC_COMMON_H__
30 // #include "BenchKernelD3Q19AaCommon.h"
34 typedef struct KernelDataAa_
37 int Blk[3]; // Blocking in X, Y, and Z direction, value of 0 disables blocking.
38 int Iteration; // Current iteration number.
41 // Macro for casting KernelData * to KernelDataAa *.
42 #define KDA(_x_) ((KernelDataAa *)(_x_))
44 // Build a function name extended by the propagation model name and the data layout.
45 // FNANEM(test) will be expanded to test_PushSoA if DATA_LAYOUT_NAME is defined
46 // as SoA and PROP_MODEL is defined as Push.
47 #define FNAME(functionName) JOIN(JOIN(functionName,_),JOIN(PROP_MODEL_NAME,DATA_LAYOUT_NAME))
49 #ifndef DATA_LAYOUT_SOA
50 #error Only DATA_LAYOUT_SOA is supported.
54 #error Only PROP_MODEL_AA is supported.
57 // -----------------------------------------------------------------------
58 // Index function for accesssing PDF array for different data layouts.
60 #define P_INDEX_5 FNAME(PINDEX5)
62 static inline int FNAME(PINDEX5)(int dims[3], int x, int y, int z, int d)
78 #error Not implemented for this discretization.
81 #ifdef DATA_LAYOUT_SOA
82 return d * dims[0] * dims[1] * dims[2] + x * dims[1] * dims[2] + y * dims[2] + z;
83 // #elif DATA_LAYOUT_AOS
84 // return x * dims[1] * dims[2] * N_D3Q19 + y * dims[2] * N_D3Q19 + z * N_D3Q19 + d;
86 #error P_INDEX_5 function no implemented for chosen data layout.
92 #endif // __BENCH_KERNEL_D3Q19_AA_VEC_COMMON_H__