78 nbrPatch().faceCentres(),
79 nbrPatch().faceAreas(),
123 nbrPatch().nbrPatchName_ = newNames[index()];
130 if (nbrPatchID_ != -1)
132 nbrPatchID_ =
findIndex(newToOldIndex, nbrPatchID_);
146 const word& patchType
151 nbrPatchName_(
word::null),
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
197 nbrPatchName_(
dict.lookupOrDefault(
"neighbourPatch",
word::null)),
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()
297 if (nbrPatchName_.empty())
300 label patchID = coupleGroup_.findOtherPatchID(*
this);
302 nbrPatchName_ = boundaryMesh()[patchID].name();
304 return nbrPatchName_;
310 if (nbrPatchID_ == -1)
312 nbrPatchID_ = this->boundaryMesh().findPatchID(nbrPatchName());
314 if (nbrPatchID_ == -1)
317 <<
"Illegal neighbourPatch name " << nbrPatchName()
318 <<
endl <<
"Valid patch names are "
319 << this->boundaryMesh().names()
326 this->boundaryMesh()[nbrPatchID_]
332 <<
"Patch " <<
name()
333 <<
" specifies neighbour patch " << nbrPatchName()
334 <<
endl <<
" but that in return specifies "
345 if (!coupledPointsPtr_)
347 const faceList& nbrLocalFaces = nbrPatch().localFaces();
348 const labelList& nbrMeshPoints = nbrPatch().meshPoints();
359 const face& fA = localFaces()[patchFacei];
360 const face& fB = nbrLocalFaces[patchFacei];
364 label patchPointA = fA[indexA];
366 if (coupledPoint[patchPointA] == -1)
371 if (meshPoints()[patchPointA] != nbrMeshPoints[fB[indexB]])
373 coupledPoint[patchPointA] = fB[indexB];
380 edgeList& connected = *coupledPointsPtr_;
383 label connectedI = 0;
387 if (coupledPoint[i] != -1)
389 connected[connectedI++] =
edge(i, coupledPoint[i]);
399 boundaryMesh().mesh().time().path()
400 /
name() +
"_coupledPoints.obj"
404 Pout<<
"Writing file " << str.
name() <<
" with coordinates of "
405 <<
"coupled points" <<
endl;
409 const point& a =
points()[meshPoints()[connected[i][0]]];
410 const point&
b =
points()[nbrMeshPoints[connected[i][1]]];
412 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
413 str<<
"v " <<
b.x() <<
' ' <<
b.y() <<
' ' <<
b.z() <<
nl;
416 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
420 return *coupledPointsPtr_;
426 if (!coupledEdgesPtr_)
428 const edgeList& pointCouples = coupledPoints();
435 const edge&
e = pointCouples[i];
445 const labelList& fEdges = faceEdges()[patchFacei];
449 label edgeI = fEdges[i];
451 const edge&
e = edges()[edgeI];
455 if (fnd0 != aToB.
end())
458 if (fnd1 != aToB.
end())
475 edgeList& coupledEdges = *coupledEdgesPtr_;
478 forAll(nbrPatch, patchFacei)
484 label edgeI = fEdges[i];
491 if (iter != edgeMap.
end())
493 label edgeA = iter();
494 const edge& eA = edges()[edgeA];
500 !=
edge(nbrMp[
e[0]], nbrMp[
e[1]])
503 coupledEdges[coupleI++] =
edge(edgeA, edgeI);
518 const edge&
e = coupledEdges[i];
520 if (
e[0] < 0 ||
e[1] < 0)
523 <<
"Problem : at position " << i
524 <<
" illegal couple:" <<
e
533 boundaryMesh().mesh().time().path()
534 /
name() +
"_coupledEdges.obj"
538 Pout<<
"Writing file " << str.
name() <<
" with centres of "
539 <<
"coupled edges" <<
endl;
543 const edge&
e = coupledEdges[i];
551 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
552 str<<
"v " <<
b.x() <<
' ' <<
b.y() <<
' ' <<
b.z() <<
nl;
555 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
559 return *coupledEdgesPtr_;
577 if (coupledPolyPatch::debug)
584 ownToNbrOrderDataPtr_(),
585 ownToNbrDebugOrderDataPtr_,
591 ownToNbrCyclicOrderDataPtr_ =
new ownToNbrCyclicOrderData();
592 ownToNbrCyclicOrderDataPtr_->ctr =
594 ownToNbrCyclicOrderDataPtr_->area =
sum(pp.
faceAreas());
617 ownToNbr = nbrPatch().ownToNbrOrderDataPtr_();
618 ownToNbrDebugPtr = nbrPatch().ownToNbrDebugOrderDataPtr_;
627 pointField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->ctr),
628 vectorField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->area),
634 if (ownToNbrDebugPtr.
valid())
636 ownToNbrDebugPtr->transform(ct.
transform());
656 if (!nbrPatchName_.empty())
658 writeEntry(os,
"neighbourPatch", nbrPatchName_);
661 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,...
A list of faces which address into the list of points.
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).
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 nbrPatchID() 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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
errorManip< error > abort(error &err)
vectorField pointField
pointField is a vectorField.
void deleteDemandDrivenData(DataPtr &dataPtr)
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,.
word name(const complex &)
Return a string representation of a complex.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
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)
Unit conversion functions.