53 x.setSize(sz+
y.size());
65 bool Foam::snappySnapDriver::isFeaturePoint
67 const scalar featureCos,
69 const PackedBoolList& isFeatureEdge,
75 const labelList& pEdges = pp.pointEdges()[pointi];
81 if (isFeatureEdge[pEdges[i]])
85 for (
label j = i+1; j < pEdges.size(); j++)
87 if (isFeatureEdge[pEdges[j]])
89 const edge& eI = edges[pEdges[i]];
90 const edge& eJ = edges[pEdges[j]];
97 scalar vIMag =
mag(vI);
100 scalar vJMag =
mag(vJ);
106 && ((vI/vIMag & vJ/vJMag) < featureCos)
126 void Foam::snappySnapDriver::smoothAndConstrain
128 const PackedBoolList& isPatchMasterEdge,
131 const List<pointConstraint>& constraints,
135 const fvMesh& mesh = meshRefiner_.mesh();
137 for (
label avgIter = 0; avgIter < 20; avgIter++)
158 forAll(pointEdges, pointi)
160 const labelList& pEdges = pointEdges[pointi];
162 label nConstraints = constraints[pointi].first();
164 if (nConstraints <= 1)
168 label edgei = pEdges[i];
170 if (isPatchMasterEdge[edgei])
172 label nbrPointi = edges[edgei].otherVertex(pointi);
173 if (constraints[nbrPointi].
first() >= nConstraints)
175 dispSum[pointi] += disp[nbrPointi];
203 forAll(constraints, pointi)
205 if (dispCount[pointi] > 0)
210 *(disp[pointi] + dispSum[pointi]/dispCount[pointi]);
217 void Foam::snappySnapDriver::calcNearestFace
228 const fvMesh& mesh = meshRefiner_.mesh();
229 const refinementSurfaces& surfaces = meshRefiner_.surfaces();
232 faceDisp.setSize(pp.size());
234 faceSurfaceNormal.setSize(pp.size());
235 faceSurfaceNormal =
Zero;
236 faceSurfaceGlobalRegion.setSize(pp.size());
237 faceSurfaceGlobalRegion = -1;
254 const PtrList<surfaceZonesInfo>& surfZones = surfaces.surfZones();
258 label zoneSurfI = zonedSurfaces[i];
260 const word& faceZoneName = surfZones[zoneSurfI].faceZoneName();
263 label zonei = mesh.faceZones().findIndex(faceZoneName);
267 <<
"Problem. Cannot find zone " << faceZoneName
270 const faceZone& fZone = mesh.faceZones()[zonei];
271 PackedBoolList isZonedFace(mesh.nFaces());
274 isZonedFace[fZone[i]] = 1;
277 DynamicList<label> ppFaces(fZone.size());
278 DynamicList<label> meshFaces(fZone.size());
279 forAll(pp.addressing(), i)
281 if (isZonedFace[pp.addressing()[i]])
283 snapSurf[i] = zoneSurfI;
285 meshFaces.append(pp.addressing()[i]);
297 IndirectList<face>(mesh.faces(), meshFaces),
302 List<pointIndexHit> hitinfo;
306 surfaces.findNearestRegion
319 if (hitinfo[hiti].hit())
321 label facei = ppFaces[hiti];
322 faceDisp[facei] = hitinfo[hiti].hitPoint() - fc[hiti];
323 faceSurfaceNormal[facei] = hitNormal[hiti];
324 faceSurfaceGlobalRegion[facei] = surfaces.globalRegion
333 <<
"Did not find surface near face centre " << fc[hiti]
344 DynamicList<label> ppFaces(pp.size());
345 DynamicList<label> meshFaces(pp.size());
346 forAll(pp.addressing(), i)
348 if (snapSurf[i] == -1)
351 meshFaces.append(pp.addressing()[i]);
361 IndirectList<face>(mesh.faces(), meshFaces),
366 List<pointIndexHit> hitinfo;
370 surfaces.findNearestRegion
383 if (hitinfo[hiti].hit())
385 label facei = ppFaces[hiti];
386 faceDisp[facei] = hitinfo[hiti].hitPoint() - fc[hiti];
387 faceSurfaceNormal[facei] = hitNormal[hiti];
388 faceSurfaceGlobalRegion[facei] = surfaces.globalRegion
397 <<
"Did not find surface near face centre " << fc[hiti]
407 faceRotation.setSize(pp.size());
410 forAll(faceRotation, facei)
413 faceRotation[facei] =
414 pp.faceNormals()[facei]
415 ^ faceSurfaceNormal[facei];
423 /
"faceDisp_" +
name(iter) +
".obj",
425 pp.faceCentres() + faceDisp
430 /
"faceRotation_" +
name(iter) +
".obj",
432 pp.faceCentres() + faceRotation
438 void Foam::snappySnapDriver::calcNearestFacePointProperties
445 const labelList& faceSurfaceGlobalRegion,
447 List<List<point>>& pointFaceSurfNormals,
448 List<List<point>>& pointFaceDisp,
449 List<List<point>>& pointFaceCentres,
450 List<labelList>& pointFacePatchID
453 const fvMesh& mesh = meshRefiner_.mesh();
462 pointFaceSurfNormals.setSize(pp.nPoints());
463 pointFaceDisp.setSize(pp.nPoints());
464 pointFaceCentres.setSize(pp.nPoints());
465 pointFacePatchID.setSize(pp.nPoints());
468 forAll(pp.pointFaces(), pointi)
477 if (isMasterFace[facei] && faceSurfaceGlobalRegion[facei] != -1)
484 List<point>& pNormals = pointFaceSurfNormals[pointi];
485 pNormals.setSize(nFaces);
486 List<point>& pDisp = pointFaceDisp[pointi];
487 pDisp.setSize(nFaces);
488 List<point>& pFc = pointFaceCentres[pointi];
490 labelList& pFid = pointFacePatchID[pointi];
497 label globalRegioni = faceSurfaceGlobalRegion[facei];
499 if (isMasterFace[facei] && globalRegioni != -1)
501 pNormals[nFaces] = faceSurfaceNormal[facei];
502 pDisp[nFaces] = faceDisp[facei];
503 pFc[nFaces] = pp.faceCentres()[facei];
504 pFid[nFaces] = globalToMasterPatch_[globalRegioni];
519 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
525 const polyPatch& pp = pbm[
patchi];
527 if (pp.coupled() || isA<emptyPolyPatch>(pp))
531 label meshFacei = pp.start()+i;
532 patchID[meshFacei-mesh.nInternalFaces()] = -1;
538 forAll(pp.addressing(), i)
540 label meshFacei = pp.addressing()[i];
541 patchID[meshFacei-mesh.nInternalFaces()] = -1;
546 const labelList& boundaryPoints = pp.boundaryPoints();
549 label pointi = boundaryPoints[i];
550 label meshPointi = pp.meshPoints()[pointi];
551 const point& pt = mesh.points()[meshPointi];
554 List<point>& pNormals = pointFaceSurfNormals[pointi];
555 List<point>& pDisp = pointFaceDisp[pointi];
556 List<point>& pFc = pointFaceCentres[pointi];
557 labelList& pFid = pointFacePatchID[pointi];
562 if (!mesh.isInternalFace(meshFacei))
564 label patchi = patchID[meshFacei-mesh.nInternalFaces()];
568 vector fn = mesh.faceAreas()[meshFacei];
569 pNormals.append(fn/
mag(fn));
570 pDisp.append(mesh.faceCentres()[meshFacei]-pt);
571 pFc.append(mesh.faceCentres()[meshFacei]);
583 pointFaceSurfNormals,
584 listPlusEqOp<point>(),
593 listPlusEqOp<point>(),
602 listPlusEqOp<point>(),
604 distributionMap::transformPosition()
611 listPlusEqOp<label>(),
619 forAll(pointFaceDisp, pointi)
621 List<point>& pNormals = pointFaceSurfNormals[pointi];
622 List<point>& pDisp = pointFaceDisp[pointi];
623 List<point>& pFc = pointFaceCentres[pointi];
624 labelList& pFid = pointFacePatchID[pointi];
628 pNormals = List<point>(pNormals, visitOrder);
629 pDisp = List<point>(pDisp, visitOrder);
630 pFc = List<point>(pFc, visitOrder);
631 pFid = UIndirectList<label>(pFid, visitOrder)();
636 void Foam::snappySnapDriver::correctAttraction
638 const DynamicList<point>& surfacePoints,
639 const DynamicList<label>& surfaceCounts,
648 scalar tang = ((pt-edgePt)&edgeNormal);
659 scalar tang2 = (attractD&edgeNormal);
661 attractD -= tang2*edgeNormal;
663 scalar magAttractD =
mag(attractD);
664 scalar fraction = magAttractD/(magAttractD+
mag(edgeOffset));
668 + ((1.0-fraction)*tang2 + fraction*tang)*edgeNormal;
669 edgeOffset = linePt-pt;
678 const List<point>& faceCentres
684 label patch0 = patchIDs[0];
686 for (
label i = 1; i < patchIDs.size(); i++)
688 if (patchIDs[i] != patch0)
700 const scalar featureCos,
702 const DynamicList<vector>& surfaceNormals
709 scalar cosAngle = (
n&surfaceNormals[j]);
713 (cosAngle >= featureCos)
714 || (cosAngle < (-1+0.001))
729 const DynamicList<vector>& surfaceNormals,
733 if (patchIDs.empty())
739 label patch0 = patchIDs[0];
741 for (
label i = 1; i < patchIDs.size(); i++)
743 if (patchIDs[i] != patch0)
757 if (surfaceNormals.size() == 1)
765 labelList normalToPatch(surfaceNormals.size(), -1);
766 forAll(faceToNormalBin, i)
768 if (faceToNormalBin[i] != -1)
770 label& patch = normalToPatch[faceToNormalBin[i]];
776 else if (patch == -2)
780 else if (patch != patchIDs[i])
788 forAll(normalToPatch, normali)
790 if (normalToPatch[normali] == -2)
805 void Foam::snappySnapDriver::featureAttractionUsingReconstruction
808 const scalar featureCos,
815 const List<List<point>>& pointFaceSurfNormals,
816 const List<List<point>>& pointFaceDisp,
817 const List<List<point>>& pointFaceCentres,
820 DynamicList<point>& surfacePoints,
821 DynamicList<vector>& surfaceNormals,
825 pointConstraint& patchConstraint
828 patchAttraction =
Zero;
829 patchConstraint = pointConstraint();
831 const List<point>& pfSurfNormals = pointFaceSurfNormals[pointi];
832 const List<point>& pfDisp = pointFaceDisp[pointi];
833 const List<point>& pfCentres = pointFaceCentres[pointi];
843 surfacePoints.clear();
844 surfaceNormals.clear();
847 faceToNormalBin.setSize(pfDisp.size());
848 faceToNormalBin = -1;
852 const point& fc = pfCentres[i];
853 const vector& fSNormal = pfSurfNormals[i];
854 const vector& fDisp = pfDisp[i];
857 if (
magSqr(fDisp) <
sqr(snapDist[pointi]) &&
mag(fSNormal) > vSmall)
859 const point pt = fc + fDisp;
862 faceToNormalBin[i] = findNormal
869 if (faceToNormalBin[i] != -1)
877 if (surfacePoints.size() <= 1)
879 surfacePoints.append(pt);
880 faceToNormalBin[i] = surfaceNormals.size();
881 surfaceNormals.append(fSNormal);
883 else if (surfacePoints.size() == 2)
885 plane pl0(surfacePoints[0], surfaceNormals[0]);
886 plane pl1(surfacePoints[1], surfaceNormals[1]);
887 plane::ray r(pl0.planeIntersect(pl1));
888 vector featureNormal = r.dir() /
mag(r.dir());
890 if (
mag(fSNormal&featureNormal) >= 0.001)
893 surfacePoints.append(pt);
894 faceToNormalBin[i] = surfaceNormals.size();
895 surfaceNormals.append(fSNormal);
898 else if (surfacePoints.size() == 3)
902 plane pl0(surfacePoints[0], surfaceNormals[0]);
903 plane pl1(surfacePoints[1], surfaceNormals[1]);
904 plane pl2(surfacePoints[2], surfaceNormals[2]);
905 point p012(pl0.planePlaneIntersect(pl1, pl2));
907 plane::ray r(pl0.planeIntersect(pl1));
908 vector featureNormal = r.dir() /
mag(r.dir());
909 if (
mag(fSNormal&featureNormal) >= 0.001)
911 plane pl3(pt, fSNormal);
912 point p013(pl0.planePlaneIntersect(pl1, pl3));
914 if (
mag(p012-p013) > snapDist[pointi])
917 surfacePoints.append(pt);
918 faceToNormalBin[i] = surfaceNormals.size();
919 surfaceNormals.append(fSNormal);
928 const point& pt = pp.localPoints()[pointi];
931 if (surfaceNormals.size() == 1)
935 ((surfacePoints[0]-pt) & surfaceNormals[0])
947 patchConstraint.applyConstraint(surfaceNormals[0]);
949 else if (surfaceNormals.size() == 2)
951 plane pl0(surfacePoints[0], surfaceNormals[0]);
952 plane pl1(surfacePoints[1], surfaceNormals[1]);
953 plane::ray r(pl0.planeIntersect(pl1));
957 vector d = r.refPoint()-pt;
969 patchConstraint.applyConstraint(surfaceNormals[0]);
970 patchConstraint.applyConstraint(surfaceNormals[1]);
972 else if (surfaceNormals.size() == 3)
975 plane pl0(surfacePoints[0], surfaceNormals[0]);
976 plane pl1(surfacePoints[1], surfaceNormals[1]);
977 plane pl2(surfacePoints[2], surfaceNormals[2]);
978 point cornerPt(pl0.planePlaneIntersect(pl1, pl2));
990 patchConstraint.applyConstraint(surfaceNormals[0]);
991 patchConstraint.applyConstraint(surfaceNormals[1]);
992 patchConstraint.applyConstraint(surfaceNormals[2]);
997 void Foam::snappySnapDriver::featureAttractionUsingReconstruction
1000 const bool avoidSnapProblems,
1001 const scalar featureCos,
1007 const List<List<point>>& pointFaceSurfNormals,
1008 const List<List<point>>& pointFaceDisp,
1009 const List<List<point>>& pointFaceCentres,
1013 List<pointConstraint>& patchConstraints
1016 autoPtr<OBJstream> feStr;
1017 autoPtr<OBJstream> fpStr;
1024 meshRefiner_.mesh().time().path()
1025 /
"implicitFeatureEdge_" +
name(iter) +
".obj"
1028 Info<<
"Dumping implicit feature-edge direction to "
1029 << feStr().name() <<
endl;
1035 meshRefiner_.mesh().time().path()
1036 /
"implicitFeaturePoint_" +
name(iter) +
".obj"
1039 Info<<
"Dumping implicit feature-point direction to "
1040 << fpStr().name() <<
endl;
1044 DynamicList<point> surfacePoints(4);
1045 DynamicList<vector> surfaceNormals(4);
1048 forAll(pp.localPoints(), pointi)
1051 pointConstraint constraint;
1053 featureAttractionUsingReconstruction
1064 pointFaceSurfNormals,
1079 (constraint.first() > patchConstraints[pointi].first())
1081 (constraint.first() == patchConstraints[pointi].first())
1082 && (
magSqr(attraction) <
magSqr(patchAttraction[pointi]))
1086 patchAttraction[pointi] = attraction;
1087 patchConstraints[pointi] = constraint;
1089 const point& pt = pp.localPoints()[pointi];
1091 if (patchConstraints[pointi].
first() == 2 && feStr.valid())
1093 feStr().write(
linePointRef(pt, pt+patchAttraction[pointi]));
1095 else if (patchConstraints[pointi].
first() == 3 && fpStr.valid())
1097 fpStr().write(
linePointRef(pt, pt+patchAttraction[pointi]));
1104 void Foam::snappySnapDriver::stringFeatureEdges
1107 const scalar featureCos,
1113 const List<pointConstraint>& rawPatchConstraints,
1116 List<pointConstraint>& patchConstraints
1146 forAll(pointEdges, pointi)
1148 if (patchConstraints[pointi].
first() == 2)
1150 const point& pt = pp.localPoints()[pointi];
1151 const labelList& pEdges = pointEdges[pointi];
1152 const vector& featVec = patchConstraints[pointi].second();
1156 bool hasPos =
false;
1157 bool hasNeg =
false;
1161 const edge&
e = pp.edges()[pEdges[pEdgei]];
1162 label nbrPointi =
e.otherVertex(pointi);
1164 if (patchConstraints[nbrPointi].
first() > 1)
1166 const point& nbrPt = pp.localPoints()[nbrPointi];
1167 const point featPt =
1168 nbrPt + patchAttraction[nbrPointi];
1169 const scalar cosAngle = (featVec & (featPt-pt));
1182 if (!hasPos || !hasNeg)
1188 label bestPosPointi = -1;
1189 scalar minPosDistSqr = great;
1190 label bestNegPointi = -1;
1191 scalar minNegDistSqr = great;
1195 const edge&
e = pp.edges()[pEdges[pEdgei]];
1196 label nbrPointi =
e.otherVertex(pointi);
1200 patchConstraints[nbrPointi].
first() <= 1
1201 && rawPatchConstraints[nbrPointi].
first() > 1
1204 const vector& nbrFeatVec =
1205 rawPatchConstraints[pointi].second();
1207 if (
mag(featVec&nbrFeatVec) > featureCos)
1214 rawPatchAttraction[nbrPointi]
1217 const point featPt =
1218 pp.localPoints()[nbrPointi]
1219 + rawPatchAttraction[nbrPointi];
1220 const scalar cosAngle =
1221 (featVec & (featPt-pt));
1225 if (!hasPos && d2 < minPosDistSqr)
1228 bestPosPointi = nbrPointi;
1233 if (!hasNeg && d2 < minNegDistSqr)
1236 bestNegPointi = nbrPointi;
1243 if (bestPosPointi != -1)
1253 patchAttraction[bestPosPointi] =
1254 0.5*rawPatchAttraction[bestPosPointi];
1255 patchConstraints[bestPosPointi] =
1256 rawPatchConstraints[bestPosPointi];
1260 if (bestNegPointi != -1)
1270 patchAttraction[bestNegPointi] =
1271 0.5*rawPatchAttraction[bestNegPointi];
1272 patchConstraints[bestNegPointi] =
1273 rawPatchConstraints[bestNegPointi];
1282 reduce(nChanged, sumOp<label>());
1283 Info<<
"Stringing feature edges : changed " << nChanged <<
" points"
1293 void Foam::snappySnapDriver::releasePointsNextToMultiPatch
1296 const scalar featureCos,
1301 const List<List<point>>& pointFaceCentres,
1305 const List<pointConstraint>& rawPatchConstraints,
1308 List<pointConstraint>& patchConstraints
1311 autoPtr<OBJstream> multiPatchStr;
1318 meshRefiner_.mesh().time().path()
1319 /
"multiPatch_" +
name(iter) +
".obj"
1322 Info<<
"Dumping removed constraints due to same-face"
1323 <<
" multi-patch points to "
1324 << multiPatchStr().name() <<
endl;
1329 PackedBoolList isMultiPatchPoint(pp.size());
1331 forAll(pointFacePatchID, pointi)
1335 pp.localPoints()[pointi],
1336 pointFacePatchID[pointi],
1337 pointFaceCentres[pointi]
1339 isMultiPatchPoint[pointi] = multiPatchPt.hit();
1343 forAll(isMultiPatchPoint, pointi)
1345 if (isMultiPatchPoint[pointi])
1349 patchConstraints[pointi].
first() <= 1
1350 && rawPatchConstraints[pointi].
first() > 1
1353 patchAttraction[pointi] = rawPatchAttraction[pointi];
1354 patchConstraints[pointi] = rawPatchConstraints[pointi];
1373 forAll(pp.localFaces(), facei)
1375 const face&
f = pp.localFaces()[facei];
1377 label nMultiPatchPoints = 0;
1383 isMultiPatchPoint[pointi]
1384 && patchConstraints[pointi].
first() > 1
1387 nMultiPatchPoints++;
1391 if (nMultiPatchPoints > 0)
1398 !isMultiPatchPoint[pointi]
1399 && patchConstraints[pointi].
first() > 1
1405 patchAttraction[pointi] =
Zero;
1406 patchConstraints[pointi] = pointConstraint();
1409 if (multiPatchStr.valid())
1411 multiPatchStr().write(pp.localPoints()[pointi]);
1418 reduce(nChanged, sumOp<label>());
1419 Info<<
"Removing constraints near multi-patch points : changed "
1420 << nChanged <<
" points" <<
endl;
1428 const List<pointConstraint>& patchConstraints,
1432 const face&
f = pp.localFaces()[facei];
1444 if (patchConstraints[pointi].
first() >= 2)
1447 if (attractIndices[0] == -1)
1450 attractIndices[0] = fp;
1452 else if (attractIndices[1] == -1)
1456 label fp0 = attractIndices[0];
1465 attractIndices[1] = fp;
1478 if (attractIndices[1] == -1)
1484 return attractIndices;
1488 void Foam::snappySnapDriver::avoidDiagonalAttraction
1491 const scalar featureCos,
1496 List<pointConstraint>& patchConstraints
1499 forAll(pp.localFaces(), facei)
1501 const face&
f = pp.localFaces()[facei];
1511 if (
diag[0] != -1 &&
diag[1] != -1)
1517 pp.localPoints()[i0]+patchAttraction[i0];
1520 pp.localPoints()[i1]+patchAttraction[i1];
1521 const point mid = 0.5*(pt0+pt1);
1523 const scalar cosAngle =
mag
1525 patchConstraints[i0].
second()
1526 & patchConstraints[i1].
second()
1535 if (cosAngle > featureCos)
1540 scalar minDistSqr = great;
1544 if (patchConstraints[pointi].
first() <= 1)
1546 const point& pt = pp.localPoints()[pointi];
1547 scalar distSqr =
magSqr(mid-pt);
1548 if (distSqr < minDistSqr)
1550 distSqr = minDistSqr;
1557 label minPointi =
f[minFp];
1558 patchAttraction[minPointi] =
1559 mid-pp.localPoints()[minPointi];
1560 patchConstraints[minPointi] =
1561 patchConstraints[
f[
diag[0]]];
1587 Foam::snappySnapDriver::findNearFeatureEdge
1589 const bool isRegionEdge,
1594 const point& estimatedPt,
1596 List<List<DynamicList<point>>>& edgeAttractors,
1597 List<List<DynamicList<pointConstraint>>>& edgeConstraints,
1599 List<pointConstraint>& patchConstraints
1602 const refinementFeatures& features = meshRefiner_.features();
1605 List<pointIndexHit> nearEdgeInfo;
1610 features.findNearestRegionEdge
1621 features.findNearestEdge
1632 label feati = nearEdgeFeat[0];
1638 edgeAttractors[feati][
nearInfo.index()].append
1642 pointConstraint
c(Tuple2<label, vector>(2, nearNormal[0]));
1643 edgeConstraints[feati][
nearInfo.index()].append(
c);
1646 patchAttraction[pointi] =
1647 nearInfo.hitPoint()-pp.localPoints()[pointi];
1648 patchConstraints[pointi] =
c;
1650 return Tuple2<label, pointIndexHit>(feati,
nearInfo);
1655 Foam::snappySnapDriver::findNearFeaturePoint
1657 const bool isRegionPoint,
1662 const point& estimatedPt,
1665 List<labelList>& pointAttractor,
1666 List<List<pointConstraint>>& pointConstraints,
1668 List<List<DynamicList<point>>>& edgeAttractors,
1669 List<List<DynamicList<pointConstraint>>>& edgeConstraints,
1672 List<pointConstraint>& patchConstraints
1675 const refinementFeatures& features = meshRefiner_.features();
1679 features.findNearestPoint
1687 label feati = nearFeat[0];
1691 const point& pt = pp.localPoints()[pointi];
1695 scalar distSqr =
magSqr(featPt-pt);
1698 label oldPointi = pointAttractor[feati][featPointi];
1700 if (oldPointi != -1)
1703 if (distSqr >=
magSqr(featPt-pp.localPoints()[oldPointi]))
1712 pointAttractor[feati][featPointi] = pointi;
1713 pointConstraints[feati][featPointi].first() = 3;
1714 pointConstraints[feati][featPointi].second() =
Zero;
1717 patchAttraction[pointi] = featPt-pt;
1718 patchConstraints[pointi] =
1719 pointConstraints[feati][featPointi];
1722 patchAttraction[oldPointi] =
Zero;
1723 patchConstraints[oldPointi] = pointConstraint();
1732 pp.localPoints()[oldPointi],
1744 pointAttractor[feati][featPointi] = pointi;
1745 pointConstraints[feati][featPointi].first() = 3;
1746 pointConstraints[feati][featPointi].second() =
Zero;
1749 patchAttraction[pointi] = featPt-pt;
1750 patchConstraints[pointi] = pointConstraints[feati][featPointi];
1754 return Tuple2<label, pointIndexHit>(feati,
nearInfo[0]);
1758 void Foam::snappySnapDriver::determineFeatures
1761 const scalar featureCos,
1762 const bool multiRegionFeatureSnap,
1768 const List<List<point>>& pointFaceSurfNormals,
1769 const List<List<point>>& pointFaceDisp,
1770 const List<List<point>>& pointFaceCentres,
1774 List<labelList>& pointAttractor,
1775 List<List<pointConstraint>>& pointConstraints,
1777 List<List<DynamicList<point>>>& edgeAttractors,
1778 List<List<DynamicList<pointConstraint>>>& edgeConstraints,
1781 List<pointConstraint>& patchConstraints
1784 autoPtr<OBJstream> featureEdgeStr;
1785 autoPtr<OBJstream> missedEdgeStr;
1786 autoPtr<OBJstream> featurePointStr;
1790 featureEdgeStr.reset
1794 meshRefiner_.mesh().time().path()
1795 /
"featureEdge_" +
name(iter) +
".obj"
1798 Info<<
"Dumping feature-edge sampling to "
1799 << featureEdgeStr().name() <<
endl;
1805 meshRefiner_.mesh().time().path()
1806 /
"missedFeatureEdge_" +
name(iter) +
".obj"
1809 Info<<
"Dumping feature-edges that are too far away to "
1810 << missedEdgeStr().name() <<
endl;
1812 featurePointStr.reset
1816 meshRefiner_.mesh().time().path()
1817 /
"featurePoint_" +
name(iter) +
".obj"
1820 Info<<
"Dumping feature-point sampling to "
1821 << featurePointStr().name() <<
endl;
1825 DynamicList<point> surfacePoints(4);
1826 DynamicList<vector> surfaceNormals(4);
1829 forAll(pp.localPoints(), pointi)
1831 const point& pt = pp.localPoints()[pointi];
1834 pointConstraint constraint;
1836 featureAttractionUsingReconstruction
1847 pointFaceSurfNormals,
1863 (constraint.first() > patchConstraints[pointi].first())
1865 (constraint.first() == patchConstraints[pointi].first())
1866 && (
magSqr(attraction) <
magSqr(patchAttraction[pointi]))
1870 patchAttraction[pointi] = attraction;
1871 patchConstraints[pointi] = constraint;
1874 if (patchConstraints[pointi].
first() == 1)
1877 if (multiRegionFeatureSnap)
1879 const point estimatedPt(pt + nearestDisp[pointi]);
1885 pointFacePatchID[pointi],
1891 if (multiPatchPt.hit())
1896 Tuple2<label, pointIndexHit>
nearInfo =
1903 multiPatchPt.hitPoint(),
1916 if (featureEdgeStr.valid())
1918 featureEdgeStr().write
1926 if (missedEdgeStr.valid())
1928 missedEdgeStr().write
1937 else if (patchConstraints[pointi].
first() == 2)
1942 const point estimatedPt(pt + patchAttraction[pointi]);
1947 bool hasSnapped =
false;
1948 if (multiRegionFeatureSnap)
1955 pointFacePatchID[pointi],
1960 if (multiPatchPt.hit())
1962 if (multiPatchPt.index() == 0)
2037 patchConstraints[pointi].
first() == 3
2038 && featurePointStr.valid()
2041 featurePointStr().write
2048 patchConstraints[pointi].
first() == 2
2049 && featureEdgeStr.valid()
2052 featureEdgeStr().write
2060 if (missedEdgeStr.valid())
2062 missedEdgeStr().write
2069 else if (patchConstraints[pointi].
first() == 3)
2072 const point estimatedPt(pt + patchAttraction[pointi]);
2076 if (multiRegionFeatureSnap)
2083 pointFacePatchID[pointi],
2088 if (multiPatchPt.hit())
2156 if (info.hit() && featurePointStr.valid())
2158 featurePointStr().write
2169 void Foam::snappySnapDriver::determineBaffleFeatures
2172 const scalar featureCos,
2178 List<labelList>& pointAttractor,
2179 List<List<pointConstraint>>& pointConstraints,
2181 List<List<DynamicList<point>>>& edgeAttractors,
2182 List<List<DynamicList<pointConstraint>>>& edgeConstraints,
2185 List<pointConstraint>& patchConstraints
2198 const fvMesh& mesh = meshRefiner_.mesh();
2199 const refinementFeatures& features = meshRefiner_.features();
2202 List<List<point>> edgeFaceNormals(pp.nEdges());
2205 forAll(pp.edgeFaces(), edgei)
2207 const labelList& eFaces = pp.edgeFaces()[edgei];
2208 List<point>& eFc = edgeFaceNormals[edgei];
2212 label facei = eFaces[i];
2213 eFc[i] = pp.faceNormals()[facei];
2221 pp.meshEdges(mesh.edges(), mesh.pointEdges())
2228 listPlusEqOp<point>(),
2240 autoPtr<OBJstream> baffleEdgeStr;
2247 meshRefiner_.mesh().time().path()
2248 /
"baffleEdge_" +
name(iter) +
".obj"
2251 Info<<
nl <<
"Dumping baffle-edges to "
2252 << baffleEdgeStr().name() <<
endl;
2257 PackedBoolList isBaffleEdge(pp.nEdges());
2258 label nBaffleEdges = 0;
2263 labelList pointStatus(pp.nPoints(), -1);
2265 forAll(edgeFaceNormals, edgei)
2267 const List<point>& efn = edgeFaceNormals[edgei];
2269 if (efn.size() == 2 && (efn[0]&efn[1]) < baffleFeatureCos)
2271 isBaffleEdge[edgei] =
true;
2273 const edge&
e = pp.edges()[edgei];
2274 pointStatus[
e[0]] = 0;
2275 pointStatus[
e[1]] = 0;
2277 if (baffleEdgeStr.valid())
2279 const point& p0 = pp.localPoints()[
e[0]];
2280 const point& p1 = pp.localPoints()[
e[1]];
2288 <<
" baffle edges out of "
2290 <<
" edges." <<
endl;
2293 forAll(pp.pointEdges(), pointi)
2314 forAll(pointStatus, pointi)
2316 const point& pt = pp.localPoints()[pointi];
2318 if (pointStatus[pointi] == 0)
2320 Tuple2<label, pointIndexHit>
nearInfo = findNearFeatureEdge
2340 else if (pointStatus[pointi] == 1)
2344 features.findNearestPoint
2352 label feati = nearFeat[0];
2358 scalar distSqr =
magSqr(featPt-pt);
2361 label oldPointi = pointAttractor[feati][featPointi];
2368 <
magSqr(featPt-pp.localPoints()[oldPointi])
2372 pointAttractor[feati][featPointi] = pointi;
2373 pointConstraints[feati][featPointi].first() = 3;
2374 pointConstraints[feati][featPointi].second() =
2378 patchAttraction[pointi] = featPt-pt;
2379 patchConstraints[pointi] =
2380 pointConstraints[feati][featPointi];
2382 if (oldPointi != -1)
2393 pp.localPoints()[oldPointi],
2437 void Foam::snappySnapDriver::reverseAttractMeshPoints
2445 const List<labelList>& pointAttractor,
2446 const List<List<pointConstraint>>& pointConstraints,
2448 const List<List<DynamicList<point>>>& edgeAttractors,
2449 const List<List<DynamicList<pointConstraint>>>& edgeConstraints,
2452 const List<pointConstraint>& rawPatchConstraints,
2456 List<pointConstraint>& patchConstraints
2459 const refinementFeatures& features = meshRefiner_.features();
2467 treeBoundBox bb(pp.localPoints());
2468 bb = bb.extend(1
e-4);
2471 DynamicList<label> attractPoints(pp.nPoints());
2473 const fvMesh& mesh = meshRefiner_.mesh();
2475 boolList isFeatureEdgeOrPoint(pp.nPoints(),
false);
2477 forAll(rawPatchConstraints, pointi)
2479 if (rawPatchConstraints[pointi].
first() >= 2)
2481 isFeatureEdgeOrPoint[pointi] =
true;
2487 <<
" points out of " <<
returnReduce(pp.nPoints(), sumOp<label>())
2488 <<
" for reverse attraction." <<
endl;
2496 isFeatureEdgeOrPoint,
2501 for (
label nGrow = 0; nGrow < 1; nGrow++)
2503 boolList newIsFeatureEdgeOrPoint(isFeatureEdgeOrPoint);
2505 forAll(pp.localFaces(), facei)
2507 const face&
f = pp.localFaces()[facei];
2511 if (isFeatureEdgeOrPoint[
f[fp]])
2516 newIsFeatureEdgeOrPoint[
f[fp]] =
true;
2523 isFeatureEdgeOrPoint = newIsFeatureEdgeOrPoint;
2529 isFeatureEdgeOrPoint,
2537 forAll(isFeatureEdgeOrPoint, pointi)
2539 if (isFeatureEdgeOrPoint[pointi])
2541 attractPoints.append(pointi);
2547 <<
" points out of " <<
returnReduce(pp.nPoints(), sumOp<label>())
2548 <<
" for reverse attraction." <<
endl;
2552 indexedOctree<treeDataPoint> ppTree
2554 treeDataPoint(pp.localPoints(), attractPoints),
2562 patchAttraction.setSize(pp.nPoints());
2563 patchAttraction =
Zero;
2564 patchConstraints.setSize(pp.nPoints());
2565 patchConstraints = pointConstraint();
2567 forAll(edgeAttractors, feati)
2569 const List<DynamicList<point>>& edgeAttr = edgeAttractors[feati];
2570 const List<DynamicList<pointConstraint>>& edgeConstr =
2571 edgeConstraints[feati];
2573 forAll(edgeAttr, featEdgei)
2575 const DynamicList<point>& attr = edgeAttr[featEdgei];
2579 const point& featPt = attr[i];
2589 ppTree.shapes().pointLabels()[
nearInfo.index()];
2590 const point attraction = featPt-pp.localPoints()[pointi];
2596 patchConstraints[pointi].
first() <= 1
2597 ||
magSqr(attraction) <
magSqr(patchAttraction[pointi])
2600 patchAttraction[pointi] = attraction;
2601 patchConstraints[pointi] = edgeConstr[featEdgei][i];
2607 <<
"Did not find pp point near " << featPt
2624 forAll(pointAttractor, feati)
2626 const labelList& pointAttr = pointAttractor[feati];
2627 const List<pointConstraint>& pointConstr = pointConstraints[feati];
2629 forAll(pointAttr, featPointi)
2631 if (pointAttr[featPointi] != -1)
2633 const point& featPt = features[feati].points()
2648 ppTree.shapes().pointLabels()[
nearInfo.index()];
2650 const point& pt = pp.localPoints()[pointi];
2651 const point attraction = featPt-pt;
2656 if (patchConstraints[pointi].
first() <= 1)
2658 patchAttraction[pointi] = attraction;
2659 patchConstraints[pointi] = pointConstr[featPointi];
2661 else if (patchConstraints[pointi].
first() == 2)
2663 patchAttraction[pointi] = attraction;
2664 patchConstraints[pointi] = pointConstr[featPointi];
2666 else if (patchConstraints[pointi].
first() == 3)
2672 <
magSqr(patchAttraction[pointi])
2675 patchAttraction[pointi] = attraction;
2676 patchConstraints[pointi] =
2677 pointConstr[featPointi];
2687 void Foam::snappySnapDriver::featureAttractionUsingFeatureEdges
2690 const bool avoidSnapProblems,
2691 const scalar featureCos,
2692 const bool multiRegionFeatureSnap,
2698 const List<List<point>>& pointFaceSurfNormals,
2699 const List<List<point>>& pointFaceDisp,
2700 const List<List<point>>& pointFaceCentres,
2704 List<pointConstraint>& patchConstraints
2707 const refinementFeatures& features = meshRefiner_.features();
2714 List<List<DynamicList<point>>> edgeAttractors(features.size());
2715 List<List<DynamicList<pointConstraint>>> edgeConstraints
2721 label nFeatEdges = features[feati].edges().size();
2722 edgeAttractors[feati].setSize(nFeatEdges);
2723 edgeConstraints[feati].setSize(nFeatEdges);
2729 List<labelList> pointAttractor(features.size());
2730 List<List<pointConstraint>> pointConstraints(features.size());
2733 label nFeatPoints = features[feati].points().size();
2734 pointAttractor[feati].setSize(nFeatPoints, -1);
2735 pointConstraints[feati].setSize(nFeatPoints);
2740 List<pointConstraint> rawPatchConstraints(pp.nPoints());
2746 multiRegionFeatureSnap,
2752 pointFaceSurfNormals,
2781 determineBaffleFeatures
2806 reverseAttractMeshPoints
2822 rawPatchConstraints,
2833 OBJstream featureEdgeStr
2835 meshRefiner_.mesh().time().path()
2836 /
"edgeAttractors_" +
name(iter) +
".obj"
2838 Info<<
"Dumping feature-edge attraction to "
2839 << featureEdgeStr.name() <<
endl;
2841 OBJstream featurePointStr
2843 meshRefiner_.mesh().time().path()
2844 /
"pointAttractors_" +
name(iter) +
".obj"
2846 Info<<
"Dumping feature-point attraction to "
2847 << featurePointStr.name() <<
endl;
2849 forAll(patchConstraints, pointi)
2851 const point& pt = pp.localPoints()[pointi];
2852 const vector& attr = patchAttraction[pointi];
2854 if (patchConstraints[pointi].
first() == 2)
2858 else if (patchConstraints[pointi].
first() == 3)
2866 if (avoidSnapProblems)
2871 if (multiRegionFeatureSnap)
2873 releasePointsNextToMultiPatch
2885 rawPatchConstraints,
2907 rawPatchConstraints,
2918 avoidDiagonalAttraction
2932 meshRefiner_.mesh().time().path()
2933 /
"patchAttraction_" +
name(iter) +
".obj",
2935 pp.localPoints() + patchAttraction
2941 void Foam::snappySnapDriver::preventFaceSqueeze
2944 const scalar featureCos,
2950 List<pointConstraint>& patchConstraints
2955 forAll(pp.localFaces(), facei)
2957 const face&
f = pp.localFaces()[facei];
2962 singleF.setSize(
f.
size());
2968 label nConstraints = 0;
2972 const point& pt = pp.localPoints()[pointi];
2974 if (patchConstraints[pointi].
first() > 1)
2976 points[fp] = pt + patchAttraction[pointi];
2985 if (nConstraints ==
f.
size())
2987 scalar oldArea =
f.mag(pp.localPoints());
2988 scalar newArea = singleF.mag(
points);
2989 if (newArea < 0.1*oldArea)
2996 scalar
s =
magSqr(patchAttraction[
f[fp]]);
3007 patchAttraction[pointi] *= 0.5;
3017 const snapParameters& snapParams,
3018 const bool avoidSnapProblems,
3020 const scalar featureCos,
3021 const scalar featureAttract,
3024 motionSmoother& meshMover,
3026 List<pointConstraint>& patchConstraints
3029 const Switch implicitFeatureAttraction = snapParams.implicitFeatureSnap();
3030 const Switch explicitFeatureAttraction = snapParams.explicitFeatureSnap();
3031 const Switch multiRegionFeatureSnap = snapParams.multiRegionFeatureSnap();
3033 Info<<
"Overriding displacement on features :" <<
nl
3034 <<
" implicit features : " << implicitFeatureAttraction <<
nl
3035 <<
" explicit features : " << explicitFeatureAttraction <<
nl
3036 <<
" multi-patch features : " << multiRegionFeatureSnap <<
nl
3041 const pointField& localPoints = pp.localPoints();
3042 const fvMesh& mesh = meshRefiner_.mesh();
3050 List<List<point>> pointFaceSurfNormals;
3051 List<List<point>> pointFaceDisp;
3052 List<List<point>> pointFaceCentres;
3053 List<labelList> pointFacePatchID;
3059 forAll(pp.localFaces(), facei)
3061 const face&
f = pp.localFaces()[facei];
3064 faceSnapDist[facei] =
max(faceSnapDist[facei], snapDist[
f[fp]]);
3076 labelList faceSurfaceGlobalRegion(pp.size(), -1);
3086 faceSurfaceGlobalRegion,
3096 calcNearestFacePointProperties
3103 faceSurfaceGlobalRegion,
3105 pointFaceSurfNormals,
3124 patchAttraction.
setSize(localPoints.size());
3125 patchAttraction =
Zero;
3127 patchConstraints.setSize(localPoints.size());
3128 patchConstraints = pointConstraint();
3130 if (implicitFeatureAttraction)
3135 featureAttractionUsingReconstruction
3145 pointFaceSurfNormals,
3155 if (explicitFeatureAttraction)
3163 featureAttractionUsingFeatureEdges
3168 multiRegionFeatureSnap,
3174 pointFaceSurfNormals,
3197 const PackedBoolList isPatchMasterPoint
3219 <<
" avg:" << avgPatchDisp <<
endl
3220 <<
" feature : max:" <<
gMaxMagSqr(patchAttraction)
3221 <<
" avg:" << avgPatchAttr <<
endl;
3235 forAll(patchConstraints, pointi)
3237 if (patchConstraints[pointi].
first() > 1)
3240 (1.0-featureAttract)*patchDisp[pointi]
3241 + featureAttract*patchAttraction[pointi];
3249 label nMasterPoints = 0;
3254 forAll(patchConstraints, pointi)
3256 if (isPatchMasterPoint[pointi])
3260 if (patchConstraints[pointi].
first() == 1)
3264 else if (patchConstraints[pointi].
first() == 2)
3268 else if (patchConstraints[pointi].
first() == 3)
3275 reduce(nMasterPoints, sumOp<label>());
3276 reduce(nPlanar, sumOp<label>());
3277 reduce(nEdge, sumOp<label>());
3278 reduce(nPoint, sumOp<label>());
3279 Info<<
"Feature analysis : total master points:"
3281 <<
" attraction to :" <<
nl
3282 <<
" feature point : " << nPoint <<
nl
3283 <<
" feature edge : " << nEdge <<
nl
3284 <<
" nearest surface : " << nPlanar <<
nl
3285 <<
" rest : " << nMasterPoints-nPoint-nEdge-nPlanar
3302 if (featureAttract < 1-0.001)
3307 pp.meshEdges(mesh.edges(), mesh.pointEdges())
3309 const PackedBoolList isPatchMasterEdge
3342 tangPatchDisp -= (pointNormals & patchDisp) * pointNormals;
3353 tangPatchDisp += (pointNormals & patchDisp) * pointNormals;
3360 /
"tangPatchDispConstrained_" +
name(iter) +
".obj",
3362 pp.localPoints() + tangPatchDisp
3367 (1.0-featureAttract)*smoothedPatchDisp
3368 + featureAttract*tangPatchDisp;
3372 const scalar
relax = featureAttract;
3383 minMagSqrEqOp<point>(),
3384 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.
scalar degToRad(const scalar deg)
Convert degrees to radians.
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.
word name(const bool)
Return a word representation of a bool.
int order(const scalar s)
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.
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]