44 template<
class Type,
class TrackingData>
47 template<
class Type,
class TrackingData>
50 template<
class Type,
class TrackingData>
55 template<
class Type,
class TrackingData>
85 if (
y.valid(solver_.
data()))
90 meshFacei = patch_.
start() + facei;
112 template<
class Type,
class TrackingData>
116 const label neighbourFacei,
117 const Type& neighbourInfo,
132 const bool propagate =
145 if (changedCell_.set(celli))
147 changedCells_.append(celli);
160 template<
class Type,
class TrackingData>
164 const label neighbourCelli,
165 const Type& neighbourInfo,
178 const bool wasValid = faceInfo.valid(td_);
180 const bool propagate =
193 if (changedFace_.set(facei))
195 changedFaces_.append(facei);
199 if (!wasValid && faceInfo.valid(td_))
208 template<
class Type,
class TrackingData>
212 const Type& neighbourInfo,
225 const bool wasValid = faceInfo.valid(td_);
227 const bool propagate =
239 if (changedFace_.set(facei))
241 changedFaces_.append(facei);
245 if (!wasValid && faceInfo.valid(td_))
254 template<
class Type,
class TrackingData>
268 const label i2 = nbrPatch.
start() + patchFacei;
272 !allFaceInfo_[i1].sameGeometry
282 <<
" faceInfo:" << allFaceInfo_[i1]
283 <<
" otherfaceInfo:" << allFaceInfo_[i2]
287 if (changedFace_.test(i1) != changedFace_.test(i2))
290 <<
" faceInfo:" << allFaceInfo_[i1]
291 <<
" otherfaceInfo:" << allFaceInfo_[i2]
292 <<
" changedFace:" << changedFace_.test(i1)
293 <<
" otherchangedFace:" << changedFace_.test(i2)
300 template<
class Type,
class TrackingData>
301 template<
class PatchType>
304 for (
const polyPatch&
p : mesh_.boundaryMesh())
306 if (isA<PatchType>(
p))
315 template<
class Type,
class TrackingData>
322 const bool wasValid = allFaceInfo_[facei].valid(td_);
325 allFaceInfo_[facei] = faceInfo;
328 if (!wasValid && allFaceInfo_[facei].valid(td_))
334 changedFace_.set(facei);
335 changedFaces_.append(facei);
339 template<
class Type,
class TrackingData>
346 forAll(changedFaces, changedFacei)
348 const label facei = changedFaces[changedFacei];
350 const bool wasValid = allFaceInfo_[facei].valid(td_);
353 allFaceInfo_[facei] = changedFacesInfo[changedFacei];
356 if (!wasValid && allFaceInfo_[facei].valid(td_))
362 changedFace_.
set(facei);
363 changedFaces_.append(facei);
368 template<
class Type,
class TrackingData>
379 for (
label changedFacei = 0; changedFacei < nFaces; ++changedFacei)
381 const Type& newInfo = changedFacesInfo[changedFacei];
382 const label patchFacei = changedFaces[changedFacei];
384 const label meshFacei =
patch.start() + patchFacei;
386 Type& currInfo = allFaceInfo_[meshFacei];
388 if (!currInfo.equal(newInfo, td_))
402 template<
class Type,
class TrackingData>
406 const label startFacei,
417 for (
label i = 0; i < nFaces; ++i)
419 const label patchFacei = i + startFacei;
420 const label meshFacei =
patch.start() + patchFacei;
422 if (changedFace_.test(meshFacei))
424 changedPatchFaces[nChanged] = patchFacei;
425 changedPatchFacesInfo[nChanged] = allFaceInfo_[meshFacei];
434 template<
class Type,
class TrackingData>
447 for (
label i = 0; i < nFaces; ++i)
449 const label patchFacei = faceLabels[i];
450 const label meshFacei =
patch.start() + patchFacei;
452 faceInfo[i].leaveDomain(mesh_,
patch, patchFacei, fc[meshFacei], td_);
457 template<
class Type,
class TrackingData>
470 for (
label i = 0; i < nFaces; ++i)
472 const label patchFacei = faceLabels[i];
473 const label meshFacei =
patch.start() + patchFacei;
475 faceInfo[i].enterDomain(mesh_,
patch, patchFacei, fc[meshFacei], td_);
480 template<
class Type,
class TrackingData>
490 if (rotTensor.size() == 1)
492 const tensor&
T = rotTensor[0];
494 for (
label facei = 0; facei < nFaces; ++facei)
496 faceInfo[facei].transform(mesh_,
T, td_);
501 for (
label facei = 0; facei < nFaces; ++facei)
503 faceInfo[facei].transform(mesh_, rotTensor[facei], td_);
509 template<
class Type,
class TrackingData>
513 const label cycOffset,
521 for (
label facei = 0; facei < nFaces; ++facei)
523 faces[facei] += cycOffset;
528 template<
class Type,
class TrackingData>
542 for (
const label patchi : procPatches)
545 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
553 nSendFaces = getChangedPatchFaces
573 Pout<<
" Processor patch " << patchi <<
' ' << procPatch.
name()
575 <<
" Sending:" << nSendFaces
590 for (
const label patchi : procPatches)
593 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
601 fromNeighbour >> receiveFaces >> receiveFacesInfo;
606 Pout<<
" Processor patch " << patchi <<
' ' << procPatch.
name()
608 <<
" Receiving:" << receiveFaces.size()
644 template<
class Type,
class TrackingData>
651 if (isA<cyclicPolyPatch>(
patch))
654 refCast<const cyclicPolyPatch>(
patch);
664 nReceiveFaces = getChangedPatchFaces
695 Pout<<
" Cyclic patch "
696 << cycPatch.
index() <<
' ' << cycPatch.
name()
697 <<
" Changed : " << nReceiveFaces
721 checkCyclic(cycPatch);
728 template<
class Type,
class TrackingData>
735 if (isA<cyclicAMIPolyPatch>(
patch))
738 refCast<const cyclicAMIPolyPatch>(
patch);
760 sendInfo[i].leaveDomain(mesh_, nbrPatch, i, fc[i], td_);
774 cycPatch.
interpolate(sendInfo, cmb, receiveInfo, defVals);
799 receiveInfo[i].enterDomain(mesh_, cycPatch, i, fc[i], td_);
808 const Type& newInfo = receiveInfo[i];
810 Type& currInfo = allFaceInfo_[meshFacei];
812 if (newInfo.valid(td_) && !currInfo.equal(newInfo, td_))
828 template<
class Type,
class TrackingData>
831 changedBaffles_.clear();
834 for (
const labelPair& baffle : explicitConnections_)
836 const label f0 = baffle.first();
837 const label f1 = baffle.second();
839 if (changedFace_.test(f0))
845 if (changedFace_.test(f1))
857 const label tgtFace = updated.first;
858 const Type& newInfo = updated.second;
860 Type& currInfo = allFaceInfo_[tgtFace];
862 if (!currInfo.equal(newInfo, td_))
874 changedBaffles_.clear();
880 template<
class Type,
class TrackingData>
890 explicitConnections_(),
891 allFaceInfo_(allFaceInfo),
892 allCellInfo_(allCellInfo),
894 changedFace_(mesh_.nFaces(),
false),
895 changedCell_(mesh_.nCells(),
false),
896 changedFaces_(mesh_.nFaces()),
897 changedCells_(mesh_.nCells()),
898 changedBaffles_(2*explicitConnections_.size()),
899 hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
905 nUnvisitedCells_(mesh_.nCells()),
906 nUnvisitedFaces_(mesh_.nFaces())
910 allFaceInfo.
size() != mesh_.nFaces()
911 || allCellInfo.
size() != mesh_.nCells()
915 <<
"face and cell storage not the size of mesh faces, cells:" <<
nl
916 <<
" allFaceInfo :" << allFaceInfo.
size() <<
nl
917 <<
" mesh_.nFaces():" << mesh_.nFaces() <<
nl
918 <<
" allCellInfo :" << allCellInfo.
size() <<
nl
919 <<
" mesh_.nCells():" << mesh_.nCells() <<
endl
925 template<
class Type,
class TrackingData>
938 explicitConnections_(),
939 allFaceInfo_(allFaceInfo),
940 allCellInfo_(allCellInfo),
942 changedFace_(mesh_.nFaces(),
false),
943 changedCell_(mesh_.nCells(),
false),
944 changedFaces_(mesh_.nFaces()),
945 changedCells_(mesh_.nCells()),
946 changedBaffles_(2*explicitConnections_.size()),
947 hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
953 nUnvisitedCells_(mesh_.nCells()),
954 nUnvisitedFaces_(mesh_.nFaces())
958 allFaceInfo.
size() != mesh_.nFaces()
959 || allCellInfo.
size() != mesh_.nCells()
963 <<
"face and cell storage not the size of mesh faces, cells:" <<
nl
964 <<
" allFaceInfo :" << allFaceInfo.
size() <<
nl
965 <<
" mesh_.nFaces():" << mesh_.nFaces() <<
nl
966 <<
" allCellInfo :" << allCellInfo.
size() <<
nl
967 <<
" mesh_.nCells():" << mesh_.nCells() <<
endl
972 setFaceInfo(changedFaces, changedFacesInfo);
975 const label iter = iterate(maxIter);
977 if ((maxIter > 0) && (iter >= maxIter))
980 <<
"Maximum number of iterations reached. Increase maxIter." <<
nl
981 <<
" maxIter:" << maxIter <<
nl
982 <<
" nChangedCells:" << changedCells_.size() <<
nl
983 <<
" nChangedFaces:" << changedFaces_.size() <<
endl
989 template<
class Type,
class TrackingData>
994 const bool handleCyclicAMI,
1004 explicitConnections_(explicitConnections),
1005 allFaceInfo_(allFaceInfo),
1006 allCellInfo_(allCellInfo),
1008 changedFace_(mesh_.nFaces(),
false),
1009 changedCell_(mesh_.nCells(),
false),
1010 changedFaces_(mesh_.nFaces()),
1011 changedCells_(mesh_.nCells()),
1012 changedBaffles_(2*explicitConnections_.size()),
1013 hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
1014 hasCyclicAMIPatches_
1020 nUnvisitedCells_(mesh_.nCells()),
1021 nUnvisitedFaces_(mesh_.nFaces())
1025 allFaceInfo.
size() != mesh_.nFaces()
1026 || allCellInfo.
size() != mesh_.nCells()
1030 <<
"face and cell storage not the size of mesh faces, cells:" <<
nl
1031 <<
" allFaceInfo :" << allFaceInfo.
size() <<
nl
1032 <<
" mesh_.nFaces():" << mesh_.nFaces() <<
nl
1033 <<
" allCellInfo :" << allCellInfo.
size() <<
nl
1034 <<
" mesh_.nCells():" << mesh_.nCells() <<
endl
1039 setFaceInfo(changedFaces, changedFacesInfo);
1042 const label iter = iterate(maxIter);
1044 if ((maxIter > 0) && (iter >= maxIter))
1047 <<
"Maximum number of iterations reached. Increase maxIter." <<
nl
1048 <<
" maxIter:" << maxIter <<
nl
1049 <<
" nChangedCells:" << changedCells_.size() <<
nl
1050 <<
" nChangedFaces:" << changedFaces_.size() <<
endl
1058 template<
class Type,
class TrackingData>
1061 return nUnvisitedCells_;
1065 template<
class Type,
class TrackingData>
1068 return nUnvisitedFaces_;
1072 template<
class Type,
class TrackingData>
1077 const labelList& owner = mesh_.faceOwner();
1078 const labelList& neighbour = mesh_.faceNeighbour();
1079 const label nInternalFaces = mesh_.nInternalFaces();
1081 for (
const label facei : changedFaces_)
1083 if (!changedFace_.test(facei))
1087 <<
" not marked as having been changed"
1091 const Type& newInfo = allFaceInfo_[facei];
1097 const label celli = owner[facei];
1098 Type& currInfo = allCellInfo_[celli];
1100 if (!currInfo.equal(newInfo, td_))
1114 if (facei < nInternalFaces)
1116 const label celli = neighbour[facei];
1117 Type& currInfo = allCellInfo_[celli];
1119 if (!currInfo.equal(newInfo, td_))
1133 changedFace_.unset(facei);
1137 changedFaces_.clear();
1141 Pout<<
" Changed cells : " << changedCells_.size() <<
endl;
1149 template<
class Type,
class TrackingData>
1156 for (
const label celli : changedCells_)
1158 if (!changedCell_.test(celli))
1161 <<
"Cell " << celli <<
" not marked as having been changed"
1165 const Type& newInfo = allCellInfo_[celli];
1170 for (
const label facei : faceLabels)
1172 Type& currInfo = allFaceInfo_[facei];
1174 if (!currInfo.equal(newInfo, td_))
1188 changedCell_.unset(celli);
1192 changedCells_.clear();
1196 handleExplicitConnections();
1198 if (hasCyclicPatches_)
1200 handleCyclicPatches();
1203 if (hasCyclicAMIPatches_)
1205 handleAMICyclicPatches();
1208 if (Pstream::parRun())
1210 handleProcPatches();
1215 Pout<<
" Changed faces : " << changedFaces_.size() <<
endl;
1225 template<
class Type,
class TrackingData>
1233 if (hasCyclicPatches_)
1235 handleCyclicPatches();
1238 if (hasCyclicAMIPatches_)
1240 handleAMICyclicPatches();
1243 if (Pstream::parRun())
1245 handleProcPatches();
1250 for (; iter < maxIter; ++iter)
1254 Info<<
" Iteration " << iter <<
endl;
1263 Info<<
" Total evaluations : "
1265 <<
" Changed cells / faces : "
1266 << nCells <<
" / " << nFaces <<
nl
1267 <<
" Pending cells / faces : "
1268 << nUnvisitedCells_ <<
" / " << nUnvisitedFaces_ <<
nl;
1271 if (!nCells || !nFaces)