57 const int neighbProcNo,
63 neighbProcNo_(neighbProcNo),
66 neighbFaceCellCentres_()
77 const int neighbProcNo,
83 newName(myProcNo, neighbProcNo),
91 neighbProcNo_(neighbProcNo),
94 neighbFaceCellCentres_()
104 const word& patchType
108 myProcNo_(
dict.lookup<
label>(
"myProcNo")),
109 neighbProcNo_(
dict.lookup<
label>(
"neighbProcNo")),
110 neighbFaceCentres_(),
112 neighbFaceCellCentres_()
123 myProcNo_(pp.myProcNo_),
124 neighbProcNo_(pp.neighbProcNo_),
125 neighbFaceCentres_(),
127 neighbFaceCellCentres_()
141 myProcNo_(pp.myProcNo_),
142 neighbProcNo_(pp.neighbProcNo_),
143 neighbFaceCentres_(),
145 neighbFaceCellCentres_()
153 nbrPointsPtr_.clear();
154 nbrEdgesPtr_.clear();
162 const label myProcNo,
163 const label neighbProcNo
178 UOPstream toNeighbProc(neighbProcNo(), pBufs);
183 << faceCellCentres();
193 UIPstream fromNeighbProc(neighbProcNo(), pBufs);
196 >> neighbFaceCentres_
198 >> neighbFaceCellCentres_;
205 vectorField nbrFaceNormals(neighbFaceAreas_.size());
211 forAll(faceNormals, facei)
213 scalar magSf = magFaceAreas()[facei];
214 scalar nbrMagSf =
mag(neighbFaceAreas_[facei]);
215 scalar avSf = (magSf + nbrMagSf)/2.0;
219 if (magSf < small || nbrMagSf < small)
223 faceNormals[facei] =
point(1, 0, 0);
224 nbrFaceNormals[facei] = -faceNormals[facei];
227 else if (
mag(magSf - nbrMagSf) > matchTolerance()*
sqr(tols[facei]))
231 boundaryMesh().mesh().time().path()/
name() +
"_faces.obj"
234 Pout<<
"processorPolyPatch::calcGeometry : Writing my "
235 << size() <<
" faces to " << patchOBJName <<
endl;
241 boundaryMesh().mesh().time().path()/
name()
242 +
"_faceCentresConnections.obj"
245 Pout<<
"processorPolyPatch::calcGeometry :"
246 <<
" Dumping lines between corresponding face centres to "
249 writeOBJ(centresOBJName, neighbFaceCentres_, faceCentres());
252 <<
"face " << facei <<
" area does not match neighbour by "
253 << 100*
mag(magSf - nbrMagSf)/avSf
254 <<
"% -- possible face ordering problem." <<
endl
255 <<
"patch:" <<
name()
256 <<
" my area:" << magSf
257 <<
" neighbour area:" << nbrMagSf
258 <<
" matching tolerance:"
259 << matchTolerance()*
sqr(tols[facei])
261 <<
"Mesh face:" << start()+facei
265 <<
"If you are certain your matching is correct"
266 <<
" you can increase the 'matchTolerance' setting"
267 <<
" in the patch dictionary in the boundary file."
269 <<
"Rerun with processor debug flag set for"
274 faceNormals[facei] = faceAreas()[facei]/magSf;
275 nbrFaceNormals[facei] = neighbFaceAreas_[facei]/nbrMagSf;
313 for (
label patchPointi = 0; patchPointi <
nPoints(); patchPointi++)
315 label facei = pointFaces()[patchPointi][0];
317 pointFace[patchPointi] = facei;
319 const face&
f = localFaces()[facei];
321 pointIndex[patchPointi] =
findIndex(
f, patchPointi);
328 for (
label patchEdgeI = 0; patchEdgeI < nEdges(); patchEdgeI++)
330 label facei = edgeFaces()[patchEdgeI][0];
332 edgeFace[patchEdgeI] = facei;
334 const labelList& fEdges = faceEdges()[facei];
336 edgeIndex[patchEdgeI] =
findIndex(fEdges, patchEdgeI);
339 UOPstream toNeighbProc(neighbProcNo(), pBufs);
355 nbrPointsPtr_.clear();
356 nbrEdgesPtr_.clear();
374 UIPstream fromNeighbProc(neighbProcNo(), pBufs);
392 forAll(nbrPointFace, nbrPointi)
395 const face&
f = localFaces()[nbrPointFace[nbrPointi]];
398 label patchPointi =
f[index];
400 if (nbrPoints[patchPointi] == -1)
403 nbrPoints[patchPointi] = nbrPointi;
405 else if (nbrPoints[patchPointi] >= 0)
408 nbrPoints[patchPointi] = -2;
413 forAll(nbrPoints, patchPointi)
415 if (nbrPoints[patchPointi] == -2)
417 nbrPoints[patchPointi] = -1;
424 nbrEdgesPtr_.reset(
new labelList(nEdges(), -1));
427 forAll(nbrEdgeFace, nbrEdgeI)
430 const labelList&
f = faceEdges()[nbrEdgeFace[nbrEdgeI]];
432 label patchEdgeI =
f[index];
434 if (nbrEdges[patchEdgeI] == -1)
437 nbrEdges[patchEdgeI] = nbrEdgeI;
439 else if (nbrEdges[patchEdgeI] >= 0)
442 nbrEdges[patchEdgeI] = -2;
447 forAll(nbrEdges, patchEdgeI)
449 if (nbrEdges[patchEdgeI] == -2)
451 nbrEdges[patchEdgeI] = -1;
464 if (!nbrPointsPtr_.valid())
467 <<
"No extended addressing calculated for patch " <<
name()
470 return nbrPointsPtr_();
476 if (!nbrEdgesPtr_.valid())
479 <<
"No extended addressing calculated for patch " <<
name()
482 return nbrEdgesPtr_();
502 coupledPolyPatch::debug
514 UOPstream toNeighbour(neighbProcNo(), pBufs);
515 toNeighbour << ownToNbr;
516 if (coupledPolyPatch::debug)
518 toNeighbour << ownToNbrDebugPtr();
540 coupledPolyPatch::debug
547 UIPstream fromOwner(neighbProcNo(), pBufs);
548 fromOwner >> ownToNbr;
550 if (coupledPolyPatch::debug)
552 fromOwner >> ownToNbrDebugPtr();
553 ownToNbrDebugPtr->transform(
transform());
573 writeEntry(os,
"neighbProcNo", neighbProcNo_);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of faces which address into the list of points.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Input inter-processor communications stream operating on external buffer.
A List with indirect addressing.
Output inter-processor communications stream operating on external buffer.
static bool & parRun()
Is this a parallel run?
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
virtual bool order(const ownToNbrOrderData &ownToNbr, const autoPtr< ownToNbrDebugOrderData > &ownToNbrDebugPtr, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for the given primitivePatch.
virtual void initOrder(ownToNbrOrderData &ownToNbr, autoPtr< ownToNbrDebugOrderData > &ownToNbrDebugPtr, const primitivePatch &) const
Initialise ordering for the given primitivePatch. Fills the.
A list of keyword definitions, which are a keyword followed by any number of values (e....
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
word name() const
Return file name (part beyond last /)
A patch is a list of labels that address the faces in the global face list.
virtual void movePoints(const pointField &p)
Correct patches after moving points.
virtual void initTopoChange(PstreamBuffers &)
Initialise the update of the patch topology.
virtual void topoChange(PstreamBuffers &)
Update of the patch topology.
Neighbour processor patch.
processorPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const int myProcNo, const int neighbProcNo, const word &patchType=typeName)
Construct from components with specified name.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
virtual ~processorPolyPatch()
Destructor.
void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialise ordering for primitivePatch. Does not.
void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
const labelList & nbrPoints() const
Return neighbour point labels. WIP.
const labelList & nbrEdges() const
Return neighbour edge labels. WIP.
static word newName(const label myProcNo, const label neighbProcNo)
Return the name of a processorPolyPatch.
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
virtual void initTopoChange(PstreamBuffers &)
Initialise the update of the patch topology.
virtual void topoChange(PstreamBuffers &)
Update of the patch topology.
A class for handling words, derived from string.
Template functions to aid in the implementation of demand driven data.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Determine correspondence between points. See below.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
vector point
Point is a vector.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensionSet transform(const dimensionSet &)
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
prefixOSstream Pout(cout, "Pout")
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
word name(const complex &)
Return a string representation of a complex.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Data to pass from owner.initOrder to nbr.order if debugging.
Data to pass from owner.initOrder to nbr.order.
void transform(const transformer &tr)