46 polyTopoChange& meshMod
49 const face&
f = mesh_.
faces()[facei];
68 <<
"No neighbour patch for internal face " << facei
73 dupFacei = meshMod.addFace
87 void Foam::meshRefinement::getBafflePatches
96 const pointField& cellCentres = mesh_.cellCentres();
104 ownPatch.setSize(mesh_.nFaces());
106 nbrPatch.setSize(mesh_.nFaces());
123 const label facei = testFaces[i];
124 const label own = mesh_.faceOwner()[facei];
126 if (mesh_.isInternalFace(facei))
128 start[i] = cellCentres[own];
129 end[i] = cellCentres[mesh_.faceNeighbour()[facei]];
133 start[i] = cellCentres[own];
134 end[i] = neiCc[facei-mesh_.nInternalFaces()];
149 List<pointIndexHit> hit1;
152 List<pointIndexHit> hit2;
154 surfaces_.findNearestIntersection
171 const label facei = testFaces[i];
173 if (hit1[i].hit() && hit2[i].hit())
176 ownPatch[facei] = globalToMasterPatch
178 surfaces_.globalRegion(surface1[i], region1[i])
180 nbrPatch[facei] = globalToMasterPatch
182 surfaces_.globalRegion(surface2[i], region2[i])
185 if (ownPatch[facei] == -1 || nbrPatch[facei] == -1)
208 const bool allowBoundary,
213 Map<labelPair> bafflePatch(mesh_.nFaces()/1000);
215 const PtrList<surfaceZonesInfo>& surfZones = surfaces_.surfZones();
216 const faceZoneList& fZones = mesh_.faceZones();
220 const word& faceZoneName = surfZones[surfi].faceZoneName();
222 if (faceZoneName.size())
225 const label zonei = fZones.findIndex(faceZoneName);
226 const faceZone& fZone = fZones[zonei];
229 const label globalRegioni = surfaces_.globalRegion(surfi, 0);
232 globalToMasterPatch[globalRegioni],
233 globalToSlavePatch[globalRegioni]
236 Info<<
"For zone " << fZone.name() <<
" found patches "
237 << mesh_.boundaryMesh()[zPatches[0]].name() <<
" and "
238 << mesh_.boundaryMesh()[zPatches[1]].name()
243 const label facei = fZone[i];
245 if (allowBoundary || mesh_.isInternalFace(facei))
248 if (fZone.flipMap()[i])
253 if (!bafflePatch.insert(facei,
patches))
257 <<
" fc:" << mesh_.faceCentres()[facei]
258 <<
" in zone " << fZone.name()
259 <<
" is in multiple zones!"
279 ownPatch.
size() != mesh_.nFaces()
280 || nbrPatch.
size() != mesh_.nFaces()
285 <<
" ownPatch:" << ownPatch.
size()
286 <<
" nbrPatch:" << nbrPatch.
size()
287 <<
". Should be number of faces:" << mesh_.nFaces()
298 forAll(syncedOwnPatch, facei)
302 (ownPatch[facei] == -1 && syncedOwnPatch[facei] != -1)
303 || (nbrPatch[facei] == -1 && syncedNeiPatch[facei] != -1)
307 <<
"Non synchronised at face:" << facei
308 <<
" on patch:" << mesh_.boundaryMesh().whichPatch(facei)
309 <<
" fc:" << mesh_.faceCentres()[facei] <<
endl
310 <<
"ownPatch:" << ownPatch[facei]
311 <<
" syncedOwnPatch:" << syncedOwnPatch[facei]
312 <<
" nbrPatch:" << nbrPatch[facei]
313 <<
" syncedNeiPatch:" << syncedNeiPatch[facei]
326 if (ownPatch[facei] != -1)
347 mesh_.topoChange(map);
350 mesh_.setInstance(
name());
354 faceSet baffledFacesSet(mesh_,
"baffledFacesSet", 2*nBaffles);
356 const labelList& reverseFaceMap = map().reverseFaceMap();
360 forAll(ownPatch, oldFacei)
362 const label facei = reverseFaceMap[oldFacei];
364 if (ownPatch[oldFacei] != -1 && facei >= 0)
366 const cell& ownFaces = mesh_.cells()[mesh_.faceOwner()[facei]];
370 baffledFacesSet.
insert(ownFaces[i]);
379 if (oldFacei >= 0 && reverseFaceMap[oldFacei] != facei)
381 const cell& ownFaces = mesh_.cells()[mesh_.faceOwner()[facei]];
385 baffledFacesSet.
insert(ownFaces[i]);
389 baffledFacesSet.
sync(mesh_);
391 topoChange(map, baffledFacesSet.
toc());
407 if (isA<processorPolyPatch>(pp))
416 if (zones[zonei] != -1)
419 <<
"face:" << facei <<
" on patch " << pp.
name()
420 <<
" is in zone " << fZones[zones[zonei]].
name()
445 if (zonedSurfaces.
size())
448 Info<<
"Converting zoned faces into baffles ..." <<
endl;
462 const label nZoneFaces =
472 ownPatch[iter.key()] = iter().
first();
473 nbrPatch[iter.key()] = iter().second();
477 map = createBaffles(ownPatch, nbrPatch);
487 const labelList& reverseFaceMap = map().reverseFaceMap();
499 if (iter != faceToPatch.
end())
501 const label masterFacei = reverseFaceMap[oldFacei];
502 if (facei != masterFacei)
504 baffles[baffleI++] =
labelPair(masterFacei, facei);
509 if (baffleI != faceToPatch.
size())
512 <<
"Had " << faceToPatch.
size() <<
" patches to create "
513 <<
" but encountered " << baffleI
514 <<
" slave faces originating from patcheable faces."
520 const_cast<Time&
>(mesh_.time())++;
521 Pout<<
"Writing zone-baffled mesh to time " <<
name()
527 mesh_.time().path()/
"baffles"
531 Info<<
"Created " << nZoneFaces <<
" baffles in = "
532 << mesh_.time().cpuTimeIncrement() <<
" s\n" <<
nl <<
endl;
541 const scalar planarAngle
551 labelList nBafflesPerEdge(mesh_.nEdges(), 0);
568 const label baffleValue = 1000000;
587 const labelList& fEdges = mesh_.faceEdges(facei);
591 nBafflesPerEdge[fEdges[fEdgei]]++;
599 DynamicList<label> fe0;
600 DynamicList<label> fe1;
610 const labelList& fEdges0 = mesh_.faceEdges(f0, fe0);
613 nBafflesPerEdge[fEdges0[fEdgei]] += baffleValue;
618 const label f1 = couples[i].second();
619 const labelList& fEdges1 = mesh_.faceEdges(f1, fe1);
622 nBafflesPerEdge[fEdges1[fEdgei]] += baffleValue;
641 List<labelPair> filteredCouples(couples.
size());
650 patches.whichPatch(couple.first())
651 ==
patches.whichPatch(couple.second())
654 const labelList& fEdges = mesh_.faceEdges(couple.first());
658 const label edgei = fEdges[fEdgei];
660 if (nBafflesPerEdge[edgei] == 2*baffleValue+2*1)
662 filteredCouples[filterI++] = couple;
668 filteredCouples.setSize(filterI);
671 const label nFiltered =
674 Info<<
"freeStandingBaffles : detected "
676 <<
" free-standing baffles out of "
689 const pointField& cellCentres = mesh_.cellCentres();
691 forAll(filteredCouples, i)
693 const labelPair& couple = filteredCouples[i];
694 start[i] = cellCentres[mesh_.faceOwner()[couple.first()]];
695 end[i] = cellCentres[mesh_.faceOwner()[couple.second()]];
709 List<pointIndexHit> hit1;
714 List<pointIndexHit> hit2;
718 surfaces_.findNearestIntersection
735 const scalar planarAngleCos =
Foam::cos(planarAngle);
738 forAll(filteredCouples, i)
740 const labelPair& couple = filteredCouples[i];
747 surface1[i] != surface2[i]
748 || hit1[i].index() != hit2[i].index()
752 if ((normal1[i ]& normal2[i]) > planarAngleCos)
755 const vector n = end[i] - start[i];
756 const scalar magN =
mag(
n);
759 filteredCouples[filterI++] = couple;
763 else if (hit1[i].hit() || hit2[i].hit())
769 filteredCouples.setSize(filterI);
771 Info<<
"freeStandingBaffles : detected "
773 <<
" planar (within " <<
radToDeg(planarAngle)
774 <<
" degrees) free-standing baffles out of "
779 return filteredCouples;
791 const faceList& faces = mesh_.faces();
792 const labelList& faceOwner = mesh_.faceOwner();
797 const label face1 = couples[i].second();
801 const label own0 = faceOwner[face0];
802 const label own1 = faceOwner[face1];
804 if (face1 < 0 || own0 < own1)
807 const label nei = (face1 < 0 ? -1 : own1);
843 mesh_.topoChange(map);
846 mesh_.setInstance(
name());
856 const label newFace0 = map().reverseFaceMap()[couples[i].
first()];
859 newExposedFaces[newI++] = newFace0;
862 const label newFace1 = map().reverseFaceMap()[couples[i].second()];
865 newExposedFaces[newI++] = newFace1;
869 topoChange(map, newExposedFaces);
876 void Foam::meshRefinement::findCellZoneGeometric
886 const pointField& cellCentres = mesh_.cellCentres();
887 const labelList& faceOwner = mesh_.faceOwner();
888 const labelList& faceNeighbour = mesh_.faceNeighbour();
899 forAll(insideSurfaces, celli)
901 if (cellToZone[celli] == -2)
903 label surfi = insideSurfaces[celli];
907 cellToZone[celli] = surfaceToCellZone[surfi];
920 label nCandidates = 0;
921 forAll(namedSurfaceIndex, facei)
923 const label surfi = namedSurfaceIndex[facei];
927 if (mesh_.isInternalFace(facei))
941 forAll(namedSurfaceIndex, facei)
943 const label surfi = namedSurfaceIndex[facei];
947 const label own = faceOwner[facei];
948 const point& ownCc = cellCentres[own];
950 if (mesh_.isInternalFace(facei))
952 const label nei = faceNeighbour[facei];
953 const point& neiCc = cellCentres[nei];
956 const vector d = 1
e-4*(neiCc - ownCc);
957 candidatePoints[nCandidates++] = ownCc-d;
958 candidatePoints[nCandidates++] = neiCc+d;
962 const point& neiFc = neiCc[facei - mesh_.nInternalFaces()];
965 const vector d = 1
e-4*(neiFc - ownCc);
966 candidatePoints[nCandidates++] = ownCc-d;
985 forAll(namedSurfaceIndex, facei)
987 const label surfi = namedSurfaceIndex[facei];
991 const label own = faceOwner[facei];
993 if (mesh_.isInternalFace(facei))
995 const label ownSurfI = insideSurfaces[nCandidates++];
998 cellToZone[own] = surfaceToCellZone[ownSurfI];
1001 const label neiSurfI = insideSurfaces[nCandidates++];
1004 label nei = faceNeighbour[facei];
1006 cellToZone[nei] = surfaceToCellZone[neiSurfI];
1011 const label ownSurfI = insideSurfaces[nCandidates++];
1014 cellToZone[own] = surfaceToCellZone[ownSurfI];
1025 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
1027 const label ownZone = cellToZone[mesh_.faceOwner()[facei]];
1028 const label neiZone = cellToZone[mesh_.faceNeighbour()[facei]];
1030 if (namedSurfaceIndex[facei] == -1 && (ownZone != neiZone))
1036 max(ownZone, neiZone)
1041 labelList neiCellZone(mesh_.nFaces() - mesh_.nInternalFaces());
1042 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
1052 const label facei = pp.start() + i;
1053 const label ownZone = cellToZone[mesh_.faceOwner()[facei]];
1054 neiCellZone[facei-mesh_.nInternalFaces()] = ownZone;
1068 const label facei = pp.start() + i;
1069 const label ownZone = cellToZone[mesh_.faceOwner()[facei]];
1070 const label neiZone = neiCellZone[facei-mesh_.nInternalFaces()];
1072 if (namedSurfaceIndex[facei] == -1 && (ownZone != neiZone))
1078 max(ownZone, neiZone)
1090 void Foam::meshRefinement::findCellZoneInsideWalk
1100 boolList blockedFace(mesh_.nFaces());
1103 forAll(namedSurfaceIndex, facei)
1105 if (namedSurfaceIndex[facei] == -1)
1107 blockedFace[facei] =
false;
1111 blockedFace[facei] =
true;
1117 regionSplit cellRegion(mesh_, blockedFace);
1118 blockedFace.clear();
1122 (void)mesh_.tetBasePtIs();
1124 const PtrList<surfaceZonesInfo>& surfZones = surfaces_.surfZones();
1127 forAll(locationSurfaces, i)
1129 const label surfi = locationSurfaces[i];
1131 const point& insidePoint = surfZones[surfi].zoneInsidePoint();
1133 Info<<
"For surface " << surfaces_.names()[surfi]
1134 <<
" finding inside point " << insidePoint
1138 label regioninMeshi = findRegion
1146 Info<<
"For surface " << surfaces_.names()[surfi]
1147 <<
" found point " << insidePoint
1148 <<
" in global region " << regioninMeshi
1149 <<
" out of " << cellRegion.nRegions() <<
" regions." <<
endl;
1151 if (regioninMeshi == -1)
1154 <<
"Point " << insidePoint
1155 <<
" is not inside the mesh." <<
nl
1156 <<
"Bounding box of the mesh:" << mesh_.bounds()
1161 forAll(cellRegion, celli)
1163 if (cellRegion[celli] == regioninMeshi)
1165 if (cellToZone[celli] == -2)
1167 cellToZone[celli] = surfaceToCellZone[surfi];
1169 else if (cellToZone[celli] != surfaceToCellZone[surfi])
1173 <<
" at " << mesh_.cellCentres()[celli]
1174 <<
" is inside surface " << surfaces_.names()[surfi]
1175 <<
" but already marked as being in zone "
1176 << cellToZone[celli] <<
endl
1177 <<
"This can happen if your surfaces are not"
1178 <<
" (sufficiently) closed."
1187 bool Foam::meshRefinement::calcRegionToZone
1189 const label surfZoneI,
1190 const label ownRegion,
1191 const label neiRegion,
1196 bool changed =
false;
1199 if (ownRegion != neiRegion)
1206 if (regionToCellZone[ownRegion] == -2)
1208 if (regionToCellZone[neiRegion] == surfZoneI)
1212 regionToCellZone[ownRegion] = -1;
1215 else if (regionToCellZone[neiRegion] != -2)
1219 regionToCellZone[ownRegion] = surfZoneI;
1223 else if (regionToCellZone[neiRegion] == -2)
1225 if (regionToCellZone[ownRegion] == surfZoneI)
1229 regionToCellZone[neiRegion] = -1;
1232 else if (regionToCellZone[ownRegion] != -2)
1236 regionToCellZone[neiRegion] = surfZoneI;
1245 void Foam::meshRefinement::findCellZoneTopo
1259 boolList blockedFace(mesh_.nFaces());
1261 forAll(namedSurfaceIndex, facei)
1263 if (namedSurfaceIndex[facei] == -1)
1265 blockedFace[facei] =
false;
1269 blockedFace[facei] =
true;
1275 regionSplit cellRegion(mesh_, blockedFace);
1276 blockedFace.clear();
1282 labelList regionToCellZone(cellRegion.nRegions(), -2);
1287 forAll(cellToZone, celli)
1289 if (cellToZone[celli] != -2)
1291 regionToCellZone[cellRegion[celli]] = cellToZone[celli];
1299 const label regioninMeshi = findRegion
1308 <<
" in global region " << regioninMeshi
1309 <<
" out of " << cellRegion.nRegions() <<
" regions." <<
endl;
1311 if (regioninMeshi == -1)
1315 <<
" is not inside the mesh." <<
nl
1316 <<
"Bounding box of the mesh:" << mesh_.bounds()
1321 if (regionToCellZone[regioninMeshi] == -2)
1323 regionToCellZone[regioninMeshi] = -1;
1343 bool changed =
false;
1347 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
1349 const label surfi = namedSurfaceIndex[facei];
1356 const bool changedCell = calcRegionToZone
1358 surfaceToCellZone[surfi],
1359 cellRegion[mesh_.faceOwner()[facei]],
1360 cellRegion[mesh_.faceNeighbour()[facei]],
1364 changed = changed | changedCell;
1370 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
1373 labelList neiCellRegion(mesh_.nFaces() - mesh_.nInternalFaces());
1382 const label facei = pp.start() + i;
1383 neiCellRegion[facei-mesh_.nInternalFaces()] =
1384 cellRegion[mesh_.faceOwner()[facei]];
1400 const label facei = pp.start() + i;
1401 const label surfi = namedSurfaceIndex[facei];
1406 const bool changedCell = calcRegionToZone
1408 surfaceToCellZone[surfi],
1409 cellRegion[mesh_.faceOwner()[facei]],
1410 neiCellRegion[facei-mesh_.nInternalFaces()],
1414 changed = changed | changedCell;
1427 forAll(regionToCellZone, regioni)
1429 const label zonei = regionToCellZone[regioni];
1434 <<
"For region " << regioni <<
" haven't set cell zone."
1441 forAll(regionToCellZone, regioni)
1443 Pout<<
"Region " << regioni
1444 <<
" becomes cellZone:" << regionToCellZone[regioni]
1450 forAll(cellToZone, celli)
1452 cellToZone[celli] = regionToCellZone[cellRegion[celli]];
1457 void Foam::meshRefinement::makeConsistentFaceIndex
1463 const labelList& faceOwner = mesh_.faceOwner();
1464 const labelList& faceNeighbour = mesh_.faceNeighbour();
1466 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
1468 const label ownZone = cellToZone[faceOwner[facei]];
1469 const label neiZone = cellToZone[faceNeighbour[facei]];
1471 if (ownZone == neiZone && namedSurfaceIndex[facei] != -1)
1473 namedSurfaceIndex[facei] = -1;
1475 else if (ownZone != neiZone && namedSurfaceIndex[facei] == -1)
1478 <<
"Different cell zones on either side of face " << facei
1479 <<
" at " << mesh_.faceCentres()[facei]
1480 <<
" but face not marked with a surface."
1485 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
1488 labelList neiCellZone(mesh_.nFaces() - mesh_.nInternalFaces());
1497 const label facei = pp.start() + i;
1498 neiCellZone[facei-mesh_.nInternalFaces()] =
1499 cellToZone[mesh_.faceOwner()[facei]];
1514 const label facei = pp.start() + i;
1516 const label ownZone = cellToZone[faceOwner[facei]];
1517 const label neiZone = neiCellZone[facei-mesh_.nInternalFaces()];
1519 if (ownZone == neiZone && namedSurfaceIndex[facei] != -1)
1521 namedSurfaceIndex[facei] = -1;
1523 else if (ownZone != neiZone && namedSurfaceIndex[facei] == -1)
1526 <<
"Different cell zones on either side of face "
1527 << facei <<
" at " << mesh_.faceCentres()[facei]
1528 <<
" but face not marked with a surface."
1538 const label facei = pp.start() + i;
1539 namedSurfaceIndex[facei] = -1;
1546 void Foam::meshRefinement::handleSnapProblems
1548 const snapParameters& snapParams,
1549 const bool useTopologicalSnapDetection,
1550 const bool removeEdgeConnectedCells,
1552 const dictionary& motionDict,
1559 <<
"Introducing baffles to block off problem cells" <<
nl
1560 <<
"----------------------------------------------" <<
nl
1564 if (useTopologicalSnapDetection)
1566 facePatch = markFacesOnProblemCells
1569 removeEdgeConnectedCells,
1576 facePatch = markFacesOnProblemCellsGeometric(snapParams, motionDict);
1578 Info<<
"Analyzed problem cells in = "
1579 << runTime.cpuTimeIncrement() <<
" s\n" <<
nl <<
endl;
1583 faceSet problemFaces(mesh_,
"problemFaces", mesh_.nFaces()/100);
1587 if (facePatch[facei] != -1)
1589 problemFaces.insert(facei);
1592 problemFaces.instance() =
name();
1593 Pout<<
"Dumping " << problemFaces.size()
1594 <<
" problem faces to " << problemFaces.objectPath() <<
endl;
1595 problemFaces.
write();
1598 Info<<
"Introducing baffles to delete problem cells." <<
nl <<
endl;
1606 createBaffles(facePatch, facePatch);
1613 Info<<
"Created baffles in = "
1614 << runTime.cpuTimeIncrement() <<
" s\n" <<
nl <<
endl;
1616 printMeshInfo(debug,
"After introducing baffles");
1620 Pout<<
"Writing extra baffled mesh to time "
1625 writeType(writeLevel() | WRITEMESH),
1626 runTime.path()/
"extraBaffles"
1628 Pout<<
"Dumped debug data in = "
1629 << runTime.cpuTimeIncrement() <<
" s\n" <<
nl <<
endl;
1641 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
1642 const labelList& faceOwner = mesh_.faceOwner();
1643 const labelList& faceNeighbour = mesh_.faceNeighbour();
1660 DynamicList<label> faceLabels(mesh_.nFaces()/100);
1662 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
1664 if (faceToZone[facei] != -1)
1667 const label ownZone = cellToZone[faceOwner[facei]];
1668 const label neiZone = cellToZone[faceNeighbour[facei]];
1669 if (ownZone == neiZone)
1671 faceLabels.append(facei);
1681 const label facei = pp.start() + i;
1682 if (faceToZone[facei] != -1)
1685 const label ownZone = cellToZone[faceOwner[facei]];
1686 const label neiZone =
1687 neiCellZone[facei - mesh_.nInternalFaces()];
1689 if (ownZone == neiZone)
1691 faceLabels.append(facei);
1696 return faceLabels.shrink();
1700 void Foam::meshRefinement::calcPatchNumMasterFaces
1702 const PackedBoolList& isMasterFace,
1708 nMasterFacesPerEdge.setSize(patch.nEdges());
1709 nMasterFacesPerEdge = 0;
1711 forAll(patch.addressing(), facei)
1713 const label meshFacei = patch.addressing()[facei];
1715 if (isMasterFace[meshFacei])
1717 const labelList& fEdges = patch.faceEdges()[facei];
1720 nMasterFacesPerEdge[fEdges[fEdgei]]++;
1728 patch.meshEdges(mesh_.edges(), mesh_.pointEdges()),
1729 nMasterFacesPerEdge,
1743 List<patchEdgeFaceRegion> allEdgeInfo(patch.nEdges());
1744 List<patchEdgeFaceRegion> allFaceInfo(patch.size());
1749 forAll(nMasterFacesPerEdge, edgei)
1751 if (nMasterFacesPerEdge[edgei] > 2)
1753 allEdgeInfo[edgei] = -2;
1761 DynamicList<label> changedEdges;
1762 DynamicList<patchEdgeFaceRegion> changedInfo;
1764 const scalar tol = PatchEdgeFaceWave
1768 >::propagationTol();
1772 const globalIndex globalFaces(patch.size());
1776 label currentZoneI = 0;
1782 for (; facei < allFaceInfo.size(); facei++)
1784 if (!allFaceInfo[facei].
valid(dummyTrackData))
1786 globalSeed = globalFaces.toGlobal(facei);
1791 reduce(globalSeed, minOp<label>());
1798 const label proci = globalFaces.whichProcID(globalSeed);
1799 const label seedFacei = globalFaces.toLocal(proci, globalSeed);
1807 patchEdgeFaceRegion& faceInfo = allFaceInfo[seedFacei];
1810 faceInfo = currentZoneI;
1813 const labelList& fEdges = patch.faceEdges()[seedFacei];
1816 const label edgei = fEdges[fEdgei];
1818 patchEdgeFaceRegion& edgeinfo = allEdgeInfo[edgei];
1822 edgeinfo.updateEdge<
int>
1834 changedEdges.append(edgei);
1835 changedInfo.append(edgeinfo);
1841 if (
returnReduce(changedEdges.size(), sumOp<label>()) == 0)
1867 faceToZone.setSize(patch.size());
1868 forAll(allFaceInfo, facei)
1870 if (!allFaceInfo[facei].
valid(dummyTrackData))
1873 <<
"Problem: unvisited face " << facei
1874 <<
" at " << patch.faceCentres()[facei]
1877 faceToZone[facei] = allFaceInfo[facei].region();
1880 return currentZoneI;
1884 void Foam::meshRefinement::consistentOrientation
1886 const PackedBoolList& isMasterFace,
1890 const Map<label>& zoneToOrientation,
1894 const polyBoundaryMesh& bm = mesh_.boundaryMesh();
1897 List<patchFaceOrientation> allEdgeInfo(patch.nEdges());
1898 List<patchFaceOrientation> allFaceInfo(patch.size());
1904 forAll(patch.addressing(), facei)
1906 const label meshFacei = patch.addressing()[facei];
1913 && !isMasterFace[meshFacei]
1922 label nProtected = 0;
1924 forAll(nMasterFacesPerEdge, edgei)
1926 if (nMasterFacesPerEdge[edgei] > 2)
1933 Info<<
"Protected from visiting "
1935 <<
" non-manifold edges" <<
nl <<
endl;
1940 DynamicList<label> changedEdges;
1941 DynamicList<patchFaceOrientation> changedInfo;
1943 const scalar tol = PatchEdgeFaceWave
1946 patchFaceOrientation
1947 >::propagationTol();
1951 globalIndex globalFaces(patch.size());
1957 forAll(allFaceInfo, facei)
1961 globalSeed = globalFaces.toGlobal(facei);
1966 reduce(globalSeed, minOp<label>());
1973 const label proci = globalFaces.whichProcID(globalSeed);
1974 const label seedFacei = globalFaces.toLocal(proci, globalSeed);
1983 patchFaceOrientation& faceInfo = allFaceInfo[seedFacei];
1988 if (zoneToOrientation[faceToZone[seedFacei]] < 0)
1994 const labelList& fEdges = patch.faceEdges()[seedFacei];
1997 const label edgei = fEdges[fEdgei];
1999 patchFaceOrientation& edgeinfo = allEdgeInfo[edgei];
2003 edgeinfo.updateEdge<
int>
2015 changedEdges.append(edgei);
2016 changedInfo.append(edgeinfo);
2022 if (
returnReduce(changedEdges.size(), sumOp<label>()) == 0)
2033 patchFaceOrientation
2051 mesh_.nFaces() - mesh_.nInternalFaces(),
2055 forAll(patch.addressing(), i)
2057 const label meshFacei = patch.addressing()[i];
2058 if (!mesh_.isInternalFace(meshFacei))
2060 neiStatus[meshFacei-mesh_.nInternalFaces()] =
2061 allFaceInfo[i].flipStatus();
2066 forAll(patch.addressing(), i)
2068 const label meshFacei = patch.addressing()[i];
2075 && !isMasterFace[meshFacei]
2079 label bFacei = meshFacei-mesh_.nInternalFaces();
2092 <<
"Incorrect status for face " << meshFacei
2102 meshFlipMap.setSize(mesh_.nFaces());
2103 meshFlipMap =
false;
2105 forAll(allFaceInfo, facei)
2107 label meshFacei = patch.addressing()[facei];
2111 meshFlipMap[meshFacei] =
false;
2115 meshFlipMap[meshFacei] =
true;
2120 <<
"Problem : unvisited face " << facei
2121 <<
" centre:" << mesh_.faceCentres()[meshFacei]
2132 const bool doHandleSnapProblems,
2134 const bool useTopologicalSnapDetection,
2135 const bool removeEdgeConnectedCells,
2137 const bool mergeFreeStanding,
2138 const scalar planarAngle,
2152 Info<<
"Introducing baffles for "
2154 <<
" faces that are intersected by the surface." <<
nl <<
endl;
2157 labelList neiLevel(mesh_.nFaces() - mesh_.nInternalFaces());
2158 pointField neiCc(mesh_.nFaces() - mesh_.nInternalFaces());
2159 calcNeighbourData(neiLevel, neiCc);
2164 globalToMasterPatch,
2172 createBaffles(ownPatch, nbrPatch);
2180 Info<<
"Created baffles in = "
2183 printMeshInfo(debug,
"After introducing baffles");
2187 Pout<<
"Writing baffled mesh to time " <<
name()
2193 runTime.
path()/
"baffles"
2195 Pout<<
"Dumped debug data in = "
2205 if (doHandleSnapProblems)
2210 useTopologicalSnapDetection,
2211 removeEdgeConnectedCells,
2215 globalToMasterPatch,
2225 <<
"Remove unreachable sections of mesh" <<
nl
2226 <<
"-----------------------------------" <<
nl
2234 splitMeshRegions(globalToMasterPatch, globalToSlavePatch, selectionPoints);
2241 Info<<
"Split mesh in = "
2244 printMeshInfo(debug,
"After subsetting");
2248 Pout<<
"Writing subsetted mesh to time " <<
name()
2256 Pout<<
"Dumped debug data in = "
2264 if (mergeFreeStanding)
2267 <<
"Merge free-standing baffles" <<
nl
2268 <<
"---------------------------" <<
nl
2285 Info<<
"Detected free-standing baffles : " << nCouples <<
endl;
2292 mergeBaffles(couples);
2299 useTopologicalSnapDetection,
2300 removeEdgeConnectedCells,
2304 globalToMasterPatch,
2314 Info<<
"Merged free-standing baffles in = "
2322 const label nBufferLayers,
2332 labelList neiLevel(mesh_.nFaces() - mesh_.nInternalFaces());
2333 pointField neiCc(mesh_.nFaces() - mesh_.nInternalFaces());
2334 calcNeighbourData(neiLevel, neiCc);
2340 globalToMasterPatch,
2349 boolList blockedFace(mesh_.nFaces(),
false);
2353 if (ownPatch[facei] != -1 || nbrPatch[facei] != -1)
2355 blockedFace[facei] =
true;
2362 blockedFace.
clear();
2380 const labelList& faceOwner = mesh_.faceOwner();
2381 const labelList& faceNeighbour = mesh_.faceNeighbour();
2384 label defaultPatch = 0;
2385 if (globalToMasterPatch.
size())
2387 defaultPatch = globalToMasterPatch[0];
2390 for (
label i = 0; i < nBufferLayers; i++)
2394 labelList pointBaffle(mesh_.nPoints(), -1);
2396 forAll(faceNeighbour, facei)
2398 const face&
f = mesh_.faces()[facei];
2399 const label ownRegion = cellRegion[faceOwner[facei]];
2400 const label neiRegion = cellRegion[faceNeighbour[facei]];
2402 if (ownRegion == -1 && neiRegion != -1)
2409 pointBaffle[
f[fp]] =
max(defaultPatch, ownPatch[facei]);
2412 else if (ownRegion != -1 && neiRegion == -1)
2414 label newPatchi = nbrPatch[facei];
2415 if (newPatchi == -1)
2417 newPatchi =
max(defaultPatch, ownPatch[facei]);
2421 pointBaffle[
f[fp]] = newPatchi;
2428 label facei = mesh_.nInternalFaces();
2429 facei < mesh_.nFaces();
2433 const face&
f = mesh_.faces()[facei];
2434 const label ownRegion = cellRegion[faceOwner[facei]];
2436 if (ownRegion == -1)
2440 pointBaffle[
f[fp]] =
max(defaultPatch, ownPatch[facei]);
2459 forAll(pointFaces, pointi)
2461 if (pointBaffle[pointi] != -1)
2469 if (ownPatch[facei] == -1)
2471 ownPatch[facei] = pointBaffle[pointi];
2485 if (ownPatch[facei] != -1)
2487 const label own = faceOwner[facei];
2489 if (cellRegion[own] == -1)
2493 const cell& ownFaces = mesh_.cells()[own];
2496 if (ownPatch[ownFaces[j]] == -1)
2498 newOwnPatch[ownFaces[j]] = ownPatch[facei];
2502 if (mesh_.isInternalFace(facei))
2504 const label nei = faceNeighbour[facei];
2506 if (cellRegion[nei] == -1)
2510 const cell& neiFaces = mesh_.cells()[nei];
2513 if (ownPatch[neiFaces[j]] == -1)
2515 newOwnPatch[neiFaces[j]] = ownPatch[facei];
2535 forAll(cellRegion, celli)
2537 if (cellRegion[celli] == -1)
2539 cellsToRemove.
append(celli);
2544 label nCellsInMesh = mesh_.nCells() - cellsToRemove.
size();
2547 Info<<
"Selecting all cells in regions containing any of the points in "
2549 <<
"Selected: " << nCellsInMesh <<
" cells." <<
endl;
2561 const label facei = exposedFaces[i];
2563 if (ownPatch[facei] != -1)
2565 exposedPatches[i] = ownPatch[facei];
2570 <<
"For exposed face " << facei
2571 <<
" fc:" << mesh_.faceCentres()[facei]
2572 <<
" found no patch." <<
endl
2573 <<
" Taking patch " << defaultPatch
2574 <<
" instead." <<
endl;
2575 exposedPatches[i] = defaultPatch;
2579 return doRemoveCells
2604 Info<<
"dupNonManifoldPoints : Found : " << nNonManifPoints
2605 <<
" non-manifold points (out of "
2606 << mesh_.globalData().nTotalPoints()
2621 mesh_.topoChange(map);
2624 mesh_.setInstance(
name());
2640 return dupNonManifoldPoints(regionSide);
2647 const bool allowFreeStandingZoneFaces
2659 label surfi = namedSurfaces[i];
2661 Info<<
"Surface : " << surfaces_.names()[surfi] <<
nl
2662 <<
" faceZone : " << surfZones[surfi].faceZoneName() <<
nl
2663 <<
" cellZone : " << surfZones[surfi].cellZoneName() <<
endl;
2685 const pointField& cellCentres = mesh_.cellCentres();
2686 const labelList& faceOwner = mesh_.faceOwner();
2687 const labelList& faceNeighbour = mesh_.faceNeighbour();
2692 labelList neiLevel(mesh_.nFaces() - mesh_.nInternalFaces());
2693 pointField neiCc(mesh_.nFaces() - mesh_.nInternalFaces());
2694 calcNeighbourData(neiLevel, neiCc);
2702 labelList namedSurfaceIndex(mesh_.nFaces(), -1);
2717 labelList testFaces(intersectedFaces());
2727 label facei = testFaces[i];
2729 if (mesh_.isInternalFace(facei))
2731 start[i] = cellCentres[faceOwner[facei]];
2732 end[i] = cellCentres[faceNeighbour[facei]];
2736 start[i] = cellCentres[faceOwner[facei]];
2737 end[i] = neiCc[facei-mesh_.nInternalFaces()];
2743 const vectorField smallVec(rootSmall*(end-start));
2763 surfaces_.findNearestIntersection
2783 label facei = testFaces[i];
2784 const vector& area = mesh_.faceAreas()[facei];
2786 if (surface1[i] != -1)
2793 magSqr(hit2[i].hitPoint())
2794 <
magSqr(hit1[i].hitPoint())
2798 namedSurfaceIndex[facei] = surface2[i];
2799 posOrientation[facei] = ((area&normal2[i]) > 0);
2800 nSurfFaces[surface2[i]]++;
2804 namedSurfaceIndex[facei] = surface1[i];
2805 posOrientation[facei] = ((area&normal1[i]) > 0);
2806 nSurfFaces[surface1[i]]++;
2809 else if (surface2[i] != -1)
2811 namedSurfaceIndex[facei] = surface2[i];
2812 posOrientation[facei] = ((area&normal2[i]) > 0);
2813 nSurfFaces[surface2[i]]++;
2832 forAll(nSurfFaces, surfi)
2835 << surfaces_.names()[surfi]
2836 <<
" nZoneFaces:" << nSurfFaces[surfi] <<
nl;
2850 labelList cellToZone(mesh_.nCells(), -2);
2862 surfaces_.geometry(),
2863 surfaces_.surfaces()
2867 if (closedNamedSurfaces.
size())
2869 Info<<
"Found " << closedNamedSurfaces.
size()
2870 <<
" closed, named surfaces. Assigning cells in/outside"
2871 <<
" these surfaces to the corresponding cellZone."
2874 findCellZoneGeometric
2877 closedNamedSurfaces,
2894 if (locationSurfaces.
size())
2896 Info<<
"Found " << locationSurfaces.
size()
2897 <<
" named surfaces with a provided inside point."
2898 <<
" Assigning cells inside these surfaces"
2899 <<
" to the corresponding cellZone."
2902 findCellZoneInsideWalk
2918 <<
" to assign cellZones "
2919 <<
"- crossing a faceZone face changes cellZone" <<
nl <<
endl;
2934 if (!allowFreeStandingZoneFaces)
2936 Info<<
"Only selecting zone faces in between different cellZones."
2939 makeConsistentFaceIndex(cellToZone, namedSurfaceIndex);
2944 labelList faceToZone(mesh_.nFaces(), -1);
2949 forAll(namedSurfaceIndex, facei)
2951 const label surfi = namedSurfaceIndex[facei];
2954 faceToZone[facei] = surfaceToFaceZone[surfi];
2962 forAll(cellToZone, celli)
2964 const label zonei = cellToZone[celli];
2968 cellZoneNewCells[zonei].insert(celli);
2971 forAll(cellZoneNewCells, zonei)
2973 mesh_.cellZones()[zonei].insert(cellZoneNewCells[zonei]);
2989 label bFacei = pp.
start() - mesh_.nInternalFaces();
2992 neiCellZone[bFacei++] = -1;
3012 boolList meshFlipMap(mesh_.nFaces(),
false);
3020 freeStandingBaffleFaces
3031 if (nFreeStanding > 0)
3033 Info<<
"Detected " << nFreeStanding <<
" free-standing zone faces"
3038 OBJstream str(mesh_.time().path()/
"freeStanding.obj");
3045 calcPatchNumMasterFaces(isMasterFace, patch, nMasterFacesPerEdge);
3050 const label nZones = markPatchZones
3053 nMasterFacesPerEdge,
3058 for (
label zonei = 0; zonei < nZones; zonei++)
3060 nPosOrientation.
insert(zonei, 0);
3066 consistentOrientation
3070 nMasterFacesPerEdge,
3071 faceToConnectedZone,
3083 if (isMasterFace[meshFacei])
3088 bool(posOrientation[meshFacei])
3089 == meshFlipMap[meshFacei]
3095 nPosOrientation.
find(faceToConnectedZone[facei])() +=
n;
3102 Info<<
"Split " << nFreeStanding <<
" free-standing zone faces"
3103 <<
" into " << nZones <<
" disconnected regions with size"
3104 <<
" (negative denotes wrong orientation) :"
3107 for (
label zonei = 0; zonei < nZones; zonei++)
3109 Info<<
" " << zonei <<
"\t" << nPosOrientation[zonei]
3117 consistentOrientation
3121 nMasterFacesPerEdge,
3122 faceToConnectedZone,
3134 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
3136 label faceZoneI = faceToZone[facei];
3138 if (faceZoneI != -1)
3144 const label ownZone = cellToZone[faceOwner[facei]];
3145 const label neiZone = cellToZone[faceNeighbour[facei]];
3149 if (ownZone == neiZone)
3152 flip = meshFlipMap[facei];
3159 || (neiZone != -1 && ownZone > neiZone)
3163 faceZonesAddedFaces[faceZoneI].insert(facei, flip);
3177 const label faceZoneI = faceToZone[facei];
3179 if (faceZoneI != -1)
3181 const label ownZone = cellToZone[faceOwner[facei]];
3182 const label neiZone = neiCellZone[facei-mesh_.nInternalFaces()];
3186 if (ownZone == neiZone)
3189 flip = meshFlipMap[facei];
3196 || (neiZone != -1 && ownZone > neiZone)
3200 faceZonesAddedFaces[faceZoneI].insert(facei, flip);
3212 mesh_.faceZones().insert(faceZonesAddedFaces);
3215 mesh_.topoChange(map);
3218 mesh_.setInstance(
name());
3221 if (mesh_.cellZones().size() > 0)
3224 forAll(mesh_.cellZones(), zonei)
3226 const cellZone& cz = mesh_.cellZones()[zonei];
3233 if (mesh_.faceZones().size() > 0)
3236 forAll(mesh_.faceZones(), zonei)
3238 const faceZone& fz = mesh_.faceZones()[zonei];
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
bool insert(const Key &key)
Insert a new entry.
List< Key > toc() const
Return the table of contents.
label size() const
Return number of elements in table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
const word & name() const
Return name.
A List with indirect addressing.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
A HashTable to objects of type <T> with a label key.
OFstream which keeps track of vertices.
virtual Ostream & write(const char)
Write character.
virtual Ostream & write(const char)=0
Write character.
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
static void mapCombineScatter(const List< commsStruct > &comms, Container &Values, const int tag, const label comm)
Scatter data. Reverse of combineGather.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void mapCombineGather(const List< commsStruct > &comms, Container &Values, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
fileName path() const
Explicitly inherit path from TimePaths to disambiguate from.
label size() const
Return the number of elements in the list.
const List< label > & addressing() const
Return the list addressing.
T & first()
Return the first element of the list.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
label size() const
Return the number of elements in the UPtrList.
labelList whichZones(const label objectIndex) const
Given a global object index, return the list of zones it is in.
const word & name() const
Return name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A cell is defined as a list of faces with extra functionality.
double cpuTimeIncrement() const
Return CPU time (in seconds) since last call to cpuTimeIncrement()
A list of keyword definitions, which are a keyword followed by any number of values (e....
void setRefinement(const localPointRegion ®ionSide, polyTopoChange &)
Play commands into polyTopoChange to duplicate points. Gets.
virtual void sync(const polyMesh &mesh)
Sync faceSet across coupled patches.
A subset of mesh faces organised as a primitive patch.
A face is a list of labels corresponding to mesh vertices.
Takes mesh with 'baffles' (= boundary faces sharing points). Determines for selected points on bounda...
const Map< label > & meshPointMap() const
Per point that is to be duplicated the local index.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
autoPtr< polyTopoChangeMap > createBaffles(const labelList &ownPatch, const labelList &nbrPatch)
Create baffle for every internal face where ownPatch != -1.
autoPtr< polyTopoChangeMap > mergeBaffles(const List< labelPair > &)
Merge baffles. Gets pairs of faces.
void baffleAndSplitMesh(const bool handleSnapProblems, const snapParameters &snapParams, const bool useTopologicalSnapDetection, const bool removeEdgeConnectedCells, const scalarField &perpendicularAngle, const bool mergeFreeStanding, const scalar freeStandingAngle, const dictionary &motionDict, Time &runTime, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const refinementParameters::cellSelectionPoints &selectionPoints)
Split off unreachable areas of mesh.
autoPtr< polyTopoChangeMap > zonify(const List< point > &insidePoints, const bool allowFreeStandingZoneFaces)
Put faces/cells into zones according to surface specification.
autoPtr< polyTopoChangeMap > splitMesh(const label nBufferLayers, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const refinementParameters::cellSelectionPoints &selectionPoints)
Split off (with optional buffer layers) unreachable areas.
autoPtr< polyTopoChangeMap > createZoneBaffles(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, List< labelPair > &)
Create baffles for faces straddling zoned surfaces. Return.
void checkZoneFaces() const
Debug helper: check faceZones are not on processor patches.
autoPtr< polyTopoChangeMap > dupNonManifoldPoints()
Find boundary points that connect to more than one cell.
const word & name() const
Return name.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
virtual const labelList & faceNeighbour() const
Return face neighbour.
A patch is a list of labels that address the faces in the global face list.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
label start() const
Return start label of this patch in the polyMesh face list.
Direct mesh changes based on v1.3 polyTopoChange syntax.
void removeFace(const label, const label)
Remove face / merge faces.
autoPtr< polyTopoChangeMap > changeMesh(polyMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
void modifyFace(const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID)
Modify vertices or cell of face.
const vectorField & faceCentres() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
Class to hold the points to select cells inside and outside.
const List< point > & inside() const
Return the points inside the surface regions to selected cells.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
Given list of cells to remove insert all the topology changes.
labelList getExposedFaces(const labelList &cellsToRemove) const
Get labels of exposed faces.
Simple container to keep together snap specific information.
static labelList getInsidePointNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of surfaces with a cellZone that have 'insidePoint'.
static labelList getUnnamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of unnamed surfaces (surfaces without faceZoneName)
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName)
static labelList addFaceZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
static labelList addCellZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
static labelList getClosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are closed and.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
bool valid(const PtrList< ModelType > &l)
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Pair< label > labelPair
Label pair.
scalar radToDeg(const scalar rad)
Convert radians to degrees.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
errorManip< error > abort(error &err)
vectorField pointField
pointField is a vectorField.
List< bool > boolList
Bool container classes.
vector point
Point is a vector.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void reverse(UList< T > &, const label n)
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Field< vector > vectorField
Specialisation of Field<T> for vector.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
prefixOSstream Pout(cout, "Pout")
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
static const label labelMax
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
dimensionedScalar cos(const dimensionedScalar &ds)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< small) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &mergedCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable