41 template<
class Type,
class TrackingData>
44 template<
class Type,
class TrackingData>
47 template<
class Type,
class TrackingData>
53 template<
class Type,
class TrackingData>
114 template<
class Type,
class TrackingData>
118 const label neighbourFaceI,
119 const Type& neighbourInfo,
141 if (!changedCell_[cellI])
143 changedCell_[cellI] =
true;
144 changedCells_[nChangedCells_++] = cellI;
162 template<
class Type,
class TrackingData>
166 const label neighbourCellI,
167 const Type& neighbourInfo,
174 bool wasValid = faceInfo.valid(td_);
189 if (!changedFace_[faceI])
191 changedFace_[faceI] =
true;
192 changedFaces_[nChangedFaces_++] = faceI;
196 if (!wasValid && faceInfo.valid(td_))
210 template<
class Type,
class TrackingData>
214 const Type& neighbourInfo,
221 bool wasValid = faceInfo.valid(td_);
235 if (!changedFace_[faceI])
237 changedFace_[faceI] =
true;
238 changedFaces_[nChangedFaces_++] = faceI;
242 if (!wasValid && faceInfo.valid(td_))
252 template<
class Type,
class TrackingData>
259 refCast<const cyclicPolyPatch>(patch).
neighbPatch();
268 !allFaceInfo_[i1].sameGeometry
278 <<
" faceInfo:" << allFaceInfo_[i1]
279 <<
" otherfaceInfo:" << allFaceInfo_[i2]
283 if (changedFace_[i1] != changedFace_[i2])
286 <<
" faceInfo:" << allFaceInfo_[i1]
287 <<
" otherfaceInfo:" << allFaceInfo_[i2]
288 <<
" changedFace:" << changedFace_[i1]
289 <<
" otherchangedFace:" << changedFace_[i2]
297 template<
class Type,
class TrackingData>
298 template<
class PatchType>
301 forAll(mesh_.boundaryMesh(), patchI)
303 if (isA<PatchType>(mesh_.boundaryMesh()[patchI]))
313 template<
class Type,
class TrackingData>
320 forAll(changedFaces, changedFaceI)
322 label faceI = changedFaces[changedFaceI];
324 bool wasValid = allFaceInfo_[faceI].valid(td_);
327 allFaceInfo_[faceI] = changedFacesInfo[changedFaceI];
330 if (!wasValid && allFaceInfo_[faceI].valid(td_))
337 changedFace_[faceI] =
true;
338 changedFaces_[nChangedFaces_++] = faceI;
344 template<
class Type,
class TrackingData>
353 for (
label changedFaceI = 0; changedFaceI < nFaces; changedFaceI++)
355 const Type& neighbourWallInfo = changedFacesInfo[changedFaceI];
356 label patchFaceI = changedFaces[changedFaceI];
360 Type& currentWallInfo = allFaceInfo_[meshFaceI];
362 if (!currentWallInfo.equal(neighbourWallInfo, td_))
379 template<
class Type,
class TrackingData>
383 const label startFaceI,
389 label nChangedPatchFaces = 0;
391 for (
label i = 0; i < nFaces; i++)
393 label patchFaceI = i + startFaceI;
397 if (changedFace_[meshFaceI])
399 changedPatchFaces[nChangedPatchFaces] = patchFaceI;
400 changedPatchFacesInfo[nChangedPatchFaces] = allFaceInfo_[meshFaceI];
401 nChangedPatchFaces++;
404 return nChangedPatchFaces;
409 template<
class Type,
class TrackingData>
420 for (
label i = 0; i < nFaces; i++)
422 label patchFaceI = faceLabels[i];
425 faceInfo[i].leaveDomain(mesh_, patch, patchFaceI, fc[meshFaceI], td_);
431 template<
class Type,
class TrackingData>
442 for (
label i = 0; i < nFaces; i++)
444 label patchFaceI = faceLabels[i];
447 faceInfo[i].enterDomain(mesh_, patch, patchFaceI, fc[meshFaceI], td_);
453 template<
class Type,
class TrackingData>
461 if (rotTensor.size() == 1)
463 const tensor&
T = rotTensor[0];
465 for (
label faceI = 0; faceI < nFaces; faceI++)
467 faceInfo[faceI].transform(mesh_,
T, td_);
472 for (
label faceI = 0; faceI < nFaces; faceI++)
474 faceInfo[faceI].transform(mesh_, rotTensor[faceI], td_);
481 template<
class Type,
class TrackingData>
485 const label cycOffset,
490 for (
label faceI = 0; faceI < nFaces; faceI++)
492 faces[faceI] += cycOffset;
498 template<
class Type,
class TrackingData>
512 label patchI = procPatches[i];
515 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
523 nSendFaces = getChangedPatchFaces
543 Pout<<
" Processor patch " << patchI <<
' ' << procPatch.
name()
545 <<
" Sending:" << nSendFaces
562 label patchI = procPatches[i];
565 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
573 fromNeighbour >> receiveFaces >> receiveFacesInfo;
578 Pout<<
" Processor patch " << patchI <<
' ' << procPatch.
name()
580 <<
" Receiving:" << receiveFaces.
size()
617 template<
class Type,
class TrackingData>
620 forAll(mesh_.boundaryMesh(), patchI)
624 if (isA<cyclicPolyPatch>(patch))
627 refCast<const cyclicPolyPatch>(patch).
neighbPatch();
635 nReceiveFaces = getChangedPatchFaces
654 refCast<const cyclicPolyPatch>(patch);
669 Pout<<
" Cyclic patch " << patchI <<
' ' << cycPatch.
name()
670 <<
" Changed : " << nReceiveFaces
694 checkCyclic(cycPatch);
702 template<
class Type,
class TrackingData>
705 forAll(mesh_.boundaryMesh(), patchI)
709 if (isA<cyclicAMIPolyPatch>(patch))
712 refCast<const cyclicAMIPolyPatch>(patch);
718 refCast<const cyclicAMIPolyPatch>(patch).
neighbPatch();
735 sendInfo[i].leaveDomain(mesh_, nbrPatch, i, fc[i], td_);
749 cycPatch.
interpolate(sendInfo, cmb, receiveInfo, defVals);
774 receiveInfo[i].enterDomain(mesh_, cycPatch, i, fc[i], td_);
783 Type& currentWallInfo = allFaceInfo_[meshFaceI];
787 receiveInfo[i].valid(td_)
788 && !currentWallInfo.equal(receiveInfo[i], td_)
805 template<
class Type,
class TrackingData>
816 forAll(explicitConnections_, connI)
818 const labelPair& baffle = explicitConnections_[connI];
820 label f0 = baffle[0];
821 if (changedFace_[f0])
824 f0Info.
append(allFaceInfo_[f0]);
828 if (changedFace_[
f1])
840 const labelPair& baffle = explicitConnections_[f1Baffle[index]];
842 label f0 = baffle[0];
843 Type& currentWallInfo = allFaceInfo_[f0];
845 if (!currentWallInfo.equal(f1Info[index], td_))
859 const labelPair& baffle = explicitConnections_[f0Baffle[index]];
862 Type& currentWallInfo = allFaceInfo_[
f1];
864 if (!currentWallInfo.equal(f0Info[index], td_))
881 template<
class Type,
class TrackingData>
891 explicitConnections_(0),
892 allFaceInfo_(allFaceInfo),
893 allCellInfo_(allCellInfo),
895 changedFace_(mesh_.nFaces(),
false),
896 changedFaces_(mesh_.nFaces()),
898 changedCell_(mesh_.nCells(),
false),
899 changedCells_(mesh_.nCells()),
901 hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
907 nUnvisitedCells_(mesh_.nCells()),
908 nUnvisitedFaces_(mesh_.nFaces())
912 allFaceInfo.
size() != mesh_.nFaces()
913 || allCellInfo.
size() != mesh_.nCells()
917 <<
"face and cell storage not the size of mesh faces, cells:"
919 <<
" allFaceInfo :" << allFaceInfo.
size() <<
endl
920 <<
" mesh_.nFaces():" << mesh_.nFaces() <<
endl
921 <<
" allCellInfo :" << allCellInfo.
size() <<
endl
922 <<
" mesh_.nCells():" << mesh_.nCells()
930 template<
class Type,
class TrackingData>
943 explicitConnections_(0),
944 allFaceInfo_(allFaceInfo),
945 allCellInfo_(allCellInfo),
947 changedFace_(mesh_.nFaces(),
false),
948 changedFaces_(mesh_.nFaces()),
950 changedCell_(mesh_.nCells(),
false),
951 changedCells_(mesh_.nCells()),
953 hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
959 nUnvisitedCells_(mesh_.nCells()),
960 nUnvisitedFaces_(mesh_.nFaces())
964 allFaceInfo.
size() != mesh_.nFaces()
965 || allCellInfo.
size() != mesh_.nCells()
969 <<
"face and cell storage not the size of mesh faces, cells:"
971 <<
" allFaceInfo :" << allFaceInfo.
size() <<
endl
972 <<
" mesh_.nFaces():" << mesh_.nFaces() <<
endl
973 <<
" allCellInfo :" << allCellInfo.
size() <<
endl
974 <<
" mesh_.nCells():" << mesh_.nCells()
979 setFaceInfo(changedFaces, changedFacesInfo);
982 label iter = iterate(maxIter);
984 if ((maxIter > 0) && (iter >= maxIter))
987 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl
988 <<
" maxIter:" << maxIter <<
endl
989 <<
" nChangedCells:" << nChangedCells_ <<
endl
990 <<
" nChangedFaces:" << nChangedFaces_ <<
endl
998 template<
class Type,
class TrackingData>
1003 const bool handleCyclicAMI,
1008 const label maxIter,
1013 explicitConnections_(explicitConnections),
1014 allFaceInfo_(allFaceInfo),
1015 allCellInfo_(allCellInfo),
1017 changedFace_(mesh_.nFaces(),
false),
1018 changedFaces_(mesh_.nFaces()),
1020 changedCell_(mesh_.nCells(),
false),
1021 changedCells_(mesh_.nCells()),
1023 hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
1024 hasCyclicAMIPatches_
1030 nUnvisitedCells_(mesh_.nCells()),
1031 nUnvisitedFaces_(mesh_.nFaces())
1035 allFaceInfo.
size() != mesh_.nFaces()
1036 || allCellInfo.
size() != mesh_.nCells()
1040 <<
"face and cell storage not the size of mesh faces, cells:"
1042 <<
" allFaceInfo :" << allFaceInfo.
size() <<
endl
1043 <<
" mesh_.nFaces():" << mesh_.nFaces() <<
endl
1044 <<
" allCellInfo :" << allCellInfo.
size() <<
endl
1045 <<
" mesh_.nCells():" << mesh_.nCells()
1050 setFaceInfo(changedFaces, changedFacesInfo);
1053 label iter = iterate(maxIter);
1055 if ((maxIter > 0) && (iter >= maxIter))
1058 <<
"Maximum number of iterations reached. Increase maxIter." <<
endl
1059 <<
" maxIter:" << maxIter <<
endl
1060 <<
" nChangedCells:" << nChangedCells_ <<
endl
1061 <<
" nChangedFaces:" << nChangedFaces_ <<
endl
1070 template<
class Type,
class TrackingData>
1073 return nUnvisitedCells_;
1077 template<
class Type,
class TrackingData>
1080 return nUnvisitedFaces_;
1086 template<
class Type,
class TrackingData>
1089 const labelList& owner = mesh_.faceOwner();
1090 const labelList& neighbour = mesh_.faceNeighbour();
1091 label nInternalFaces = mesh_.nInternalFaces();
1095 label changedFaceI = 0;
1096 changedFaceI < nChangedFaces_;
1100 label faceI = changedFaces_[changedFaceI];
1101 if (!changedFace_[faceI])
1105 <<
" not marked as having been changed"
1110 const Type& neighbourWallInfo = allFaceInfo_[faceI];
1115 label cellI = owner[faceI];
1116 Type& currentWallInfo = allCellInfo_[cellI];
1118 if (!currentWallInfo.equal(neighbourWallInfo, td_))
1131 if (faceI < nInternalFaces)
1133 cellI = neighbour[faceI];
1134 Type& currentWallInfo2 = allCellInfo_[cellI];
1136 if (!currentWallInfo2.equal(neighbourWallInfo, td_))
1150 changedFace_[faceI] =
false;
1158 Pout<<
" Changed cells : " << nChangedCells_ <<
endl;
1162 label totNChanged = nChangedCells_;
1171 template<
class Type,
class TrackingData>
1178 label changedCellI = 0;
1179 changedCellI < nChangedCells_;
1183 label cellI = changedCells_[changedCellI];
1184 if (!changedCell_[cellI])
1187 <<
"Cell " << cellI <<
" not marked as having been changed"
1191 const Type& neighbourWallInfo = allCellInfo_[cellI];
1196 forAll(faceLabels, faceLabelI)
1198 label faceI = faceLabels[faceLabelI];
1199 Type& currentWallInfo = allFaceInfo_[faceI];
1201 if (!currentWallInfo.equal(neighbourWallInfo, td_))
1215 changedCell_[cellI] =
false;
1223 handleExplicitConnections();
1225 if (hasCyclicPatches_)
1228 handleCyclicPatches();
1231 if (hasCyclicAMIPatches_)
1233 handleAMICyclicPatches();
1236 if (Pstream::parRun())
1239 handleProcPatches();
1244 Pout<<
" Changed faces : " << nChangedFaces_ <<
endl;
1248 label totNChanged = nChangedFaces_;
1257 template<
class Type,
class TrackingData>
1260 if (hasCyclicPatches_)
1263 handleCyclicPatches();
1266 if (hasCyclicAMIPatches_)
1268 handleAMICyclicPatches();
1271 if (Pstream::parRun())
1274 handleProcPatches();
1279 while (iter < maxIter)
1283 Info<<
" Iteration " << iter <<
endl;
1292 Info<<
" Total changed cells : " << nCells <<
endl;
1304 Info<<
" Total changed faces : " << nFaces <<
nl
1305 <<
" Total evaluations : " << nEvals_ <<
nl
1306 <<
" Remaining unvisited cells: " << nUnvisitedCells_ <<
nl
1307 <<
" Remaining unvisited faces: " << nUnvisitedFaces_ <<
endl;