54 x.setSize(sz+
y.size());
66 bool Foam::snappySnapDriver::isFeaturePoint
68 const scalar featureCos,
70 const PackedBoolList& isFeatureEdge,
76 const labelList& pEdges = pp.pointEdges()[pointi];
82 if (isFeatureEdge[pEdges[i]])
86 for (
label j = i+1; j < pEdges.size(); j++)
88 if (isFeatureEdge[pEdges[j]])
90 const edge& eI = edges[pEdges[i]];
91 const edge& eJ = edges[pEdges[j]];
98 scalar vIMag =
mag(vI);
101 scalar vJMag =
mag(vJ);
107 && ((vI/vIMag & vJ/vJMag) < featureCos)
127 void Foam::snappySnapDriver::smoothAndConstrain
129 const PackedBoolList& isPatchMasterEdge,
132 const List<pointConstraint>& constraints,
136 const fvMesh& mesh = meshRefiner_.mesh();
138 for (
label avgIter = 0; avgIter < 20; avgIter++)
159 forAll(pointEdges, pointi)
161 const labelList& pEdges = pointEdges[pointi];
163 label nConstraints = constraints[pointi].first();
165 if (nConstraints <= 1)
169 label edgei = pEdges[i];
171 if (isPatchMasterEdge[edgei])
173 label nbrPointi = edges[edgei].otherVertex(pointi);
174 if (constraints[nbrPointi].
first() >= nConstraints)
176 dispSum[pointi] += disp[nbrPointi];
204 forAll(constraints, pointi)
206 if (dispCount[pointi] > 0)
211 *(disp[pointi] + dispSum[pointi]/dispCount[pointi]);
218 void Foam::snappySnapDriver::calcNearestFace
229 const fvMesh& mesh = meshRefiner_.mesh();
230 const refinementSurfaces& surfaces = meshRefiner_.surfaces();
233 faceDisp.setSize(pp.size());
235 faceSurfaceNormal.setSize(pp.size());
236 faceSurfaceNormal =
Zero;
237 faceSurfaceGlobalRegion.setSize(pp.size());
238 faceSurfaceGlobalRegion = -1;
255 const PtrList<surfaceZonesInfo>& surfZones = surfaces.surfZones();
259 label zoneSurfI = zonedSurfaces[i];
261 const word& faceZoneName = surfZones[zoneSurfI].faceZoneName();
264 label zonei = mesh.faceZones().findZoneID(faceZoneName);
268 <<
"Problem. Cannot find zone " << faceZoneName
271 const faceZone& fZone = mesh.faceZones()[zonei];
272 PackedBoolList isZonedFace(mesh.nFaces());
275 isZonedFace[fZone[i]] = 1;
278 DynamicList<label> ppFaces(fZone.size());
279 DynamicList<label> meshFaces(fZone.size());
280 forAll(pp.addressing(), i)
282 if (isZonedFace[pp.addressing()[i]])
284 snapSurf[i] = zoneSurfI;
286 meshFaces.append(pp.addressing()[i]);
298 IndirectList<face>(mesh.faces(), meshFaces),
303 List<pointIndexHit> hitinfo;
307 surfaces.findNearestRegion
320 if (hitinfo[hiti].hit())
322 label facei = ppFaces[hiti];
323 faceDisp[facei] = hitinfo[hiti].hitPoint() - fc[hiti];
324 faceSurfaceNormal[facei] = hitNormal[hiti];
325 faceSurfaceGlobalRegion[facei] = surfaces.globalRegion
334 <<
"Did not find surface near face centre " << fc[hiti]
345 DynamicList<label> ppFaces(pp.size());
346 DynamicList<label> meshFaces(pp.size());
347 forAll(pp.addressing(), i)
349 if (snapSurf[i] == -1)
352 meshFaces.append(pp.addressing()[i]);
362 IndirectList<face>(mesh.faces(), meshFaces),
367 List<pointIndexHit> hitinfo;
371 surfaces.findNearestRegion
384 if (hitinfo[hiti].hit())
386 label facei = ppFaces[hiti];
387 faceDisp[facei] = hitinfo[hiti].hitPoint() - fc[hiti];
388 faceSurfaceNormal[facei] = hitNormal[hiti];
389 faceSurfaceGlobalRegion[facei] = surfaces.globalRegion
398 <<
"Did not find surface near face centre " << fc[hiti]
408 faceRotation.setSize(pp.size());
411 forAll(faceRotation, facei)
414 faceRotation[facei] =
415 pp.faceNormals()[facei]
416 ^ faceSurfaceNormal[facei];
424 /
"faceDisp_" +
name(iter) +
".obj",
426 pp.faceCentres() + faceDisp
431 /
"faceRotation_" +
name(iter) +
".obj",
433 pp.faceCentres() + faceRotation
439 void Foam::snappySnapDriver::calcNearestFacePointProperties
446 const labelList& faceSurfaceGlobalRegion,
448 List<List<point>>& pointFaceSurfNormals,
449 List<List<point>>& pointFaceDisp,
450 List<List<point>>& pointFaceCentres,
451 List<labelList>& pointFacePatchID
454 const fvMesh& mesh = meshRefiner_.mesh();
463 pointFaceSurfNormals.setSize(pp.nPoints());
464 pointFaceDisp.setSize(pp.nPoints());
465 pointFaceCentres.setSize(pp.nPoints());
466 pointFacePatchID.setSize(pp.nPoints());
469 forAll(pp.pointFaces(), pointi)
478 if (isMasterFace[facei] && faceSurfaceGlobalRegion[facei] != -1)
485 List<point>& pNormals = pointFaceSurfNormals[pointi];
486 pNormals.setSize(nFaces);
487 List<point>& pDisp = pointFaceDisp[pointi];
488 pDisp.setSize(nFaces);
489 List<point>& pFc = pointFaceCentres[pointi];
491 labelList& pFid = pointFacePatchID[pointi];
498 label globalRegioni = faceSurfaceGlobalRegion[facei];
500 if (isMasterFace[facei] && globalRegioni != -1)
502 pNormals[nFaces] = faceSurfaceNormal[facei];
503 pDisp[nFaces] = faceDisp[facei];
504 pFc[nFaces] = pp.faceCentres()[facei];
505 pFid[nFaces] = globalToMasterPatch_[globalRegioni];
520 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
526 const polyPatch& pp = pbm[
patchi];
528 if (pp.coupled() || isA<emptyPolyPatch>(pp))
532 label meshFacei = pp.start()+i;
533 patchID[meshFacei-mesh.nInternalFaces()] = -1;
539 forAll(pp.addressing(), i)
541 label meshFacei = pp.addressing()[i];
542 patchID[meshFacei-mesh.nInternalFaces()] = -1;
547 const labelList& boundaryPoints = pp.boundaryPoints();
550 label pointi = boundaryPoints[i];
551 label meshPointi = pp.meshPoints()[pointi];
552 const point& pt = mesh.points()[meshPointi];
555 List<point>& pNormals = pointFaceSurfNormals[pointi];
556 List<point>& pDisp = pointFaceDisp[pointi];
557 List<point>& pFc = pointFaceCentres[pointi];
558 labelList& pFid = pointFacePatchID[pointi];
563 if (!mesh.isInternalFace(meshFacei))
565 label patchi = patchID[meshFacei-mesh.nInternalFaces()];
569 vector fn = mesh.faceAreas()[meshFacei];
570 pNormals.append(fn/
mag(fn));
571 pDisp.append(mesh.faceCentres()[meshFacei]-pt);
572 pFc.append(mesh.faceCentres()[meshFacei]);
584 pointFaceSurfNormals,
585 listPlusEqOp<point>(),
594 listPlusEqOp<point>(),
603 listPlusEqOp<point>(),
605 distributionMap::transformPosition()
612 listPlusEqOp<label>(),
620 forAll(pointFaceDisp, pointi)
622 List<point>& pNormals = pointFaceSurfNormals[pointi];
623 List<point>& pDisp = pointFaceDisp[pointi];
624 List<point>& pFc = pointFaceCentres[pointi];
625 labelList& pFid = pointFacePatchID[pointi];
629 pNormals = List<point>(pNormals, visitOrder);
630 pDisp = List<point>(pDisp, visitOrder);
631 pFc = List<point>(pFc, visitOrder);
632 pFid = UIndirectList<label>(pFid, visitOrder)();
637 void Foam::snappySnapDriver::correctAttraction
639 const DynamicList<point>& surfacePoints,
640 const DynamicList<label>& surfaceCounts,
649 scalar tang = ((pt-edgePt)&edgeNormal);
654 if (order[0] < order[1])
658 vector attractD = surfacePoints[order[0]]-edgePt;
660 scalar tang2 = (attractD&edgeNormal);
662 attractD -= tang2*edgeNormal;
664 scalar magAttractD =
mag(attractD);
665 scalar fraction = magAttractD/(magAttractD+
mag(edgeOffset));
669 + ((1.0-fraction)*tang2 + fraction*tang)*edgeNormal;
670 edgeOffset = linePt-pt;
679 const List<point>& faceCentres
685 label patch0 = patchIDs[0];
687 for (
label i = 1; i < patchIDs.size(); i++)
689 if (patchIDs[i] != patch0)
701 const scalar featureCos,
703 const DynamicList<vector>& surfaceNormals
710 scalar cosAngle = (
n&surfaceNormals[j]);
714 (cosAngle >= featureCos)
715 || (cosAngle < (-1+0.001))
730 const DynamicList<vector>& surfaceNormals,
734 if (patchIDs.empty())
740 label patch0 = patchIDs[0];
742 for (
label i = 1; i < patchIDs.size(); i++)
744 if (patchIDs[i] != patch0)
758 if (surfaceNormals.size() == 1)
766 labelList normalToPatch(surfaceNormals.size(), -1);
767 forAll(faceToNormalBin, i)
769 if (faceToNormalBin[i] != -1)
771 label& patch = normalToPatch[faceToNormalBin[i]];
777 else if (patch == -2)
781 else if (patch != patchIDs[i])
789 forAll(normalToPatch, normali)
791 if (normalToPatch[normali] == -2)
806 void Foam::snappySnapDriver::featureAttractionUsingReconstruction
809 const scalar featureCos,
816 const List<List<point>>& pointFaceSurfNormals,
817 const List<List<point>>& pointFaceDisp,
818 const List<List<point>>& pointFaceCentres,
821 DynamicList<point>& surfacePoints,
822 DynamicList<vector>& surfaceNormals,
826 pointConstraint& patchConstraint
829 patchAttraction =
Zero;
830 patchConstraint = pointConstraint();
832 const List<point>& pfSurfNormals = pointFaceSurfNormals[pointi];
833 const List<point>& pfDisp = pointFaceDisp[pointi];
834 const List<point>& pfCentres = pointFaceCentres[pointi];
844 surfacePoints.clear();
845 surfaceNormals.clear();
848 faceToNormalBin.setSize(pfDisp.size());
849 faceToNormalBin = -1;
853 const point& fc = pfCentres[i];
854 const vector& fSNormal = pfSurfNormals[i];
855 const vector& fDisp = pfDisp[i];
858 if (
magSqr(fDisp) <
sqr(snapDist[pointi]) &&
mag(fSNormal) > vSmall)
860 const point pt = fc + fDisp;
863 faceToNormalBin[i] = findNormal
870 if (faceToNormalBin[i] != -1)
878 if (surfacePoints.size() <= 1)
880 surfacePoints.append(pt);
881 faceToNormalBin[i] = surfaceNormals.size();
882 surfaceNormals.append(fSNormal);
884 else if (surfacePoints.size() == 2)
886 plane pl0(surfacePoints[0], surfaceNormals[0]);
887 plane pl1(surfacePoints[1], surfaceNormals[1]);
888 plane::ray r(pl0.planeIntersect(pl1));
889 vector featureNormal = r.dir() /
mag(r.dir());
891 if (
mag(fSNormal&featureNormal) >= 0.001)
894 surfacePoints.append(pt);
895 faceToNormalBin[i] = surfaceNormals.size();
896 surfaceNormals.append(fSNormal);
899 else if (surfacePoints.size() == 3)
903 plane pl0(surfacePoints[0], surfaceNormals[0]);
904 plane pl1(surfacePoints[1], surfaceNormals[1]);
905 plane pl2(surfacePoints[2], surfaceNormals[2]);
906 point p012(pl0.planePlaneIntersect(pl1, pl2));
908 plane::ray r(pl0.planeIntersect(pl1));
909 vector featureNormal = r.dir() /
mag(r.dir());
910 if (
mag(fSNormal&featureNormal) >= 0.001)
912 plane pl3(pt, fSNormal);
913 point p013(pl0.planePlaneIntersect(pl1, pl3));
915 if (
mag(p012-p013) > snapDist[pointi])
918 surfacePoints.append(pt);
919 faceToNormalBin[i] = surfaceNormals.size();
920 surfaceNormals.append(fSNormal);
929 const point& pt = pp.localPoints()[pointi];
932 if (surfaceNormals.size() == 1)
936 ((surfacePoints[0]-pt) & surfaceNormals[0])
948 patchConstraint.applyConstraint(surfaceNormals[0]);
950 else if (surfaceNormals.size() == 2)
952 plane pl0(surfacePoints[0], surfaceNormals[0]);
953 plane pl1(surfacePoints[1], surfaceNormals[1]);
954 plane::ray r(pl0.planeIntersect(pl1));
958 vector d = r.refPoint()-pt;
970 patchConstraint.applyConstraint(surfaceNormals[0]);
971 patchConstraint.applyConstraint(surfaceNormals[1]);
973 else if (surfaceNormals.size() == 3)
976 plane pl0(surfacePoints[0], surfaceNormals[0]);
977 plane pl1(surfacePoints[1], surfaceNormals[1]);
978 plane pl2(surfacePoints[2], surfaceNormals[2]);
979 point cornerPt(pl0.planePlaneIntersect(pl1, pl2));
991 patchConstraint.applyConstraint(surfaceNormals[0]);
992 patchConstraint.applyConstraint(surfaceNormals[1]);
993 patchConstraint.applyConstraint(surfaceNormals[2]);
998 void Foam::snappySnapDriver::featureAttractionUsingReconstruction
1001 const bool avoidSnapProblems,
1002 const scalar featureCos,
1008 const List<List<point>>& pointFaceSurfNormals,
1009 const List<List<point>>& pointFaceDisp,
1010 const List<List<point>>& pointFaceCentres,
1014 List<pointConstraint>& patchConstraints
1017 autoPtr<OBJstream> feStr;
1018 autoPtr<OBJstream> fpStr;
1025 meshRefiner_.mesh().time().path()
1026 /
"implicitFeatureEdge_" +
name(iter) +
".obj"
1029 Info<<
"Dumping implicit feature-edge direction to "
1030 << feStr().name() <<
endl;
1036 meshRefiner_.mesh().time().path()
1037 /
"implicitFeaturePoint_" +
name(iter) +
".obj"
1040 Info<<
"Dumping implicit feature-point direction to "
1041 << fpStr().name() <<
endl;
1045 DynamicList<point> surfacePoints(4);
1046 DynamicList<vector> surfaceNormals(4);
1049 forAll(pp.localPoints(), pointi)
1052 pointConstraint constraint;
1054 featureAttractionUsingReconstruction
1065 pointFaceSurfNormals,
1080 (constraint.first() > patchConstraints[pointi].first())
1082 (constraint.first() == patchConstraints[pointi].first())
1083 && (
magSqr(attraction) <
magSqr(patchAttraction[pointi]))
1087 patchAttraction[pointi] = attraction;
1088 patchConstraints[pointi] = constraint;
1090 const point& pt = pp.localPoints()[pointi];
1092 if (patchConstraints[pointi].
first() == 2 && feStr.valid())
1094 feStr().write(
linePointRef(pt, pt+patchAttraction[pointi]));
1096 else if (patchConstraints[pointi].
first() == 3 && fpStr.valid())
1098 fpStr().write(
linePointRef(pt, pt+patchAttraction[pointi]));
1105 void Foam::snappySnapDriver::stringFeatureEdges
1108 const scalar featureCos,
1114 const List<pointConstraint>& rawPatchConstraints,
1117 List<pointConstraint>& patchConstraints
1147 forAll(pointEdges, pointi)
1149 if (patchConstraints[pointi].
first() == 2)
1151 const point& pt = pp.localPoints()[pointi];
1152 const labelList& pEdges = pointEdges[pointi];
1153 const vector& featVec = patchConstraints[pointi].second();
1157 bool hasPos =
false;
1158 bool hasNeg =
false;
1162 const edge&
e = pp.edges()[pEdges[pEdgei]];
1163 label nbrPointi =
e.otherVertex(pointi);
1165 if (patchConstraints[nbrPointi].
first() > 1)
1167 const point& nbrPt = pp.localPoints()[nbrPointi];
1168 const point featPt =
1169 nbrPt + patchAttraction[nbrPointi];
1170 const scalar cosAngle = (featVec & (featPt-pt));
1183 if (!hasPos || !hasNeg)
1189 label bestPosPointi = -1;
1190 scalar minPosDistSqr = great;
1191 label bestNegPointi = -1;
1192 scalar minNegDistSqr = great;
1196 const edge&
e = pp.edges()[pEdges[pEdgei]];
1197 label nbrPointi =
e.otherVertex(pointi);
1201 patchConstraints[nbrPointi].
first() <= 1
1202 && rawPatchConstraints[nbrPointi].
first() > 1
1205 const vector& nbrFeatVec =
1206 rawPatchConstraints[pointi].second();
1208 if (
mag(featVec&nbrFeatVec) > featureCos)
1215 rawPatchAttraction[nbrPointi]
1218 const point featPt =
1219 pp.localPoints()[nbrPointi]
1220 + rawPatchAttraction[nbrPointi];
1221 const scalar cosAngle =
1222 (featVec & (featPt-pt));
1226 if (!hasPos && d2 < minPosDistSqr)
1229 bestPosPointi = nbrPointi;
1234 if (!hasNeg && d2 < minNegDistSqr)
1237 bestNegPointi = nbrPointi;
1244 if (bestPosPointi != -1)
1254 patchAttraction[bestPosPointi] =
1255 0.5*rawPatchAttraction[bestPosPointi];
1256 patchConstraints[bestPosPointi] =
1257 rawPatchConstraints[bestPosPointi];
1261 if (bestNegPointi != -1)
1271 patchAttraction[bestNegPointi] =
1272 0.5*rawPatchAttraction[bestNegPointi];
1273 patchConstraints[bestNegPointi] =
1274 rawPatchConstraints[bestNegPointi];
1283 reduce(nChanged, sumOp<label>());
1284 Info<<
"Stringing feature edges : changed " << nChanged <<
" points"
1294 void Foam::snappySnapDriver::releasePointsNextToMultiPatch
1297 const scalar featureCos,
1302 const List<List<point>>& pointFaceCentres,
1306 const List<pointConstraint>& rawPatchConstraints,
1309 List<pointConstraint>& patchConstraints
1312 autoPtr<OBJstream> multiPatchStr;
1319 meshRefiner_.mesh().time().path()
1320 /
"multiPatch_" +
name(iter) +
".obj"
1323 Info<<
"Dumping removed constraints due to same-face"
1324 <<
" multi-patch points to "
1325 << multiPatchStr().name() <<
endl;
1330 PackedBoolList isMultiPatchPoint(pp.size());
1332 forAll(pointFacePatchID, pointi)
1336 pp.localPoints()[pointi],
1337 pointFacePatchID[pointi],
1338 pointFaceCentres[pointi]
1340 isMultiPatchPoint[pointi] = multiPatchPt.hit();
1344 forAll(isMultiPatchPoint, pointi)
1346 if (isMultiPatchPoint[pointi])
1350 patchConstraints[pointi].
first() <= 1
1351 && rawPatchConstraints[pointi].
first() > 1
1354 patchAttraction[pointi] = rawPatchAttraction[pointi];
1355 patchConstraints[pointi] = rawPatchConstraints[pointi];
1374 forAll(pp.localFaces(), facei)
1376 const face&
f = pp.localFaces()[facei];
1378 label nMultiPatchPoints = 0;
1384 isMultiPatchPoint[pointi]
1385 && patchConstraints[pointi].
first() > 1
1388 nMultiPatchPoints++;
1392 if (nMultiPatchPoints > 0)
1399 !isMultiPatchPoint[pointi]
1400 && patchConstraints[pointi].
first() > 1
1406 patchAttraction[pointi] =
Zero;
1407 patchConstraints[pointi] = pointConstraint();
1410 if (multiPatchStr.valid())
1412 multiPatchStr().write(pp.localPoints()[pointi]);
1419 reduce(nChanged, sumOp<label>());
1420 Info<<
"Removing constraints near multi-patch points : changed "
1421 << nChanged <<
" points" <<
endl;
1429 const List<pointConstraint>& patchConstraints,
1433 const face&
f = pp.localFaces()[facei];
1445 if (patchConstraints[pointi].
first() >= 2)
1448 if (attractIndices[0] == -1)
1451 attractIndices[0] = fp;
1453 else if (attractIndices[1] == -1)
1457 label fp0 = attractIndices[0];
1466 attractIndices[1] = fp;
1479 if (attractIndices[1] == -1)
1485 return attractIndices;
1489 void Foam::snappySnapDriver::avoidDiagonalAttraction
1492 const scalar featureCos,
1497 List<pointConstraint>& patchConstraints
1500 forAll(pp.localFaces(), facei)
1502 const face&
f = pp.localFaces()[facei];
1512 if (
diag[0] != -1 &&
diag[1] != -1)
1518 pp.localPoints()[i0]+patchAttraction[i0];
1521 pp.localPoints()[i1]+patchAttraction[i1];
1522 const point mid = 0.5*(pt0+pt1);
1524 const scalar cosAngle =
mag
1526 patchConstraints[i0].
second()
1527 & patchConstraints[i1].
second()
1536 if (cosAngle > featureCos)
1541 scalar minDistSqr = great;
1545 if (patchConstraints[pointi].
first() <= 1)
1547 const point& pt = pp.localPoints()[pointi];
1548 scalar distSqr =
magSqr(mid-pt);
1549 if (distSqr < minDistSqr)
1551 distSqr = minDistSqr;
1558 label minPointi =
f[minFp];
1559 patchAttraction[minPointi] =
1560 mid-pp.localPoints()[minPointi];
1561 patchConstraints[minPointi] =
1562 patchConstraints[
f[
diag[0]]];
1588 Foam::snappySnapDriver::findNearFeatureEdge
1590 const bool isRegionEdge,
1595 const point& estimatedPt,
1597 List<List<DynamicList<point>>>& edgeAttractors,
1598 List<List<DynamicList<pointConstraint>>>& edgeConstraints,
1600 List<pointConstraint>& patchConstraints
1603 const refinementFeatures& features = meshRefiner_.features();
1606 List<pointIndexHit> nearEdgeInfo;
1611 features.findNearestRegionEdge
1622 features.findNearestEdge
1633 label feati = nearEdgeFeat[0];
1639 edgeAttractors[feati][
nearInfo.index()].append
1643 pointConstraint
c(Tuple2<label, vector>(2, nearNormal[0]));
1644 edgeConstraints[feati][
nearInfo.index()].append(
c);
1647 patchAttraction[pointi] =
1648 nearInfo.hitPoint()-pp.localPoints()[pointi];
1649 patchConstraints[pointi] =
c;
1651 return Tuple2<label, pointIndexHit>(feati,
nearInfo);
1656 Foam::snappySnapDriver::findNearFeaturePoint
1658 const bool isRegionPoint,
1663 const point& estimatedPt,
1666 List<labelList>& pointAttractor,
1667 List<List<pointConstraint>>& pointConstraints,
1669 List<List<DynamicList<point>>>& edgeAttractors,
1670 List<List<DynamicList<pointConstraint>>>& edgeConstraints,
1673 List<pointConstraint>& patchConstraints
1676 const refinementFeatures& features = meshRefiner_.features();
1680 features.findNearestPoint
1688 label feati = nearFeat[0];
1692 const point& pt = pp.localPoints()[pointi];
1696 scalar distSqr =
magSqr(featPt-pt);
1699 label oldPointi = pointAttractor[feati][featPointi];
1701 if (oldPointi != -1)
1704 if (distSqr >=
magSqr(featPt-pp.localPoints()[oldPointi]))
1713 pointAttractor[feati][featPointi] = pointi;
1714 pointConstraints[feati][featPointi].first() = 3;
1715 pointConstraints[feati][featPointi].second() =
Zero;
1718 patchAttraction[pointi] = featPt-pt;
1719 patchConstraints[pointi] =
1720 pointConstraints[feati][featPointi];
1723 patchAttraction[oldPointi] =
Zero;
1724 patchConstraints[oldPointi] = pointConstraint();
1733 pp.localPoints()[oldPointi],
1745 pointAttractor[feati][featPointi] = pointi;
1746 pointConstraints[feati][featPointi].first() = 3;
1747 pointConstraints[feati][featPointi].second() =
Zero;
1750 patchAttraction[pointi] = featPt-pt;
1751 patchConstraints[pointi] = pointConstraints[feati][featPointi];
1755 return Tuple2<label, pointIndexHit>(feati,
nearInfo[0]);
1759 void Foam::snappySnapDriver::determineFeatures
1762 const scalar featureCos,
1763 const bool multiRegionFeatureSnap,
1769 const List<List<point>>& pointFaceSurfNormals,
1770 const List<List<point>>& pointFaceDisp,
1771 const List<List<point>>& pointFaceCentres,
1775 List<labelList>& pointAttractor,
1776 List<List<pointConstraint>>& pointConstraints,
1778 List<List<DynamicList<point>>>& edgeAttractors,
1779 List<List<DynamicList<pointConstraint>>>& edgeConstraints,
1782 List<pointConstraint>& patchConstraints
1785 autoPtr<OBJstream> featureEdgeStr;
1786 autoPtr<OBJstream> missedEdgeStr;
1787 autoPtr<OBJstream> featurePointStr;
1791 featureEdgeStr.reset
1795 meshRefiner_.mesh().time().path()
1796 /
"featureEdge_" +
name(iter) +
".obj"
1799 Info<<
"Dumping feature-edge sampling to "
1800 << featureEdgeStr().name() <<
endl;
1806 meshRefiner_.mesh().time().path()
1807 /
"missedFeatureEdge_" +
name(iter) +
".obj"
1810 Info<<
"Dumping feature-edges that are too far away to "
1811 << missedEdgeStr().name() <<
endl;
1813 featurePointStr.reset
1817 meshRefiner_.mesh().time().path()
1818 /
"featurePoint_" +
name(iter) +
".obj"
1821 Info<<
"Dumping feature-point sampling to "
1822 << featurePointStr().name() <<
endl;
1826 DynamicList<point> surfacePoints(4);
1827 DynamicList<vector> surfaceNormals(4);
1830 forAll(pp.localPoints(), pointi)
1832 const point& pt = pp.localPoints()[pointi];
1835 pointConstraint constraint;
1837 featureAttractionUsingReconstruction
1848 pointFaceSurfNormals,
1864 (constraint.first() > patchConstraints[pointi].first())
1866 (constraint.first() == patchConstraints[pointi].first())
1867 && (
magSqr(attraction) <
magSqr(patchAttraction[pointi]))
1871 patchAttraction[pointi] = attraction;
1872 patchConstraints[pointi] = constraint;
1875 if (patchConstraints[pointi].
first() == 1)
1878 if (multiRegionFeatureSnap)
1880 const point estimatedPt(pt + nearestDisp[pointi]);
1886 pointFacePatchID[pointi],
1892 if (multiPatchPt.hit())
1897 Tuple2<label, pointIndexHit>
nearInfo =
1904 multiPatchPt.hitPoint(),
1917 if (featureEdgeStr.valid())
1919 featureEdgeStr().write
1927 if (missedEdgeStr.valid())
1929 missedEdgeStr().write
1938 else if (patchConstraints[pointi].
first() == 2)
1943 const point estimatedPt(pt + patchAttraction[pointi]);
1948 bool hasSnapped =
false;
1949 if (multiRegionFeatureSnap)
1956 pointFacePatchID[pointi],
1961 if (multiPatchPt.hit())
1963 if (multiPatchPt.index() == 0)
2038 patchConstraints[pointi].
first() == 3
2039 && featurePointStr.valid()
2042 featurePointStr().write
2049 patchConstraints[pointi].
first() == 2
2050 && featureEdgeStr.valid()
2053 featureEdgeStr().write
2061 if (missedEdgeStr.valid())
2063 missedEdgeStr().write
2070 else if (patchConstraints[pointi].
first() == 3)
2073 const point estimatedPt(pt + patchAttraction[pointi]);
2077 if (multiRegionFeatureSnap)
2084 pointFacePatchID[pointi],
2089 if (multiPatchPt.hit())
2157 if (info.hit() && featurePointStr.valid())
2159 featurePointStr().write
2170 void Foam::snappySnapDriver::determineBaffleFeatures
2173 const scalar featureCos,
2179 List<labelList>& pointAttractor,
2180 List<List<pointConstraint>>& pointConstraints,
2182 List<List<DynamicList<point>>>& edgeAttractors,
2183 List<List<DynamicList<pointConstraint>>>& edgeConstraints,
2186 List<pointConstraint>& patchConstraints
2199 const fvMesh& mesh = meshRefiner_.mesh();
2200 const refinementFeatures& features = meshRefiner_.features();
2203 List<List<point>> edgeFaceNormals(pp.nEdges());
2206 forAll(pp.edgeFaces(), edgei)
2208 const labelList& eFaces = pp.edgeFaces()[edgei];
2209 List<point>& eFc = edgeFaceNormals[edgei];
2213 label facei = eFaces[i];
2214 eFc[i] = pp.faceNormals()[facei];
2222 pp.meshEdges(mesh.edges(), mesh.pointEdges())
2229 listPlusEqOp<point>(),
2241 autoPtr<OBJstream> baffleEdgeStr;
2248 meshRefiner_.mesh().time().path()
2249 /
"baffleEdge_" +
name(iter) +
".obj"
2252 Info<<
nl <<
"Dumping baffle-edges to "
2253 << baffleEdgeStr().name() <<
endl;
2258 PackedBoolList isBaffleEdge(pp.nEdges());
2259 label nBaffleEdges = 0;
2264 labelList pointStatus(pp.nPoints(), -1);
2266 forAll(edgeFaceNormals, edgei)
2268 const List<point>& efn = edgeFaceNormals[edgei];
2270 if (efn.size() == 2 && (efn[0]&efn[1]) < baffleFeatureCos)
2272 isBaffleEdge[edgei] =
true;
2274 const edge&
e = pp.edges()[edgei];
2275 pointStatus[
e[0]] = 0;
2276 pointStatus[
e[1]] = 0;
2278 if (baffleEdgeStr.valid())
2280 const point& p0 = pp.localPoints()[
e[0]];
2281 const point& p1 = pp.localPoints()[
e[1]];
2289 <<
" baffle edges out of "
2291 <<
" edges." <<
endl;
2294 forAll(pp.pointEdges(), pointi)
2315 forAll(pointStatus, pointi)
2317 const point& pt = pp.localPoints()[pointi];
2319 if (pointStatus[pointi] == 0)
2321 Tuple2<label, pointIndexHit>
nearInfo = findNearFeatureEdge
2341 else if (pointStatus[pointi] == 1)
2345 features.findNearestPoint
2353 label feati = nearFeat[0];
2359 scalar distSqr =
magSqr(featPt-pt);
2362 label oldPointi = pointAttractor[feati][featPointi];
2369 <
magSqr(featPt-pp.localPoints()[oldPointi])
2373 pointAttractor[feati][featPointi] = pointi;
2374 pointConstraints[feati][featPointi].first() = 3;
2375 pointConstraints[feati][featPointi].second() =
2379 patchAttraction[pointi] = featPt-pt;
2380 patchConstraints[pointi] =
2381 pointConstraints[feati][featPointi];
2383 if (oldPointi != -1)
2394 pp.localPoints()[oldPointi],
2438 void Foam::snappySnapDriver::reverseAttractMeshPoints
2446 const List<labelList>& pointAttractor,
2447 const List<List<pointConstraint>>& pointConstraints,
2449 const List<List<DynamicList<point>>>& edgeAttractors,
2450 const List<List<DynamicList<pointConstraint>>>& edgeConstraints,
2453 const List<pointConstraint>& rawPatchConstraints,
2457 List<pointConstraint>& patchConstraints
2460 const refinementFeatures& features = meshRefiner_.features();
2468 treeBoundBox bb(pp.localPoints());
2469 bb = bb.extend(1
e-4);
2472 DynamicList<label> attractPoints(pp.nPoints());
2474 const fvMesh& mesh = meshRefiner_.mesh();
2476 boolList isFeatureEdgeOrPoint(pp.nPoints(),
false);
2478 forAll(rawPatchConstraints, pointi)
2480 if (rawPatchConstraints[pointi].
first() >= 2)
2482 isFeatureEdgeOrPoint[pointi] =
true;
2488 <<
" points out of " <<
returnReduce(pp.nPoints(), sumOp<label>())
2489 <<
" for reverse attraction." <<
endl;
2497 isFeatureEdgeOrPoint,
2502 for (
label nGrow = 0; nGrow < 1; nGrow++)
2504 boolList newIsFeatureEdgeOrPoint(isFeatureEdgeOrPoint);
2506 forAll(pp.localFaces(), facei)
2508 const face&
f = pp.localFaces()[facei];
2512 if (isFeatureEdgeOrPoint[
f[fp]])
2517 newIsFeatureEdgeOrPoint[
f[fp]] =
true;
2524 isFeatureEdgeOrPoint = newIsFeatureEdgeOrPoint;
2530 isFeatureEdgeOrPoint,
2538 forAll(isFeatureEdgeOrPoint, pointi)
2540 if (isFeatureEdgeOrPoint[pointi])
2542 attractPoints.append(pointi);
2548 <<
" points out of " <<
returnReduce(pp.nPoints(), sumOp<label>())
2549 <<
" for reverse attraction." <<
endl;
2553 indexedOctree<treeDataPoint> ppTree
2555 treeDataPoint(pp.localPoints(), attractPoints),
2563 patchAttraction.setSize(pp.nPoints());
2564 patchAttraction =
Zero;
2565 patchConstraints.setSize(pp.nPoints());
2566 patchConstraints = pointConstraint();
2568 forAll(edgeAttractors, feati)
2570 const List<DynamicList<point>>& edgeAttr = edgeAttractors[feati];
2571 const List<DynamicList<pointConstraint>>& edgeConstr =
2572 edgeConstraints[feati];
2574 forAll(edgeAttr, featEdgei)
2576 const DynamicList<point>& attr = edgeAttr[featEdgei];
2580 const point& featPt = attr[i];
2590 ppTree.shapes().pointLabels()[
nearInfo.index()];
2591 const point attraction = featPt-pp.localPoints()[pointi];
2597 patchConstraints[pointi].
first() <= 1
2598 ||
magSqr(attraction) <
magSqr(patchAttraction[pointi])
2601 patchAttraction[pointi] = attraction;
2602 patchConstraints[pointi] = edgeConstr[featEdgei][i];
2608 <<
"Did not find pp point near " << featPt
2625 forAll(pointAttractor, feati)
2627 const labelList& pointAttr = pointAttractor[feati];
2628 const List<pointConstraint>& pointConstr = pointConstraints[feati];
2630 forAll(pointAttr, featPointi)
2632 if (pointAttr[featPointi] != -1)
2634 const point& featPt = features[feati].points()
2649 ppTree.shapes().pointLabels()[
nearInfo.index()];
2651 const point& pt = pp.localPoints()[pointi];
2652 const point attraction = featPt-pt;
2657 if (patchConstraints[pointi].
first() <= 1)
2659 patchAttraction[pointi] = attraction;
2660 patchConstraints[pointi] = pointConstr[featPointi];
2662 else if (patchConstraints[pointi].
first() == 2)
2664 patchAttraction[pointi] = attraction;
2665 patchConstraints[pointi] = pointConstr[featPointi];
2667 else if (patchConstraints[pointi].
first() == 3)
2673 <
magSqr(patchAttraction[pointi])
2676 patchAttraction[pointi] = attraction;
2677 patchConstraints[pointi] =
2678 pointConstr[featPointi];
2688 void Foam::snappySnapDriver::featureAttractionUsingFeatureEdges
2691 const bool avoidSnapProblems,
2692 const scalar featureCos,
2693 const bool multiRegionFeatureSnap,
2699 const List<List<point>>& pointFaceSurfNormals,
2700 const List<List<point>>& pointFaceDisp,
2701 const List<List<point>>& pointFaceCentres,
2705 List<pointConstraint>& patchConstraints
2708 const refinementFeatures& features = meshRefiner_.features();
2715 List<List<DynamicList<point>>> edgeAttractors(features.size());
2716 List<List<DynamicList<pointConstraint>>> edgeConstraints
2722 label nFeatEdges = features[feati].edges().size();
2723 edgeAttractors[feati].setSize(nFeatEdges);
2724 edgeConstraints[feati].setSize(nFeatEdges);
2730 List<labelList> pointAttractor(features.size());
2731 List<List<pointConstraint>> pointConstraints(features.size());
2734 label nFeatPoints = features[feati].points().size();
2735 pointAttractor[feati].setSize(nFeatPoints, -1);
2736 pointConstraints[feati].setSize(nFeatPoints);
2741 List<pointConstraint> rawPatchConstraints(pp.nPoints());
2747 multiRegionFeatureSnap,
2753 pointFaceSurfNormals,
2782 determineBaffleFeatures
2807 reverseAttractMeshPoints
2823 rawPatchConstraints,
2834 OBJstream featureEdgeStr
2836 meshRefiner_.mesh().time().path()
2837 /
"edgeAttractors_" +
name(iter) +
".obj"
2839 Info<<
"Dumping feature-edge attraction to "
2840 << featureEdgeStr.name() <<
endl;
2842 OBJstream featurePointStr
2844 meshRefiner_.mesh().time().path()
2845 /
"pointAttractors_" +
name(iter) +
".obj"
2847 Info<<
"Dumping feature-point attraction to "
2848 << featurePointStr.name() <<
endl;
2850 forAll(patchConstraints, pointi)
2852 const point& pt = pp.localPoints()[pointi];
2853 const vector& attr = patchAttraction[pointi];
2855 if (patchConstraints[pointi].
first() == 2)
2859 else if (patchConstraints[pointi].
first() == 3)
2867 if (avoidSnapProblems)
2872 if (multiRegionFeatureSnap)
2874 releasePointsNextToMultiPatch
2886 rawPatchConstraints,
2908 rawPatchConstraints,
2919 avoidDiagonalAttraction
2933 meshRefiner_.mesh().time().path()
2934 /
"patchAttraction_" +
name(iter) +
".obj",
2936 pp.localPoints() + patchAttraction
2942 void Foam::snappySnapDriver::preventFaceSqueeze
2945 const scalar featureCos,
2951 List<pointConstraint>& patchConstraints
2956 forAll(pp.localFaces(), facei)
2958 const face&
f = pp.localFaces()[facei];
2963 singleF.setSize(
f.
size());
2969 label nConstraints = 0;
2973 const point& pt = pp.localPoints()[pointi];
2975 if (patchConstraints[pointi].
first() > 1)
2977 points[fp] = pt + patchAttraction[pointi];
2986 if (nConstraints ==
f.
size())
2988 scalar oldArea =
f.mag(pp.localPoints());
2989 scalar newArea = singleF.mag(
points);
2990 if (newArea < 0.1*oldArea)
2997 scalar
s =
magSqr(patchAttraction[
f[fp]]);
3008 patchAttraction[pointi] *= 0.5;
3018 const snapParameters& snapParams,
3019 const bool avoidSnapProblems,
3021 const scalar featureCos,
3022 const scalar featureAttract,
3025 motionSmoother& meshMover,
3027 List<pointConstraint>& patchConstraints
3030 const Switch implicitFeatureAttraction = snapParams.implicitFeatureSnap();
3031 const Switch explicitFeatureAttraction = snapParams.explicitFeatureSnap();
3032 const Switch multiRegionFeatureSnap = snapParams.multiRegionFeatureSnap();
3034 Info<<
"Overriding displacement on features :" <<
nl
3035 <<
" implicit features : " << implicitFeatureAttraction <<
nl
3036 <<
" explicit features : " << explicitFeatureAttraction <<
nl
3037 <<
" multi-patch features : " << multiRegionFeatureSnap <<
nl
3042 const pointField& localPoints = pp.localPoints();
3043 const fvMesh& mesh = meshRefiner_.mesh();
3051 List<List<point>> pointFaceSurfNormals;
3052 List<List<point>> pointFaceDisp;
3053 List<List<point>> pointFaceCentres;
3054 List<labelList> pointFacePatchID;
3060 forAll(pp.localFaces(), facei)
3062 const face&
f = pp.localFaces()[facei];
3065 faceSnapDist[facei] =
max(faceSnapDist[facei], snapDist[
f[fp]]);
3077 labelList faceSurfaceGlobalRegion(pp.size(), -1);
3087 faceSurfaceGlobalRegion,
3097 calcNearestFacePointProperties
3104 faceSurfaceGlobalRegion,
3106 pointFaceSurfNormals,
3125 patchAttraction.
setSize(localPoints.size());
3126 patchAttraction =
Zero;
3128 patchConstraints.setSize(localPoints.size());
3129 patchConstraints = pointConstraint();
3131 if (implicitFeatureAttraction)
3136 featureAttractionUsingReconstruction
3146 pointFaceSurfNormals,
3156 if (explicitFeatureAttraction)
3164 featureAttractionUsingFeatureEdges
3169 multiRegionFeatureSnap,
3175 pointFaceSurfNormals,
3198 const PackedBoolList isPatchMasterPoint
3220 <<
" avg:" << avgPatchDisp <<
endl
3221 <<
" feature : max:" <<
gMaxMagSqr(patchAttraction)
3222 <<
" avg:" << avgPatchAttr <<
endl;
3236 forAll(patchConstraints, pointi)
3238 if (patchConstraints[pointi].
first() > 1)
3241 (1.0-featureAttract)*patchDisp[pointi]
3242 + featureAttract*patchAttraction[pointi];
3250 label nMasterPoints = 0;
3255 forAll(patchConstraints, pointi)
3257 if (isPatchMasterPoint[pointi])
3261 if (patchConstraints[pointi].
first() == 1)
3265 else if (patchConstraints[pointi].
first() == 2)
3269 else if (patchConstraints[pointi].
first() == 3)
3276 reduce(nMasterPoints, sumOp<label>());
3277 reduce(nPlanar, sumOp<label>());
3278 reduce(nEdge, sumOp<label>());
3279 reduce(nPoint, sumOp<label>());
3280 Info<<
"Feature analysis : total master points:"
3282 <<
" attraction to :" <<
nl
3283 <<
" feature point : " << nPoint <<
nl
3284 <<
" feature edge : " << nEdge <<
nl
3285 <<
" nearest surface : " << nPlanar <<
nl
3286 <<
" rest : " << nMasterPoints-nPoint-nEdge-nPlanar
3303 if (featureAttract < 1-0.001)
3308 pp.meshEdges(mesh.edges(), mesh.pointEdges())
3310 const PackedBoolList isPatchMasterEdge
3343 tangPatchDisp -= (pointNormals & patchDisp) * pointNormals;
3354 tangPatchDisp += (pointNormals & patchDisp) * pointNormals;
3361 /
"tangPatchDispConstrained_" +
name(iter) +
".obj",
3363 pp.localPoints() + tangPatchDisp
3368 (1.0-featureAttract)*smoothedPatchDisp
3369 + featureAttract*tangPatchDisp;
3373 const scalar
relax = featureAttract;
3384 minMagSqrEqOp<point>(),
3385 vector(great, great, great)
#define forAll(list, i)
Loop across all elements in list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
const Field< PointType > & faceCentres() const
Return face centres for patch.
A 2-tuple for storing two objects of different types.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
void operator()(List< T > &x, const List< T > &y) const
static T gAverage(const PackedBoolList &isMasterElem, const UList< T > &values)
Helper: calculate average.
static PackedBoolList getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
static PackedBoolList getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
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)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
Tuple2< scalar, label > nearInfo
Private class for finding nearest.
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.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
Ostream & endl(Ostream &os)
Add newline and flush stream.
line< point, const point & > linePointRef
Line using referred points.
labelList second(const UList< labelPair > &p)
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.
labelList first(const UList< labelPair > &p)
Type gMaxMagSqr(const UList< Type > &f, const label comm)
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)
dimensionedScalar sqrt(const dimensionedScalar &ds)
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
List< labelList > labelListList
A List of labelList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensionSet transform(const dimensionSet &)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static const label labelMax
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
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]
Unit conversion functions.