IteratorMacros.h 95.5 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//======================================================================================================================
//
//  This file is part of waLBerla. waLBerla is free software: you can 
//  redistribute it and/or modify it under the terms of the GNU General Public
//  License as published by the Free Software Foundation, either version 3 of 
//  the License, or (at your option) any later version.
//  
//  waLBerla 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 General Public License along
//  with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file IteratorMacros.h
//! \ingroup field
//! \author Florian Schornbaum <florian.schornbaum@fau.de>
//! \author Martin Bauer <martin.bauer@fau.de>
//!
//! This file provides macros which make iterating over all cells of one or more fields easier.
//!
//! \section docFieldIteratorMacros Field Iterator Macros
//!
//! Iterator macros iterate cells, not all values in all cells, i.e., iteration includes x, y, and z, but **not** f values!
//!
//! ATTENTION: If OpenMP is enabled, iterating all cells is done in parallel!
//!            Meaning: Your code that is supposed to be executed for each cell must be free of any race condition!
//!
//! Existing macros are:
//!
//! - `WALBERLA_FOR_ALL_CELLS_XYZ`
//! - `WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_XYZ`
//! - `WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ`
//! - `WALBERLA_FOR_ALL_CELLS_YZ`
//! - `WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_YZ`
//! - `WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ`
//! - `WALBERLA_FOR_ALL_CELLS`
//!
//! All macros also exist with `_OMP` at the end (for these macros, the OpenMP pragma can be specified by hand):
//!
//! - `WALBERLA_FOR_ALL_CELLS_XYZ_OMP`
//! - `WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_XYZ_OMP`
//! - `WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP`
//! - `WALBERLA_FOR_ALL_CELLS_YZ_OMP`
//! - `WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_YZ_OMP`
//! - `WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP`
//! - `WALBERLA_FOR_ALL_CELLS_OMP`
//!
//! Some examples:
//!
//! Increase all values by '42':
//!
//! \code
//! WALBERLA_FOR_ALL_CELLS_XYZ( ptrToField,
//!
//!    ptrToField->get(x,y,z) += 42;
//! )
//! \endcode
//!
//! Increase all values by '42', including all cells in all ghost layers:
//!
//! \code
//! WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( ptrToField,
//!
//!    ptrToField->get(x,y,z) += 42;
//! )
//! \endcode
//!
//! Increase all values by '42', including all cells in the first and second ghost layer:
//!
//! \code
//! WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( ptrToField, 2,
//!
//!    ptrToField->get(x,y,z) += 42;
//! )
//! \endcode
//!
//! Increase all values by '42', using a field iterator:
//!
//! \code
//! WALBERLA_FOR_ALL_CELLS( fieldIterator, ptrToField,
//!
//!    *fieldIterator += 42;
//! )
//! \endcode
//!
//! Add values from one field to another field:
//!
//! \code
//! WALBERLA_FOR_ALL_CELLS_XYZ( ptrToField,
//!
//!    ptrToAnotherField->get(x,y,z) += ptrToField->get(x,y,z);
//! )
//! \endcode
//!
//! Add values from one field to another field using field iterators:
//!
//! \code
//! WALBERLA_FOR_ALL_CELLS( fieldIterator, ptrToField, anotherFieldIterator, ptrToAnotherField,
//!
//!    *anotherFieldIterator += *fieldIterator;
//! )
//! \endcode
//!
//! Only use every second x-coordinate for computation (aka: write the innermost loop yourself!):
//!
//! \code
//! WALBERLA_FOR_ALL_CELLS_YZ( ptrToField,
//!
//!    for( ::walberla::cell_idx_t x = ::walberla::cell_idx_t(0); x < ::walberla::cell_idx_c( ptrToField->xSize() ); x += ::walberla::cell_idx_t(2) )
//!       ptrToField->get(x,y,z) += 42;
//! )
//! \endcode
//!
//! If you want to customize to pragma used for OpenMP, you can do so by using the `_OMP` macros.
//! The OpenMP pragma is always the last parameter of the macro prior the the code itself.
//! Example (calculate scalar product):
//!
//! \code
//! WALBERLA_FOR_ALL_CELLS_XYZ_OMP( ptrToField, omp parallel for schedule(static) reduction(+:sum)
//!
//!    const auto value = ptrToField->get(x,y,z);
//!    sum += value * value;
//! )
//! \endcode
//!
//! The same code using a field iterator:
//!
//! \code
//! WALBERLA_FOR_ALL_CELLS_OMP( fieldIterator, ptrToField, omp parallel for schedule(static) reduction(+:sum)
//!
//!    const auto value = *fieldIterator;
//!    sum += value * value;
//! )
//! \endcode
//!
//======================================================================================================================

