110 bool zoneFlip =
false;
123 mesh.
faces()[faceID],
153 if (!isA<processorPolyPatch>(pp))
170 Info<<
"Removing empty patch " << pp.
name() <<
" at position "
180 if (isA<processorPolyPatch>(pp))
197 Info<<
"Removing empty processor patch " << pp.
name()
198 <<
" at position " << patchI <<
endl;
204 if (nAllPatches != nOldPatches)
213 Info<<
"No patches removed." <<
endl;
225 if (isA<cyclicPolyPatch>(patches[patchI]))
228 refCast<const cyclicPolyPatch>(patches[patchI]);
230 label halfSize = cycPatch.size()/2;
235 Pout<<
"Dumping " << cycPatch.
name()
236 <<
" half0 faces to " << str.name() <<
endl;
240 static_cast<faceList>
253 Pout<<
"Dumping " << cycPatch.
name()
254 <<
" half1 faces to " << str.name() <<
endl;
258 static_cast<faceList>
276 Pout<<
"Dumping cyclic match as lines between face centres to "
279 for (label faceI = 0; faceI < halfSize; faceI++)
285 label nbrFaceI = halfSize + faceI;
291 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
304 if (separation.
size() == 1)
310 field[i] += separation[0];
313 else if (separation.
size() == field.
size())
317 field[i] += separation[i];
324 "separateList(const vectorField&, UList<vector>&)"
325 ) <<
"Sizes of field and transformation not equal. field:"
326 << field.
size() <<
" transformation:" << separation.
size()
333 template <
class CombineOp>
338 const CombineOp& cop,
339 const point& nullValue
347 "(const polyMesh&, pointField&, const CombineOp&, const point&)"
348 ) <<
"Number of values " << points.
size()
349 <<
" is not equal to the number of points in the mesh "
356 bool hasTransformation =
false;
368 isA<processorPolyPatch>(pp)
370 && refCast<const processorPolyPatch>(pp).owner()
374 refCast<const processorPolyPatch>(pp);
384 label nbrPointI = nbrPts[pointI];
385 if (nbrPointI >= 0 && nbrPointI < patchInfo.size())
387 patchInfo[nbrPointI] = points[meshPts[pointI]];
405 isA<processorPolyPatch>(pp)
407 && !refCast<const processorPolyPatch>(pp).owner()
411 refCast<const processorPolyPatch>(pp);
422 fromNbr >> nbrPatchInfo;
425 nbrPatchInfo.setSize(procPatch.
nPoints(), nullValue);
429 hasTransformation =
true;
434 hasTransformation =
true;
435 separateList(-procPatch.
separation(), nbrPatchInfo);
442 label meshPointI = meshPts[pointI];
443 points[meshPointI] = nbrPatchInfo[pointI];
454 if (isA<cyclicPolyPatch>(pp))
457 refCast<const cyclicPolyPatch>(pp);
466 const edge&
e = coupledPoints[i];
467 label point0 = meshPts[e[0]];
468 half0Values[i] = points[point0];
473 hasTransformation =
true;
478 hasTransformation =
true;
479 const vectorField& v = cycPatch.coupledPolyPatch::separation();
480 separateList(v, half0Values);
485 const edge&
e = coupledPoints[i];
486 label point1 = meshPts[e[1]];
487 points[point1] = half0Values[i];
501 if (hasTransformation)
506 "(const polyMesh&, pointField&, const CombineOp&, const point&)"
507 ) <<
"There are decomposed cyclics in this mesh with"
508 <<
" transformations." << endl
509 <<
"This is not supported. The result will be incorrect"
541 int main(
int argc,
char *argv[])
548 runTime.functionObjects().off();
555 Info<<
"Reading createPatchDict." <<
nl <<
endl;
577 const Switch pointSync(dict.lookup(
"pointSync"));
581 scalar tol =
readScalar(dict.lookup(
"matchTolerance"));
582 Info<<
"Using relative tolerance " << tol
583 <<
" to match up faces and points" <<
nl <<
endl;
596 dumpCyclicMatch(
"initial_", mesh);
606 if (patchSources.size())
618 if (!isA<processorPolyPatch>(pp))
630 startFaceI += pp.size();
634 forAll(patchSources, addedI)
636 const dictionary& dict = patchSources[addedI];
642 if (destPatchI == -1)
646 destPatchI = allPatches.
size();
648 Info<<
"Adding new patch " << patchName
649 <<
" as patch " << destPatchI
650 <<
" from " << patchDict <<
endl;
652 patchDict.set(
"nFaces", 0);
653 patchDict.set(
"startFace", startFaceI);
674 if (isA<processorPolyPatch>(pp))
686 startFaceI += pp.size();
705 forAll(patchSources, addedI)
707 const dictionary& dict = patchSources[addedI];
713 if (destPatchI == -1)
719 word sourceType(dict.
lookup(
"constructFrom"));
721 if (sourceType ==
"patches")
728 const polyPatch& pp = patches[iter.key()];
730 Info<<
"Moving faces from patch " << pp.
name()
731 <<
" to patch " << destPatchI <<
endl;
745 else if (sourceType ==
"set")
752 <<
" faces from faceSet " << faces.name() <<
endl;
761 label faceI = patchFaces[i];
766 <<
"Face " << faceI <<
" specified in set "
768 <<
" is not an external face of the mesh." << endl
769 <<
"This application can only repatch existing boundary"
785 <<
"Invalid source type " << sourceType << endl
794 Info<<
"Doing topology modification to order faces." <<
nl <<
endl;
798 dumpCyclicMatch(
"coupled_", mesh);
803 Info<<
"Not synchronising points." <<
nl <<
endl;
825 if (pp.size() && isA<coupledPolyPatch>(pp))
828 refCast<const coupledPolyPatch>(pp);
832 Info<<
"On coupled patch " << pp.
name()
833 <<
" separation[0] was "
836 if (isA<cyclicPolyPatch>(pp))
839 refCast<const cyclicPolyPatch>(pp);
843 Info<<
"On cyclic translation patch " << pp.
name()
844 <<
" forcing uniform separation of "
855 pp[pp.size()/2].centre(mesh.
points())
856 - pp[0].centre(mesh.
points())
865 Info<<
"On coupled patch " << pp.
name()
866 <<
" forcing uniform separation of "
871 Info<<
"On coupled patch " << pp.
name()
872 <<
" forcing uniform rotation of "
884 Info<<
"On coupled patch " << pp.
name()
885 <<
" forcing uniform rotation of "
891 Info<<
"Synchronising points." <<
endl;
900 point(GREAT, GREAT, GREAT)
913 Info<<
"Removing patches with no faces in them." <<
nl<<
endl;
917 dumpCyclicMatch(
"final_", mesh);
933 Info<<
"Writing repatched mesh to " << runTime.timeName() <<
nl <<
endl;