57 const int neighbProcNo
62 neighbProcNo_(neighbProcNo),
65 neighbFaceCellCentres_()
76 const int neighbProcNo
81 newName(myProcNo, neighbProcNo),
88 neighbProcNo_(neighbProcNo),
91 neighbFaceCellCentres_()
106 neighbFaceCentres_(),
108 neighbFaceCellCentres_()
119 myProcNo_(pp.myProcNo_),
120 neighbProcNo_(pp.neighbProcNo_),
121 neighbFaceCentres_(),
123 neighbFaceCellCentres_()
137 myProcNo_(pp.myProcNo_),
138 neighbProcNo_(pp.neighbProcNo_),
139 neighbFaceCentres_(),
141 neighbFaceCellCentres_()
149 nbrPointsPtr_.clear();
150 nbrEdgesPtr_.clear();
158 const label myProcNo,
159 const label neighbProcNo
174 UOPstream toNeighbProc(neighbProcNo(), pBufs);
179 << faceCellCentres();
189 UIPstream fromNeighbProc(neighbProcNo(), pBufs);
192 >> neighbFaceCentres_
194 >> neighbFaceCellCentres_;
201 vectorField nbrFaceNormals(neighbFaceAreas_.size());
207 forAll(faceNormals, facei)
209 scalar magSf = magFaceAreas()[facei];
210 scalar nbrMagSf =
mag(neighbFaceAreas_[facei]);
211 scalar avSf = (magSf + nbrMagSf)/2.0;
215 if (magSf < small || nbrMagSf < small)
219 faceNormals[facei] =
point(1, 0, 0);
220 nbrFaceNormals[facei] = -faceNormals[facei];
223 else if (
mag(magSf - nbrMagSf) > matchTolerance()*
sqr(tols[facei]))
230 Pout<<
"processorPolyPatch::calcGeometry : Writing my "
231 << size() <<
" faces to " << patchOBJName <<
endl;
238 +
"_faceCentresConnections.obj"
241 Pout<<
"processorPolyPatch::calcGeometry :"
242 <<
" Dumping lines between corresponding face centres to "
245 writeOBJ(centresOBJName, neighbFaceCentres_, faceCentres());
248 <<
"face " << facei <<
" area does not match neighbour by "
249 << 100*
mag(magSf - nbrMagSf)/avSf
250 <<
"% -- possible face ordering problem." <<
endl
251 <<
"patch:" <<
name()
252 <<
" my area:" << magSf
253 <<
" neighbour area:" << nbrMagSf
254 <<
" matching tolerance:"
255 << matchTolerance()*
sqr(tols[facei])
257 <<
"Mesh face:" << start()+facei
261 <<
"If you are certain your matching is correct"
262 <<
" you can increase the 'matchTolerance' setting"
263 <<
" in the patch dictionary in the boundary file."
265 <<
"Rerun with processor debug flag set for"
270 faceNormals[facei] = faceAreas()[facei]/magSf;
271 nbrFaceNormals[facei] = neighbFaceAreas_[facei]/nbrMagSf;
309 for (
label patchPointi = 0; patchPointi <
nPoints(); patchPointi++)
311 label facei = pointFaces()[patchPointi][0];
313 pointFace[patchPointi] = facei;
315 const face&
f = localFaces()[facei];
317 pointIndex[patchPointi] =
findIndex(
f, patchPointi);
324 for (
label patchEdgeI = 0; patchEdgeI < nEdges(); patchEdgeI++)
326 label facei = edgeFaces()[patchEdgeI][0];
328 edgeFace[patchEdgeI] = facei;
330 const labelList& fEdges = faceEdges()[facei];
332 edgeIndex[patchEdgeI] =
findIndex(fEdges, patchEdgeI);
335 UOPstream toNeighbProc(neighbProcNo(), pBufs);
351 nbrPointsPtr_.clear();
352 nbrEdgesPtr_.clear();
370 UIPstream fromNeighbProc(neighbProcNo(), pBufs);
388 forAll(nbrPointFace, nbrPointi)
391 const face&
f = localFaces()[nbrPointFace[nbrPointi]];
394 label patchPointi =
f[index];
396 if (nbrPoints[patchPointi] == -1)
399 nbrPoints[patchPointi] = nbrPointi;
401 else if (nbrPoints[patchPointi] >= 0)
404 nbrPoints[patchPointi] = -2;
409 forAll(nbrPoints, patchPointi)
411 if (nbrPoints[patchPointi] == -2)
413 nbrPoints[patchPointi] = -1;
420 nbrEdgesPtr_.reset(
new labelList(nEdges(), -1));
423 forAll(nbrEdgeFace, nbrEdgeI)
426 const labelList&
f = faceEdges()[nbrEdgeFace[nbrEdgeI]];
428 label patchEdgeI =
f[index];
430 if (nbrEdges[patchEdgeI] == -1)
433 nbrEdges[patchEdgeI] = nbrEdgeI;
435 else if (nbrEdges[patchEdgeI] >= 0)
438 nbrEdges[patchEdgeI] = -2;
443 forAll(nbrEdges, patchEdgeI)
445 if (nbrEdges[patchEdgeI] == -2)
447 nbrEdges[patchEdgeI] = -1;
460 if (!nbrPointsPtr_.valid())
463 <<
"No extended addressing calculated for patch " <<
name()
466 return nbrPointsPtr_();
472 if (!nbrEdgesPtr_.valid())
475 <<
"No extended addressing calculated for patch " <<
name()
478 return nbrEdgesPtr_();
498 coupledPolyPatch::debug
510 UOPstream toNeighbour(neighbProcNo(), pBufs);
511 toNeighbour << ownToNbr;
512 if (coupledPolyPatch::debug)
514 toNeighbour << ownToNbrDebugPtr();
536 coupledPolyPatch::debug
543 UIPstream fromOwner(neighbProcNo(), pBufs);
544 fromOwner >> ownToNbr;
546 if (coupledPolyPatch::debug)
548 fromOwner >> ownToNbrDebugPtr();
549 ownToNbrDebugPtr->transform(
transform());
569 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,...
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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.
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.
processorPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const int myProcNo, const int neighbProcNo)
Construct from components with specified name.
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.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
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.
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
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.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void transform(GeometricField< Type, GeoMesh > &rtf, const GeometricField< tensor, GeoMesh > &trf, const GeometricField< Type, GeoMesh > &tf)
errorManip< error > abort(error &err)
vector point
Point is a vector.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
prefixOSstream Pout(cout, "Pout")
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
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)