#pragma once

#include "core/DataTypes.h"
#include "core/Macros.h"
#include "core/debug/Debug.h"

/////////////////////////////
//  WALBERLA_FOR_ALL_CELLS //
/////////////////////////////

#ifdef _OPENMP

152
#if (defined(_MSC_VER) && _MSC_VER < 1926)
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443

#define WALBERLA_FOR_ALL_CELLS_XYZ_OMP( field, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (field) ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (field)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (field)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (field)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         for( ::walberla::cell_idx_t y = ::walberla::cell_idx_t(0); y < ySize__; ++y ) { \
            for( ::walberla::cell_idx_t x = ::walberla::cell_idx_t(0); x < xSize__; ++x ) \
            { \
               CODE \
            } \
         } \
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         for( ::walberla::cell_idx_t z = ::walberla::cell_idx_t(0); z < zSize__; ++z ) { \
            for( ::walberla::cell_idx_t x = ::walberla::cell_idx_t(0); x < xSize__; ++x ) \
            { \
               CODE \
            } \
         } \
      } \
   } }

#define WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_XYZ_OMP( interval, omp, CODE ) \
   { if( interval.zSize() >= interval.ySize() ) \
   { \
      const int izMax = ::walberla::int_c( interval.zMax() ); \
      __pragma(omp) \
      for( int iz = ::walberla::int_c( interval.zMin() ); iz <= izMax; ++iz ) { \
         ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         for( ::walberla::cell_idx_t y = interval.yMin(); y <= interval.yMax(); ++y ) { \
            for( ::walberla::cell_idx_t x = interval.xMin(); x <= interval.xMax(); ++x ) \
            { \
               CODE \
            } \
         } \
      } \
   } \
   else \
   { \
      const int iyMax = ::walberla::int_c( interval.yMax() ); \
      __pragma(omp) \
      for( int iy = ::walberla::int_c( interval.yMin() ); iy <= iyMax; ++iy ) { \
         ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         for( ::walberla::cell_idx_t z = interval.zMin(); z <= interval.zMax(); ++z ) { \
            for( ::walberla::cell_idx_t x = interval.xMin(); x <= interval.xMax(); ++x ) \
            { \
               CODE \
            } \
         } \
      } \
   } }
   
// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_4( field, gl, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (field) ); \
   WALBERLA_ASSERT_GREATER_EQUAL_2( (field)->nrOfGhostLayers(), gl ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (field)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (field)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (field)->zSize() ); \
   const ::walberla::cell_idx_t gl__ = ::walberla::cell_idx_c( gl ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         if( iz == 0 ) \
         { \
            for( ::walberla::cell_idx_t z = -gl__; z < ::walberla::cell_idx_t(0); ++z ) { \
               for( ::walberla::cell_idx_t y = -gl__; y < (ySize__ + gl__); ++y ) { \
                  for( ::walberla::cell_idx_t x = -gl__; x < (xSize__ + gl__); ++x ) \
                  { \
                     CODE \
                  } \
               } \
            } \
         } \
         { \
            ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
            for( ::walberla::cell_idx_t y = -gl__; y < (ySize__ + gl__); ++y ) { \
               for( ::walberla::cell_idx_t x = -gl__; x < (xSize__ + gl__); ++x ) \
               { \
                  CODE \
               } \
            } \
         } \
         if( iz == (izSize - 1) ) \
         { \
            for( ::walberla::cell_idx_t z = zSize__; z < (zSize__ + gl__); ++z ) { \
               for( ::walberla::cell_idx_t y = -gl__; y < (ySize__ + gl__); ++y ) { \
                  for( ::walberla::cell_idx_t x = -gl__; x < (xSize__ + gl__); ++x ) \
                  { \
                     CODE \
                  } \
               } \
            } \
         } \
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         if( iy == 0 ) \
         { \
            for( ::walberla::cell_idx_t y = -gl__; y < ::walberla::cell_idx_t(0); ++y ) { \
               for( ::walberla::cell_idx_t z = -gl__; z < (zSize__ + gl__); ++z ) { \
                  for( ::walberla::cell_idx_t x = -gl__; x < (xSize__ + gl__); ++x ) \
                  { \
                     CODE \
                  } \
               } \
            } \
         } \
         { \
            ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
            for( ::walberla::cell_idx_t z = -gl__; z < (zSize__ + gl__); ++z ) { \
               for( ::walberla::cell_idx_t x = -gl__; x < (xSize__ + gl__); ++x ) \
               { \
                  CODE \
               } \
            } \
         } \
         if( iy == (iySize - 1) ) \
         { \
            for( ::walberla::cell_idx_t y = ySize__; y < (ySize__ + gl__); ++y ) { \
               for( ::walberla::cell_idx_t z = -gl__; z < (zSize__ + gl__); ++z ) { \
                  for( ::walberla::cell_idx_t x = -gl__; x < (xSize__ + gl__); ++x ) \
                  { \
                     CODE \
                  } \
               } \
            } \
         } \
      } \
   } }
   
#define WALBERLA_FOR_ALL_CELLS_YZ_OMP( field, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (field) ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (field)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (field)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         for( ::walberla::cell_idx_t y = ::walberla::cell_idx_t(0); y < ySize__; ++y ) \
         { \
            CODE \
         } \
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         for( ::walberla::cell_idx_t z = ::walberla::cell_idx_t(0); z < zSize__; ++z ) \
         { \
            CODE \
         } \
      } \
   } }

#define WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_YZ_OMP( interval, omp, CODE ) \
   { if( interval.zSize() >= interval.ySize() ) \
   { \
      const int izMax = ::walberla::int_c( interval.zMax() ); \
      __pragma(omp) \
      for( int iz = ::walberla::int_c( interval.zMin() ); iz <= izMax; ++iz ) { \
         ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         for( ::walberla::cell_idx_t y = interval.yMin(); y <= interval.yMax(); ++y ) \
         { \
            CODE \
         } \
      } \
   } \
   else \
   { \
      const int iyMax = ::walberla::int_c( interval.yMax() ); \
      __pragma(omp) \
      for( int iy = ::walberla::int_c( interval.yMin() ); iy <= iyMax; ++iy ) { \
         ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         for( ::walberla::cell_idx_t z = interval.zMin(); z <= interval.zMax(); ++z ) \
         { \
            CODE \
         } \
      } \
   } }
   
// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_4( field, gl, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (field) ); \
   WALBERLA_ASSERT_GREATER_EQUAL_2( (field)->nrOfGhostLayers(), gl ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (field)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (field)->zSize() ); \
   const ::walberla::cell_idx_t gl__ = ::walberla::cell_idx_c( gl ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         if( iz == 0 ) \
         { \
            for( ::walberla::cell_idx_t z = -gl__; z < ::walberla::cell_idx_t(0); ++z ) { \
               for( ::walberla::cell_idx_t y = -gl__; y < (ySize__ + gl__); ++y ) \
               { \
                  CODE \
               } \
            } \
         } \
         { \
            ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
            for( ::walberla::cell_idx_t y = -gl__; y < (ySize__ + gl__); ++y ) \
            { \
               CODE \
            } \
         } \
         if( iz == (izSize - 1) ) \
         { \
            for( ::walberla::cell_idx_t z = zSize__; z < (zSize__ + gl__); ++z ) { \
               for( ::walberla::cell_idx_t y = -gl__; y < (ySize__ + gl__); ++y ) \
               { \
                     CODE \
               } \
            } \
         } \
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         if( iy == 0 ) \
         { \
            for( ::walberla::cell_idx_t y = -gl__; y < ::walberla::cell_idx_t(0); ++y ) { \
               for( ::walberla::cell_idx_t z = -gl__; z < (zSize__ + gl__); ++z ) \
               { \
                  CODE \
               } \
            } \
         } \
         { \
            ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
            for( ::walberla::cell_idx_t z = -gl__; z < (zSize__ + gl__); ++z ) \
            { \
               CODE \
            } \
         } \
         if( iy == (iySize - 1) ) \
         { \
            for( ::walberla::cell_idx_t y = ySize__; y < (ySize__ + gl__); ++y ) { \
               for( ::walberla::cell_idx_t z = -gl__; z < (zSize__ + gl__); ++z ) \
               { \
                  CODE \
               } \
            } \
         } \
      } \
   } }
   
// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_OMP_4( it0, f0, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (f0) ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (f0)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (f0)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (f0)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         const ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), ::walberla::cell_idx_t(0), z, xSize__ - ::walberla::cell_idx_t(1), ySize__ - ::walberla::cell_idx_t(1), z ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
444
         for(/* see above */; it0 != (f0)->end(); ++it0) \
445
446
447
448
449
450
451
452
453
454
455
456
457
         { \
            CODE \
         } \
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         const ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), y, ::walberla::cell_idx_t(0), xSize__ - ::walberla::cell_idx_t(1), y, zSize__ - ::walberla::cell_idx_t(1) ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
458
         for(/* see above */; it0 != (f0)->end(); ++it0) \
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
         { \
            CODE \
         } \
      } \
   } }

// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_OMP_6( it0, f0, it1, f1, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (f0) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f1) ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f1)->xyzSize() ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (f0)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (f0)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (f0)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         const ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), ::walberla::cell_idx_t(0), z, xSize__ - ::walberla::cell_idx_t(1), ySize__ - ::walberla::cell_idx_t(1), z ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
482
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1) \
483
484
485
         { \
            CODE \
         } \
486
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
487
488
489
490
491
492
493
494
495
496
497
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         const ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), y, ::walberla::cell_idx_t(0), xSize__ - ::walberla::cell_idx_t(1), y, zSize__ - ::walberla::cell_idx_t(1) ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
498
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1) \
499
500
501
         { \
            CODE \
         } \
502
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
      } \
   } }
   
// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_OMP_8( it0, f0, it1, f1, it2, f2, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (f0) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f1) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f2) ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f1)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f2)->xyzSize() ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (f0)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (f0)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (f0)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         const ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), ::walberla::cell_idx_t(0), z, xSize__ - ::walberla::cell_idx_t(1), ySize__ - ::walberla::cell_idx_t(1), z ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
526
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2) \
527
528
529
         { \
            CODE \
         } \
530
531
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
532
533
534
535
536
537
538
539
540
541
542
543
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         const ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), y, ::walberla::cell_idx_t(0), xSize__ - ::walberla::cell_idx_t(1), y, zSize__ - ::walberla::cell_idx_t(1) ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
544
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2) \
545
546
547
         { \
            CODE \
         } \
548
549
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
550
551
      } \
   } }
552

553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_OMP_10( it0, f0, it1, f1, it2, f2, it3, f3, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (f0) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f1) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f2) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f3) ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f1)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f2)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f3)->xyzSize() ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (f0)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (f0)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (f0)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         const ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), ::walberla::cell_idx_t(0), z, xSize__ - ::walberla::cell_idx_t(1), ySize__ - ::walberla::cell_idx_t(1), z ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
         auto it3 = (f3)->beginSliceXYZ( interval ); \
576
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2, ++it3) \
577
578
579
         { \
            CODE \
         } \
580
581
582
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it3, (f3)->end() ); \
583
584
585
586
587
588
589
590
591
592
593
594
595
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         const ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), y, ::walberla::cell_idx_t(0), xSize__ - ::walberla::cell_idx_t(1), y, zSize__ - ::walberla::cell_idx_t(1) ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
         auto it3 = (f3)->beginSliceXYZ( interval ); \
596
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2, ++it3) \
597
598
599
         { \
            CODE \
         } \
600
601
602
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it3, (f3)->end() ); \
603
604
      } \
   } }
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631

// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_OMP_12( it0, f0, it1, f1, it2, f2, it3, f3, it4, f4, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (f0) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f1) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f2) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f3) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f4) ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f1)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f2)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f3)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f4)->xyzSize() ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (f0)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (f0)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (f0)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         const ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), ::walberla::cell_idx_t(0), z, xSize__ - ::walberla::cell_idx_t(1), ySize__ - ::walberla::cell_idx_t(1), z ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
         auto it3 = (f3)->beginSliceXYZ( interval ); \
         auto it4 = (f4)->beginSliceXYZ( interval ); \
632
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2, ++it3, ++it4) \
633
634
635
         { \
            CODE \
         } \
636
637
638
639
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it3, (f3)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it4, (f4)->end() ); \
640
641
642
643
644
645
646
647
648
649
650
651
652
653
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         const ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), y, ::walberla::cell_idx_t(0), xSize__ - ::walberla::cell_idx_t(1), y, zSize__ - ::walberla::cell_idx_t(1) ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
         auto it3 = (f3)->beginSliceXYZ( interval ); \
         auto it4 = (f4)->beginSliceXYZ( interval ); \
654
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2, ++it3, ++it4) \
655
656
657
         { \
            CODE \
         } \
658
659
660
661
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it3, (f3)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it4, (f4)->end() ); \
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
      } \
   } }

// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_OMP_14( it0, f0, it1, f1, it2, f2, it3, f3, it4, f4, it5, f5, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (f0) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f1) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f2) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f3) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f4) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f5) ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f1)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f2)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f3)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f4)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f5)->xyzSize() ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (f0)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (f0)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (f0)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         const ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), ::walberla::cell_idx_t(0), z, xSize__ - ::walberla::cell_idx_t(1), ySize__ - ::walberla::cell_idx_t(1), z ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
         auto it3 = (f3)->beginSliceXYZ( interval ); \
         auto it4 = (f4)->beginSliceXYZ( interval ); \
         auto it5 = (f5)->beginSliceXYZ( interval ); \
694
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2, ++it3, ++it4, ++it5) \
695
696
697
         { \
            CODE \
         } \
698
699
700
701
702
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it3, (f3)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it4, (f4)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it5, (f5)->end() ); \
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         const ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), y, ::walberla::cell_idx_t(0), xSize__ - ::walberla::cell_idx_t(1), y, zSize__ - ::walberla::cell_idx_t(1) ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
         auto it3 = (f3)->beginSliceXYZ( interval ); \
         auto it4 = (f4)->beginSliceXYZ( interval ); \
         auto it5 = (f5)->beginSliceXYZ( interval ); \
718
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2, ++it3, ++it4, ++it5) \
719
720
721
         { \
            CODE \
         } \
722
723
724
725
726
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it3, (f3)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it4, (f4)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it5, (f5)->end() ); \
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
      } \
   } }

// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_OMP_16( it0, f0, it1, f1, it2, f2, it3, f3, it4, f4, it5, f5, it6, f6, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (f0) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f1) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f2) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f3) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f4) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f5) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f6) ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f1)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f2)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f3)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f4)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f5)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f6)->xyzSize() ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (f0)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (f0)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (f0)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         const ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), ::walberla::cell_idx_t(0), z, xSize__ - ::walberla::cell_idx_t(1), ySize__ - ::walberla::cell_idx_t(1), z ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
         auto it3 = (f3)->beginSliceXYZ( interval ); \
         auto it4 = (f4)->beginSliceXYZ( interval ); \
         auto it5 = (f5)->beginSliceXYZ( interval ); \
         auto it6 = (f6)->beginSliceXYZ( interval ); \
762
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2, ++it3, ++it4, ++it5, ++it6) \
763
764
765
         { \
            CODE \
         } \
766
767
768
769
770
771
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it3, (f3)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it4, (f4)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it5, (f5)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it6, (f6)->end() ); \
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         const ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), y, ::walberla::cell_idx_t(0), xSize__ - ::walberla::cell_idx_t(1), y, zSize__ - ::walberla::cell_idx_t(1) ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
         auto it3 = (f3)->beginSliceXYZ( interval ); \
         auto it4 = (f4)->beginSliceXYZ( interval ); \
         auto it5 = (f5)->beginSliceXYZ( interval ); \
         auto it6 = (f6)->beginSliceXYZ( interval ); \
