163 IBlock *
block, ConstBlockDataID flagFieldID,
164 FlagUID boundaryFlagUID, FlagUID domainFlagUID) {
170 auto *flagField =
block->getData<FlagField_T>(flagFieldID);
172 if (!(flagField->flagExists(boundaryFlagUID) &&
173 flagField->flagExists(domainFlagUID)))
176 auto boundaryFlag = flagField->getFlag(boundaryFlagUID);
177 auto domainFlag = flagField->getFlag(domainFlagUID);
179 auto inner = flagField->xyzSize();
180 inner.expand(cell_idx_t(-1));
182 indexVectorAll.clear();
183 indexVectorInner.clear();
184 indexVectorOuter.clear();
186 for (
auto it = flagField->beginWithGhostLayerXYZ(
187 cell_idx_c(flagField->nrOfGhostLayers() - 1));
188 it != flagField->end(); ++it) {
189 if (!isFlagSet(it, domainFlag))
192 if (isFlagSet(it.neighbor(0, 0, 0, 0), boundaryFlag)) {
193 auto element =
IndexInfo(it.x(), it.y(), it.z(), 0);
194 auto const InitialisationAdditionalData = elementInitialiser(
195 Cell(it.x() + 0, it.y() + 0, it.z() + 0), blocks, *
block);
196 element.vel_0 = InitialisationAdditionalData[0];
197 element.vel_1 = InitialisationAdditionalData[1];
198 element.vel_2 = InitialisationAdditionalData[2];
199 indexVectorAll.push_back(element);
200 if (
inner.contains(it.x(), it.y(), it.z()))
201 indexVectorInner.push_back(element);
203 indexVectorOuter.push_back(element);
207 for (
auto it = flagField->beginWithGhostLayerXYZ(
208 cell_idx_c(flagField->nrOfGhostLayers() - 1));
209 it != flagField->end(); ++it) {
210 if (!isFlagSet(it, domainFlag))
213 if (isFlagSet(it.neighbor(0, 1, 0, 0), boundaryFlag)) {
214 auto element =
IndexInfo(it.x(), it.y(), it.z(), 1);
215 auto const InitialisationAdditionalData = elementInitialiser(
216 Cell(it.x() + 0, it.y() + 1, it.z() + 0), blocks, *
block);
217 element.vel_0 = InitialisationAdditionalData[0];
218 element.vel_1 = InitialisationAdditionalData[1];
219 element.vel_2 = InitialisationAdditionalData[2];
220 indexVectorAll.push_back(element);
221 if (
inner.contains(it.x(), it.y(), it.z()))
222 indexVectorInner.push_back(element);
224 indexVectorOuter.push_back(element);
228 for (
auto it = flagField->beginWithGhostLayerXYZ(
229 cell_idx_c(flagField->nrOfGhostLayers() - 1));
230 it != flagField->end(); ++it) {
231 if (!isFlagSet(it, domainFlag))
234 if (isFlagSet(it.neighbor(0, -1, 0, 0), boundaryFlag)) {
235 auto element =
IndexInfo(it.x(), it.y(), it.z(), 2);
236 auto const InitialisationAdditionalData = elementInitialiser(
237 Cell(it.x() + 0, it.y() - 1, it.z() + 0), blocks, *
block);
238 element.vel_0 = InitialisationAdditionalData[0];
239 element.vel_1 = InitialisationAdditionalData[1];
240 element.vel_2 = InitialisationAdditionalData[2];
241 indexVectorAll.push_back(element);
242 if (
inner.contains(it.x(), it.y(), it.z()))
243 indexVectorInner.push_back(element);
245 indexVectorOuter.push_back(element);
249 for (
auto it = flagField->beginWithGhostLayerXYZ(
250 cell_idx_c(flagField->nrOfGhostLayers() - 1));
251 it != flagField->end(); ++it) {
252 if (!isFlagSet(it, domainFlag))
255 if (isFlagSet(it.neighbor(-1, 0, 0, 0), boundaryFlag)) {
256 auto element =
IndexInfo(it.x(), it.y(), it.z(), 3);
257 auto const InitialisationAdditionalData = elementInitialiser(
258 Cell(it.x() - 1, it.y() + 0, it.z() + 0), blocks, *
block);
259 element.vel_0 = InitialisationAdditionalData[0];
260 element.vel_1 = InitialisationAdditionalData[1];
261 element.vel_2 = InitialisationAdditionalData[2];
262 indexVectorAll.push_back(element);
263 if (
inner.contains(it.x(), it.y(), it.z()))
264 indexVectorInner.push_back(element);
266 indexVectorOuter.push_back(element);
270 for (
auto it = flagField->beginWithGhostLayerXYZ(
271 cell_idx_c(flagField->nrOfGhostLayers() - 1));
272 it != flagField->end(); ++it) {
273 if (!isFlagSet(it, domainFlag))
276 if (isFlagSet(it.neighbor(1, 0, 0, 0), boundaryFlag)) {
277 auto element =
IndexInfo(it.x(), it.y(), it.z(), 4);
278 auto const InitialisationAdditionalData = elementInitialiser(
279 Cell(it.x() + 1, it.y() + 0, it.z() + 0), blocks, *
block);
280 element.vel_0 = InitialisationAdditionalData[0];
281 element.vel_1 = InitialisationAdditionalData[1];
282 element.vel_2 = InitialisationAdditionalData[2];
283 indexVectorAll.push_back(element);
284 if (
inner.contains(it.x(), it.y(), it.z()))
285 indexVectorInner.push_back(element);
287 indexVectorOuter.push_back(element);
291 for (
auto it = flagField->beginWithGhostLayerXYZ(
292 cell_idx_c(flagField->nrOfGhostLayers() - 1));
293 it != flagField->end(); ++it) {
294 if (!isFlagSet(it, domainFlag))
297 if (isFlagSet(it.neighbor(0, 0, 1, 0), boundaryFlag)) {
298 auto element =
IndexInfo(it.x(), it.y(), it.z(), 5);
299 auto const InitialisationAdditionalData = elementInitialiser(
300 Cell(it.x() + 0, it.y() + 0, it.z() + 1), blocks, *
block);
301 element.vel_0 = InitialisationAdditionalData[0];
302 element.vel_1 = InitialisationAdditionalData[1];
303 element.vel_2 = InitialisationAdditionalData[2];
304 indexVectorAll.push_back(element);
305 if (
inner.contains(it.x(), it.y(), it.z()))
306 indexVectorInner.push_back(element);
308 indexVectorOuter.push_back(element);
312 for (
auto it = flagField->beginWithGhostLayerXYZ(
313 cell_idx_c(flagField->nrOfGhostLayers() - 1));
314 it != flagField->end(); ++it) {
315 if (!isFlagSet(it, domainFlag))
318 if (isFlagSet(it.neighbor(0, 0, -1, 0), boundaryFlag)) {
319 auto element =
IndexInfo(it.x(), it.y(), it.z(), 6);
320 auto const InitialisationAdditionalData = elementInitialiser(
321 Cell(it.x() + 0, it.y() + 0, it.z() - 1), blocks, *
block);
322 element.vel_0 = InitialisationAdditionalData[0];
323 element.vel_1 = InitialisationAdditionalData[1];
324 element.vel_2 = InitialisationAdditionalData[2];
325 indexVectorAll.push_back(element);
326 if (
inner.contains(it.x(), it.y(), it.z()))
327 indexVectorInner.push_back(element);
329 indexVectorOuter.push_back(element);
333 for (
auto it = flagField->beginWithGhostLayerXYZ(
334 cell_idx_c(flagField->nrOfGhostLayers() - 1));
335 it != flagField->end(); ++it) {
336 if (!isFlagSet(it, domainFlag))
339 if (isFlagSet(it.neighbor(-1, 1, 0, 0), boundaryFlag)) {
340 auto element =
IndexInfo(it.x(), it.y(), it.z(), 7);
341 auto const InitialisationAdditionalData = elementInitialiser(
342 Cell(it.x() - 1, it.y() + 1, it.z() + 0), blocks, *
block);
343 element.vel_0 = InitialisationAdditionalData[0];
344 element.vel_1 = InitialisationAdditionalData[1];
345 element.vel_2 = InitialisationAdditionalData[2];
346 indexVectorAll.push_back(element);
347 if (
inner.contains(it.x(), it.y(), it.z()))
348 indexVectorInner.push_back(element);
350 indexVectorOuter.push_back(element);
354 for (
auto it = flagField->beginWithGhostLayerXYZ(
355 cell_idx_c(flagField->nrOfGhostLayers() - 1));
356 it != flagField->end(); ++it) {
357 if (!isFlagSet(it, domainFlag))
360 if (isFlagSet(it.neighbor(1, 1, 0, 0), boundaryFlag)) {
361 auto element =
IndexInfo(it.x(), it.y(), it.z(), 8);
362 auto const InitialisationAdditionalData = elementInitialiser(
363 Cell(it.x() + 1, it.y() + 1, it.z() + 0), blocks, *
block);
364 element.vel_0 = InitialisationAdditionalData[0];
365 element.vel_1 = InitialisationAdditionalData[1];
366 element.vel_2 = InitialisationAdditionalData[2];
367 indexVectorAll.push_back(element);
368 if (
inner.contains(it.x(), it.y(), it.z()))
369 indexVectorInner.push_back(element);
371 indexVectorOuter.push_back(element);
375 for (
auto it = flagField->beginWithGhostLayerXYZ(
376 cell_idx_c(flagField->nrOfGhostLayers() - 1));
377 it != flagField->end(); ++it) {
378 if (!isFlagSet(it, domainFlag))
381 if (isFlagSet(it.neighbor(-1, -1, 0, 0), boundaryFlag)) {
382 auto element =
IndexInfo(it.x(), it.y(), it.z(), 9);
383 auto const InitialisationAdditionalData = elementInitialiser(
384 Cell(it.x() - 1, it.y() - 1, it.z() + 0), blocks, *
block);
385 element.vel_0 = InitialisationAdditionalData[0];
386 element.vel_1 = InitialisationAdditionalData[1];
387 element.vel_2 = InitialisationAdditionalData[2];
388 indexVectorAll.push_back(element);
389 if (
inner.contains(it.x(), it.y(), it.z()))
390 indexVectorInner.push_back(element);
392 indexVectorOuter.push_back(element);
396 for (
auto it = flagField->beginWithGhostLayerXYZ(
397 cell_idx_c(flagField->nrOfGhostLayers() - 1));
398 it != flagField->end(); ++it) {
399 if (!isFlagSet(it, domainFlag))
402 if (isFlagSet(it.neighbor(1, -1, 0, 0), boundaryFlag)) {
403 auto element =
IndexInfo(it.x(), it.y(), it.z(), 10);
404 auto const InitialisationAdditionalData = elementInitialiser(
405 Cell(it.x() + 1, it.y() - 1, it.z() + 0), blocks, *
block);
406 element.vel_0 = InitialisationAdditionalData[0];
407 element.vel_1 = InitialisationAdditionalData[1];
408 element.vel_2 = InitialisationAdditionalData[2];
409 indexVectorAll.push_back(element);
410 if (
inner.contains(it.x(), it.y(), it.z()))
411 indexVectorInner.push_back(element);
413 indexVectorOuter.push_back(element);
417 for (
auto it = flagField->beginWithGhostLayerXYZ(
418 cell_idx_c(flagField->nrOfGhostLayers() - 1));
419 it != flagField->end(); ++it) {
420 if (!isFlagSet(it, domainFlag))
423 if (isFlagSet(it.neighbor(0, 1, 1, 0), boundaryFlag)) {
424 auto element =
IndexInfo(it.x(), it.y(), it.z(), 11);
425 auto const InitialisationAdditionalData = elementInitialiser(
426 Cell(it.x() + 0, it.y() + 1, it.z() + 1), blocks, *
block);
427 element.vel_0 = InitialisationAdditionalData[0];
428 element.vel_1 = InitialisationAdditionalData[1];
429 element.vel_2 = InitialisationAdditionalData[2];
430 indexVectorAll.push_back(element);
431 if (
inner.contains(it.x(), it.y(), it.z()))
432 indexVectorInner.push_back(element);
434 indexVectorOuter.push_back(element);
438 for (
auto it = flagField->beginWithGhostLayerXYZ(
439 cell_idx_c(flagField->nrOfGhostLayers() - 1));
440 it != flagField->end(); ++it) {
441 if (!isFlagSet(it, domainFlag))
444 if (isFlagSet(it.neighbor(0, -1, 1, 0), boundaryFlag)) {
445 auto element =
IndexInfo(it.x(), it.y(), it.z(), 12);
446 auto const InitialisationAdditionalData = elementInitialiser(
447 Cell(it.x() + 0, it.y() - 1, it.z() + 1), blocks, *
block);
448 element.vel_0 = InitialisationAdditionalData[0];
449 element.vel_1 = InitialisationAdditionalData[1];
450 element.vel_2 = InitialisationAdditionalData[2];
451 indexVectorAll.push_back(element);
452 if (
inner.contains(it.x(), it.y(), it.z()))
453 indexVectorInner.push_back(element);
455 indexVectorOuter.push_back(element);
459 for (
auto it = flagField->beginWithGhostLayerXYZ(
460 cell_idx_c(flagField->nrOfGhostLayers() - 1));
461 it != flagField->end(); ++it) {
462 if (!isFlagSet(it, domainFlag))
465 if (isFlagSet(it.neighbor(-1, 0, 1, 0), boundaryFlag)) {
466 auto element =
IndexInfo(it.x(), it.y(), it.z(), 13);
467 auto const InitialisationAdditionalData = elementInitialiser(
468 Cell(it.x() - 1, it.y() + 0, it.z() + 1), blocks, *
block);
469 element.vel_0 = InitialisationAdditionalData[0];
470 element.vel_1 = InitialisationAdditionalData[1];
471 element.vel_2 = InitialisationAdditionalData[2];
472 indexVectorAll.push_back(element);
473 if (
inner.contains(it.x(), it.y(), it.z()))
474 indexVectorInner.push_back(element);
476 indexVectorOuter.push_back(element);
480 for (
auto it = flagField->beginWithGhostLayerXYZ(
481 cell_idx_c(flagField->nrOfGhostLayers() - 1));
482 it != flagField->end(); ++it) {
483 if (!isFlagSet(it, domainFlag))
486 if (isFlagSet(it.neighbor(1, 0, 1, 0), boundaryFlag)) {
487 auto element =
IndexInfo(it.x(), it.y(), it.z(), 14);
488 auto const InitialisationAdditionalData = elementInitialiser(
489 Cell(it.x() + 1, it.y() + 0, it.z() + 1), blocks, *
block);
490 element.vel_0 = InitialisationAdditionalData[0];
491 element.vel_1 = InitialisationAdditionalData[1];
492 element.vel_2 = InitialisationAdditionalData[2];
493 indexVectorAll.push_back(element);
494 if (
inner.contains(it.x(), it.y(), it.z()))
495 indexVectorInner.push_back(element);
497 indexVectorOuter.push_back(element);
501 for (
auto it = flagField->beginWithGhostLayerXYZ(
502 cell_idx_c(flagField->nrOfGhostLayers() - 1));
503 it != flagField->end(); ++it) {
504 if (!isFlagSet(it, domainFlag))
507 if (isFlagSet(it.neighbor(0, 1, -1, 0), boundaryFlag)) {
508 auto element =
IndexInfo(it.x(), it.y(), it.z(), 15);
509 auto const InitialisationAdditionalData = elementInitialiser(
510 Cell(it.x() + 0, it.y() + 1, it.z() - 1), blocks, *
block);
511 element.vel_0 = InitialisationAdditionalData[0];
512 element.vel_1 = InitialisationAdditionalData[1];
513 element.vel_2 = InitialisationAdditionalData[2];
514 indexVectorAll.push_back(element);
515 if (
inner.contains(it.x(), it.y(), it.z()))
516 indexVectorInner.push_back(element);
518 indexVectorOuter.push_back(element);
522 for (
auto it = flagField->beginWithGhostLayerXYZ(
523 cell_idx_c(flagField->nrOfGhostLayers() - 1));
524 it != flagField->end(); ++it) {
525 if (!isFlagSet(it, domainFlag))
528 if (isFlagSet(it.neighbor(0, -1, -1, 0), boundaryFlag)) {
529 auto element =
IndexInfo(it.x(), it.y(), it.z(), 16);
530 auto const InitialisationAdditionalData = elementInitialiser(
531 Cell(it.x() + 0, it.y() - 1, it.z() - 1), blocks, *
block);
532 element.vel_0 = InitialisationAdditionalData[0];
533 element.vel_1 = InitialisationAdditionalData[1];
534 element.vel_2 = InitialisationAdditionalData[2];
535 indexVectorAll.push_back(element);
536 if (
inner.contains(it.x(), it.y(), it.z()))
537 indexVectorInner.push_back(element);
539 indexVectorOuter.push_back(element);
543 for (
auto it = flagField->beginWithGhostLayerXYZ(
544 cell_idx_c(flagField->nrOfGhostLayers() - 1));
545 it != flagField->end(); ++it) {
546 if (!isFlagSet(it, domainFlag))
549 if (isFlagSet(it.neighbor(-1, 0, -1, 0), boundaryFlag)) {
550 auto element =
IndexInfo(it.x(), it.y(), it.z(), 17);
551 auto const InitialisationAdditionalData = elementInitialiser(
552 Cell(it.x() - 1, it.y() + 0, it.z() - 1), blocks, *
block);
553 element.vel_0 = InitialisationAdditionalData[0];
554 element.vel_1 = InitialisationAdditionalData[1];
555 element.vel_2 = InitialisationAdditionalData[2];
556 indexVectorAll.push_back(element);
557 if (
inner.contains(it.x(), it.y(), it.z()))
558 indexVectorInner.push_back(element);
560 indexVectorOuter.push_back(element);
564 for (
auto it = flagField->beginWithGhostLayerXYZ(
565 cell_idx_c(flagField->nrOfGhostLayers() - 1));
566 it != flagField->end(); ++it) {
567 if (!isFlagSet(it, domainFlag))
570 if (isFlagSet(it.neighbor(1, 0, -1, 0), boundaryFlag)) {
571 auto element =
IndexInfo(it.x(), it.y(), it.z(), 18);
572 auto const InitialisationAdditionalData = elementInitialiser(
573 Cell(it.x() + 1, it.y() + 0, it.z() - 1), blocks, *
block);
574 element.vel_0 = InitialisationAdditionalData[0];
575 element.vel_1 = InitialisationAdditionalData[1];
576 element.vel_2 = InitialisationAdditionalData[2];
577 indexVectorAll.push_back(element);
578 if (
inner.contains(it.x(), it.y(), it.z()))
579 indexVectorInner.push_back(element);
581 indexVectorOuter.push_back(element);