78 nbrPatch().faceCentres(),
79 nbrPatch().faceAreas(),
123 nbrPatch().nbrPatchName_ = newNames[index()];
130 if (nbrPatchID_ != -1)
132 nbrPatchID_ =
findIndex(newToOldIndex, nbrPatchID_);
146 const word& patchType
153 coupledPointsPtr_(
nullptr),
154 coupledEdgesPtr_(
nullptr),
155 ownToNbrOrderDataPtr_(
nullptr),
156 ownToNbrCyclicOrderDataPtr_(
nullptr),
157 ownToNbrDebugOrderDataPtr_(
nullptr)
168 const word& patchType,
169 const word& nbrPatchName,
175 nbrPatchName_(nbrPatchName),
177 coupledPointsPtr_(
nullptr),
178 coupledEdgesPtr_(
nullptr),
179 ownToNbrOrderDataPtr_(
nullptr),
180 ownToNbrCyclicOrderDataPtr_(
nullptr),
181 ownToNbrDebugOrderDataPtr_(
nullptr)
191 const word& patchType,
192 const bool cyclicTransformDefaultIsNone
200 coupledPointsPtr_(
nullptr),
201 coupledEdgesPtr_(
nullptr),
202 ownToNbrOrderDataPtr_(
nullptr),
203 ownToNbrCyclicOrderDataPtr_(
nullptr),
204 ownToNbrDebugOrderDataPtr_(
nullptr)
211 ) <<
"No \"neighbourPatch\" provided." <<
endl 215 if (nbrPatchName_ == name)
218 <<
"Neighbour patch name " << nbrPatchName_
219 <<
" cannot be the same as this patch " << name
236 nbrPatchName_(pp.nbrPatchName_),
237 coupleGroup_(pp.coupleGroup_),
239 coupledPointsPtr_(
nullptr),
240 coupledEdgesPtr_(
nullptr),
241 ownToNbrOrderDataPtr_(
nullptr),
242 ownToNbrCyclicOrderDataPtr_(
nullptr),
243 ownToNbrDebugOrderDataPtr_(
nullptr)
256 const label newStart,
262 nbrPatchName_(neiName),
263 coupleGroup_(pp.coupleGroup_),
265 coupledPointsPtr_(
nullptr),
266 coupledEdgesPtr_(
nullptr),
267 ownToNbrOrderDataPtr_(
nullptr),
268 ownToNbrCyclicOrderDataPtr_(
nullptr),
269 ownToNbrDebugOrderDataPtr_(
nullptr)
271 if (neiName ==
name())
274 <<
"Neighbour patch name " << neiName
275 <<
" cannot be the same as this patch " <<
name()
295 nbrPatchName_(pp.nbrPatchName_),
296 coupleGroup_(pp.coupleGroup_),
298 coupledPointsPtr_(
nullptr),
299 coupledEdgesPtr_(
nullptr),
300 ownToNbrOrderDataPtr_(
nullptr),
301 ownToNbrCyclicOrderDataPtr_(
nullptr),
302 ownToNbrDebugOrderDataPtr_(
nullptr)
319 if (nbrPatchName_.empty())
322 label patchID = coupleGroup_.findOtherPatchID(*
this);
324 nbrPatchName_ = boundaryMesh()[patchID].name();
326 return nbrPatchName_;
332 if (nbrPatchID_ == -1)
334 nbrPatchID_ = this->boundaryMesh().findPatchID(nbrPatchName());
336 if (nbrPatchID_ == -1)
339 <<
"Illegal neighbourPatch name " << nbrPatchName()
340 <<
endl <<
"Valid patch names are " 341 << this->boundaryMesh().names()
348 this->boundaryMesh()[nbrPatchID_]
354 <<
"Patch " <<
name()
355 <<
" specifies neighbour patch " << nbrPatchName()
356 <<
endl <<
" but that in return specifies " 367 if (!coupledPointsPtr_)
369 const faceList& nbrLocalFaces = nbrPatch().localFaces();
370 const labelList& nbrMeshPoints = nbrPatch().meshPoints();
381 const face& fA = localFaces()[patchFacei];
382 const face& fB = nbrLocalFaces[patchFacei];
386 label patchPointA = fA[indexA];
388 if (coupledPoint[patchPointA] == -1)
393 if (meshPoints()[patchPointA] != nbrMeshPoints[fB[indexB]])
395 coupledPoint[patchPointA] = fB[indexB];
402 edgeList& connected = *coupledPointsPtr_;
405 label connectedI = 0;
409 if (coupledPoint[i] != -1)
411 connected[connectedI++] =
edge(i, coupledPoint[i]);
421 boundaryMesh().
mesh().time().path()
422 /
name() +
"_coupledPoints.obj" 426 Pout<<
"Writing file " << str.
name() <<
" with coordinates of " 427 <<
"coupled points" <<
endl;
431 const point& a =
points()[meshPoints()[connected[i][0]]];
432 const point&
b =
points()[nbrMeshPoints[connected[i][1]]];
434 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
435 str<<
"v " << b.
x() <<
' ' << b.
y() <<
' ' << b.
z() <<
nl;
438 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
442 return *coupledPointsPtr_;
448 if (!coupledEdgesPtr_)
450 const edgeList& pointCouples = coupledPoints();
457 const edge&
e = pointCouples[i];
459 aToB.insert(e[0], e[1]);
467 const labelList& fEdges = faceEdges()[patchFacei];
471 label edgeI = fEdges[i];
473 const edge&
e = edges()[edgeI];
477 if (fnd0 != aToB.
end())
480 if (fnd1 != aToB.
end())
497 edgeList& coupledEdges = *coupledEdgesPtr_;
500 forAll(nbrPatch, patchFacei)
506 label edgeI = fEdges[i];
513 if (iter != edgeMap.
end())
515 label edgeA = iter();
516 const edge& eA = edges()[edgeA];
521 edge(mp[eA[0]], mp[eA[1]])
522 !=
edge(nbrMp[e[0]], nbrMp[e[1]])
525 coupledEdges[coupleI++] =
edge(edgeA, edgeI);
533 coupledEdges.setSize(coupleI);
540 const edge&
e = coupledEdges[i];
542 if (e[0] < 0 || e[1] < 0)
545 <<
"Problem : at position " << i
546 <<
" illegal couple:" << e
555 boundaryMesh().
mesh().time().path()
556 /
name() +
"_coupledEdges.obj" 560 Pout<<
"Writing file " << str.
name() <<
" with centres of " 561 <<
"coupled edges" <<
endl;
565 const edge&
e = coupledEdges[i];
567 const point& a = edges()[e[0]].
centre(localPoints());
573 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
574 str<<
"v " << b.
x() <<
' ' << b.
y() <<
' ' << b.
z() <<
nl;
577 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
581 return *coupledEdgesPtr_;
599 if (coupledPolyPatch::debug)
606 ownToNbrOrderDataPtr_(),
607 ownToNbrDebugOrderDataPtr_,
613 ownToNbrCyclicOrderDataPtr_ =
new ownToNbrCyclicOrderData();
614 ownToNbrCyclicOrderDataPtr_->ctr =
616 ownToNbrCyclicOrderDataPtr_->area =
sum(pp.
faceAreas());
639 ownToNbr = nbrPatch().ownToNbrOrderDataPtr_();
640 ownToNbrDebugPtr = nbrPatch().ownToNbrDebugOrderDataPtr_;
649 pointField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->ctr),
650 vectorField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->area),
656 if (ownToNbrDebugPtr.
valid())
658 ownToNbrDebugPtr->transform(ct.transform());
678 if (!nbrPatchName_.empty())
680 writeEntry(os,
"neighbourPatch", nbrPatchName_);
683 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.
virtual void initTopoChange(PstreamBuffers &)
Initialise the update of the patch topology.
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.
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.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
Ostream & endl(Ostream &os)
Add newline and flush stream.
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...
cyclicPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
virtual void topoChange(PstreamBuffers &)
Update of the patch topology.
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 void initTopoChange(PstreamBuffers &)
Initialise the update of the patch topology.
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
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.
bool insert(const edge &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
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.
virtual void rename(const wordList &newNames)
Reset the patch name.
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...
A class for handling words, derived from string.
Data to pass from owner.initOrder to nbr.order.
virtual void rename(const wordList &newNames)
Reset the patch name.
static const word null
An empty word.
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
const dimensionedScalar mp
Proton mass.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
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)
Map from edge (expressed as its endpoints) to value.
defineTypeNameAndDebug(combustionModel, 0)
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.
virtual void topoChange(PstreamBuffers &)
Update of the patch topology.
void setSize(const label)
Reset size of List.
Template functions to aid in the implementation of demand driven data.
virtual void movePoints(const pointField &p)
Correct patches after moving points.
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
Initialise 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.