371 std::vector < std::vector<int> >& elemVertMap)
373 BoundaryTypes bcType;
375 int eIdxGlobal =
problem_.variables().index(element);
377 const ElementGeometry& geometry = element.geometry();
379 const auto referenceElement = ReferenceElements::general(geometry.type());
381 int levelI = element.level();
386 int indexInInside = intersection.indexInInside();
388 DimVector normal = intersection.centerUnitOuterNormal();
390 const IntersectionGeometry& isGeometry = intersection.geometry();
392 Scalar faceVol = isGeometry.volume();
394 const DimVector& globalPosFace = isGeometry.center();
396 bool takeIntersection =
true;
397 if (intersection.neighbor())
399 auto outside = intersection.outside();
400 int eIdxGlobalJ =
problem_.variables().index(outside);
402 if (levelI == outside.level() && eIdxGlobal > eIdxGlobalJ)
403 takeIntersection =
false;
404 if (levelI < outside.level())
405 takeIntersection =
false;
408 if (takeIntersection)
411 if (intersection.neighbor())
413 int eIdxGlobalJ =
problem_.variables().index(intersection.outside());
417 for (
int i = 0; i < isGeometry.corners(); i++)
419 int localVertIdx = referenceElement.subEntity(indexInInside, 1, i, dim);
421 int vIdxGlobal =
problem_.variables().vertexMapper().subIndex(element, localVertIdx, dim);
425 if (elemVertMap[vIdxGlobal][0] == eIdxGlobal)
427 if (indexInInside == 1)
433 if (intersection.neighbor())
435 int indexInOutside = intersection.indexInOutside();
438 DimVector normalOutside = normal;
444 else if (indexInInside == 3)
450 if (intersection.neighbor())
452 int indexInOutside = intersection.indexInOutside();
455 DimVector normalOutside = normal;
461 else if (indexInInside == 5)
467 if (intersection.neighbor())
469 int indexInOutside = intersection.indexInOutside();
472 DimVector normalOutside = normal;
479 if (elemVertMap[vIdxGlobal][1] == eIdxGlobal)
481 if (indexInInside == 3)
487 if (intersection.neighbor())
489 int indexInOutside = intersection.indexInOutside();
492 DimVector normalOutside = normal;
498 else if (indexInInside == 0)
504 if (intersection.neighbor())
506 int indexInOutside = intersection.indexInOutside();
509 DimVector normalOutside = normal;
515 else if (indexInInside == 5)
521 if (intersection.neighbor())
523 int indexInOutside = intersection.indexInOutside();
526 DimVector normalOutside = normal;
533 if (elemVertMap[vIdxGlobal][2] == eIdxGlobal)
535 if (indexInInside == 2)
541 if (intersection.neighbor())
543 int indexInOutside = intersection.indexInOutside();
546 DimVector normalOutside = normal;
552 else if (indexInInside == 1)
558 if (intersection.neighbor())
560 int indexInOutside = intersection.indexInOutside();
563 DimVector normalOutside = normal;
569 else if (indexInInside == 5)
575 if (intersection.neighbor())
577 int indexInOutside = intersection.indexInOutside();
580 DimVector normalOutside = normal;
587 if (elemVertMap[vIdxGlobal][3] == eIdxGlobal)
589 if (indexInInside == 0)
595 if (intersection.neighbor())
597 int indexInOutside = intersection.indexInOutside();
600 DimVector normalOutside = normal;
606 else if (indexInInside == 2)
612 if (intersection.neighbor())
614 int indexInOutside = intersection.indexInOutside();
617 DimVector normalOutside = normal;
623 else if (indexInInside == 5)
629 if (intersection.neighbor())
631 int indexInOutside = intersection.indexInOutside();
634 DimVector normalOutside = normal;
641 if (elemVertMap[vIdxGlobal][4] == eIdxGlobal)
643 if (indexInInside == 4)
649 if (intersection.neighbor())
651 int indexInOutside = intersection.indexInOutside();
654 DimVector normalOutside = normal;
660 else if (indexInInside == 1)
666 if (intersection.neighbor())
668 int indexInOutside = intersection.indexInOutside();
671 DimVector normalOutside = normal;
677 else if (indexInInside == 3)
683 if (intersection.neighbor())
685 int indexInOutside = intersection.indexInOutside();
688 DimVector normalOutside = normal;
695 if (elemVertMap[vIdxGlobal][5] == eIdxGlobal)
697 if (indexInInside == 4)
703 if (intersection.neighbor())
705 int indexInOutside = intersection.indexInOutside();
708 DimVector normalOutside = normal;
714 else if (indexInInside == 3)
720 if (intersection.neighbor())
722 int indexInOutside = intersection.indexInOutside();
725 DimVector normalOutside = normal;
732 else if (indexInInside == 0)
738 if (intersection.neighbor())
740 int indexInOutside = intersection.indexInOutside();
743 DimVector normalOutside = normal;
750 if (elemVertMap[vIdxGlobal][6] == eIdxGlobal)
752 if (indexInInside == 4)
758 if (intersection.neighbor())
760 int indexInOutside = intersection.indexInOutside();
763 DimVector normalOutside = normal;
769 else if (indexInInside == 2)
775 if (intersection.neighbor())
777 int indexInOutside = intersection.indexInOutside();
780 DimVector normalOutside = normal;
786 else if (indexInInside == 1)
792 if (intersection.neighbor())
794 int indexInOutside = intersection.indexInOutside();
797 DimVector normalOutside = normal;
804 if (elemVertMap[vIdxGlobal][7] == eIdxGlobal)
806 if (indexInInside == 4)
812 if (intersection.neighbor())
814 int indexInOutside = intersection.indexInOutside();
817 DimVector normalOutside = normal;
823 else if (indexInInside == 0)
829 if (intersection.neighbor())
831 int indexInOutside = intersection.indexInOutside();
834 DimVector normalOutside = normal;
840 else if (indexInInside == 2)
846 if (intersection.neighbor())
848 int indexInOutside = intersection.indexInOutside();
851 DimVector normalOutside = normal;
858 if (intersection.boundary())
860 if (elemVertMap[vIdxGlobal][0] == eIdxGlobal)
862 if (indexInInside == 1)
864 problem_.boundaryTypes(bcType, intersection);
865 PrimaryVariables boundValues(0.0);
868 if (bcType.isNeumann(pressureEqIdx))
870 problem_.neumann(boundValues, intersection);
871 boundValues *= faceVol/4.0;
874 if (bcType.hasDirichlet())
876 problem_.dirichlet(boundValues, intersection);
880 else if (indexInInside == 3)
882 problem_.boundaryTypes(bcType, intersection);
883 PrimaryVariables boundValues(0.0);
886 if (bcType.isNeumann(pressureEqIdx))
888 problem_.neumann(boundValues, intersection);
889 boundValues *= faceVol/4.0;
892 if (bcType.hasDirichlet())
894 problem_.dirichlet(boundValues, intersection);
898 else if (indexInInside == 5)
900 problem_.boundaryTypes(bcType, intersection);
901 PrimaryVariables boundValues(0.0);
904 if (bcType.isNeumann(pressureEqIdx))
906 problem_.neumann(boundValues, intersection);
907 boundValues *= faceVol/4.0;
910 if (bcType.hasDirichlet())
912 problem_.dirichlet(boundValues, intersection);
917 if (elemVertMap[vIdxGlobal][1] == eIdxGlobal)
919 if (indexInInside == 3)
921 problem_.boundaryTypes(bcType, intersection);
922 PrimaryVariables boundValues(0.0);
925 if (bcType.isNeumann(pressureEqIdx))
927 problem_.neumann(boundValues, intersection);
928 boundValues *= faceVol/4.0;
931 if (bcType.hasDirichlet())
933 problem_.dirichlet(boundValues, intersection);
937 else if (indexInInside == 0)
939 problem_.boundaryTypes(bcType, intersection);
940 PrimaryVariables boundValues(0.0);
943 if (bcType.isNeumann(pressureEqIdx))
945 problem_.neumann(boundValues, intersection);
946 boundValues *= faceVol/4.0;
949 if (bcType.hasDirichlet())
951 problem_.dirichlet(boundValues, intersection);
955 else if (indexInInside == 5)
957 problem_.boundaryTypes(bcType, intersection);
958 PrimaryVariables boundValues(0.0);
961 if (bcType.isNeumann(pressureEqIdx))
963 problem_.neumann(boundValues, intersection);
964 boundValues *= faceVol/4.0;
967 if (bcType.hasDirichlet())
969 problem_.dirichlet(boundValues, intersection);
974 if (elemVertMap[vIdxGlobal][2] == eIdxGlobal)
976 if (indexInInside == 2)
978 problem_.boundaryTypes(bcType, intersection);
979 PrimaryVariables boundValues(0.0);
982 if (bcType.isNeumann(pressureEqIdx))
984 problem_.neumann(boundValues, intersection);
985 boundValues *= faceVol/4.0;
988 if (bcType.hasDirichlet())
990 problem_.dirichlet(boundValues, intersection);
994 else if (indexInInside == 1)
996 problem_.boundaryTypes(bcType, intersection);
997 PrimaryVariables boundValues(0.0);
1000 if (bcType.isNeumann(pressureEqIdx))
1002 problem_.neumann(boundValues, intersection);
1003 boundValues *= faceVol/4.0;
1006 if (bcType.hasDirichlet())
1008 problem_.dirichlet(boundValues, intersection);
1012 else if (indexInInside == 5)
1014 problem_.boundaryTypes(bcType, intersection);
1015 PrimaryVariables boundValues(0.0);
1018 if (bcType.isNeumann(pressureEqIdx))
1020 problem_.neumann(boundValues, intersection);
1021 boundValues *= faceVol/4.0;
1024 if (bcType.hasDirichlet())
1026 problem_.dirichlet(boundValues, intersection);
1031 if (elemVertMap[vIdxGlobal][3] == eIdxGlobal)
1033 if (indexInInside == 0)
1035 problem_.boundaryTypes(bcType, intersection);
1036 PrimaryVariables boundValues(0.0);
1039 if (bcType.isNeumann(pressureEqIdx))
1041 problem_.neumann(boundValues, intersection);
1042 boundValues *= faceVol/4.0;
1045 if (bcType.hasDirichlet())
1047 problem_.dirichlet(boundValues, intersection);
1051 else if (indexInInside == 2)
1053 problem_.boundaryTypes(bcType, intersection);
1054 PrimaryVariables boundValues(0.0);
1057 if (bcType.isNeumann(pressureEqIdx))
1059 problem_.neumann(boundValues, intersection);
1060 boundValues *= faceVol/4.0;
1063 if (bcType.hasDirichlet())
1065 problem_.dirichlet(boundValues, intersection);
1069 else if (indexInInside == 5)
1071 problem_.boundaryTypes(bcType, intersection);
1072 PrimaryVariables boundValues(0.0);
1075 if (bcType.isNeumann(pressureEqIdx))
1077 problem_.neumann(boundValues, intersection);
1078 boundValues *= faceVol/4.0;
1081 if (bcType.hasDirichlet())
1083 problem_.dirichlet(boundValues, intersection);
1088 if (elemVertMap[vIdxGlobal][4] == eIdxGlobal)
1090 if (indexInInside == 4)
1092 problem_.boundaryTypes(bcType, intersection);
1093 PrimaryVariables boundValues(0.0);
1096 if (bcType.isNeumann(pressureEqIdx))
1098 problem_.neumann(boundValues, intersection);
1099 boundValues *= faceVol/4.0;
1102 if (bcType.hasDirichlet())
1104 problem_.dirichlet(boundValues, intersection);
1108 else if (indexInInside == 1)
1110 problem_.boundaryTypes(bcType, intersection);
1111 PrimaryVariables boundValues(0.0);
1114 if (bcType.isNeumann(pressureEqIdx))
1116 problem_.neumann(boundValues, intersection);
1117 boundValues *= faceVol/4.0;
1120 if (bcType.hasDirichlet())
1122 problem_.dirichlet(boundValues, intersection);
1126 else if (indexInInside == 3)
1128 problem_.boundaryTypes(bcType, intersection);
1129 PrimaryVariables boundValues(0.0);
1132 if (bcType.isNeumann(pressureEqIdx))
1134 problem_.neumann(boundValues, intersection);
1135 boundValues *= faceVol/4.0;
1138 if (bcType.hasDirichlet())
1140 problem_.dirichlet(boundValues, intersection);
1145 if (elemVertMap[vIdxGlobal][5] == eIdxGlobal)
1147 if (indexInInside == 4)
1149 problem_.boundaryTypes(bcType, intersection);
1150 PrimaryVariables boundValues(0.0);
1153 if (bcType.isNeumann(pressureEqIdx))
1155 problem_.neumann(boundValues, intersection);
1156 boundValues *= faceVol/4.0;
1159 if (bcType.hasDirichlet())
1161 problem_.dirichlet(boundValues, intersection);
1165 else if (indexInInside == 3)
1167 problem_.boundaryTypes(bcType, intersection);
1168 PrimaryVariables boundValues(0.0);
1171 if (bcType.isNeumann(pressureEqIdx))
1173 problem_.neumann(boundValues, intersection);
1174 boundValues *= faceVol/4.0;
1177 if (bcType.hasDirichlet())
1179 problem_.dirichlet(boundValues, intersection);
1183 else if (indexInInside == 0)
1185 problem_.boundaryTypes(bcType, intersection);
1186 PrimaryVariables boundValues(0.0);
1189 if (bcType.isNeumann(pressureEqIdx))
1191 problem_.neumann(boundValues, intersection);
1192 boundValues *= faceVol/4.0;
1195 if (bcType.hasDirichlet())
1197 problem_.dirichlet(boundValues, intersection);
1202 if (elemVertMap[vIdxGlobal][6] == eIdxGlobal)
1204 if (indexInInside == 4)
1206 problem_.boundaryTypes(bcType, intersection);
1207 PrimaryVariables boundValues(0.0);
1210 if (bcType.isNeumann(pressureEqIdx))
1212 problem_.neumann(boundValues, intersection);
1213 boundValues *= faceVol/4.0;
1216 if (bcType.hasDirichlet())
1218 problem_.dirichlet(boundValues, intersection);
1222 else if (indexInInside == 2)
1224 problem_.boundaryTypes(bcType, intersection);
1225 PrimaryVariables boundValues(0.0);
1228 if (bcType.isNeumann(pressureEqIdx))
1230 problem_.neumann(boundValues, intersection);
1231 boundValues *= faceVol/4.0;
1234 if (bcType.hasDirichlet())
1236 problem_.dirichlet(boundValues, intersection);
1240 else if (indexInInside == 1)
1242 problem_.boundaryTypes(bcType, intersection);
1243 PrimaryVariables boundValues(0.0);
1246 if (bcType.isNeumann(pressureEqIdx))
1248 problem_.neumann(boundValues, intersection);
1249 boundValues *= faceVol/4.0;
1252 if (bcType.hasDirichlet())
1254 problem_.dirichlet(boundValues, intersection);
1259 if (elemVertMap[vIdxGlobal][7] == eIdxGlobal)
1261 if (indexInInside == 4)
1263 problem_.boundaryTypes(bcType, intersection);
1264 PrimaryVariables boundValues(0.0);
1267 if (bcType.isNeumann(pressureEqIdx))
1269 problem_.neumann(boundValues, intersection);
1270 boundValues *= faceVol/4.0;
1273 if (bcType.hasDirichlet())
1275 problem_.dirichlet(boundValues, intersection);
1279 else if (indexInInside == 0)
1281 problem_.boundaryTypes(bcType, intersection);
1282 PrimaryVariables boundValues(0.0);
1285 if (bcType.isNeumann(pressureEqIdx))
1287 problem_.neumann(boundValues, intersection);
1288 boundValues *= faceVol/4.0;
1291 if (bcType.hasDirichlet())
1293 problem_.dirichlet(boundValues, intersection);
1297 else if (indexInInside == 2)
1299 problem_.boundaryTypes(bcType, intersection);
1300 PrimaryVariables boundValues(0.0);
1303 if (bcType.isNeumann(pressureEqIdx))
1305 problem_.neumann(boundValues, intersection);
1306 boundValues *= faceVol/4.0;
1309 if (bcType.hasDirichlet())
1311 problem_.dirichlet(boundValues, intersection);
1478 const Vertex& vertex)
1480 const DimVector& centerPos = vertex.geometry().center();
1990 DUNE_THROW(Dune::NotImplemented,
"Boundary shape not implemented");