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)
171 const word& patchType,
172 const word& nbrPatchName
177 nbrPatchName_(nbrPatchName),
179 coupledPointsPtr_(
nullptr),
180 coupledEdgesPtr_(
nullptr),
181 ownToNbrOrderDataPtr_(
nullptr),
182 ownToNbrCyclicOrderDataPtr_(
nullptr),
183 ownToNbrDebugOrderDataPtr_(
nullptr)
196 const word& patchType
204 coupledPointsPtr_(
nullptr),
205 coupledEdgesPtr_(
nullptr),
206 ownToNbrOrderDataPtr_(
nullptr),
207 ownToNbrCyclicOrderDataPtr_(
nullptr),
208 ownToNbrDebugOrderDataPtr_(
nullptr)
215 ) <<
"No \"neighbourPatch\" provided." <<
endl 219 if (nbrPatchName_ == name)
222 <<
"Neighbour patch name " << nbrPatchName_
223 <<
" cannot be the same as this patch " << name
240 nbrPatchName_(pp.nbrPatchName_),
241 coupleGroup_(pp.coupleGroup_),
243 coupledPointsPtr_(
nullptr),
244 coupledEdgesPtr_(
nullptr),
245 ownToNbrOrderDataPtr_(
nullptr),
246 ownToNbrCyclicOrderDataPtr_(
nullptr),
247 ownToNbrDebugOrderDataPtr_(
nullptr)
260 const label newStart,
266 nbrPatchName_(neiName),
267 coupleGroup_(pp.coupleGroup_),
269 coupledPointsPtr_(
nullptr),
270 coupledEdgesPtr_(
nullptr),
271 ownToNbrOrderDataPtr_(
nullptr),
272 ownToNbrCyclicOrderDataPtr_(
nullptr),
273 ownToNbrDebugOrderDataPtr_(
nullptr)
275 if (neiName ==
name())
278 <<
"Neighbour patch name " << neiName
279 <<
" cannot be the same as this patch " <<
name()
299 nbrPatchName_(pp.nbrPatchName_),
300 coupleGroup_(pp.coupleGroup_),
302 coupledPointsPtr_(
nullptr),
303 coupledEdgesPtr_(
nullptr),
304 ownToNbrOrderDataPtr_(
nullptr),
305 ownToNbrCyclicOrderDataPtr_(
nullptr),
306 ownToNbrDebugOrderDataPtr_(
nullptr)
323 if (nbrPatchName_.empty())
326 label patchID = coupleGroup_.findOtherPatchID(*
this);
328 nbrPatchName_ = boundaryMesh()[patchID].name();
330 return nbrPatchName_;
336 if (nbrPatchID_ == -1)
338 nbrPatchID_ = this->boundaryMesh().findPatchID(nbrPatchName());
340 if (nbrPatchID_ == -1)
343 <<
"Illegal neighbourPatch name " << nbrPatchName()
344 <<
endl <<
"Valid patch names are " 345 << this->boundaryMesh().names()
352 this->boundaryMesh()[nbrPatchID_]
358 <<
"Patch " <<
name()
359 <<
" specifies neighbour patch " << nbrPatchName()
360 <<
endl <<
" but that in return specifies " 371 if (!coupledPointsPtr_)
373 const faceList& nbrLocalFaces = nbrPatch().localFaces();
374 const labelList& nbrMeshPoints = nbrPatch().meshPoints();
385 const face& fA = localFaces()[patchFacei];
386 const face& fB = nbrLocalFaces[patchFacei];
390 label patchPointA = fA[indexA];
392 if (coupledPoint[patchPointA] == -1)
397 if (meshPoints()[patchPointA] != nbrMeshPoints[fB[indexB]])
399 coupledPoint[patchPointA] = fB[indexB];
406 edgeList& connected = *coupledPointsPtr_;
409 label connectedI = 0;
413 if (coupledPoint[i] != -1)
415 connected[connectedI++] =
edge(i, coupledPoint[i]);
426 /
name() +
"_coupledPoints.obj" 430 Pout<<
"Writing file " << str.
name() <<
" with coordinates of " 431 <<
"coupled points" <<
endl;
435 const point& a =
points()[meshPoints()[connected[i][0]]];
436 const point&
b =
points()[nbrMeshPoints[connected[i][1]]];
438 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
439 str<<
"v " << b.
x() <<
' ' << b.
y() <<
' ' << b.
z() <<
nl;
442 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
446 return *coupledPointsPtr_;
452 if (!coupledEdgesPtr_)
454 const edgeList& pointCouples = coupledPoints();
461 const edge&
e = pointCouples[i];
463 aToB.insert(e[0], e[1]);
471 const labelList& fEdges = faceEdges()[patchFacei];
475 label edgeI = fEdges[i];
477 const edge&
e = edges()[edgeI];
481 if (fnd0 != aToB.
end())
484 if (fnd1 != aToB.
end())
501 edgeList& coupledEdges = *coupledEdgesPtr_;
504 forAll(nbrPatch, patchFacei)
510 label edgeI = fEdges[i];
517 if (iter != edgeMap.
end())
519 label edgeA = iter();
520 const edge& eA = edges()[edgeA];
525 edge(mp[eA[0]], mp[eA[1]])
526 !=
edge(nbrMp[e[0]], nbrMp[e[1]])
529 coupledEdges[coupleI++] =
edge(edgeA, edgeI);
537 coupledEdges.setSize(coupleI);
544 const edge&
e = coupledEdges[i];
546 if (e[0] < 0 || e[1] < 0)
549 <<
"Problem : at position " << i
550 <<
" illegal couple:" << e
560 /
name() +
"_coupledEdges.obj" 564 Pout<<
"Writing file " << str.
name() <<
" with centres of " 565 <<
"coupled edges" <<
endl;
569 const edge&
e = coupledEdges[i];
571 const point& a = edges()[e[0]].
centre(localPoints());
577 str<<
"v " << a.
x() <<
' ' << a.
y() <<
' ' << a.
z() <<
nl;
578 str<<
"v " << b.
x() <<
' ' << b.
y() <<
' ' << b.
z() <<
nl;
581 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
585 return *coupledEdgesPtr_;
603 if (coupledPolyPatch::debug)
610 ownToNbrOrderDataPtr_(),
611 ownToNbrDebugOrderDataPtr_,
617 ownToNbrCyclicOrderDataPtr_ =
new ownToNbrCyclicOrderData();
618 ownToNbrCyclicOrderDataPtr_->ctr =
620 ownToNbrCyclicOrderDataPtr_->area =
sum(pp.
faceAreas());
643 ownToNbr = nbrPatch().ownToNbrOrderDataPtr_();
644 ownToNbrDebugPtr = nbrPatch().ownToNbrDebugOrderDataPtr_;
653 pointField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->ctr),
654 vectorField(1, nbrPatch().ownToNbrCyclicOrderDataPtr_->area),
660 if (ownToNbrDebugPtr.
valid())
662 ownToNbrDebugPtr->transform(ct.transform());
682 if (!nbrPatchName_.empty())
684 writeEntry(os,
"neighbourPatch", nbrPatchName_);
687 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.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
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...
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.
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.
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.
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.
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.
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.
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
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.
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())