788
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2, ++it3, ++it4, ++it5, ++it6) \
789
790
791
         { \
            CODE \
         } \
792
793
794
795
796
797
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it3, (f3)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it4, (f4)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it5, (f5)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it6, (f6)->end() ); \
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
      } \
   } }

// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_OMP_18( it0, f0, it1, f1, it2, f2, it3, f3, it4, f4, it5, f5, it6, f6, it7, f7, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (f0) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f1) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f2) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f3) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f4) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f5) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f6) ); \
   WALBERLA_ASSERT_NOT_NULLPTR_1( (f7) ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f1)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f2)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f3)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f4)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f5)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f6)->xyzSize() ); \
   WALBERLA_ASSERT_EQUAL_2( (f0)->xyzSize(), (f7)->xyzSize() ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (f0)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (f0)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (f0)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      __pragma(omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         const ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), ::walberla::cell_idx_t(0), z, xSize__ - ::walberla::cell_idx_t(1), ySize__ - ::walberla::cell_idx_t(1), z ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
         auto it3 = (f3)->beginSliceXYZ( interval ); \
         auto it4 = (f4)->beginSliceXYZ( interval ); \
         auto it5 = (f5)->beginSliceXYZ( interval ); \
         auto it6 = (f6)->beginSliceXYZ( interval ); \
         auto it7 = (f7)->beginSliceXYZ( interval ); \
836
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2, ++it3, ++it4, ++it5, ++it6, ++it7) \
837
838
839
         { \
            CODE \
         } \
840
841
842
843
844
845
846
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it3, (f3)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it4, (f4)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it5, (f5)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it6, (f6)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it7, (f7)->end() ); \
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      __pragma(omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         const ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         const CellInterval interval( ::walberla::cell_idx_t(0), y, ::walberla::cell_idx_t(0), xSize__ - ::walberla::cell_idx_t(1), y, zSize__ - ::walberla::cell_idx_t(1) ); \
         auto it0 = (f0)->beginSliceXYZ( interval ); \
         auto it1 = (f1)->beginSliceXYZ( interval ); \
         auto it2 = (f2)->beginSliceXYZ( interval ); \
         auto it3 = (f3)->beginSliceXYZ( interval ); \
         auto it4 = (f4)->beginSliceXYZ( interval ); \
         auto it5 = (f5)->beginSliceXYZ( interval ); \
         auto it6 = (f6)->beginSliceXYZ( interval ); \
         auto it7 = (f7)->beginSliceXYZ( interval ); \
864
         for(/* see above */; it0 != (f0)->end(); ++it0, ++it1, ++it2, ++it3, ++it4, ++it5, ++it6, ++it7) \
865
866
867
         { \
            CODE \
         } \
868
869
870
871
872
873
874
         WALBERLA_ASSERT_EQUAL_2( it1, (f1)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it2, (f2)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it3, (f3)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it4, (f4)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it5, (f5)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it6, (f6)->end() ); \
         WALBERLA_ASSERT_EQUAL_2( it7, (f7)->end() ); \
875
876
      } \
   } }
877

878
#else // == MSVC >= 2019 16.6 or not MSVC
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942

#define WALBERLA_FOR_ALL_CELLS_XYZ_OMP( field, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (field) ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (field)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (field)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (field)->zSize() ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      _Pragma(#omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         for( ::walberla::cell_idx_t y = ::walberla::cell_idx_t(0); y < ySize__; ++y ) { \
            for( ::walberla::cell_idx_t x = ::walberla::cell_idx_t(0); x < xSize__; ++x ) \
            { \
               CODE \
            } \
         } \
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      _Pragma(#omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         for( ::walberla::cell_idx_t z = ::walberla::cell_idx_t(0); z < zSize__; ++z ) { \
            for( ::walberla::cell_idx_t x = ::walberla::cell_idx_t(0); x < xSize__; ++x ) \
            { \
               CODE \
            } \
         } \
      } \
   } }

