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
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_()
159 myProcNo_(pp.myProcNo_),
160 neighbProcNo_(pp.neighbProcNo_),
161 neighbFaceCentres_(),
163 neighbFaceCellCentres_()
171 nbrPointsPtr_.clear();
172 nbrEdgesPtr_.clear();
180 const label myProcNo,
181 const label neighbProcNo
196 UOPstream toNeighbProc(neighbProcNo(), pBufs);
201 << faceCellCentres();
211 UIPstream fromNeighbProc(neighbProcNo(), pBufs);
214 >> neighbFaceCentres_
216 >> neighbFaceCellCentres_;
223 vectorField nbrFaceNormals(neighbFaceAreas_.size());
229 forAll(faceNormals, facei)
231 scalar magSf = magFaceAreas()[facei];
232 scalar nbrMagSf =
mag(neighbFaceAreas_[facei]);
233 scalar avSf = (magSf + nbrMagSf)/2.0;
237 if (magSf < small || nbrMagSf < small)
241 faceNormals[facei] =
point(1, 0, 0);
242 nbrFaceNormals[facei] = -faceNormals[facei];
245 else if (
mag(magSf - nbrMagSf) > matchTolerance()*
sqr(tols[facei]))
249 boundaryMesh().
mesh().time().
path()/
name() +
"_faces.obj" 252 Pout<<
"processorPolyPatch::calcGeometry : Writing my " 253 << size() <<
" faces to " << patchOBJName <<
endl;
260 +
"_faceCentresConnections.obj" 263 Pout<<
"processorPolyPatch::calcGeometry :" 264 <<
" Dumping lines between corresponding face centres to " 267 writeOBJ(centresOBJName, neighbFaceCentres_, faceCentres());
270 <<
"face " << facei <<
" area does not match neighbour by " 271 << 100*
mag(magSf - nbrMagSf)/avSf
272 <<
"% -- possible face ordering problem." << endl
273 <<
"patch:" <<
name()
274 <<
" my area:" << magSf
275 <<
" neighbour area:" << nbrMagSf
276 <<
" matching tolerance:" 277 << matchTolerance()*
sqr(tols[facei])
279 <<
"Mesh face:" << start()+facei
283 <<
"If you are certain your matching is correct" 284 <<
" you can increase the 'matchTolerance' setting" 285 <<
" in the patch dictionary in the boundary file." 287 <<
"Rerun with processor debug flag set for" 292 faceNormals[facei] = faceAreas()[facei]/magSf;
293 nbrFaceNormals[facei] = neighbFaceAreas_[facei]/nbrMagSf;
331 for (
label patchPointi = 0; patchPointi <
nPoints(); patchPointi++)
333 label facei = pointFaces()[patchPointi][0];
335 pointFace[patchPointi] = facei;
337 const face&
f = localFaces()[facei];
339 pointIndex[patchPointi] =
findIndex(f, patchPointi);
346 for (
label patchEdgeI = 0; patchEdgeI < nEdges(); patchEdgeI++)
348 label facei = edgeFaces()[patchEdgeI][0];
350 edgeFace[patchEdgeI] = facei;
352 const labelList& fEdges = faceEdges()[facei];
354 edgeIndex[patchEdgeI] =
findIndex(fEdges, patchEdgeI);
357 UOPstream toNeighbProc(neighbProcNo(), pBufs);
373 nbrPointsPtr_.clear();
374 nbrEdgesPtr_.clear();
392 UIPstream fromNeighbProc(neighbProcNo(), pBufs);
410 forAll(nbrPointFace, nbrPointi)
413 const face&
f = localFaces()[nbrPointFace[nbrPointi]];
415 label index = (f.
size() - nbrPointIndex[nbrPointi]) % f.
size();
416 label patchPointi = f[index];
418 if (nbrPoints[patchPointi] == -1)
421 nbrPoints[patchPointi] = nbrPointi;
423 else if (nbrPoints[patchPointi] >= 0)
426 nbrPoints[patchPointi] = -2;
431 forAll(nbrPoints, patchPointi)
433 if (nbrPoints[patchPointi] == -2)
435 nbrPoints[patchPointi] = -1;
442 nbrEdgesPtr_.reset(
new labelList(nEdges(), -1));
445 forAll(nbrEdgeFace, nbrEdgeI)
448 const labelList&
f = faceEdges()[nbrEdgeFace[nbrEdgeI]];
449 label index = (f.
size() - nbrEdgeIndex[nbrEdgeI] - 1) % f.
size();
450 label patchEdgeI = f[index];
452 if (nbrEdges[patchEdgeI] == -1)
455 nbrEdges[patchEdgeI] = nbrEdgeI;
457 else if (nbrEdges[patchEdgeI] >= 0)
460 nbrEdges[patchEdgeI] = -2;
465 forAll(nbrEdges, patchEdgeI)
467 if (nbrEdges[patchEdgeI] == -2)
469 nbrEdges[patchEdgeI] = -1;
482 if (!nbrPointsPtr_.valid())
485 <<
"No extended addressing calculated for patch " <<
name()
488 return nbrPointsPtr_();
494 if (!nbrEdgesPtr_.valid())
497 <<
"No extended addressing calculated for patch " <<
name()
500 return nbrEdgesPtr_();
520 coupledPolyPatch::debug
532 UOPstream toNeighbour(neighbProcNo(), pBufs);
533 toNeighbour << ownToNbr;
534 if (coupledPolyPatch::debug)
536 toNeighbour << ownToNbrDebugPtr();
558 coupledPolyPatch::debug
565 UIPstream fromOwner(neighbProcNo(), pBufs);
566 fromOwner >> ownToNbr;
568 if (coupledPolyPatch::debug)
570 fromOwner >> ownToNbrDebugPtr();
571 ownToNbrDebugPtr->transform(
transform());
591 writeEntry(os,
"neighbProcNo", neighbProcNo_);
virtual bool order(const ownToNbrOrderData &ownToNbr, const autoPtr< ownToNbrDebugOrderData > &ownToNbrDebugPtr, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for the given primitivePatch.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
const labelList & nbrPoints() const
Return neighbour point labels. WIP.
const labelList & nbrEdges() const
Return neighbour edge labels. WIP.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void transform(const transformer &tr)
void size(const label)
Override size to be inconsistent with allocated storage.
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialise ordering for primitivePatch. Does not.
static word newName(const label myProcNo, const label neighbProcNo)
Return the name of a processorPolyPatch.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
Determine correspondence between points. See below.
Macros for easy insertion into run-time selection tables.
virtual void movePoints(PstreamBuffers &, const pointField &p)
Correct patches after moving points.
Neighbour processor patch.
void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
virtual void initOrder(ownToNbrOrderData &ownToNbr, autoPtr< ownToNbrDebugOrderData > &ownToNbrDebugPtr, const primitivePatch &) const
Initialise ordering for the given primitivePatch. Fills the.
Data to pass from owner.initOrder to nbr.order if debugging.
Input inter-processor communications stream operating on external buffer.
A list of faces which address into the list of points.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
A class for handling words, derived from string.
Data to pass from owner.initOrder to nbr.order.
word name() const
Return file name (part beyond last /)
virtual ~processorPolyPatch()
Destructor.
List< label > labelList
A List of labels.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
errorManip< error > abort(error &err)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Output inter-processor communications stream operating on external buffer.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
word name(const complex &)
Return a string representation of a complex.
Template functions to aid in the implementation of demand driven data.
static bool & parRun()
Is this a parallel run?
vector point
Point is a vector.
prefixOSstream Pout(cout, "Pout")
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.
A List with indirect addressing.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
dimensionSet transform(const dimensionSet &)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())