78 nbrPatch().faceCentres(),
79 nbrPatch().faceAreas(),
129 const word& patchType
136 coupledPointsPtr_(
nullptr),
137 coupledEdgesPtr_(
nullptr),
138 ownToNbrOrderDataPtr_(
nullptr),
139 ownToNbrCyclicOrderDataPtr_(
nullptr),
140 ownToNbrDebugOrderDataPtr_(
nullptr)
154 const word& patchType,
155 const word& nbrPatchName
160 nbrPatchName_(nbrPatchName),
162 coupledPointsPtr_(
nullptr),
163 coupledEdgesPtr_(
nullptr),
164 ownToNbrOrderDataPtr_(
nullptr),
165 ownToNbrCyclicOrderDataPtr_(
nullptr),
166 ownToNbrDebugOrderDataPtr_(
nullptr)
179 const word& patchType
187 coupledPointsPtr_(
nullptr),
188 coupledEdgesPtr_(
nullptr),
189 ownToNbrOrderDataPtr_(
nullptr),
190 ownToNbrCyclicOrderDataPtr_(
nullptr),
191 ownToNbrDebugOrderDataPtr_(
nullptr)
198 ) <<
"No \"neighbourPatch\" provided." <<
endl 202 if (nbrPatchName_ == name)
205 <<
"Neighbour patch name " << nbrPatchName_
206 <<
" cannot be the same as this patch " << name
223 nbrPatchName_(pp.nbrPatchName_),
224 coupleGroup_(pp.coupleGroup_),
226 coupledPointsPtr_(
nullptr),
227 coupledEdgesPtr_(
nullptr),
228 ownToNbrOrderDataPtr_(
nullptr),
229 ownToNbrCyclicOrderDataPtr_(
nullptr),
230 ownToNbrDebugOrderDataPtr_(
nullptr)
243 const label newStart,
249 nbrPatchName_(neiName),
250 coupleGroup_(pp.coupleGroup_),
252 coupledPointsPtr_(
nullptr),
253 coupledEdgesPtr_(
nullptr),
254 ownToNbrOrderDataPtr_(
nullptr),
255 ownToNbrCyclicOrderDataPtr_(
nullptr),
256 ownToNbrDebugOrderDataPtr_(
nullptr)
258 if (neiName ==
name())
261 <<
"Neighbour patch name " << neiName
262 <<
" cannot be the same as this patch " <<
name()
282 nbrPatchName_(pp.nbrPatchName_),
283 coupleGroup_(pp.coupleGroup_),
285 coupledPointsPtr_(
nullptr),
286 coupledEdgesPtr_(
nullptr),
287 ownToNbrOrderDataPtr_(
nullptr),
288 ownToNbrCyclicOrderDataPtr_(
nullptr),
289 ownToNbrDebugOrderDataPtr_(
nullptr)
306 if (nbrPatchName_.empty())
309 label patchID = coupleGroup_.findOtherPatchID(*
this);
313 return nbrPatchName_;
319 if (nbrPatchID_ == -1)
321 nbrPatchID_ = this->
boundaryMesh().findPatchID(nbrPatchName());
323 if (nbrPatchID_ == -1)
326 <<
"Illegal neighbourPatch name " << nbrPatchName()
327 <<
endl <<
"Valid patch names are " 341 <<
"Patch " <<
name()
342 <<
" specifies neighbour patch " << nbrPatchName()
343 <<
endl <<
" but that in return specifies " 354 if (!coupledPointsPtr_)
356 const faceList& nbrLocalFaces = nbrPatch().localFaces();
357 const labelList& nbrMeshPoints = nbrPatch().meshPoints();
368 const face& fA = localFaces()[patchFacei];
369 const face& fB = nbrLocalFaces[patchFacei];
373 label patchPointA = fA[indexA];
375 if (coupledPoint[patchPointA] == -1)
380 if (meshPoints()[patchPointA] != nbrMeshPoints[fB[indexB]])
382 coupledPoint[patchPointA] = fB[indexB];
389 edgeList& connected = *coupledPointsPtr_;
392 label connectedI = 0;
396 if (coupledPoint[i] != -1)
398 connected[connectedI++] =
edge(i, coupledPoint[i]);
409 /
name() +
"_coupledPoints.obj" 413 Pout<<
"Writing file " << str.
name() <<
" with coordinates of " 414 <<
"coupled points" <<
endl;
418 const point& a =
points()[meshPoints()[connected[i][0]]];
419 const point&
b =
points()[nbrMeshPoints[connected[i][1]]];
421 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
422 str<<
"v " << b.
x() <<
' ' << b.
y() <<
' ' << b.
z() <<
nl;
425 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
429 return *coupledPointsPtr_;
435 if (!coupledEdgesPtr_)
437 const edgeList& pointCouples = coupledPoints();
444 const edge&
e = pointCouples[i];
446 aToB.insert(e[0], e[1]);
454 const labelList& fEdges = faceEdges()[patchFacei];
458 label edgeI = fEdges[i];
460 const edge&
e = edges()[edgeI];
464 if (fnd0 != aToB.
end())
467 if (fnd1 != aToB.
end())
484 edgeList& coupledEdges = *coupledEdgesPtr_;
487 forAll(nbrPatch, patchFacei)
493 label edgeI = fEdges[i];
500 if (iter != edgeMap.
end())
502 label edgeA = iter();
503 const edge& eA = edges()[edgeA];
508 edge(mp[eA[0]], mp[eA[1]])
509 !=
edge(nbrMp[e[0]], nbrMp[e[1]])
512 coupledEdges[coupleI++] =
edge(edgeA, edgeI);
520 coupledEdges.setSize(coupleI);
527 const edge&
e = coupledEdges[i];
529 if (e[0] < 0 || e[1] < 0)
532 <<
"Problem : at position " << i
533 <<
" illegal couple:" << e
543 /
name() +
"_coupledEdges.obj" 547 Pout<<
"Writing file " << str.
name() <<
" with centres of " 548 <<
"coupled edges" <<
endl;
552 const edge&
e = coupledEdges[i];
554 const point& a = edges()[e[0]].
centre(localPoints());
560 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
561 str<<
"v " << b.
x() <<
' ' << b.
y() <<
' ' << b.
z() <<
nl;
564 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
568 return *coupledEdgesPtr_;
586 if (coupledPolyPatch::debug)
593 ownToNbrOrderDataPtr_(),
594 ownToNbrDebugOrderDataPtr_,
600 ownToNbrCyclicOrderDataPtr_ =
new ownToNbrCyclicOrderData();
601 ownToNbrCyclicOrderDataPtr_->ctr =
603 ownToNbrCyclicOrderDataPtr_->area =
sum(pp.
faceAreas());
626 ownToNbr = nbrPatch().ownToNbrOrderDataPtr_();
627 ownToNbrDebugPtr = nbrPatch().ownToNbrDebugOrderDataPtr_;
636 pointField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->ctr),
637 vectorField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->area),
643 if (ownToNbrDebugPtr.
valid())
645 ownToNbrDebugPtr->transform(ct.transform());
665 if (!nbrPatchName_.empty())
667 writeEntry(os,
"neighbourPatch", nbrPatchName_);
670 coupleGroup_.write(os);
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
static bool valid(char)
Is this character valid for a word.
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
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.
const Field< PointType > & faceCentres() const
Return face centres for patch.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Unit conversion functions.
void transform(const transformer &tr)
void size(const label)
Override size to be inconsistent with allocated storage.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
const word & nbrPatchName() const
Neighbour patch name.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
const dimensionedScalar & mp
Proton mass.
cyclicPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
const edgeList & coupledEdges() const
Return connected edges (from patch local to neighbour patch local).
const fileName & name() const
Return the name of the stream.
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
label size() const
Return number of elements in table.
Determine correspondence between points. See below.
const Field< PointType > & faceAreas() const
Return face areas for patch.
Macros for easy insertion into run-time selection tables.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
virtual void movePoints(PstreamBuffers &, const pointField &p)
Correct patches after moving points.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
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.
A list of faces which address into the list of points.
vectorField pointField
pointField is a vectorField.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const dimensionedScalar & b
Wien displacement law constant: default SI units: [m K].
A class for handling words, derived from string.
Data to pass from owner.initOrder to nbr.order.
static const word null
An empty word.
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
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...
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
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.
void setSize(const label)
Reset size of List.
Template functions to aid in the implementation of demand driven data.
virtual ~cyclicPolyPatch()
Destructor.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
virtual void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
prefixOSstream Pout(cout, "Pout")
const labelListList & faceEdges() const
Return face-edge addressing.
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
const doubleScalar e
Elementary charge.
virtual void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
void deleteDemandDrivenData(DataPtr &dataPtr)
virtual label nbrPatchID() const
Neighbour patchID.
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())