291{
292 std::vector<int> discreteNormal(4, 0);
293 std::vector<int> discreteNormal2(4, 0);
294 std::vector<int> nullVector(4, 0);
295
297 && _blockGeometry->
getMaterial({iX, iY, iZ}) != 0) {
298
299
300 if ( _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
301 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
302 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
303 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
304 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
305 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
306 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
307 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0) {
308
309 if (_blockGeometry->
getMaterial({iX + 1, iY, iZ}) == 1) {
310 if (discreteNormal == nullVector) {
311 discreteNormal[0] = 0;
312 discreteNormal[1] = -1;
313 discreteNormal[2] = 0;
314 discreteNormal[3] = 0;
315 }
316 else {
317 discreteNormal2[0] = 0;
318 discreteNormal2[1] = -1;
319 discreteNormal2[2] = 0;
320 discreteNormal2[3] = 0;
321 }
322 }
323
324 if (_blockGeometry->
getMaterial({iX - 1, iY, iZ}) == 1) {
325 if (discreteNormal == nullVector) {
326 discreteNormal[0] = 0;
327 discreteNormal[1] = 1;
328 discreteNormal[2] = 0;
329 discreteNormal[3] = 0;
330 }
331 else {
332 discreteNormal2[0] = 0;
333 discreteNormal2[1] = 1;
334 discreteNormal2[2] = 0;
335 discreteNormal2[3] = 0;
336 }
337 }
338 }
339
340
341 if ( _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
342 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
343 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
344 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
345 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
346 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
347 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
348 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0) {
349
350 if (_blockGeometry->
getMaterial({iX, iY + 1, iZ}) == 1) {
351 if (discreteNormal == nullVector) {
352 discreteNormal[0] = 0;
353 discreteNormal[1] = 0;
354 discreteNormal[2] = -1;
355 discreteNormal[3] = 0;
356 }
357 else {
358 discreteNormal2[0] = 0;
359 discreteNormal2[1] = 0;
360 discreteNormal2[2] = -1;
361 discreteNormal2[3] = 0;
362 }
363 }
364
365 if (_blockGeometry->
getMaterial({iX, iY - 1, iZ}) == 1) {
366 if (discreteNormal == nullVector) {
367 discreteNormal[0] = 0;
368 discreteNormal[1] = 0;
369 discreteNormal[2] = 1;
370 discreteNormal[3] = 0;
371 }
372 else {
373 discreteNormal2[0] = 0;
374 discreteNormal2[1] = 0;
375 discreteNormal2[2] = 1;
376 discreteNormal2[3] = 0;
377 }
378 }
379 }
380
381
382 if (_blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
383 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
384 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
385 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
386 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
387 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
388 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
389 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0) {
390
391 if (_blockGeometry->
getMaterial({iX, iY, iZ + 1}) == 1) {
392 if (discreteNormal == nullVector) {
393 discreteNormal[0] = 0;
394 discreteNormal[1] = 0;
395 discreteNormal[2] = 0;
396 discreteNormal[3] = -1;
397 }
398 else {
399 discreteNormal2[0] = 0;
400 discreteNormal2[1] = 0;
401 discreteNormal2[2] = 0;
402 discreteNormal2[3] = -1;
403 }
404 }
405
406 if (_blockGeometry->
getMaterial({iX, iY, iZ - 1}) == 1) {
407 if (discreteNormal == nullVector) {
408 discreteNormal[0] = 0;
409 discreteNormal[1] = 0;
410 discreteNormal[2] = 0;
411 discreteNormal[3] = 1;
412 }
413 else {
414 discreteNormal2[0] = 0;
415 discreteNormal2[1] = 0;
416 discreteNormal2[2] = 0;
417 discreteNormal2[3] = 1;
418 }
419 }
420 }
421
422
423 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
424 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
425 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
426 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
427 && _blockGeometry->
getMaterial({iX + 1, iY, iZ + 1}) != 1
428 && _blockGeometry->
getMaterial({iX + 1, iY, iZ + 1}) != 0) {
429
430 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
431 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
432 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ}) != 1
433 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ}) != 0
434 && _blockGeometry->
getMaterial({iX, iY + 1, iZ + 1}) != 1
435 && _blockGeometry->
getMaterial({iX, iY + 1, iZ + 1}) != 0
436 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ + 1}) == 1) {
437
438 if (discreteNormal == nullVector) {
439 discreteNormal[0] = 1;
440 discreteNormal[1] = -1;
441 discreteNormal[2] = -1;
442 discreteNormal[3] = -1;
443 }
444 else {
445 discreteNormal2[0] = 1;
446 discreteNormal2[1] = -1;
447 discreteNormal2[2] = -1;
448 discreteNormal2[3] = -1;
449 }
450 }
451
452 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
453 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0
454 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ}) != 1
455 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ}) != 0
456 && _blockGeometry->
getMaterial({iX, iY - 1, iZ + 1}) != 1
457 && _blockGeometry->
getMaterial({iX, iY - 1, iZ + 1}) != 0
458 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ + 1}) == 1) {
459
460 if (discreteNormal == nullVector) {
461 discreteNormal[0] = 1;
462 discreteNormal[1] = -1;
463 discreteNormal[2] = 1;
464 discreteNormal[3] = -1;
465 }
466 else {
467 discreteNormal2[0] = 1;
468 discreteNormal2[1] = -1;
469 discreteNormal2[2] = 1;
470 discreteNormal2[3] = -1;
471 }
472 }
473 }
474
475
476 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
477 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
478 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
479 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
480 && _blockGeometry->
getMaterial({iX + 1, iY, iZ - 1}) != 1
481 && _blockGeometry->
getMaterial({iX + 1, iY, iZ - 1}) != 0) {
482
483 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
484 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0
485 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ}) != 1
486 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ}) != 0
487 && _blockGeometry->
getMaterial({iX, iY - 1, iZ - 1}) != 1
488 && _blockGeometry->
getMaterial({iX, iY - 1, iZ - 1}) != 0
489 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ - 1}) == 1) {
490
491 if (discreteNormal == nullVector) {
492 discreteNormal[0] = 1;
493 discreteNormal[1] = -1;
494 discreteNormal[2] = 1;
495 discreteNormal[3] = 1;
496 }
497 else {
498 discreteNormal2[0] = 1;
499 discreteNormal2[1] = -1;
500 discreteNormal2[2] = 1;
501 discreteNormal2[3] = 1;
502 }
503 }
504
505 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
506 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
507 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ}) != 1
508 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ}) != 0
509 && _blockGeometry->
getMaterial({iX, iY + 1, iZ - 1}) != 1
510 && _blockGeometry->
getMaterial({iX, iY + 1, iZ - 1}) != 0
511 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ - 1}) == 1) {
512
513 if (discreteNormal == nullVector) {
514 discreteNormal[0] = 1;
515 discreteNormal[1] = -1;
516 discreteNormal[2] = -1;
517 discreteNormal[3] = 1;
518 }
519
520 else {
521 discreteNormal2[0] = 1;
522 discreteNormal2[1] = -1;
523 discreteNormal2[2] = -1;
524 discreteNormal2[3] = 1;
525 }
526 }
527 }
528
529
530 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
531 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
532 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
533 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
534 && _blockGeometry->
getMaterial({iX - 1, iY, iZ - 1}) != 1
535 && _blockGeometry->
getMaterial({iX - 1, iY, iZ - 1}) != 0) {
536
537 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
538 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0
539 && _blockGeometry->
getMaterial({iX, iY - 1, iZ - 1}) != 1
540 && _blockGeometry->
getMaterial({iX, iY - 1, iZ - 1}) != 0
541 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ}) != 1
542 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ}) != 0
543 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ - 1}) == 1) {
544
545 if (discreteNormal == nullVector) {
546 discreteNormal[0] = 1;
547 discreteNormal[1] = 1;
548 discreteNormal[2] = 1;
549 discreteNormal[3] = 1;
550 }
551 else {
552 discreteNormal2[0] = 1;
553 discreteNormal2[1] = 1;
554 discreteNormal2[2] = 1;
555 discreteNormal2[3] = 1;
556 }
557 }
558
559 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
560 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
561 && _blockGeometry->
getMaterial({iX, iY + 1, iZ - 1}) != 1
562 && _blockGeometry->
getMaterial({iX, iY + 1, iZ - 1}) != 0
563 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ}) != 1
564 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ}) != 0
565 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ - 1}) == 1) {
566
567 if (discreteNormal == nullVector) {
568 discreteNormal[0] = 1;
569 discreteNormal[1] = 1;
570 discreteNormal[2] = -1;
571 discreteNormal[3] = 1;
572 }
573 else {
574 discreteNormal2[0] = 1;
575 discreteNormal2[1] = 1;
576 discreteNormal2[2] = -1;
577 discreteNormal2[3] = 1;
578 }
579 }
580 }
581
582
583 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
584 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
585 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
586 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
587 && _blockGeometry->
getMaterial({iX - 1, iY, iZ + 1}) != 1
588 && _blockGeometry->
getMaterial({iX - 1, iY, iZ + 1}) != 0) {
589
590 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
591 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
592 && _blockGeometry->
getMaterial({iX, iY + 1, iZ + 1}) != 1
593 && _blockGeometry->
getMaterial({iX, iY + 1, iZ + 1}) != 0
594 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ}) != 1
595 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ}) != 0
596 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ + 1}) == 1) {
597
598 if (discreteNormal == nullVector) {
599 discreteNormal[0] = 1;
600 discreteNormal[1] = 1;
601 discreteNormal[2] = -1;
602 discreteNormal[3] = -1;
603 }
604 else {
605 discreteNormal2[0] = 1;
606 discreteNormal2[1] = 1;
607 discreteNormal2[2] = -1;
608 discreteNormal2[3] = -1;
609 }
610 }
611
612 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
613 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0
614 && _blockGeometry->
getMaterial({iX, iY - 1, iZ + 1}) != 1
615 && _blockGeometry->
getMaterial({iX, iY - 1, iZ + 1}) != 0
616 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ}) != 1
617 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ}) != 0
618 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ + 1}) == 1) {
619
620 if (discreteNormal == nullVector) {
621
622 discreteNormal[0] = 1;
623 discreteNormal[1] = 1;
624 discreteNormal[2] = 1;
625 discreteNormal[3] = -1;
626 }
627
628 else {
629 discreteNormal2[0] = 1;
630 discreteNormal2[1] = 1;
631 discreteNormal2[2] = 1;
632 discreteNormal2[3] = -1;
633 }
634 }
635 }
636
637
638 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) == 1
639 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) == 1
640 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
641 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
642 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
643 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0) {
644
645 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) == 1
646 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
647 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0) {
648
649 if (discreteNormal == nullVector) {
650 discreteNormal[0] = 2;
651 discreteNormal[1] = 1;
652 discreteNormal[2] = 1;
653 discreteNormal[3] = 1;
654 }
655 else {
656 discreteNormal2[0] = 2;
657 discreteNormal2[1] = 1;
658 discreteNormal2[2] = 1;
659 discreteNormal2[3] = 1;
660 }
661 }
662
663 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) == 1
664 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
665 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0) {
666
667 if (discreteNormal == nullVector) {
668 discreteNormal[0] = 2;
669 discreteNormal[1] = 1;
670 discreteNormal[2] = -1;
671 discreteNormal[3] = 1;
672 }
673
674 else {
675 discreteNormal2[0] = 2;
676 discreteNormal2[1] = 1;
677 discreteNormal2[2] = -1;
678 discreteNormal2[3] = 1;
679 }
680 }
681 }
682
683
684 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) == 1
685 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) == 1
686 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
687 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
688 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
689 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0) {
690
691 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) == 1
692 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
693 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0) {
694
695 if (discreteNormal == nullVector) {
696 discreteNormal[0] = 2;
697 discreteNormal[1] = 1;
698 discreteNormal[2] = -1;
699 discreteNormal[3] = -1;
700 }
701 else {
702 discreteNormal2[0] = 2;
703 discreteNormal2[1] = 1;
704 discreteNormal2[2] = -1;
705 discreteNormal2[3] = -1;
706 }
707 }
708
709 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) == 1
710 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
711 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0) {
712
713 if (discreteNormal == nullVector) {
714 discreteNormal[0] = 2;
715 discreteNormal[1] = 1;
716 discreteNormal[2] = 1;
717 discreteNormal[3] = -1;
718 }
719 else {
720 discreteNormal2[0] = 2;
721 discreteNormal2[1] = 1;
722 discreteNormal2[2] = 1;
723 discreteNormal2[3] = -1;
724 }
725 }
726 }
727
728
729 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ}) == 1
730 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) == 1
731 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
732 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
733 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
734 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0) {
735
736 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) == 1
737 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
738 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0) {
739
740 if (discreteNormal == nullVector) {
741 discreteNormal[0] = 2;
742 discreteNormal[1] = -1;
743 discreteNormal[2] = 1;
744 discreteNormal[3] = 1;
745 }
746 else {
747 discreteNormal2[0] = 2;
748 discreteNormal2[1] = -1;
749 discreteNormal2[2] = 1;
750 discreteNormal2[3] = 1;
751 }
752 }
753
754 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) == 1
755 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
756 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0) {
757
758 if (discreteNormal == nullVector) {
759 discreteNormal[0] = 2;
760 discreteNormal[1] = -1;
761 discreteNormal[2] = -1;
762 discreteNormal[3] = 1;
763 }
764
765 else {
766 discreteNormal2[0] = 2;
767 discreteNormal2[1] = -1;
768 discreteNormal2[2] = -1;
769 discreteNormal2[3] = 1;
770 }
771 }
772 }
773
774
775 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ}) == 1
776 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) == 1
777 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
778 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
779 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
780 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0) {
781
782 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) == 1
783 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
784 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0) {
785
786 if (discreteNormal == nullVector) {
787 discreteNormal[0] = 2;
788 discreteNormal[1] = -1;
789 discreteNormal[2] = 1;
790 discreteNormal[3] = -1;
791 }
792
793 else {
794 discreteNormal2[0] = 2;
795 discreteNormal2[1] = -1;
796 discreteNormal2[2] = 1;
797 discreteNormal2[3] = -1;
798 }
799 }
800
801 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) == 1
802 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
803 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0) {
804
805 if (discreteNormal == nullVector) {
806 discreteNormal[0] = 2;
807 discreteNormal[1] = -1;
808 discreteNormal[2] = -1;
809 discreteNormal[3] = -1;
810 }
811 else {
812 discreteNormal2[0] = 2;
813 discreteNormal2[1] = -1;
814 discreteNormal2[2] = -1;
815 discreteNormal2[3] = -1;
816 }
817 }
818 }
819
820
821 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
822 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
823 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
824 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
825 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
826 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
827 && _blockGeometry->
getMaterial({iX + 1, iY, iZ + 1}) != 1
828 && _blockGeometry->
getMaterial({iX - 1, iY, iZ + 1}) != 1) {
829
830 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ + 1}) == 1
831 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
832 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0) {
833
834 if (discreteNormal == nullVector) {
835 discreteNormal[0] = 3;
836 discreteNormal[1] = 0;
837 discreteNormal[2] = 1;
838 discreteNormal[3] = -1;
839 }
840 else {
841 discreteNormal2[0] = 3;
842 discreteNormal2[1] = 0;
843 discreteNormal2[2] = 1;
844 discreteNormal2[3] = -1;
845 }
846 }
847
848 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ + 1}) == 1
849 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
850 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0) {
851
852 if (discreteNormal == nullVector) {
853 discreteNormal[0] = 3;
854 discreteNormal[1] = 0;
855 discreteNormal[2] = -1;
856 discreteNormal[3] = -1;
857 }
858 else {
859 discreteNormal2[0] = 3;
860 discreteNormal2[1] = 0;
861 discreteNormal2[2] = -1;
862 discreteNormal2[3] = -1;
863 }
864 }
865 }
866
867
868 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
869 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
870 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
871 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
872 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
873 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
874 && _blockGeometry->
getMaterial({iX + 1, iY, iZ - 1}) != 1
875 && _blockGeometry->
getMaterial({iX - 1, iY, iZ - 1}) != 1) {
876
877 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ - 1}) == 1
878 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1) {
879 if (discreteNormal == nullVector) {
880 discreteNormal[0] = 3;
881 discreteNormal[1] = 0;
882 discreteNormal[2] = -1;
883 discreteNormal[3] = 1;
884 }
885 else {
886 discreteNormal2[0] = 3;
887 discreteNormal2[1] = 0;
888 discreteNormal2[2] = -1;
889 discreteNormal2[3] = 1;
890 }
891 }
892
893 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ - 1}) == 1
894 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1) {
895 if (discreteNormal == nullVector) {
896 discreteNormal[0] = 3;
897 discreteNormal[1] = 0;
898 discreteNormal[2] = 1;
899 discreteNormal[3] = 1;
900 }
901 else {
902 discreteNormal2[0] = 3;
903 discreteNormal2[1] = 0;
904 discreteNormal2[2] = 1;
905 discreteNormal2[3] = 1;
906 }
907 }
908 }
909
910
911 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
912 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
913 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
914 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0
915 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
916 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0) {
917
918 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ + 1}) == 1
919 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
920 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
921 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
922 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1) {
923
924 if (discreteNormal == nullVector) {
925 discreteNormal[0] = 3;
926 discreteNormal[1] = -1;
927 discreteNormal[2] = 0;
928 discreteNormal[3] = -1;
929 }
930 else {
931 discreteNormal2[0] = 3;
932 discreteNormal2[1] = -1;
933 discreteNormal2[2] = 0;
934 discreteNormal2[3] = -1;
935 }
936 }
937
938 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ + 1}) == 1
939 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
940 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
941 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
942 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1) {
943
944 if (discreteNormal == nullVector) {
945 discreteNormal[0] = 3;
946 discreteNormal[1] = 1;
947 discreteNormal[2] = 0;
948 discreteNormal[3] = -1;
949 }
950 else {
951 discreteNormal2[0] = 3;
952 discreteNormal2[1] = 1;
953 discreteNormal2[2] = 0;
954 discreteNormal2[3] = -1;
955 }
956 }
957 }
958
959
960 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
961 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
962 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
963 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0
964 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
965 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0) {
966
967 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ - 1}) == 1
968 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
969 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
970 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
971 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1) {
972
973 if (discreteNormal == nullVector) {
974 discreteNormal[0] = 3;
975 discreteNormal[1] = -1;
976 discreteNormal[2] = 0;
977 discreteNormal[3] = 1;
978 }
979 else {
980 discreteNormal2[0] = 3;
981 discreteNormal2[1] = -1;
982 discreteNormal2[2] = 0;
983 discreteNormal2[3] = 1;
984 }
985 }
986
987 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ - 1}) == 1
988 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
989 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
990 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
991 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1) {
992
993 if (discreteNormal == nullVector) {
994 discreteNormal[0] = 3;
995 discreteNormal[1] = 1;
996 discreteNormal[2] = 0;
997 discreteNormal[3] = 1;
998 }
999 else {
1000 discreteNormal2[0] = 3;
1001 discreteNormal2[1] = 1;
1002 discreteNormal2[2] = 0;
1003 discreteNormal2[3] = 1;
1004 }
1005 }
1006 }
1007
1008
1009 if ( _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
1010 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
1011 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
1012 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
1013 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
1014 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0) {
1015
1016 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
1017 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ}) == 1) {
1018 if (discreteNormal == nullVector) {
1019 discreteNormal[0] = 3;
1020 discreteNormal[1] = -1;
1021 discreteNormal[2] = -1;
1022 discreteNormal[3] = 0;
1023 }
1024 else {
1025 discreteNormal2[0] = 3;
1026 discreteNormal2[1] = -1;
1027 discreteNormal2[2] = -1;
1028 discreteNormal2[3] = 0;
1029 }
1030 }
1031
1032 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
1033 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ}) == 1) {
1034 if (discreteNormal == nullVector) {
1035 discreteNormal[0] = 3;
1036 discreteNormal[1] = 1;
1037 discreteNormal[2] = -1;
1038 discreteNormal[3] = 0;
1039 }
1040 else {
1041 discreteNormal2[0] = 3;
1042 discreteNormal2[1] = 1;
1043 discreteNormal2[2] = -1;
1044 discreteNormal2[3] = 0;
1045 }
1046 }
1047 }
1048
1049
1050 if ( _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
1051 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
1052 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
1053 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
1054 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
1055 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0) {
1056
1057 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
1058 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ}) == 1) {
1059 if (discreteNormal == nullVector) {
1060 discreteNormal[0] = 3;
1061 discreteNormal[1] = 1;
1062 discreteNormal[2] = 1;
1063 discreteNormal[3] = 0;
1064 }
1065 else {
1066 discreteNormal2[0] = 3;
1067 discreteNormal2[1] = 1;
1068 discreteNormal2[2] = 1;
1069 discreteNormal2[3] = 0;
1070 }
1071 }
1072
1073 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
1074 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ}) == 1) {
1075 if (discreteNormal == nullVector) {
1076 discreteNormal[0] = 3;
1077 discreteNormal[1] = -1;
1078 discreteNormal[2] = 1;
1079 discreteNormal[3] = 0;
1080 }
1081 else {
1082 discreteNormal2[0] = 3;
1083 discreteNormal2[1] = -1;
1084 discreteNormal2[2] = 1;
1085 discreteNormal2[3] = 0;
1086 }
1087 }
1088 }
1089
1090
1091 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
1092 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
1093 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
1094 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
1095 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
1096 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
1097 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) == 1) {
1098
1099 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) == 1
1100 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
1101 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0
1102 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ}) != 1
1103 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ}) != 0
1104 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ}) != 1
1105 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ}) != 0) {
1106
1107 discreteNormal[0] = 4;
1108 discreteNormal[1] = 0;
1109 discreteNormal[2] = -1;
1110 discreteNormal[3] = -1;
1111 }
1112 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) == 1
1113 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
1114 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
1115 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ}) != 1
1116 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ}) != 0
1117 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ}) != 1
1118 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ}) != 0) {
1119
1120 discreteNormal[0] = 4;
1121 discreteNormal[1] = 0;
1122 discreteNormal[2] = 1;
1123 discreteNormal[3] = -1;
1124 }
1125 }
1126
1127
1128 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
1129 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
1130 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
1131 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
1132 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
1133 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
1134 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) == 1) {
1135
1136 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) == 1
1137 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ}) != 1
1138 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ}) != 0
1139 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
1140 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0
1141 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ}) != 1
1142 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ}) != 0) {
1143
1144 discreteNormal[0] = 4;
1145 discreteNormal[1] = 0;
1146 discreteNormal[2] = -1;
1147 discreteNormal[3] = 1;
1148 }
1149
1150 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) == 1
1151 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ}) != 1
1152 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ}) != 0
1153 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
1154 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
1155 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ}) != 1
1156 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ}) != 0) {
1157
1158 discreteNormal[0] = 4;
1159 discreteNormal[1] = 0;
1160 discreteNormal[2] = 1;
1161 discreteNormal[3] = 1;
1162 }
1163 }
1164
1165
1166 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) == 1
1167 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 1
1168 && _blockGeometry->
getMaterial({iX + 1, iY, iZ}) != 0
1169 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
1170 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0
1171 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
1172 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0) {
1173
1174 if ( _blockGeometry->
getMaterial({iX, iY, iZ - 1}) == 1
1175 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
1176 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
1177 && _blockGeometry->
getMaterial({iX, iY + 1, iZ + 1}) != 1
1178 && _blockGeometry->
getMaterial({iX, iY + 1, iZ + 1}) != 0
1179 && _blockGeometry->
getMaterial({iX, iY - 1, iZ + 1}) != 1
1180 && _blockGeometry->
getMaterial({iX, iY - 1, iZ + 1}) != 0) {
1181
1182 discreteNormal[0] = 4;
1183 discreteNormal[1] = 1;
1184 discreteNormal[2] = 0;
1185 discreteNormal[3] = 1;
1186 }
1187
1188 if ( _blockGeometry->
getMaterial({iX, iY, iZ + 1}) == 1
1189 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
1190 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
1191 && _blockGeometry->
getMaterial({iX, iY + 1, iZ - 1}) != 1
1192 && _blockGeometry->
getMaterial({iX, iY + 1, iZ - 1}) != 0
1193 && _blockGeometry->
getMaterial({iX, iY - 1, iZ - 1}) != 1
1194 && _blockGeometry->
getMaterial({iX, iY - 1, iZ - 1}) != 0) {
1195
1196 discreteNormal[0] = 4;
1197 discreteNormal[1] = 1;
1198 discreteNormal[2] = 0;
1199 discreteNormal[3] = -1;
1200 }
1201 }
1202
1203
1204 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ}) == 1
1205 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 1
1206 && _blockGeometry->
getMaterial({iX - 1, iY, iZ}) != 0
1207 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
1208 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0
1209 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
1210 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0) {
1211
1212 if ( _blockGeometry->
getMaterial({iX, iY, iZ - 1}) == 1
1213 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
1214 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
1215 && _blockGeometry->
getMaterial({iX, iY + 1, iZ + 1}) != 1
1216 && _blockGeometry->
getMaterial({iX, iY + 1, iZ + 1}) != 0
1217 && _blockGeometry->
getMaterial({iX, iY - 1, iZ + 1}) != 1
1218 && _blockGeometry->
getMaterial({iX, iY - 1, iZ + 1}) != 0) {
1219
1220 discreteNormal[0] = 4;
1221 discreteNormal[1] = -1;
1222 discreteNormal[2] = 0;
1223 discreteNormal[3] = 1;
1224 }
1225
1226 if ( _blockGeometry->
getMaterial({iX, iY, iZ + 1}) == 1
1227 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
1228 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
1229 && _blockGeometry->
getMaterial({iX, iY + 1, iZ - 1}) != 1
1230 && _blockGeometry->
getMaterial({iX, iY + 1, iZ - 1}) != 0
1231 && _blockGeometry->
getMaterial({iX, iY - 1, iZ - 1}) != 1
1232 && _blockGeometry->
getMaterial({iX, iY - 1, iZ - 1}) != 0) {
1233
1234 discreteNormal[0] = 4;
1235 discreteNormal[1] = -1;
1236 discreteNormal[2] = 0;
1237 discreteNormal[3] = -1;
1238 }
1239 }
1240
1241
1242 if ( _blockGeometry->
getMaterial({iX, iY - 1, iZ}) == 1
1243 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
1244 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
1245 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
1246 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
1247 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 1
1248 && _blockGeometry->
getMaterial({iX, iY + 1, iZ}) != 0) {
1249
1250 if (_blockGeometry->
getMaterial({iX - 1, iY, iZ}) == 1
1251 && _blockGeometry->
getMaterial({iX - 1, iY - 1, iZ}) == 1) {
1252
1253 discreteNormal[0] = 4;
1254 discreteNormal[1] = 1;
1255 discreteNormal[2] = 1;
1256 discreteNormal[3] = 0;
1257 }
1258
1259 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ}) == 1
1260 && _blockGeometry->
getMaterial({iX + 1, iY - 1, iZ}) == 1) {
1261
1262 discreteNormal[0] = 4;
1263 discreteNormal[1] = -1;
1264 discreteNormal[2] = 1;
1265 discreteNormal[3] = 0;
1266 }
1267 }
1268
1269
1270 if ( _blockGeometry->
getMaterial({iX, iY + 1, iZ}) == 1
1271 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 1
1272 && _blockGeometry->
getMaterial({iX, iY, iZ - 1}) != 0
1273 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 1
1274 && _blockGeometry->
getMaterial({iX, iY, iZ + 1}) != 0
1275 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 1
1276 && _blockGeometry->
getMaterial({iX, iY - 1, iZ}) != 0) {
1277
1278 if ( _blockGeometry->
getMaterial({iX - 1, iY, iZ}) == 1
1279 && _blockGeometry->
getMaterial({iX - 1, iY + 1, iZ}) == 1) {
1280
1281 discreteNormal[0] = 4;
1282 discreteNormal[1] = 1;
1283 discreteNormal[2] = -1;
1284 discreteNormal[3] = 0;
1285 }
1286
1287 if ( _blockGeometry->
getMaterial({iX + 1, iY, iZ}) == 1
1288 && _blockGeometry->
getMaterial({iX + 1, iY + 1, iZ}) == 1) {
1289
1290 discreteNormal[0] = 4;
1291 discreteNormal[1] = -1;
1292 discreteNormal[2] = -1;
1293 discreteNormal[3] = 0;
1294 }
1295 }
1296
1297
1298 if (discreteNormal2 != nullVector && anyNormal == false) {
1299 discreteNormal = checkExtraBoundary(discreteNormal, discreteNormal2);
1300 }
1301 }
1302
1303 if (discreteNormal[1] == 0 && discreteNormal[2] == 0 && discreteNormal[3] == 0) {
1304 clout << "WARNING: no discreteNormal is found" << std::endl;
1305 }
1306 else if (_blockGeometry->
getMaterial({iX-discreteNormal[1], iY-discreteNormal[2], iZ-discreteNormal[3]}) != 1) {
1307#ifdef OLB_DEBUG
1308 clout << "WARNING: discreteNormal is not pointing outside the fluid. Use option: anyNormal" << std::endl;
1309#endif
1310 }
1311
1312 return discreteNormal;
1313}