56 const int neighbProcNo
61 neighbProcNo_(neighbProcNo),
64 neighbFaceCellCentres_(),
65 neighbPointsPtr_(NULL),
79 myProcNo_(readLabel(dict.
lookup(
"myProcNo"))),
80 neighbProcNo_(readLabel(dict.
lookup(
"neighbProcNo"))),
83 neighbFaceCellCentres_(),
84 neighbPointsPtr_(NULL),
96 myProcNo_(pp.myProcNo_),
97 neighbProcNo_(pp.neighbProcNo_),
100 neighbFaceCellCentres_(),
101 neighbPointsPtr_(NULL),
102 neighbEdgesPtr_(NULL)
116 myProcNo_(pp.myProcNo_),
117 neighbProcNo_(pp.neighbProcNo_),
118 neighbFaceCentres_(),
120 neighbFaceCellCentres_(),
121 neighbPointsPtr_(NULL),
122 neighbEdgesPtr_(NULL)
145 3*(
sizeof(label) + size()*
sizeof(
vector) +
sizeof(scalar))
151 << faceCellCentres();
165 3*(
sizeof(label) + size()*
sizeof(
vector) +
sizeof(scalar))
168 >> neighbFaceCentres_
170 >> neighbFaceCellCentres_;
177 vectorField nbrFaceNormals(neighbFaceAreas_.size());
180 forAll(faceNormals, facei)
182 scalar magSf =
mag(faceAreas()[facei]);
183 scalar nbrMagSf =
mag(neighbFaceAreas_[facei]);
184 scalar avSf = (magSf + nbrMagSf)/2.0;
186 if (magSf < ROOTVSMALL && nbrMagSf < ROOTVSMALL)
191 faceNormals[facei] =
point(1, 0, 0);
192 nbrFaceNormals[facei] = faceNormals[facei];
198 "processorPolyPatch::calcGeometry()"
199 ) <<
"face " << facei <<
" area does not match neighbour by "
200 << 100*
mag(magSf - nbrMagSf)/avSf
201 <<
"% -- possible face ordering problem." <<
endl
202 <<
"patch:" <<
name()
203 <<
" my area:" << magSf
204 <<
" neighbour area:" << nbrMagSf
207 <<
"Mesh face:" << start()+facei
211 <<
"Rerun with processor debug flag set for"
216 faceNormals[facei] = faceAreas()[facei]/magSf;
217 nbrFaceNormals[facei] = neighbFaceAreas_[facei]/nbrMagSf;
227 calcFaceTol(*
this,
points(), faceCentres())
259 for (label patchPointI = 0; patchPointI <
nPoints(); patchPointI++)
261 label faceI = pointFaces()[patchPointI][0];
263 pointFace[patchPointI] = faceI;
265 const face&
f = localFaces()[faceI];
267 pointIndex[patchPointI] =
findIndex(f, patchPointI);
274 for (label patchEdgeI = 0; patchEdgeI < nEdges(); patchEdgeI++)
276 label faceI = edgeFaces()[patchEdgeI][0];
278 edgeFace[patchEdgeI] = faceI;
280 const labelList& fEdges = faceEdges()[faceI];
282 edgeIndex[patchEdgeI] =
findIndex(fEdges, patchEdgeI);
291 + 2*nEdges()*
sizeof(label)
334 labelList& neighbPoints = *neighbPointsPtr_;
336 forAll(nbrPointFace, nbrPointI)
339 const face&
f = localFaces()[nbrPointFace[nbrPointI]];
340 label index = (f.
size() - nbrPointIndex[nbrPointI]) % f.
size();
341 label patchPointI = f[index];
343 if (neighbPoints[patchPointI] == -1)
346 neighbPoints[patchPointI] = nbrPointI;
348 else if (neighbPoints[patchPointI] >= 0)
351 neighbPoints[patchPointI] = -2;
356 forAll(neighbPoints, patchPointI)
358 if (neighbPoints[patchPointI] == -2)
360 neighbPoints[patchPointI] = -1;
367 neighbEdgesPtr_ =
new labelList(nEdges(), -1);
368 labelList& neighbEdges = *neighbEdgesPtr_;
370 forAll(nbrEdgeFace, nbrEdgeI)
373 const labelList&
f = faceEdges()[nbrEdgeFace[nbrEdgeI]];
374 label index = (f.
size() - nbrEdgeIndex[nbrEdgeI] - 1) % f.
size();
375 label patchEdgeI = f[index];
377 if (neighbEdges[patchEdgeI] == -1)
380 neighbEdges[patchEdgeI] = nbrEdgeI;
382 else if (neighbEdges[patchEdgeI] >= 0)
385 neighbEdges[patchEdgeI] = -2;
390 forAll(neighbEdges, patchEdgeI)
392 if (neighbEdges[patchEdgeI] == -2)
394 neighbEdges[patchEdgeI] = -1;
406 if (!neighbPointsPtr_)
408 FatalErrorIn(
"processorPolyPatch::neighbPoints() const")
409 <<
"No extended addressing calculated for patch " <<
name()
412 return *neighbPointsPtr_;
418 if (!neighbEdgesPtr_)
421 <<
"No extended addressing calculated for patch " <<
name()
424 return *neighbEdgesPtr_;
442 Pout<<
"processorPolyPatch::order : Writing my " << pp.size()
443 <<
" faces to OBJ file " << nm <<
endl;
452 /
name() +
"_localFaceCentres.obj"
454 Pout<<
"processorPolyPatch::order : "
455 <<
"Dumping " << ctrs.size()
456 <<
" local faceCentres to " << localStr.
name() <<
endl;
474 toNeighbour << ctrs << anchors;
507 forAll(faceMap, patchFaceI)
509 faceMap[patchFaceI] = patchFaceI;
522 fromNeighbour >> masterCtrs >> masterAnchors;
531 if (debug || masterCtrs.
size() != pp.size())
537 /
name() +
"_nbrFaceCentres.obj"
539 Pout<<
"processorPolyPatch::order : "
540 <<
"Dumping neighbour faceCentres to " << nbrStr.
name()
544 writeOBJ(nbrStr, masterCtrs[faceI]);
548 if (masterCtrs.
size() != pp.size())
552 "processorPolyPatch::order(const primitivePatch&"
553 ", labelList&, labelList&) const"
554 ) <<
"in patch:" <<
name() <<
" : "
555 <<
"Local size of patch is " << pp.size() <<
" (faces)."
557 <<
"Received from neighbour " << masterCtrs.
size()
567 bool matchedAll =
false;
572 && (separation().size() == 1 || separation().size() == pp.size())
581 transformedCtrs = masterCtrs-v[0];
585 transformedCtrs = masterCtrs-v;
599 masterCtrs = transformedCtrs;
604 masterAnchors -= v[0];
615 && (forwardT().size() == 1 || forwardT().size() == pp.size())
632 masterCtrs = transformedCtrs;
643 matchedAll =
matchPoints(ctrs, masterCtrs, tols,
true, faceMap);
646 if (!matchedAll || debug)
654 Pout<<
"processorPolyPatch::order :"
655 <<
" Writing faces to OBJ file " << str.
name() <<
endl;
661 /
name() +
"_faceCentresConnections.obj"
664 Pout<<
"processorPolyPatch::order :"
665 <<
" Dumping newly found match as lines between"
666 <<
" corresponding face centres to OBJ file " << ccStr.
name()
673 label masterFaceI = faceMap[faceI];
675 if (masterFaceI != -1)
677 const point& c0 = masterCtrs[masterFaceI];
678 const point& c1 = ctrs[faceI];
688 "processorPolyPatch::order(const primitivePatch&"
689 ", labelList&, labelList&) const"
690 ) <<
"in patch:" <<
name() <<
" : "
691 <<
"Cannot match vectors to faces on both sides of patch"
693 <<
" masterCtrs[0]:" << masterCtrs[0] <<
endl
694 <<
" ctrs[0]:" << ctrs[0] <<
endl
695 <<
" Please check your topology changes or maybe you have"
696 <<
" multiple separated (from cyclics) processor patches"
698 <<
" Continuing with incorrect face ordering from now on!"
711 label newFaceI = faceMap[oldFaceI];
713 const point& wantedAnchor = masterAnchors[newFaceI];
715 rotation[newFaceI] = getRotation
723 if (rotation[newFaceI] == -1)
727 "processorPolyPatch::order(const primitivePatch&"
728 ", labelList&, labelList&) const"
729 ) <<
"in patch " <<
name()
731 <<
"Cannot find point on face " << pp[oldFaceI]
734 <<
" that matches point " << wantedAnchor
735 <<
" when matching the halves of processor patch " <<
name()
736 <<
"Continuing with incorrect face ordering from now on!"
745 if (faceMap[faceI] != faceI || rotation[faceI] != 0)