|
waLBerla 7.3
|
This file provides macros which make iterating over all cells of one or more fields easier.
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:
All macros also exist with _OMP at the end (for these macros, the OpenMP pragma can be specified by hand):
Some examples:
Increase all values by '42':
Increase all values by '42', including all cells in all ghost layers:
Increase all values by '42', including all cells in the first and second ghost layer:
Increase all values by '42', using a field iterator:
Add values from one field to another field:
Add values from one field to another field using field iterators:
Only use every second x-coordinate for computation (aka: write the innermost loop yourself!):
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):
The same code using a field iterator:
| #define WALBERLA_FOR_ALL_CELLS | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_1 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_10 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_11 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| it3, | |||
| f3, | |||
| it4, | |||
| f4, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_12 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_13 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| it3, | |||
| f3, | |||
| it4, | |||
| f4, | |||
| it5, | |||
| f5, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_14 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_15 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| it3, | |||
| f3, | |||
| it4, | |||
| f4, | |||
| it5, | |||
| f5, | |||
| it6, | |||
| f6, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_16 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_17 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| it3, | |||
| f3, | |||
| it4, | |||
| f4, | |||
| it5, | |||
| f5, | |||
| it6, | |||
| f6, | |||
| it7, | |||
| f7, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_18 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_19 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_2 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_20 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_3 | ( | it0, | |
| f0, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_4 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_5 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_6 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_7 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_8 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_9 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| it3, | |||
| f3, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_XYZ | ( | interval, | |
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_XYZ_OMP | ( | interval, | |
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_YZ | ( | interval, | |
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_YZ_OMP | ( | interval, | |
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_1 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_10 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_2 | ( | field, | |
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_3 | ( | field, | |
| gl, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_4 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_5 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_6 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_7 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_8 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_9 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_1 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_10 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_2 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_3 | ( | field, | |
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_4 | ( | field, | |
| gl, | |||
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_5 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_6 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_7 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_8 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ_OMP_9 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_1 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_10 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_2 | ( | field, | |
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_3 | ( | field, | |
| gl, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_4 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_5 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_6 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_7 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_8 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_9 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_1 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_10 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_2 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_3 | ( | field, | |
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_4 | ( | field, | |
| gl, | |||
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_5 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_6 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_7 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_8 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_YZ_OMP_9 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_1 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_10 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| it3, | |||
| f3, | |||
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_11 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_12 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| it3, | |||
| f3, | |||
| it4, | |||
| f4, | |||
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_13 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_14 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| it3, | |||
| f3, | |||
| it4, | |||
| f4, | |||
| it5, | |||
| f5, | |||
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_15 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_16 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| it3, | |||
| f3, | |||
| it4, | |||
| f4, | |||
| it5, | |||
| f5, | |||
| it6, | |||
| f6, | |||
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_17 | ( | ... | ) |
| #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 ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_19 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_2 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_20 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_3 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_4 | ( | it0, | |
| f0, | |||
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_5 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_6 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_7 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_8 | ( | it0, | |
| f0, | |||
| it1, | |||
| f1, | |||
| it2, | |||
| f2, | |||
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_OMP_9 | ( | ... | ) |
| #define WALBERLA_FOR_ALL_CELLS_XYZ | ( | field, | |
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_XYZ_OMP | ( | field, | |
| omp, | |||
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_YZ | ( | field, | |
| CODE ) |
| #define WALBERLA_FOR_ALL_CELLS_YZ_OMP | ( | field, | |
| omp, | |||
| CODE ) |