53 polyTopoChange& meshMod
56 const face&
f = mesh_.
faces()[facei];
58 bool zoneFlip =
false;
62 const faceZone& fZone = mesh_.
faceZones()[zoneID];
63 zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
90 <<
"No neighbour patch for internal face " << facei
95 bool reverseFlip =
false;
98 reverseFlip = !zoneFlip;
101 dupFacei = meshMod.setAction
122 void Foam::meshRefinement::getBafflePatches
131 const pointField& cellCentres = mesh_.cellCentres();
139 ownPatch.setSize(mesh_.nFaces());
141 nbrPatch.setSize(mesh_.nFaces());
158 const label facei = testFaces[i];
159 const label own = mesh_.faceOwner()[facei];
161 if (mesh_.isInternalFace(facei))
163 start[i] = cellCentres[own];
164 end[i] = cellCentres[mesh_.faceNeighbour()[facei]];
168 start[i] = cellCentres[own];
169 end[i] = neiCc[facei-mesh_.nInternalFaces()];
184 List<pointIndexHit> hit1;
187 List<pointIndexHit> hit2;
189 surfaces_.findNearestIntersection
206 const label facei = testFaces[i];
208 if (hit1[i].hit() && hit2[i].hit())
211 ownPatch[facei] = globalToMasterPatch
213 surfaces_.globalRegion(surface1[i], region1[i])
215 nbrPatch[facei] = globalToMasterPatch
217 surfaces_.globalRegion(surface2[i], region2[i])
220 if (ownPatch[facei] == -1 || nbrPatch[facei] == -1)
243 const bool allowBoundary,
248 Map<labelPair> bafflePatch(mesh_.nFaces()/1000);
250 const PtrList<surfaceZonesInfo>& surfZones = surfaces_.surfZones();
255 const word& faceZoneName = surfZones[surfi].faceZoneName();
257 if (faceZoneName.size())
260 const label zonei = fZones.findZoneID(faceZoneName);
261 const faceZone& fZone = fZones[zonei];
264 const label globalRegioni = surfaces_.globalRegion(surfi, 0);
267 globalToMasterPatch[globalRegioni],
268 globalToSlavePatch[globalRegioni]
271 Info<<
"For zone " << fZone.name() <<
" found patches "
272 << mesh_.boundaryMesh()[zPatches[0]].name() <<
" and "
273 << mesh_.boundaryMesh()[zPatches[1]].name()
278 const label facei = fZone[i];
280 if (allowBoundary || mesh_.isInternalFace(facei))
283 if (fZone.flipMap()[i])
288 if (!bafflePatch.insert(facei,
patches))
292 <<
" fc:" << mesh_.faceCentres()[facei]
293 <<
" in zone " << fZone.name()
294 <<
" is in multiple zones!"
314 ownPatch.
size() != mesh_.nFaces()
315 || nbrPatch.
size() != mesh_.nFaces()
320 <<
" ownPatch:" << ownPatch.
size()
321 <<
" nbrPatch:" << nbrPatch.
size()
322 <<
". Should be number of faces:" << mesh_.nFaces()
333 forAll(syncedOwnPatch, facei)
337 (ownPatch[facei] == -1 && syncedOwnPatch[facei] != -1)
338 || (nbrPatch[facei] == -1 && syncedNeiPatch[facei] != -1)
342 <<
"Non synchronised at face:" << facei
343 <<
" on patch:" << mesh_.boundaryMesh().whichPatch(facei)
344 <<
" fc:" << mesh_.faceCentres()[facei] <<
endl
345 <<
"ownPatch:" << ownPatch[facei]
346 <<
" syncedOwnPatch:" << syncedOwnPatch[facei]
347 <<
" nbrPatch:" << nbrPatch[facei]
348 <<
" syncedNeiPatch:" << syncedNeiPatch[facei]
361 if (ownPatch[facei] != -1)
382 mesh_.topoChange(map);
385 if (map().hasMotionPoints())
387 mesh_.movePoints(map().preMotionPoints());
397 mesh_.setInstance(
name());
401 faceSet baffledFacesSet(mesh_,
"baffledFacesSet", 2*nBaffles);
403 const labelList& reverseFaceMap = map().reverseFaceMap();
407 forAll(ownPatch, oldFacei)
409 const label facei = reverseFaceMap[oldFacei];
411 if (ownPatch[oldFacei] != -1 && facei >= 0)
413 const cell& ownFaces = mesh_.cells()[mesh_.faceOwner()[facei]];
417 baffledFacesSet.
insert(ownFaces[i]);
426 if (oldFacei >= 0 && reverseFaceMap[oldFacei] != facei)
428 const cell& ownFaces = mesh_.cells()[mesh_.faceOwner()[facei]];
432 baffledFacesSet.
insert(ownFaces[i]);
436 baffledFacesSet.
sync(mesh_);
438 topoChange(map, baffledFacesSet.
toc());
454 if (isA<processorPolyPatch>(pp))
464 <<
"face:" << facei <<
" on patch " << pp.
name()
465 <<
" is in zone " << fZones[zonei].
name()
489 if (zonedSurfaces.
size())
492 Info<<
"Converting zoned faces into baffles ..." <<
endl;
506 const label nZoneFaces =
516 ownPatch[iter.key()] = iter().
first();
517 nbrPatch[iter.key()] = iter().second();
521 map = createBaffles(ownPatch, nbrPatch);
531 const labelList& reverseFaceMap = map().reverseFaceMap();
543 if (iter != faceToPatch.
end())
545 const label masterFacei = reverseFaceMap[oldFacei];
546 if (facei != masterFacei)
548 baffles[baffleI++] =
labelPair(masterFacei, facei);
553 if (baffleI != faceToPatch.
size())
556 <<
"Had " << faceToPatch.
size() <<
" patches to create "
557 <<
" but encountered " << baffleI
558 <<
" slave faces originating from patcheable faces."
564 const_cast<Time&
>(mesh_.time())++;
565 Pout<<
"Writing zone-baffled mesh to time " <<
name()
571 mesh_.time().path()/
"baffles"
575 Info<<
"Created " << nZoneFaces <<
" baffles in = "
576 << mesh_.time().cpuTimeIncrement() <<
" s\n" <<
nl <<
endl;
585 const scalar planarAngle
595 labelList nBafflesPerEdge(mesh_.nEdges(), 0);
612 const label baffleValue = 1000000;
631 const labelList& fEdges = mesh_.faceEdges(facei);
635 nBafflesPerEdge[fEdges[fEdgei]]++;
643 DynamicList<label> fe0;
644 DynamicList<label> fe1;
654 const labelList& fEdges0 = mesh_.faceEdges(f0, fe0);
657 nBafflesPerEdge[fEdges0[fEdgei]] += baffleValue;
662 const label f1 = couples[i].second();
663 const labelList& fEdges1 = mesh_.faceEdges(f1, fe1);
666 nBafflesPerEdge[fEdges1[fEdgei]] += baffleValue;
685 List<labelPair> filteredCouples(couples.
size());
694 patches.whichPatch(couple.first())
695 ==
patches.whichPatch(couple.second())
698 const labelList& fEdges = mesh_.faceEdges(couple.first());
702 const label edgei = fEdges[fEdgei];
704 if (nBafflesPerEdge[edgei] == 2*baffleValue+2*1)
706 filteredCouples[filterI++] = couple;
712 filteredCouples.setSize(filterI);
715 const label nFiltered =
718 Info<<
"freeStandingBaffles : detected "
720 <<
" free-standing baffles out of "
733 const pointField& cellCentres = mesh_.cellCentres();
735 forAll(filteredCouples, i)
737 const labelPair& couple = filteredCouples[i];
738 start[i] = cellCentres[mesh_.faceOwner()[couple.first()]];
739 end[i] = cellCentres[mesh_.faceOwner()[couple.second()]];
753 List<pointIndexHit> hit1;
758 List<pointIndexHit> hit2;
762 surfaces_.findNearestIntersection
782 forAll(filteredCouples, i)
784 const labelPair& couple = filteredCouples[i];
791 surface1[i] != surface2[i]
792 || hit1[i].index() != hit2[i].index()
796 if ((normal1[i ]& normal2[i]) > planarAngleCos)
799 const vector n = end[i] - start[i];
800 const scalar magN =
mag(
n);
803 filteredCouples[filterI++] = couple;
807 else if (hit1[i].hit() || hit2[i].hit())
813 filteredCouples.setSize(filterI);
815 Info<<
"freeStandingBaffles : detected "
817 <<
" planar (within " << planarAngle
818 <<
" degrees) free-standing baffles out of "
823 return filteredCouples;
835 const faceList& faces = mesh_.faces();
836 const labelList& faceOwner = mesh_.faceOwner();
842 const label face1 = couples[i].second();
846 const label own0 = faceOwner[face0];
847 const label own1 = faceOwner[face1];
849 if (face1 < 0 || own0 < own1)
853 bool zoneFlip =
false;
857 const faceZone& fZone = faceZones[zoneID];
861 const label nei = (face1 < 0 ? -1 : own1);
884 bool zoneFlip =
false;
888 const faceZone& fZone = faceZones[zoneID];
917 mesh_.topoChange(map);
920 if (map().hasMotionPoints())
922 mesh_.movePoints(map().preMotionPoints());
931 mesh_.setInstance(
name());
941 const label newFace0 = map().reverseFaceMap()[couples[i].
first()];
944 newExposedFaces[newI++] = newFace0;
947 const label newFace1 = map().reverseFaceMap()[couples[i].second()];
950 newExposedFaces[newI++] = newFace1;
954 topoChange(map, newExposedFaces);
961 void Foam::meshRefinement::findCellZoneGeometric
971 const pointField& cellCentres = mesh_.cellCentres();
972 const labelList& faceOwner = mesh_.faceOwner();
973 const labelList& faceNeighbour = mesh_.faceNeighbour();
984 forAll(insideSurfaces, celli)
986 if (cellToZone[celli] == -2)
988 label surfi = insideSurfaces[celli];
992 cellToZone[celli] = surfaceToCellZone[surfi];
1005 label nCandidates = 0;
1006 forAll(namedSurfaceIndex, facei)
1008 const label surfi = namedSurfaceIndex[facei];
1012 if (mesh_.isInternalFace(facei))
1026 forAll(namedSurfaceIndex, facei)
1028 const label surfi = namedSurfaceIndex[facei];
1032 const label own = faceOwner[facei];
1033 const point& ownCc = cellCentres[own];
1035 if (mesh_.isInternalFace(facei))
1037 const label nei = faceNeighbour[facei];
1038 const point& neiCc = cellCentres[nei];
1041 const vector d = 1
e-4*(neiCc - ownCc);
1042 candidatePoints[nCandidates++] = ownCc-d;
1043 candidatePoints[nCandidates++] = neiCc+d;
1047 const point& neiFc = neiCc[facei - mesh_.nInternalFaces()];
1050 const vector d = 1
e-4*(neiFc - ownCc);
1051 candidatePoints[nCandidates++] = ownCc-d;
1059 surfaces_.findInside
1061 closedNamedSurfaces,
1070 forAll(namedSurfaceIndex, facei)
1072 const label surfi = namedSurfaceIndex[facei];
1076 const label own = faceOwner[facei];
1078 if (mesh_.isInternalFace(facei))
1080 const label ownSurfI = insideSurfaces[nCandidates++];
1083 cellToZone[own] = surfaceToCellZone[ownSurfI];
1086 const label neiSurfI = insideSurfaces[nCandidates++];
1089 label nei = faceNeighbour[facei];
1091 cellToZone[nei] = surfaceToCellZone[neiSurfI];
1096 const label ownSurfI = insideSurfaces[nCandidates++];
1099 cellToZone[own] = surfaceToCellZone[ownSurfI];
1110 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
1112 const label ownZone = cellToZone[mesh_.faceOwner()[facei]];
1113 const label neiZone = cellToZone[mesh_.faceNeighbour()[facei]];
1115 if (namedSurfaceIndex[facei] == -1 && (ownZone != neiZone))
1121 max(ownZone, neiZone)
1126 labelList neiCellZone(mesh_.nFaces() - mesh_.nInternalFaces());
1127 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
1137 const label facei = pp.start() + i;
1138 const label ownZone = cellToZone[mesh_.faceOwner()[facei]];
1139 neiCellZone[facei-mesh_.nInternalFaces()] = ownZone;
1153 const label facei = pp.start() + i;
1154 const label ownZone = cellToZone[mesh_.faceOwner()[facei]];
1155 const label neiZone = neiCellZone[facei-mesh_.nInternalFaces()];
1157 if (namedSurfaceIndex[facei] == -1 && (ownZone != neiZone))
1163 max(ownZone, neiZone)
1175 void Foam::meshRefinement::findCellZoneInsideWalk
1185 boolList blockedFace(mesh_.nFaces());
1188 forAll(namedSurfaceIndex, facei)
1190 if (namedSurfaceIndex[facei] == -1)
1192 blockedFace[facei] =
false;
1196 blockedFace[facei] =
true;
1202 regionSplit cellRegion(mesh_, blockedFace);
1203 blockedFace.clear();
1207 (void)mesh_.tetBasePtIs();
1209 const PtrList<surfaceZonesInfo>& surfZones = surfaces_.surfZones();
1212 forAll(locationSurfaces, i)
1214 const label surfi = locationSurfaces[i];
1216 const point& insidePoint = surfZones[surfi].zoneInsidePoint();
1218 Info<<
"For surface " << surfaces_.names()[surfi]
1219 <<
" finding inside point " << insidePoint
1223 label regioninMeshi = findRegion
1231 Info<<
"For surface " << surfaces_.names()[surfi]
1232 <<
" found point " << insidePoint
1233 <<
" in global region " << regioninMeshi
1234 <<
" out of " << cellRegion.nRegions() <<
" regions." <<
endl;
1236 if (regioninMeshi == -1)
1239 <<
"Point " << insidePoint
1240 <<
" is not inside the mesh." <<
nl
1241 <<
"Bounding box of the mesh:" << mesh_.bounds()
1246 forAll(cellRegion, celli)
1248 if (cellRegion[celli] == regioninMeshi)
1250 if (cellToZone[celli] == -2)
1252 cellToZone[celli] = surfaceToCellZone[surfi];
1254 else if (cellToZone[celli] != surfaceToCellZone[surfi])
1258 <<
" at " << mesh_.cellCentres()[celli]
1259 <<
" is inside surface " << surfaces_.names()[surfi]
1260 <<
" but already marked as being in zone "
1261 << cellToZone[celli] <<
endl
1262 <<
"This can happen if your surfaces are not"
1263 <<
" (sufficiently) closed."
1272 bool Foam::meshRefinement::calcRegionToZone
1274 const label surfZoneI,
1275 const label ownRegion,
1276 const label neiRegion,
1281 bool changed =
false;
1284 if (ownRegion != neiRegion)
1291 if (regionToCellZone[ownRegion] == -2)
1293 if (regionToCellZone[neiRegion] == surfZoneI)
1297 regionToCellZone[ownRegion] = -1;
1300 else if (regionToCellZone[neiRegion] != -2)
1304 regionToCellZone[ownRegion] = surfZoneI;
1308 else if (regionToCellZone[neiRegion] == -2)
1310 if (regionToCellZone[ownRegion] == surfZoneI)
1314 regionToCellZone[neiRegion] = -1;
1317 else if (regionToCellZone[ownRegion] != -2)
1321 regionToCellZone[neiRegion] = surfZoneI;
1330 void Foam::meshRefinement::findCellZoneTopo
1344 boolList blockedFace(mesh_.nFaces());
1346 forAll(namedSurfaceIndex, facei)
1348 if (namedSurfaceIndex[facei] == -1)
1350 blockedFace[facei] =
false;
1354 blockedFace[facei] =
true;
1360 regionSplit cellRegion(mesh_, blockedFace);
1361 blockedFace.clear();
1367 labelList regionToCellZone(cellRegion.nRegions(), -2);
1372 forAll(cellToZone, celli)
1374 if (cellToZone[celli] != -2)
1376 regionToCellZone[cellRegion[celli]] = cellToZone[celli];
1384 const label regioninMeshi = findRegion
1393 <<
" in global region " << regioninMeshi
1394 <<
" out of " << cellRegion.nRegions() <<
" regions." <<
endl;
1396 if (regioninMeshi == -1)
1400 <<
" is not inside the mesh." <<
nl
1401 <<
"Bounding box of the mesh:" << mesh_.bounds()
1406 if (regionToCellZone[regioninMeshi] == -2)
1408 regionToCellZone[regioninMeshi] = -1;
1428 bool changed =
false;
1432 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
1434 const label surfi = namedSurfaceIndex[facei];
1441 const bool changedCell = calcRegionToZone
1443 surfaceToCellZone[surfi],
1444 cellRegion[mesh_.faceOwner()[facei]],
1445 cellRegion[mesh_.faceNeighbour()[facei]],
1449 changed = changed | changedCell;
1455 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
1458 labelList neiCellRegion(mesh_.nFaces() - mesh_.nInternalFaces());
1467 const label facei = pp.start() + i;
1468 neiCellRegion[facei-mesh_.nInternalFaces()] =
1469 cellRegion[mesh_.faceOwner()[facei]];
1485 const label facei = pp.start() + i;
1486 const label surfi = namedSurfaceIndex[facei];
1491 const bool changedCell = calcRegionToZone
1493 surfaceToCellZone[surfi],
1494 cellRegion[mesh_.faceOwner()[facei]],
1495 neiCellRegion[facei-mesh_.nInternalFaces()],
1499 changed = changed | changedCell;
1512 forAll(regionToCellZone, regioni)
1514 const label zonei = regionToCellZone[regioni];
1519 <<
"For region " << regioni <<
" haven't set cell zone."
1526 forAll(regionToCellZone, regioni)
1528 Pout<<
"Region " << regioni
1529 <<
" becomes cellZone:" << regionToCellZone[regioni]
1535 forAll(cellToZone, celli)
1537 cellToZone[celli] = regionToCellZone[cellRegion[celli]];
1542 void Foam::meshRefinement::makeConsistentFaceIndex
1548 const labelList& faceOwner = mesh_.faceOwner();
1549 const labelList& faceNeighbour = mesh_.faceNeighbour();
1551 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
1553 const label ownZone = cellToZone[faceOwner[facei]];
1554 const label neiZone = cellToZone[faceNeighbour[facei]];
1556 if (ownZone == neiZone && namedSurfaceIndex[facei] != -1)
1558 namedSurfaceIndex[facei] = -1;
1560 else if (ownZone != neiZone && namedSurfaceIndex[facei] == -1)
1563 <<
"Different cell zones on either side of face " << facei
1564 <<
" at " << mesh_.faceCentres()[facei]
1565 <<
" but face not marked with a surface."
1570 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
1573 labelList neiCellZone(mesh_.nFaces() - mesh_.nInternalFaces());
1582 const label facei = pp.start() + i;
1583 neiCellZone[facei-mesh_.nInternalFaces()] =
1584 cellToZone[mesh_.faceOwner()[facei]];
1599 const label facei = pp.start() + i;
1601 const label ownZone = cellToZone[faceOwner[facei]];
1602 const label neiZone = neiCellZone[facei-mesh_.nInternalFaces()];
1604 if (ownZone == neiZone && namedSurfaceIndex[facei] != -1)
1606 namedSurfaceIndex[facei] = -1;
1608 else if (ownZone != neiZone && namedSurfaceIndex[facei] == -1)
1611 <<
"Different cell zones on either side of face "
1612 << facei <<
" at " << mesh_.faceCentres()[facei]
1613 <<
" but face not marked with a surface."
1623 const label facei = pp.start() + i;
1624 namedSurfaceIndex[facei] = -1;
1631 void Foam::meshRefinement::handleSnapProblems
1633 const snapParameters& snapParams,
1634 const bool useTopologicalSnapDetection,
1635 const bool removeEdgeConnectedCells,
1637 const dictionary& motionDict,
1644 <<
"Introducing baffles to block off problem cells" <<
nl
1645 <<
"----------------------------------------------" <<
nl
1649 if (useTopologicalSnapDetection)
1651 facePatch = markFacesOnProblemCells
1654 removeEdgeConnectedCells,
1661 facePatch = markFacesOnProblemCellsGeometric(snapParams, motionDict);
1663 Info<<
"Analyzed problem cells in = "
1664 << runTime.cpuTimeIncrement() <<
" s\n" <<
nl <<
endl;
1668 faceSet problemFaces(mesh_,
"problemFaces", mesh_.nFaces()/100);
1672 if (facePatch[facei] != -1)
1674 problemFaces.insert(facei);
1677 problemFaces.instance() =
name();
1678 Pout<<
"Dumping " << problemFaces.size()
1679 <<
" problem faces to " << problemFaces.objectPath() <<
endl;
1680 problemFaces.
write();
1683 Info<<
"Introducing baffles to delete problem cells." <<
nl <<
endl;
1691 createBaffles(facePatch, facePatch);
1698 Info<<
"Created baffles in = "
1699 << runTime.cpuTimeIncrement() <<
" s\n" <<
nl <<
endl;
1701 printMeshInfo(debug,
"After introducing baffles");
1705 Pout<<
"Writing extra baffled mesh to time "
1710 writeType(writeLevel() | WRITEMESH),
1711 runTime.path()/
"extraBaffles"
1713 Pout<<
"Dumped debug data in = "
1714 << runTime.cpuTimeIncrement() <<
" s\n" <<
nl <<
endl;
1726 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
1727 const labelList& faceOwner = mesh_.faceOwner();
1728 const labelList& faceNeighbour = mesh_.faceNeighbour();
1745 DynamicList<label> faceLabels(mesh_.nFaces()/100);
1747 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
1749 if (faceToZone[facei] != -1)
1752 const label ownZone = cellToZone[faceOwner[facei]];
1753 const label neiZone = cellToZone[faceNeighbour[facei]];
1754 if (ownZone == neiZone)
1756 faceLabels.append(facei);
1766 const label facei = pp.start() + i;
1767 if (faceToZone[facei] != -1)
1770 const label ownZone = cellToZone[faceOwner[facei]];
1771 const label neiZone =
1772 neiCellZone[facei - mesh_.nInternalFaces()];
1774 if (ownZone == neiZone)
1776 faceLabels.append(facei);
1781 return faceLabels.shrink();
1785 void Foam::meshRefinement::calcPatchNumMasterFaces
1787 const PackedBoolList& isMasterFace,
1793 nMasterFacesPerEdge.setSize(patch.nEdges());
1794 nMasterFacesPerEdge = 0;
1796 forAll(patch.addressing(), facei)
1798 const label meshFacei = patch.addressing()[facei];
1800 if (isMasterFace[meshFacei])
1802 const labelList& fEdges = patch.faceEdges()[facei];
1805 nMasterFacesPerEdge[fEdges[fEdgei]]++;
1813 patch.meshEdges(mesh_.edges(), mesh_.pointEdges()),
1814 nMasterFacesPerEdge,
1828 List<patchEdgeFaceRegion> allEdgeInfo(patch.nEdges());
1829 List<patchEdgeFaceRegion> allFaceInfo(patch.size());
1834 forAll(nMasterFacesPerEdge, edgei)
1836 if (nMasterFacesPerEdge[edgei] > 2)
1838 allEdgeInfo[edgei] = -2;
1846 DynamicList<label> changedEdges;
1847 DynamicList<patchEdgeFaceRegion> changedInfo;
1849 const scalar tol = PatchEdgeFaceWave
1853 >::propagationTol();
1857 const globalIndex globalFaces(patch.size());
1861 label currentZoneI = 0;
1867 for (; facei < allFaceInfo.size(); facei++)
1869 if (!allFaceInfo[facei].
valid(dummyTrackData))
1871 globalSeed = globalFaces.toGlobal(facei);
1876 reduce(globalSeed, minOp<label>());
1883 const label proci = globalFaces.whichProcID(globalSeed);
1884 const label seedFacei = globalFaces.toLocal(proci, globalSeed);
1892 patchEdgeFaceRegion& faceInfo = allFaceInfo[seedFacei];
1895 faceInfo = currentZoneI;
1898 const labelList& fEdges = patch.faceEdges()[seedFacei];
1901 const label edgei = fEdges[fEdgei];
1903 patchEdgeFaceRegion& edgeinfo = allEdgeInfo[edgei];
1907 edgeinfo.updateEdge<
int>
1919 changedEdges.append(edgei);
1920 changedInfo.append(edgeinfo);
1926 if (
returnReduce(changedEdges.size(), sumOp<label>()) == 0)
1952 faceToZone.setSize(patch.size());
1953 forAll(allFaceInfo, facei)
1955 if (!allFaceInfo[facei].
valid(dummyTrackData))
1958 <<
"Problem: unvisited face " << facei
1959 <<
" at " << patch.faceCentres()[facei]
1962 faceToZone[facei] = allFaceInfo[facei].region();
1965 return currentZoneI;
1969 void Foam::meshRefinement::consistentOrientation
1971 const PackedBoolList& isMasterFace,
1975 const Map<label>& zoneToOrientation,
1979 const polyBoundaryMesh& bm = mesh_.boundaryMesh();
1982 List<patchFaceOrientation> allEdgeInfo(patch.nEdges());
1983 List<patchFaceOrientation> allFaceInfo(patch.size());
1989 forAll(patch.addressing(), facei)
1991 const label meshFacei = patch.addressing()[facei];
1998 && !isMasterFace[meshFacei]
2007 label nProtected = 0;
2009 forAll(nMasterFacesPerEdge, edgei)
2011 if (nMasterFacesPerEdge[edgei] > 2)
2018 Info<<
"Protected from visiting "
2020 <<
" non-manifold edges" <<
nl <<
endl;
2025 DynamicList<label> changedEdges;
2026 DynamicList<patchFaceOrientation> changedInfo;
2028 const scalar tol = PatchEdgeFaceWave
2031 patchFaceOrientation
2032 >::propagationTol();
2036 globalIndex globalFaces(patch.size());
2042 forAll(allFaceInfo, facei)
2046 globalSeed = globalFaces.toGlobal(facei);
2051 reduce(globalSeed, minOp<label>());
2058 const label proci = globalFaces.whichProcID(globalSeed);
2059 const label seedFacei = globalFaces.toLocal(proci, globalSeed);
2068 patchFaceOrientation& faceInfo = allFaceInfo[seedFacei];
2073 if (zoneToOrientation[faceToZone[seedFacei]] < 0)
2079 const labelList& fEdges = patch.faceEdges()[seedFacei];
2082 const label edgei = fEdges[fEdgei];
2084 patchFaceOrientation& edgeinfo = allEdgeInfo[edgei];
2088 edgeinfo.updateEdge<
int>
2100 changedEdges.append(edgei);
2101 changedInfo.append(edgeinfo);
2107 if (
returnReduce(changedEdges.size(), sumOp<label>()) == 0)
2118 patchFaceOrientation
2136 mesh_.nFaces() - mesh_.nInternalFaces(),
2140 forAll(patch.addressing(), i)
2142 const label meshFacei = patch.addressing()[i];
2143 if (!mesh_.isInternalFace(meshFacei))
2145 neiStatus[meshFacei-mesh_.nInternalFaces()] =
2146 allFaceInfo[i].flipStatus();
2151 forAll(patch.addressing(), i)
2153 const label meshFacei = patch.addressing()[i];
2160 && !isMasterFace[meshFacei]
2164 label bFacei = meshFacei-mesh_.nInternalFaces();
2177 <<
"Incorrect status for face " << meshFacei
2187 meshFlipMap.setSize(mesh_.nFaces());
2188 meshFlipMap =
false;
2190 forAll(allFaceInfo, facei)
2192 label meshFacei = patch.addressing()[facei];
2196 meshFlipMap[meshFacei] =
false;
2200 meshFlipMap[meshFacei] =
true;
2205 <<
"Problem : unvisited face " << facei
2206 <<
" centre:" << mesh_.faceCentres()[meshFacei]
2217 const bool doHandleSnapProblems,
2219 const bool useTopologicalSnapDetection,
2220 const bool removeEdgeConnectedCells,
2222 const bool mergeFreeStanding,
2223 const scalar planarAngle,
2237 Info<<
"Introducing baffles for "
2239 <<
" faces that are intersected by the surface." <<
nl <<
endl;
2242 labelList neiLevel(mesh_.nFaces() - mesh_.nInternalFaces());
2243 pointField neiCc(mesh_.nFaces() - mesh_.nInternalFaces());
2244 calcNeighbourData(neiLevel, neiCc);
2249 globalToMasterPatch,
2257 createBaffles(ownPatch, nbrPatch);
2265 Info<<
"Created baffles in = "
2268 printMeshInfo(debug,
"After introducing baffles");
2272 Pout<<
"Writing baffled mesh to time " <<
name()
2278 runTime.
path()/
"baffles"
2280 Pout<<
"Dumped debug data in = "
2290 if (doHandleSnapProblems)
2295 useTopologicalSnapDetection,
2296 removeEdgeConnectedCells,
2300 globalToMasterPatch,
2310 <<
"Remove unreachable sections of mesh" <<
nl
2311 <<
"-----------------------------------" <<
nl
2319 splitMeshRegions(globalToMasterPatch, globalToSlavePatch, selectionPoints);
2326 Info<<
"Split mesh in = "
2329 printMeshInfo(debug,
"After subsetting");
2333 Pout<<
"Writing subsetted mesh to time " <<
name()
2341 Pout<<
"Dumped debug data in = "
2349 if (mergeFreeStanding)
2352 <<
"Merge free-standing baffles" <<
nl
2353 <<
"---------------------------" <<
nl
2370 Info<<
"Detected free-standing baffles : " << nCouples <<
endl;
2377 mergeBaffles(couples);
2384 useTopologicalSnapDetection,
2385 removeEdgeConnectedCells,
2389 globalToMasterPatch,
2399 Info<<
"Merged free-standing baffles in = "
2407 const label nBufferLayers,
2417 labelList neiLevel(mesh_.nFaces() - mesh_.nInternalFaces());
2418 pointField neiCc(mesh_.nFaces() - mesh_.nInternalFaces());
2419 calcNeighbourData(neiLevel, neiCc);
2425 globalToMasterPatch,
2434 boolList blockedFace(mesh_.nFaces(),
false);
2438 if (ownPatch[facei] != -1 || nbrPatch[facei] != -1)
2440 blockedFace[facei] =
true;
2447 blockedFace.
clear();
2465 const labelList& faceOwner = mesh_.faceOwner();
2466 const labelList& faceNeighbour = mesh_.faceNeighbour();
2469 label defaultPatch = 0;
2470 if (globalToMasterPatch.
size())
2472 defaultPatch = globalToMasterPatch[0];
2475 for (
label i = 0; i < nBufferLayers; i++)
2479 labelList pointBaffle(mesh_.nPoints(), -1);
2481 forAll(faceNeighbour, facei)
2483 const face&
f = mesh_.faces()[facei];
2484 const label ownRegion = cellRegion[faceOwner[facei]];
2485 const label neiRegion = cellRegion[faceNeighbour[facei]];
2487 if (ownRegion == -1 && neiRegion != -1)
2494 pointBaffle[
f[fp]] =
max(defaultPatch, ownPatch[facei]);
2497 else if (ownRegion != -1 && neiRegion == -1)
2499 label newPatchi = nbrPatch[facei];
2500 if (newPatchi == -1)
2502 newPatchi =
max(defaultPatch, ownPatch[facei]);
2506 pointBaffle[
f[fp]] = newPatchi;
2513 label facei = mesh_.nInternalFaces();
2514 facei < mesh_.nFaces();
2518 const face&
f = mesh_.faces()[facei];
2519 const label ownRegion = cellRegion[faceOwner[facei]];
2521 if (ownRegion == -1)
2525 pointBaffle[
f[fp]] =
max(defaultPatch, ownPatch[facei]);
2544 forAll(pointFaces, pointi)
2546 if (pointBaffle[pointi] != -1)
2554 if (ownPatch[facei] == -1)
2556 ownPatch[facei] = pointBaffle[pointi];
2570 if (ownPatch[facei] != -1)
2572 const label own = faceOwner[facei];
2574 if (cellRegion[own] == -1)
2578 const cell& ownFaces = mesh_.cells()[own];
2581 if (ownPatch[ownFaces[j]] == -1)
2583 newOwnPatch[ownFaces[j]] = ownPatch[facei];
2587 if (mesh_.isInternalFace(facei))
2589 const label nei = faceNeighbour[facei];
2591 if (cellRegion[nei] == -1)
2595 const cell& neiFaces = mesh_.cells()[nei];
2598 if (ownPatch[neiFaces[j]] == -1)
2600 newOwnPatch[neiFaces[j]] = ownPatch[facei];
2620 forAll(cellRegion, celli)
2622 if (cellRegion[celli] == -1)
2624 cellsToRemove.
append(celli);
2629 label nCellsInMesh = mesh_.nCells() - cellsToRemove.
size();
2632 Info<<
"Selecting all cells in regions containing any of the points in "
2634 <<
"Selected: " << nCellsInMesh <<
" cells." <<
endl;
2646 const label facei = exposedFaces[i];
2648 if (ownPatch[facei] != -1)
2650 exposedPatches[i] = ownPatch[facei];
2655 <<
"For exposed face " << facei
2656 <<
" fc:" << mesh_.faceCentres()[facei]
2657 <<
" found no patch." <<
endl
2658 <<
" Taking patch " << defaultPatch
2659 <<
" instead." <<
endl;
2660 exposedPatches[i] = defaultPatch;
2664 return doRemoveCells
2689 Info<<
"dupNonManifoldPoints : Found : " << nNonManifPoints
2690 <<
" non-manifold points (out of "
2691 << mesh_.globalData().nTotalPoints()
2706 mesh_.topoChange(map);
2709 if (map().hasMotionPoints())
2711 mesh_.movePoints(map().preMotionPoints());
2720 mesh_.setInstance(
name());
2743 const bool allowFreeStandingZoneFaces
2755 label surfi = namedSurfaces[i];
2757 Info<<
"Surface : " << surfaces_.names()[surfi] <<
nl
2758 <<
" faceZone : " << surfZones[surfi].faceZoneName() <<
nl
2759 <<
" cellZone : " << surfZones[surfi].cellZoneName() <<
endl;
2781 const pointField& cellCentres = mesh_.cellCentres();
2782 const labelList& faceOwner = mesh_.faceOwner();
2783 const labelList& faceNeighbour = mesh_.faceNeighbour();
2788 labelList neiLevel(mesh_.nFaces() - mesh_.nInternalFaces());
2789 pointField neiCc(mesh_.nFaces() - mesh_.nInternalFaces());
2790 calcNeighbourData(neiLevel, neiCc);
2798 labelList namedSurfaceIndex(mesh_.nFaces(), -1);
2813 labelList testFaces(intersectedFaces());
2823 label facei = testFaces[i];
2825 if (mesh_.isInternalFace(facei))
2827 start[i] = cellCentres[faceOwner[facei]];
2828 end[i] = cellCentres[faceNeighbour[facei]];
2832 start[i] = cellCentres[faceOwner[facei]];
2833 end[i] = neiCc[facei-mesh_.nInternalFaces()];
2839 const vectorField smallVec(rootSmall*(end-start));
2859 surfaces_.findNearestIntersection
2879 label facei = testFaces[i];
2880 const vector& area = mesh_.faceAreas()[facei];
2882 if (surface1[i] != -1)
2889 magSqr(hit2[i].hitPoint())
2890 <
magSqr(hit1[i].hitPoint())
2894 namedSurfaceIndex[facei] = surface2[i];
2895 posOrientation[facei] = ((area&normal2[i]) > 0);
2896 nSurfFaces[surface2[i]]++;
2900 namedSurfaceIndex[facei] = surface1[i];
2901 posOrientation[facei] = ((area&normal1[i]) > 0);
2902 nSurfFaces[surface1[i]]++;
2905 else if (surface2[i] != -1)
2907 namedSurfaceIndex[facei] = surface2[i];
2908 posOrientation[facei] = ((area&normal2[i]) > 0);
2909 nSurfFaces[surface2[i]]++;
2928 forAll(nSurfFaces, surfi)
2931 << surfaces_.names()[surfi]
2932 <<
" nZoneFaces:" << nSurfFaces[surfi] <<
nl;
2946 labelList cellToZone(mesh_.nCells(), -2);
2958 surfaces_.geometry(),
2959 surfaces_.surfaces()
2963 if (closedNamedSurfaces.
size())
2965 Info<<
"Found " << closedNamedSurfaces.
size()
2966 <<
" closed, named surfaces. Assigning cells in/outside"
2967 <<
" these surfaces to the corresponding cellZone."
2970 findCellZoneGeometric
2973 closedNamedSurfaces,
2990 if (locationSurfaces.
size())
2992 Info<<
"Found " << locationSurfaces.
size()
2993 <<
" named surfaces with a provided inside point."
2994 <<
" Assigning cells inside these surfaces"
2995 <<
" to the corresponding cellZone."
2998 findCellZoneInsideWalk
3014 <<
" to assign cellZones "
3015 <<
"- crossing a faceZone face changes cellZone" <<
nl <<
endl;
3030 if (!allowFreeStandingZoneFaces)
3032 Info<<
"Only selecting zone faces in between different cellZones."
3035 makeConsistentFaceIndex(cellToZone, namedSurfaceIndex);
3040 labelList faceToZone(mesh_.nFaces(), -1);
3045 forAll(namedSurfaceIndex, facei)
3047 const label surfi = namedSurfaceIndex[facei];
3050 faceToZone[facei] = surfaceToFaceZone[surfi];
3069 label bFacei = pp.
start() - mesh_.nInternalFaces();
3072 neiCellZone[bFacei++] = -1;
3094 boolList meshFlipMap(mesh_.nFaces(),
false);
3102 freeStandingBaffleFaces
3113 if (nFreeStanding > 0)
3115 Info<<
"Detected " << nFreeStanding <<
" free-standing zone faces"
3120 OBJstream str(mesh_.time().path()/
"freeStanding.obj");
3127 calcPatchNumMasterFaces(isMasterFace, patch, nMasterFacesPerEdge);
3132 const label nZones = markPatchZones
3135 nMasterFacesPerEdge,
3140 for (
label zonei = 0; zonei < nZones; zonei++)
3142 nPosOrientation.
insert(zonei, 0);
3148 consistentOrientation
3152 nMasterFacesPerEdge,
3153 faceToConnectedZone,
3165 if (isMasterFace[meshFacei])
3170 bool(posOrientation[meshFacei])
3171 == meshFlipMap[meshFacei]
3177 nPosOrientation.
find(faceToConnectedZone[facei])() +=
n;
3184 Info<<
"Split " << nFreeStanding <<
" free-standing zone faces"
3185 <<
" into " << nZones <<
" disconnected regions with size"
3186 <<
" (negative denotes wrong orientation) :"
3189 for (
label zonei = 0; zonei < nZones; zonei++)
3191 Info<<
" " << zonei <<
"\t" << nPosOrientation[zonei]
3199 consistentOrientation
3203 nMasterFacesPerEdge,
3204 faceToConnectedZone,
3216 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
3218 label faceZoneI = faceToZone[facei];
3220 if (faceZoneI != -1)
3226 const label ownZone = cellToZone[faceOwner[facei]];
3227 const label neiZone = cellToZone[faceNeighbour[facei]];
3231 if (ownZone == neiZone)
3234 flip = meshFlipMap[facei];
3241 || (neiZone != -1 && ownZone > neiZone)
3249 mesh_.faces()[facei],
3252 faceNeighbour[facei],
3273 const label faceZoneI = faceToZone[facei];
3275 if (faceZoneI != -1)
3277 const label ownZone = cellToZone[faceOwner[facei]];
3278 const label neiZone = neiCellZone[facei-mesh_.nInternalFaces()];
3282 if (ownZone == neiZone)
3285 flip = meshFlipMap[facei];
3292 || (neiZone != -1 && ownZone > neiZone)
3300 mesh_.faces()[facei],
3320 forAll(cellToZone, celli)
3322 const label zonei = cellToZone[celli];
3344 mesh_.topoChange(map);
3347 if (map().hasMotionPoints())
3349 mesh_.movePoints(map().preMotionPoints());
3358 mesh_.setInstance(
name());
3361 if (mesh_.cellZones().size() > 0)
3364 forAll(mesh_.cellZones(), zonei)
3366 const cellZone& cz = mesh_.cellZones()[zonei];
3373 if (mesh_.faceZones().size() > 0)
3376 forAll(mesh_.faceZones(), zonei)
3378 const faceZone& fz = mesh_.faceZones()[zonei];
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#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.
An STL-conforming const_iterator.
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.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
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.
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.
const boolList & flipMap() const
Return face flip map.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
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...
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.
const meshFaceZones & faceZones() const
Return face zones.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Class describing modification of a cell.
Class describing modification of a face.
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.
Class containing data for face removal.
Direct mesh changes based on v1.3 polyTopoChange syntax.
autoPtr< polyTopoChangeMap > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
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.
Determines the 'side' for every face and connected to a singly-connected (through edges) region of fa...
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.
const word & name() const
Return name.
#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.
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.
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
MeshZones< faceZone, polyMesh > meshFaceZones
A MeshZones with the type faceZone.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
word name(const complex &)
Return a string representation of a complex.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
dimensionedScalar cos(const dimensionedScalar &ds)
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
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
Unit conversion functions.