#define WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_XYZ_OMP( interval, omp, CODE ) \
   { if( interval.zSize() >= interval.ySize() ) \
   { \
      const int izMax = ::walberla::int_c( interval.zMax() ); \
      _Pragma(#omp) \
      for( int iz = ::walberla::int_c( interval.zMin() ); iz <= izMax; ++iz ) { \
         ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
         for( ::walberla::cell_idx_t y = interval.yMin(); y <= interval.yMax(); ++y ) { \
            for( ::walberla::cell_idx_t x = interval.xMin(); x <= interval.xMax(); ++x ) \
            { \
               CODE \
            } \
         } \
      } \
   } \
   else \
   { \
      const int iyMax = ::walberla::int_c( interval.yMax() ); \
      _Pragma(#omp) \
      for( int iy = ::walberla::int_c( interval.yMin() ); iy <= iyMax; ++iy ) { \
         ::walberla::cell_idx_t y = ::walberla::cell_idx_c( iy ); \
         for( ::walberla::cell_idx_t z = interval.zMin(); z <= interval.zMax(); ++z ) { \
            for( ::walberla::cell_idx_t x = interval.xMin(); x <= interval.xMax(); ++x ) \
            { \
               CODE \
            } \
         } \
      } \
   } }
943

944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Do not call this macro, call 'WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP' (using the same signature) instead
#define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_4( field, gl, omp, CODE ) \
   { WALBERLA_ASSERT_NOT_NULLPTR_1( (field) ); \
   WALBERLA_ASSERT_GREATER_EQUAL_2( (field)->nrOfGhostLayers(), gl ); \
   const ::walberla::cell_idx_t xSize__ = ::walberla::cell_idx_c( (field)->xSize() ); \
   const ::walberla::cell_idx_t ySize__ = ::walberla::cell_idx_c( (field)->ySize() ); \
   const ::walberla::cell_idx_t zSize__ = ::walberla::cell_idx_c( (field)->zSize() ); \
   const ::walberla::cell_idx_t gl__ = ::walberla::cell_idx_c( gl ); \
   if( zSize__ >= ySize__ ) \
   { \
      const int izSize = ::walberla::int_c( zSize__ ); \
      _Pragma(#omp) \
      for( int iz = 0; iz < izSize; ++iz ) { \
         if( iz == 0 ) \
         { \
            for( ::walberla::cell_idx_t z = -gl__; z < ::walberla::cell_idx_t(0); ++z ) { \
               for( ::walberla::cell_idx_t y = -gl__; y < (ySize__ + gl__); ++y ) { \
                  for( ::walberla::cell_idx_t x = -gl__; x < (xSize__ + gl__); ++x ) \
                  { \
                     CODE \
                  } \
               } \
            } \
         } \
         { \
            ::walberla::cell_idx_t z = ::walberla::cell_idx_c( iz ); \
            for( ::walberla::cell_idx_t y = -gl__; y < (ySize__ + gl__); ++y ) { \
               for( ::walberla::cell_idx_t x = -gl__; x < (xSize__ + gl__); ++x ) \
               { \
                  CODE \
               } \
            } \
         } \
         if( iz == (izSize - 1) ) \
         { \
            for( ::walberla::cell_idx_t z = zSize__; z < (zSize__ + gl__); ++z ) { \
               for( ::walberla::cell_idx_t y = -gl__; y < (ySize__ + gl__); ++y ) { \
                  for( ::walberla::cell_idx_t x = -gl__; x < (xSize__ + gl__); ++x ) \
                  { \
                     CODE \
                  } \
               } \
            } \
         } \
      } \
   } \
   else \
   { \
      const int iySize = ::walberla::int_c( ySize__ ); \
      _Pragma(#omp) \
      for( int iy = 0; iy < iySize; ++iy ) { \
         if( iy == 0 ) \
         { \
            for( ::walberla::cell_idx_t y = -gl__; y < ::walberla::cell_idx_t(0); ++y ) { \
               for( ::walberla::cell_idx_t z = -gl__; z < (zSize__ + gl__); ++z ) { \
                  for( ::walberla::cell_idx_t x = -gl__; x < (xSize__ + gl__); ++x ) \
                  { \
For faster browsing, not all history is shown. View entire blame