77 nbrPatch().faceCentres(),
78 nbrPatch().faceAreas(),
122 nbrPatch().nbrPatchName_ = newNames[index()];
129 if (nbrPatchIndex_ != -1)
131 nbrPatchIndex_ =
findIndex(newToOldIndex, nbrPatchIndex_);
149 nbrPatchName_(
word::null),
151 coupledPointsPtr_(nullptr),
152 coupledEdgesPtr_(nullptr),
153 ownToNbrOrderDataPtr_(nullptr),
154 ownToNbrCyclicOrderDataPtr_(nullptr),
155 ownToNbrDebugOrderDataPtr_(nullptr)
166 const word& nbrPatchName,
172 nbrPatchName_(nbrPatchName),
174 coupledPointsPtr_(nullptr),
175 coupledEdgesPtr_(nullptr),
176 ownToNbrOrderDataPtr_(nullptr),
177 ownToNbrCyclicOrderDataPtr_(nullptr),
178 ownToNbrDebugOrderDataPtr_(nullptr)
188 const bool cyclicTransformDefaultIsNone
193 nbrPatchName_(
dict.lookupOrDefault(
"neighbourPatch",
word::null)),
196 coupledPointsPtr_(nullptr),
197 coupledEdgesPtr_(nullptr),
198 ownToNbrOrderDataPtr_(nullptr),
199 ownToNbrCyclicOrderDataPtr_(nullptr),
200 ownToNbrDebugOrderDataPtr_(nullptr)
207 ) <<
"No \"neighbourPatch\" provided." <<
endl
211 if (nbrPatchName_ ==
name)
214 <<
"Neighbour patch name " << nbrPatchName_
215 <<
" cannot be the same as this patch " <<
name
232 nbrPatchName_(pp.nbrPatchName_),
233 coupleGroup_(pp.coupleGroup_),
235 coupledPointsPtr_(nullptr),
236 coupledEdgesPtr_(nullptr),
237 ownToNbrOrderDataPtr_(nullptr),
238 ownToNbrCyclicOrderDataPtr_(nullptr),
239 ownToNbrDebugOrderDataPtr_(nullptr)
252 const label newStart,
258 nbrPatchName_(neiName),
259 coupleGroup_(pp.coupleGroup_),
261 coupledPointsPtr_(nullptr),
262 coupledEdgesPtr_(nullptr),
263 ownToNbrOrderDataPtr_(nullptr),
264 ownToNbrCyclicOrderDataPtr_(nullptr),
265 ownToNbrDebugOrderDataPtr_(nullptr)
267 if (neiName ==
name())
270 <<
"Neighbour patch name " << neiName
271 <<
" cannot be the same as this patch " <<
name()
293 if (nbrPatchName_.empty())
296 label patchID = coupleGroup_.findOtherPatchID(*
this);
298 nbrPatchName_ = boundaryMesh()[patchID].name();
300 return nbrPatchName_;
306 if (nbrPatchIndex_ == -1)
308 nbrPatchIndex_ = this->boundaryMesh().findIndex(nbrPatchName());
310 if (nbrPatchIndex_ == -1)
313 <<
"Illegal neighbourPatch name " << nbrPatchName()
314 <<
endl <<
"Valid patch names are "
315 << this->boundaryMesh().names()
322 this->boundaryMesh()[nbrPatchIndex_]
328 <<
"Patch " <<
name()
329 <<
" specifies neighbour patch " << nbrPatchName()
330 <<
endl <<
" but that in return specifies "
335 return nbrPatchIndex_;
341 if (!coupledPointsPtr_)
343 const faceList& nbrLocalFaces = nbrPatch().localFaces();
344 const labelList& nbrMeshPoints = nbrPatch().meshPoints();
355 const face& fA = localFaces()[patchFacei];
356 const face& fB = nbrLocalFaces[patchFacei];
360 label patchPointA = fA[indexA];
362 if (coupledPoint[patchPointA] == -1)
367 if (meshPoints()[patchPointA] != nbrMeshPoints[fB[indexB]])
369 coupledPoint[patchPointA] = fB[indexB];
376 edgeList& connected = *coupledPointsPtr_;
379 label connectedI = 0;
383 if (coupledPoint[i] != -1)
385 connected[connectedI++] =
edge(i, coupledPoint[i]);
396 /
name() +
"_coupledPoints.obj"
400 Pout<<
"Writing file " << str.
name() <<
" with coordinates of "
401 <<
"coupled points" <<
endl;
405 const point& a =
points()[meshPoints()[connected[i][0]]];
406 const point&
b =
points()[nbrMeshPoints[connected[i][1]]];
408 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
409 str<<
"v " <<
b.x() <<
' ' <<
b.y() <<
' ' <<
b.z() <<
nl;
412 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
416 return *coupledPointsPtr_;
422 if (!coupledEdgesPtr_)
424 const edgeList& pointCouples = coupledPoints();
431 const edge&
e = pointCouples[i];
441 const labelList& fEdges = faceEdges()[patchFacei];
445 label edgeI = fEdges[i];
447 const edge&
e = edges()[edgeI];
451 if (fnd0 != aToB.
end())
454 if (fnd1 != aToB.
end())
471 edgeList& coupledEdges = *coupledEdgesPtr_;
474 forAll(nbrPatch, patchFacei)
480 label edgeI = fEdges[i];
487 if (iter != edgeMap.
end())
489 label edgeA = iter();
490 const edge& eA = edges()[edgeA];
496 !=
edge(nbrMp[
e[0]], nbrMp[
e[1]])
499 coupledEdges[coupleI++] =
edge(edgeA, edgeI);
514 const edge&
e = coupledEdges[i];
516 if (
e[0] < 0 ||
e[1] < 0)
519 <<
"Problem : at position " << i
520 <<
" illegal couple:" <<
e
530 /
name() +
"_coupledEdges.obj"
534 Pout<<
"Writing file " << str.
name() <<
" with centres of "
535 <<
"coupled edges" <<
endl;
539 const edge&
e = coupledEdges[i];
547 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
548 str<<
"v " <<
b.x() <<
' ' <<
b.y() <<
' ' <<
b.z() <<
nl;
551 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
555 return *coupledEdgesPtr_;
573 if (coupledPolyPatch::debug)
580 ownToNbrOrderDataPtr_(),
581 ownToNbrDebugOrderDataPtr_,
587 ownToNbrCyclicOrderDataPtr_ =
new ownToNbrCyclicOrderData();
588 ownToNbrCyclicOrderDataPtr_->ctr =
590 ownToNbrCyclicOrderDataPtr_->area =
sum(pp.
faceAreas());
613 ownToNbr = nbrPatch().ownToNbrOrderDataPtr_();
614 ownToNbrDebugPtr = nbrPatch().ownToNbrDebugOrderDataPtr_;
623 pointField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->ctr),
624 vectorField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->area),
630 if (ownToNbrDebugPtr.
valid())
632 ownToNbrDebugPtr->transform(ct.
transform());
652 if (!nbrPatchName_.empty())
654 writeEntry(os,
"neighbourPatch", nbrPatchName_);
657 coupleGroup_.write(os);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
label size() const
Return number of elements in table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
const fileName & name() const
Return the name of the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
const Field< PointType > & faceAreas() const
Return face areas for patch.
const labelListList & faceEdges() const
Return face-edge addressing.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
const Field< PointType > & faceCentres() const
Return face centres for patch.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
bool empty() const
Return true if the UList is empty (ie, size() is zero)
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
bool valid() const
Is a valid patchGroup.
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.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
virtual void rename(const wordList &newNames)
Reset the patch name.
const edgeList & coupledEdges() const
Return connected edges (from patch local to neighbour patch local).
const word & nbrPatchName() const
Neighbour patch name.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialise ordering for primitivePatch. Does not.
virtual void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual label nbrPatchIndex() const
Neighbour patchID.
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
cyclicPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Construct from components.
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
virtual void initTopoChange(PstreamBuffers &)
Initialise the update of the patch topology.
virtual ~cyclicPolyPatch()
Destructor.
virtual void topoChange(PstreamBuffers &)
Update of the patch topology.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A face is a list of labels corresponding to mesh vertices.
const word & name() const
Return name.
A patch is a list of labels that address the faces in the global face list.
virtual void rename(const wordList &newNames)
Reset the patch name.
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
virtual void movePoints(const pointField &p)
Correct patches after moving points.
virtual void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual void initTopoChange(PstreamBuffers &)
Initialise the update of the patch topology.
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
virtual void topoChange(PstreamBuffers &)
Update of the patch topology.
A class for handling words, derived from string.
static const word null
An empty word.
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 FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Determine correspondence between points. See below.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar mp
Proton mass.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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)
void deleteDemandDrivenData(DataType *&dataPtr)
errorManip< error > abort(error &err)
vectorField pointField
pointField is a vectorField.
dimensioned< Type > sum(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)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
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)