ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
FixedFlux_single_precision.cpp
Go to the documentation of this file.
1//======================================================================================================================
2//
3// This file is part of waLBerla. waLBerla is free software: you can
4// redistribute it and/or modify it under the terms of the GNU General Public
5// License as published by the Free Software Foundation, either version 3 of
6// the License, or (at your option) any later version.
7//
8// waLBerla is distributed in the hope that it will be useful, but WITHOUT
9// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11// for more details.
12//
13// You should have received a copy of the GNU General Public License along
14// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
15//
16//! \\file FixedFlux_single_precision.cpp
17//! \\author pystencils
18//======================================================================================================================
19
20// kernel generated with pystencils v1.4+1.ge851f4e, lbmpy v1.4+1.ge9efe34, sympy v1.12.1, lbmpy_walberla/pystencils_walberla from waLBerla commit 007e77e077ad9d22b5eed6f3d3118240993e553c
21
23#include "core/DataTypes.h"
24#include "core/Macros.h"
25
26#define FUNC_PREFIX
27
28using namespace std;
29
30namespace walberla {
31namespace pystencils {
32
33#ifdef __GNUC__
34#pragma GCC diagnostic push
35#pragma GCC diagnostic ignored "-Wstrict-aliasing"
36#pragma GCC diagnostic ignored "-Wunused-variable"
37#pragma GCC diagnostic ignored "-Wconversion"
38#endif
39
40#ifdef __CUDACC__
41#pragma push
42#ifdef __NVCC_DIAG_PRAGMA_SUPPORT__
43#pragma nv_diag_suppress 177
44#else
45#pragma diag_suppress 177
46#endif
47#endif
48// NOLINTBEGIN(readability-non-const-parameter*)
49namespace internal_11b127eed0b5044a0a655e8444f26034 {
50static FUNC_PREFIX void fixedflux_single_precision_boundary_FixedFlux_single_precision(float *RESTRICT const _data_flux, uint8_t *RESTRICT const _data_indexVector, int64_t const _stride_flux_0, int64_t const _stride_flux_1, int64_t const _stride_flux_2, int64_t const _stride_flux_3, int32_t indexVectorSize) {
51 for (int64_t ctr_0 = 0; ctr_0 < indexVectorSize; ctr_0 += 1) {
52 const int32_t x = *((int32_t *)(&_data_indexVector[28 * ctr_0]));
53 const int32_t y = *((int32_t *)(&_data_indexVector[28 * ctr_0 + 4]));
54 const int32_t z = *((int32_t *)(&_data_indexVector[28 * ctr_0 + 8]));
55
56 const int32_t dir = *((int32_t *)(&_data_indexVector[28 * ctr_0 + 12]));
57 if (((dir) == (26))) {
58 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 9 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
59 } else {
60 if (((dir) == (25))) {
61 _data_flux[_stride_flux_0 * x + _stride_flux_0 + _stride_flux_1 * y - _stride_flux_1 + _stride_flux_2 * z - _stride_flux_2 + 12 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
62 } else {
63 if (((dir) == (24))) {
64 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 11 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20]));
65 } else {
66 if (((dir) == (23))) {
67 _data_flux[_stride_flux_0 * x + _stride_flux_0 + _stride_flux_1 * y + _stride_flux_1 + _stride_flux_2 * z - _stride_flux_2 + 10 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
68 } else {
69 if (((dir) == (22))) {
70 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 10 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
71 } else {
72 if (((dir) == (21))) {
73 _data_flux[_stride_flux_0 * x + _stride_flux_0 + _stride_flux_1 * y - _stride_flux_1 + _stride_flux_2 * z + _stride_flux_2 + 11 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20]));
74 } else {
75 if (((dir) == (20))) {
76 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 12 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
77 } else {
78 if (((dir) == (19))) {
79 _data_flux[_stride_flux_0 * x + _stride_flux_0 + _stride_flux_1 * y + _stride_flux_1 + _stride_flux_2 * z + _stride_flux_2 + 9 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
80 } else {
81 if (((dir) == (18))) {
82 _data_flux[_stride_flux_0 * x + _stride_flux_0 + _stride_flux_1 * y + _stride_flux_2 * z - _stride_flux_2 + 6 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
83 } else {
84 if (((dir) == (17))) {
85 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 5 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
86 } else {
87 if (((dir) == (16))) {
88 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 7 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
89 } else {
90 if (((dir) == (15))) {
91 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_1 + _stride_flux_2 * z - _stride_flux_2 + 8 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
92 } else {
93 if (((dir) == (14))) {
94 _data_flux[_stride_flux_0 * x + _stride_flux_0 + _stride_flux_1 * y + _stride_flux_2 * z + _stride_flux_2 + 5 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
95 } else {
96 if (((dir) == (13))) {
97 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 6 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
98 } else {
99 if (((dir) == (12))) {
100 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 8 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
101 } else {
102 if (((dir) == (11))) {
103 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_1 + _stride_flux_2 * z + _stride_flux_2 + 7 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
104 } else {
105 if (((dir) == (10))) {
106 _data_flux[_stride_flux_0 * x + _stride_flux_0 + _stride_flux_1 * y - _stride_flux_1 + _stride_flux_2 * z + 4 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20]));
107 } else {
108 if (((dir) == (9))) {
109 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 3 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20]));
110 } else {
111 if (((dir) == (8))) {
112 _data_flux[_stride_flux_0 * x + _stride_flux_0 + _stride_flux_1 * y + _stride_flux_1 + _stride_flux_2 * z + 3 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) - 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20]));
113 } else {
114 if (((dir) == (7))) {
115 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 4 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16])) + 0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20]));
116 } else {
117 if (((dir) == (6))) {
118 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + 2 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
119 } else {
120 if (((dir) == (5))) {
121 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + _stride_flux_2 + 2 * _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 24]));
122 } else {
123 if (((dir) == (4))) {
124 _data_flux[_stride_flux_0 * x + _stride_flux_0 + _stride_flux_1 * y + _stride_flux_2 * z] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16]));
125 } else {
126 if (((dir) == (3))) {
127 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 16]));
128 } else {
129 if (((dir) == (2))) {
130 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_2 * z + _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20]));
131 } else {
132 if (((dir) == (1))) {
133 _data_flux[_stride_flux_0 * x + _stride_flux_1 * y + _stride_flux_1 + _stride_flux_2 * z + _stride_flux_3] = -0.1111111111111111f * *((float *)(&_data_indexVector[28 * ctr_0 + 20]));
134 }
135 }
136 }
137 }
138 }
139 }
140 }
141 }
142 }
143 }
144 }
145 }
146 }
147 }
148 }
149 }
150 }
151 }
152 }
153 }
154 }
155 }
156 }
157 }
158 }
159 }
160 }
161}
162} // namespace internal_11b127eed0b5044a0a655e8444f26034
163
164// NOLINTEND(readability-non-const-parameter*)
165#ifdef __GNUC__
166#pragma GCC diagnostic pop
167#endif
168
169#ifdef __CUDACC__
170#pragma pop
171#endif
172
173void FixedFlux_single_precision::run_impl(IBlock *block, IndexVectors::Type type) {
174 auto *indexVectors = block->getData<IndexVectors>(indexVectorID);
175 int32_t indexVectorSize = int32_c(indexVectors->indexVector(type).size());
176 if (indexVectorSize == 0)
177 return;
178
179 auto pointer = indexVectors->pointerCpu(type);
180
181 uint8_t *_data_indexVector = reinterpret_cast<uint8_t *>(pointer);
182
183 auto flux = block->getData<field::GhostLayerField<float, 13>>(fluxID);
184
185 WALBERLA_ASSERT_GREATER_EQUAL(0, -int_c(flux->nrOfGhostLayers()))
186 float *RESTRICT const _data_flux = flux->dataAt(0, 0, 0, 0);
187 const int64_t _stride_flux_0 = int64_t(flux->xStride());
188 const int64_t _stride_flux_1 = int64_t(flux->yStride());
189 const int64_t _stride_flux_2 = int64_t(flux->zStride());
190 const int64_t _stride_flux_3 = int64_t(1 * int64_t(flux->fStride()));
191 internal_11b127eed0b5044a0a655e8444f26034::fixedflux_single_precision_boundary_FixedFlux_single_precision(_data_flux, _data_indexVector, _stride_flux_0, _stride_flux_1, _stride_flux_2, _stride_flux_3, indexVectorSize);
192}
193
195 run_impl(block, IndexVectors::ALL);
196}
197
201
205
206} // namespace pystencils
207} // namespace walberla
#define FUNC_PREFIX
\file AdvectiveFluxKernel_double_precision.cpp \author pystencils
#define RESTRICT
\file AdvectiveFluxKernel_double_precision.h \author pystencils
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
static double * block(double *p, std::size_t index, std::size_t size)
Definition elc.cpp:177
STL namespace.
static FUNC_PREFIX void fixedflux_single_precision_boundary_FixedFlux_single_precision(float *RESTRICT const _data_flux, uint8_t *RESTRICT const _data_indexVector, int64_t const _stride_flux_0, int64_t const _stride_flux_1, int64_t const _stride_flux_2, int64_t const _stride_flux_3, int32_t indexVectorSize)
\file PackInfoPdfDoublePrecision.cpp \author pystencils