77 nbrPatch().faceCentres(),
78 nbrPatch().faceAreas(),
122 nbrPatch().nbrPatchName_ = newNames[index()];
129 if (nbrPatchIndex_ != -1)
131 nbrPatchIndex_ =
findIndex(newToOldIndex, nbrPatchIndex_);
145 const word& patchType
150 nbrPatchName_(
word::null),
152 coupledPointsPtr_(nullptr),
153 coupledEdgesPtr_(nullptr),
154 ownToNbrOrderDataPtr_(nullptr),
155 ownToNbrCyclicOrderDataPtr_(nullptr),
156 ownToNbrDebugOrderDataPtr_(nullptr)
167 const word& patchType,
168 const word& nbrPatchName,
174 nbrPatchName_(nbrPatchName),
176 coupledPointsPtr_(nullptr),
177 coupledEdgesPtr_(nullptr),
178 ownToNbrOrderDataPtr_(nullptr),
179 ownToNbrCyclicOrderDataPtr_(nullptr),
180 ownToNbrDebugOrderDataPtr_(nullptr)
190 const word& patchType,
191 const bool cyclicTransformDefaultIsNone
196 nbrPatchName_(
dict.lookupOrDefault(
"neighbourPatch",
word::null)),
199 coupledPointsPtr_(nullptr),
200 coupledEdgesPtr_(nullptr),
201 ownToNbrOrderDataPtr_(nullptr),
202 ownToNbrCyclicOrderDataPtr_(nullptr),
203 ownToNbrDebugOrderDataPtr_(nullptr)
210 ) <<
"No \"neighbourPatch\" provided." <<
endl
214 if (nbrPatchName_ ==
name)
217 <<
"Neighbour patch name " << nbrPatchName_
218 <<
" cannot be the same as this patch " <<
name
235 nbrPatchName_(pp.nbrPatchName_),
236 coupleGroup_(pp.coupleGroup_),
238 coupledPointsPtr_(nullptr),
239 coupledEdgesPtr_(nullptr),
240 ownToNbrOrderDataPtr_(nullptr),
241 ownToNbrCyclicOrderDataPtr_(nullptr),
242 ownToNbrDebugOrderDataPtr_(nullptr)
255 const label newStart,
261 nbrPatchName_(neiName),
262 coupleGroup_(pp.coupleGroup_),
264 coupledPointsPtr_(nullptr),
265 coupledEdgesPtr_(nullptr),
266 ownToNbrOrderDataPtr_(nullptr),
267 ownToNbrCyclicOrderDataPtr_(nullptr),
268 ownToNbrDebugOrderDataPtr_(nullptr)
270 if (neiName ==
name())
273 <<
"Neighbour patch name " << neiName
274 <<
" cannot be the same as this patch " <<
name()
296 if (nbrPatchName_.empty())
299 label patchID = coupleGroup_.findOtherPatchID(*
this);
301 nbrPatchName_ = boundaryMesh()[patchID].name();
303 return nbrPatchName_;
309 if (nbrPatchIndex_ == -1)
311 nbrPatchIndex_ = this->boundaryMesh().findIndex(nbrPatchName());
313 if (nbrPatchIndex_ == -1)
316 <<
"Illegal neighbourPatch name " << nbrPatchName()
317 <<
endl <<
"Valid patch names are "
318 << this->boundaryMesh().names()
325 this->boundaryMesh()[nbrPatchIndex_]
331 <<
"Patch " <<
name()
332 <<
" specifies neighbour patch " << nbrPatchName()
333 <<
endl <<
" but that in return specifies "
338 return nbrPatchIndex_;
344 if (!coupledPointsPtr_)
346 const faceList& nbrLocalFaces = nbrPatch().localFaces();
347 const labelList& nbrMeshPoints = nbrPatch().meshPoints();
358 const face& fA = localFaces()[patchFacei];
359 const face& fB = nbrLocalFaces[patchFacei];
363 label patchPointA = fA[indexA];
365 if (coupledPoint[patchPointA] == -1)
370 if (meshPoints()[patchPointA] != nbrMeshPoints[fB[indexB]])
372 coupledPoint[patchPointA] = fB[indexB];
379 edgeList& connected = *coupledPointsPtr_;
382 label connectedI = 0;
386 if (coupledPoint[i] != -1)
388 connected[connectedI++] =
edge(i, coupledPoint[i]);
398 boundaryMesh().mesh().time().path()
399 /
name() +
"_coupledPoints.obj"
403 Pout<<
"Writing file " << str.
name() <<
" with coordinates of "
404 <<
"coupled points" <<
endl;
408 const point& a =
points()[meshPoints()[connected[i][0]]];
409 const point&
b =
points()[nbrMeshPoints[connected[i][1]]];
411 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
412 str<<
"v " <<
b.x() <<
' ' <<
b.y() <<
' ' <<
b.z() <<
nl;
415 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
419 return *coupledPointsPtr_;
425 if (!coupledEdgesPtr_)
427 const edgeList& pointCouples = coupledPoints();
434 const edge&
e = pointCouples[i];
444 const labelList& fEdges = faceEdges()[patchFacei];
448 label edgeI = fEdges[i];
450 const edge&
e = edges()[edgeI];
454 if (fnd0 != aToB.
end())
457 if (fnd1 != aToB.
end())
474 edgeList& coupledEdges = *coupledEdgesPtr_;
477 forAll(nbrPatch, patchFacei)
483 label edgeI = fEdges[i];
490 if (iter != edgeMap.
end())
492 label edgeA = iter();
493 const edge& eA = edges()[edgeA];
499 !=
edge(nbrMp[
e[0]], nbrMp[
e[1]])
502 coupledEdges[coupleI++] =
edge(edgeA, edgeI);
517 const edge&
e = coupledEdges[i];
519 if (
e[0] < 0 ||
e[1] < 0)
522 <<
"Problem : at position " << i
523 <<
" illegal couple:" <<
e
532 boundaryMesh().mesh().time().path()
533 /
name() +
"_coupledEdges.obj"
537 Pout<<
"Writing file " << str.
name() <<
" with centres of "
538 <<
"coupled edges" <<
endl;
542 const edge&
e = coupledEdges[i];
550 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
551 str<<
"v " <<
b.x() <<
' ' <<
b.y() <<
' ' <<
b.z() <<
nl;
554 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
558 return *coupledEdgesPtr_;
576 if (coupledPolyPatch::debug)
583 ownToNbrOrderDataPtr_(),
584 ownToNbrDebugOrderDataPtr_,
590 ownToNbrCyclicOrderDataPtr_ =
new ownToNbrCyclicOrderData();
591 ownToNbrCyclicOrderDataPtr_->ctr =
593 ownToNbrCyclicOrderDataPtr_->area =
sum(pp.
faceAreas());
616 ownToNbr = nbrPatch().ownToNbrOrderDataPtr_();
617 ownToNbrDebugPtr = nbrPatch().ownToNbrDebugOrderDataPtr_;
626 pointField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->ctr),
627 vectorField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->area),
633 if (ownToNbrDebugPtr.
valid())
635 ownToNbrDebugPtr->transform(ct.
transform());
655 if (!nbrPatchName_.empty())
657 writeEntry(os,
"neighbourPatch", nbrPatchName_);
660 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.
cyclicPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
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.
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 keyword definitions, which are a keyword followed by any number of values (e....
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.
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.
word name(const bool)
Return a word representation of a bool.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
void deleteDemandDrivenData(DataType *&dataPtr)
errorManip< error > abort(error &err)
vectorField pointField
pointField is a vectorField.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensionSet transform(const dimensionSet &)
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
prefixOSstream Pout(cout, "Pout")
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
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)