136 IBlock *
block, ConstBlockDataID flagFieldID,
137 FlagUID boundaryFlagUID, FlagUID domainFlagUID) {
143 auto *flagField =
block->getData<FlagField_T>(flagFieldID);
145 if (!(flagField->flagExists(boundaryFlagUID) &&
146 flagField->flagExists(domainFlagUID)))
149 auto boundaryFlag = flagField->getFlag(boundaryFlagUID);
150 auto domainFlag = flagField->getFlag(domainFlagUID);
152 auto inner = flagField->xyzSize();
153 inner.expand(cell_idx_t(-1));
155 indexVectorAll.clear();
156 indexVectorInner.clear();
157 indexVectorOuter.clear();
159 for (
auto it = flagField->beginWithGhostLayerXYZ(
160 cell_idx_c(flagField->nrOfGhostLayers() - 1));
161 it != flagField->end(); ++it) {
162 if (!isFlagSet(it, domainFlag))
165 if (isFlagSet(it.neighbor(0, 0, 0, 0), boundaryFlag)) {
166 auto element =
IndexInfo(it.x(), it.y(), it.z(), 0);
167 auto const InitialisationAdditionalData = elementInitialiser(
168 Cell(it.x() + 0, it.y() + 0, it.z() + 0), blocks, *
block);
169 element.vel_0 = InitialisationAdditionalData[0];
170 element.vel_1 = InitialisationAdditionalData[1];
171 element.vel_2 = InitialisationAdditionalData[2];
172 indexVectorAll.push_back(element);
173 if (
inner.contains(it.x(), it.y(), it.z()))
174 indexVectorInner.push_back(element);
176 indexVectorOuter.push_back(element);
180 for (
auto it = flagField->beginWithGhostLayerXYZ(
181 cell_idx_c(flagField->nrOfGhostLayers() - 1));
182 it != flagField->end(); ++it) {
183 if (!isFlagSet(it, domainFlag))
186 if (isFlagSet(it.neighbor(0, 1, 0, 0), boundaryFlag)) {
187 auto element =
IndexInfo(it.x(), it.y(), it.z(), 1);
188 auto const InitialisationAdditionalData = elementInitialiser(
189 Cell(it.x() + 0, it.y() + 1, it.z() + 0), blocks, *
block);
190 element.vel_0 = InitialisationAdditionalData[0];
191 element.vel_1 = InitialisationAdditionalData[1];
192 element.vel_2 = InitialisationAdditionalData[2];
193 indexVectorAll.push_back(element);
194 if (
inner.contains(it.x(), it.y(), it.z()))
195 indexVectorInner.push_back(element);
197 indexVectorOuter.push_back(element);
201 for (
auto it = flagField->beginWithGhostLayerXYZ(
202 cell_idx_c(flagField->nrOfGhostLayers() - 1));
203 it != flagField->end(); ++it) {
204 if (!isFlagSet(it, domainFlag))
207 if (isFlagSet(it.neighbor(0, -1, 0, 0), boundaryFlag)) {
208 auto element =
IndexInfo(it.x(), it.y(), it.z(), 2);
209 auto const InitialisationAdditionalData = elementInitialiser(
210 Cell(it.x() + 0, it.y() - 1, it.z() + 0), blocks, *
block);
211 element.vel_0 = InitialisationAdditionalData[0];
212 element.vel_1 = InitialisationAdditionalData[1];
213 element.vel_2 = InitialisationAdditionalData[2];
214 indexVectorAll.push_back(element);
215 if (
inner.contains(it.x(), it.y(), it.z()))
216 indexVectorInner.push_back(element);
218 indexVectorOuter.push_back(element);
222 for (
auto it = flagField->beginWithGhostLayerXYZ(
223 cell_idx_c(flagField->nrOfGhostLayers() - 1));
224 it != flagField->end(); ++it) {
225 if (!isFlagSet(it, domainFlag))
228 if (isFlagSet(it.neighbor(-1, 0, 0, 0), boundaryFlag)) {
229 auto element =
IndexInfo(it.x(), it.y(), it.z(), 3);
230 auto const InitialisationAdditionalData = elementInitialiser(
231 Cell(it.x() - 1, it.y() + 0, it.z() + 0), blocks, *
block);
232 element.vel_0 = InitialisationAdditionalData[0];
233 element.vel_1 = InitialisationAdditionalData[1];
234 element.vel_2 = InitialisationAdditionalData[2];
235 indexVectorAll.push_back(element);
236 if (
inner.contains(it.x(), it.y(), it.z()))
237 indexVectorInner.push_back(element);
239 indexVectorOuter.push_back(element);
243 for (
auto it = flagField->beginWithGhostLayerXYZ(
244 cell_idx_c(flagField->nrOfGhostLayers() - 1));
245 it != flagField->end(); ++it) {
246 if (!isFlagSet(it, domainFlag))
249 if (isFlagSet(it.neighbor(1, 0, 0, 0), boundaryFlag)) {
250 auto element =
IndexInfo(it.x(), it.y(), it.z(), 4);
251 auto const InitialisationAdditionalData = elementInitialiser(
252 Cell(it.x() + 1, it.y() + 0, it.z() + 0), blocks, *
block);
253 element.vel_0 = InitialisationAdditionalData[0];
254 element.vel_1 = InitialisationAdditionalData[1];
255 element.vel_2 = InitialisationAdditionalData[2];
256 indexVectorAll.push_back(element);
257 if (
inner.contains(it.x(), it.y(), it.z()))
258 indexVectorInner.push_back(element);
260 indexVectorOuter.push_back(element);
264 for (
auto it = flagField->beginWithGhostLayerXYZ(
265 cell_idx_c(flagField->nrOfGhostLayers() - 1));
266 it != flagField->end(); ++it) {
267 if (!isFlagSet(it, domainFlag))
270 if (isFlagSet(it.neighbor(0, 0, 1, 0), boundaryFlag)) {
271 auto element =
IndexInfo(it.x(), it.y(), it.z(), 5);
272 auto const InitialisationAdditionalData = elementInitialiser(
273 Cell(it.x() + 0, it.y() + 0, it.z() + 1), blocks, *
block);
274 element.vel_0 = InitialisationAdditionalData[0];
275 element.vel_1 = InitialisationAdditionalData[1];
276 element.vel_2 = InitialisationAdditionalData[2];
277 indexVectorAll.push_back(element);
278 if (
inner.contains(it.x(), it.y(), it.z()))
279 indexVectorInner.push_back(element);
281 indexVectorOuter.push_back(element);
285 for (
auto it = flagField->beginWithGhostLayerXYZ(
286 cell_idx_c(flagField->nrOfGhostLayers() - 1));
287 it != flagField->end(); ++it) {
288 if (!isFlagSet(it, domainFlag))
291 if (isFlagSet(it.neighbor(0, 0, -1, 0), boundaryFlag)) {
292 auto element =
IndexInfo(it.x(), it.y(), it.z(), 6);
293 auto const InitialisationAdditionalData = elementInitialiser(
294 Cell(it.x() + 0, it.y() + 0, it.z() - 1), blocks, *
block);
295 element.vel_0 = InitialisationAdditionalData[0];
296 element.vel_1 = InitialisationAdditionalData[1];
297 element.vel_2 = InitialisationAdditionalData[2];
298 indexVectorAll.push_back(element);
299 if (
inner.contains(it.x(), it.y(), it.z()))
300 indexVectorInner.push_back(element);
302 indexVectorOuter.push_back(element);
306 for (
auto it = flagField->beginWithGhostLayerXYZ(
307 cell_idx_c(flagField->nrOfGhostLayers() - 1));
308 it != flagField->end(); ++it) {
309 if (!isFlagSet(it, domainFlag))
312 if (isFlagSet(it.neighbor(-1, 1, 0, 0), boundaryFlag)) {
313 auto element =
IndexInfo(it.x(), it.y(), it.z(), 7);
314 auto const InitialisationAdditionalData = elementInitialiser(
315 Cell(it.x() - 1, it.y() + 1, it.z() + 0), blocks, *
block);
316 element.vel_0 = InitialisationAdditionalData[0];
317 element.vel_1 = InitialisationAdditionalData[1];
318 element.vel_2 = InitialisationAdditionalData[2];
319 indexVectorAll.push_back(element);
320 if (
inner.contains(it.x(), it.y(), it.z()))
321 indexVectorInner.push_back(element);
323 indexVectorOuter.push_back(element);
327 for (
auto it = flagField->beginWithGhostLayerXYZ(
328 cell_idx_c(flagField->nrOfGhostLayers() - 1));
329 it != flagField->end(); ++it) {
330 if (!isFlagSet(it, domainFlag))
333 if (isFlagSet(it.neighbor(1, 1, 0, 0), boundaryFlag)) {
334 auto element =
IndexInfo(it.x(), it.y(), it.z(), 8);
335 auto const InitialisationAdditionalData = elementInitialiser(
336 Cell(it.x() + 1, it.y() + 1, it.z() + 0), blocks, *
block);
337 element.vel_0 = InitialisationAdditionalData[0];
338 element.vel_1 = InitialisationAdditionalData[1];
339 element.vel_2 = InitialisationAdditionalData[2];
340 indexVectorAll.push_back(element);
341 if (
inner.contains(it.x(), it.y(), it.z()))
342 indexVectorInner.push_back(element);
344 indexVectorOuter.push_back(element);
348 for (
auto it = flagField->beginWithGhostLayerXYZ(
349 cell_idx_c(flagField->nrOfGhostLayers() - 1));
350 it != flagField->end(); ++it) {
351 if (!isFlagSet(it, domainFlag))
354 if (isFlagSet(it.neighbor(-1, -1, 0, 0), boundaryFlag)) {
355 auto element =
IndexInfo(it.x(), it.y(), it.z(), 9);
356 auto const InitialisationAdditionalData = elementInitialiser(
357 Cell(it.x() - 1, it.y() - 1, it.z() + 0), blocks, *
block);
358 element.vel_0 = InitialisationAdditionalData[0];
359 element.vel_1 = InitialisationAdditionalData[1];
360 element.vel_2 = InitialisationAdditionalData[2];
361 indexVectorAll.push_back(element);
362 if (
inner.contains(it.x(), it.y(), it.z()))
363 indexVectorInner.push_back(element);
365 indexVectorOuter.push_back(element);
369 for (
auto it = flagField->beginWithGhostLayerXYZ(
370 cell_idx_c(flagField->nrOfGhostLayers() - 1));
371 it != flagField->end(); ++it) {
372 if (!isFlagSet(it, domainFlag))
375 if (isFlagSet(it.neighbor(1, -1, 0, 0), boundaryFlag)) {
376 auto element =
IndexInfo(it.x(), it.y(), it.z(), 10);
377 auto const InitialisationAdditionalData = elementInitialiser(
378 Cell(it.x() + 1, it.y() - 1, it.z() + 0), blocks, *
block);
379 element.vel_0 = InitialisationAdditionalData[0];
380 element.vel_1 = InitialisationAdditionalData[1];
381 element.vel_2 = InitialisationAdditionalData[2];
382 indexVectorAll.push_back(element);
383 if (
inner.contains(it.x(), it.y(), it.z()))
384 indexVectorInner.push_back(element);
386 indexVectorOuter.push_back(element);
390 for (
auto it = flagField->beginWithGhostLayerXYZ(
391 cell_idx_c(flagField->nrOfGhostLayers() - 1));
392 it != flagField->end(); ++it) {
393 if (!isFlagSet(it, domainFlag))
396 if (isFlagSet(it.neighbor(0, 1, 1, 0), boundaryFlag)) {
397 auto element =
IndexInfo(it.x(), it.y(), it.z(), 11);
398 auto const InitialisationAdditionalData = elementInitialiser(
399 Cell(it.x() + 0, it.y() + 1, it.z() + 1), blocks, *
block);
400 element.vel_0 = InitialisationAdditionalData[0];
401 element.vel_1 = InitialisationAdditionalData[1];
402 element.vel_2 = InitialisationAdditionalData[2];
403 indexVectorAll.push_back(element);
404 if (
inner.contains(it.x(), it.y(), it.z()))
405 indexVectorInner.push_back(element);
407 indexVectorOuter.push_back(element);
411 for (
auto it = flagField->beginWithGhostLayerXYZ(
412 cell_idx_c(flagField->nrOfGhostLayers() - 1));
413 it != flagField->end(); ++it) {
414 if (!isFlagSet(it, domainFlag))
417 if (isFlagSet(it.neighbor(0, -1, 1, 0), boundaryFlag)) {
418 auto element =
IndexInfo(it.x(), it.y(), it.z(), 12);
419 auto const InitialisationAdditionalData = elementInitialiser(
420 Cell(it.x() + 0, it.y() - 1, it.z() + 1), blocks, *
block);
421 element.vel_0 = InitialisationAdditionalData[0];
422 element.vel_1 = InitialisationAdditionalData[1];
423 element.vel_2 = InitialisationAdditionalData[2];
424 indexVectorAll.push_back(element);
425 if (
inner.contains(it.x(), it.y(), it.z()))
426 indexVectorInner.push_back(element);
428 indexVectorOuter.push_back(element);
432 for (
auto it = flagField->beginWithGhostLayerXYZ(
433 cell_idx_c(flagField->nrOfGhostLayers() - 1));
434 it != flagField->end(); ++it) {
435 if (!isFlagSet(it, domainFlag))
438 if (isFlagSet(it.neighbor(-1, 0, 1, 0), boundaryFlag)) {
439 auto element =
IndexInfo(it.x(), it.y(), it.z(), 13);
440 auto const InitialisationAdditionalData = elementInitialiser(
441 Cell(it.x() - 1, it.y() + 0, it.z() + 1), blocks, *
block);
442 element.vel_0 = InitialisationAdditionalData[0];
443 element.vel_1 = InitialisationAdditionalData[1];
444 element.vel_2 = InitialisationAdditionalData[2];
445 indexVectorAll.push_back(element);
446 if (
inner.contains(it.x(), it.y(), it.z()))
447 indexVectorInner.push_back(element);
449 indexVectorOuter.push_back(element);
453 for (
auto it = flagField->beginWithGhostLayerXYZ(
454 cell_idx_c(flagField->nrOfGhostLayers() - 1));
455 it != flagField->end(); ++it) {
456 if (!isFlagSet(it, domainFlag))
459 if (isFlagSet(it.neighbor(1, 0, 1, 0), boundaryFlag)) {
460 auto element =
IndexInfo(it.x(), it.y(), it.z(), 14);
461 auto const InitialisationAdditionalData = elementInitialiser(
462 Cell(it.x() + 1, it.y() + 0, it.z() + 1), blocks, *
block);
463 element.vel_0 = InitialisationAdditionalData[0];
464 element.vel_1 = InitialisationAdditionalData[1];
465 element.vel_2 = InitialisationAdditionalData[2];
466 indexVectorAll.push_back(element);
467 if (
inner.contains(it.x(), it.y(), it.z()))
468 indexVectorInner.push_back(element);
470 indexVectorOuter.push_back(element);
474 for (
auto it = flagField->beginWithGhostLayerXYZ(
475 cell_idx_c(flagField->nrOfGhostLayers() - 1));
476 it != flagField->end(); ++it) {
477 if (!isFlagSet(it, domainFlag))
480 if (isFlagSet(it.neighbor(0, 1, -1, 0), boundaryFlag)) {
481 auto element =
IndexInfo(it.x(), it.y(), it.z(), 15);
482 auto const InitialisationAdditionalData = elementInitialiser(
483 Cell(it.x() + 0, it.y() + 1, it.z() - 1), blocks, *
block);
484 element.vel_0 = InitialisationAdditionalData[0];
485 element.vel_1 = InitialisationAdditionalData[1];
486 element.vel_2 = InitialisationAdditionalData[2];
487 indexVectorAll.push_back(element);
488 if (
inner.contains(it.x(), it.y(), it.z()))
489 indexVectorInner.push_back(element);
491 indexVectorOuter.push_back(element);
495 for (
auto it = flagField->beginWithGhostLayerXYZ(
496 cell_idx_c(flagField->nrOfGhostLayers() - 1));
497 it != flagField->end(); ++it) {
498 if (!isFlagSet(it, domainFlag))
501 if (isFlagSet(it.neighbor(0, -1, -1, 0), boundaryFlag)) {
502 auto element =
IndexInfo(it.x(), it.y(), it.z(), 16);
503 auto const InitialisationAdditionalData = elementInitialiser(
504 Cell(it.x() + 0, it.y() - 1, it.z() - 1), blocks, *
block);
505 element.vel_0 = InitialisationAdditionalData[0];
506 element.vel_1 = InitialisationAdditionalData[1];
507 element.vel_2 = InitialisationAdditionalData[2];
508 indexVectorAll.push_back(element);
509 if (
inner.contains(it.x(), it.y(), it.z()))
510 indexVectorInner.push_back(element);
512 indexVectorOuter.push_back(element);
516 for (
auto it = flagField->beginWithGhostLayerXYZ(
517 cell_idx_c(flagField->nrOfGhostLayers() - 1));
518 it != flagField->end(); ++it) {
519 if (!isFlagSet(it, domainFlag))
522 if (isFlagSet(it.neighbor(-1, 0, -1, 0), boundaryFlag)) {
523 auto element =
IndexInfo(it.x(), it.y(), it.z(), 17);
524 auto const InitialisationAdditionalData = elementInitialiser(
525 Cell(it.x() - 1, it.y() + 0, it.z() - 1), blocks, *
block);
526 element.vel_0 = InitialisationAdditionalData[0];
527 element.vel_1 = InitialisationAdditionalData[1];
528 element.vel_2 = InitialisationAdditionalData[2];
529 indexVectorAll.push_back(element);
530 if (
inner.contains(it.x(), it.y(), it.z()))
531 indexVectorInner.push_back(element);
533 indexVectorOuter.push_back(element);
537 for (
auto it = flagField->beginWithGhostLayerXYZ(
538 cell_idx_c(flagField->nrOfGhostLayers() - 1));
539 it != flagField->end(); ++it) {
540 if (!isFlagSet(it, domainFlag))
543 if (isFlagSet(it.neighbor(1, 0, -1, 0), boundaryFlag)) {
544 auto element =
IndexInfo(it.x(), it.y(), it.z(), 18);
545 auto const InitialisationAdditionalData = elementInitialiser(
546 Cell(it.x() + 1, it.y() + 0, it.z() - 1), blocks, *
block);
547 element.vel_0 = InitialisationAdditionalData[0];
548 element.vel_1 = InitialisationAdditionalData[1];
549 element.vel_2 = InitialisationAdditionalData[2];
550 indexVectorAll.push_back(element);
551 if (
inner.contains(it.x(), it.y(), it.z()))
552 indexVectorInner.push_back(element);
554 indexVectorOuter.push_back(element);