48void Foam::faceZone::setFlipMap(
const bool val)
58void Foam::faceZone::calcFaceZonePatch()
const
65 <<
"primitive face zone patch already calculated"
77 auto&
patch = *patchPtr_;
79 const faceList&
f = zoneMesh().mesh().faces();
88 patch[facei] =
f[addr[facei]].reverseFace();
92 patch[facei] =
f[addr[facei]];
100void Foam::faceZone::calcCellLayers()
const
104 if (frontCellsPtr_ || backCellsPtr_)
107 <<
"cell layers already calculated"
115 const labelList& own = zoneMesh().mesh().faceOwner();
116 const labelList& nei = zoneMesh().mesh().faceNeighbour();
121 frontCellsPtr_.reset(
new labelList(addr.size()));
122 backCellsPtr_.reset(
new labelList(addr.size()));
124 auto& fronts = *frontCellsPtr_;
125 auto& backs = *backCellsPtr_;
129 const label ownCelli = own[addr[facei]];
130 const label neiCelli =
132 zoneMesh().mesh().isInternalFace(addr[facei])
139 fronts[facei] = ownCelli;
140 backs[facei] = neiCelli;
144 fronts[facei] = neiCelli;
145 backs[facei] = ownCelli;
188void Foam::faceZone::checkAddressing()
const
192 if (addr.size() != flipMap_.size())
195 <<
"Size of addressing: " << addr.size()
196 <<
" size of flip map: " << flipMap_.size()
201 const label nFaces = zoneMesh().mesh().faceOwner().size();
203 for (
const label facei : addr)
205 if (facei < 0 || facei >= nFaces)
208 <<
"Illegal face index " << facei
209 <<
" outside range 0.." << nFaces-1 <<
endl;
241 const bool flipMapValue,
259 const bool flipMapValue,
348 flipMap_ = originalZone.
flipMap();
418 return zoneMesh_.mesh().nFaces();
449 return *frontCellsPtr_;
459 return *backCellsPtr_;
471 this->patch().meshEdges
473 zoneMesh().
mesh().edges(),
474 zoneMesh().
mesh().pointEdges()
484void Foam::faceZone::clearGeom()
486 patchPtr_.reset(
nullptr);
487 frontCellsPtr_.reset(
nullptr);
488 backCellsPtr_.reset(
nullptr);
489 mePtr_.reset(
nullptr);
516 flipMap_.transfer(zn.flipMap_);
517 zn.clearAddressing();
530 flipMap_ = zn.flipMap_;
537 const bool flipMapValue
542 setFlipMap(flipMapValue);
549 const bool flipMapValue
554 setFlipMap(flipMapValue);
575 boolList newFlipMap(flipMap_.size());
584 const label facei = addr[i];
588 newAddressing[nFaces] =
faceMap[facei];
589 newFlipMap[nFaces] = flips[i];
594 newAddressing.
resize(nFaces);
595 newFlipMap.resize(nFaces);
598 flipMap_.transfer(newFlipMap);
607 bool hasError =
false;
622 const label facei = addr[i];
624 if (!
mesh.isInternalFace(facei))
626 const label bFacei = facei-
mesh.nInternalFaces();
627 neiZoneFace[bFacei] =
true;
628 neiZoneFlip[bFacei] = flips[i];
638 const label facei = addr[i];
641 if (patchi != -1 && bm[patchi].
coupled())
646 if (myZoneFace[bFacei] != neiZoneFace[bFacei])
652 Pout<<
" ***Problem with faceZone " << index()
653 <<
" named " <<
name()
654 <<
". Face " << facei
655 <<
" on coupled patch " << bm[patchi].
name()
656 <<
" is inconsistent with its coupled neighbour."
665 else if (myZoneFlip[bFacei] == neiZoneFlip[bFacei])
672 Pout<<
" ***Problem with faceZone " << index()
673 <<
" named " <<
name()
674 <<
". Face " << facei
675 <<
" on coupled patch " << bm[patchi].
name()
676 <<
" has inconsistent flipMap across coupled faces."
697 patchPtr_->movePoints(
pts);
706 flipMap_.writeEntry(
"flipMap",
os);
721 flipMap_ = zn.flipMap_;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const word & name() const noexcept
Return the object name.
void transfer(List< label > &list)
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void operator=(const UList< label > &list)
void resize(const label len)
Adjust allocated size of list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
void writeEntry(Ostream &os) const
label size() const noexcept
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A subset of mesh faces organised as a primitive patch.
static constexpr const char * labelsName()
The name associated with the zone-labels dictionary entry.
const primitiveFacePatch & patch() const
Return [demand-driven] reference to an equivalent primitive patch, with faces oriented according to f...
const boolList & flipMap() const noexcept
Return face flip map.
virtual void clearPrimitives()
Clear primitive addressing.
virtual void resetAddressing(faceZone &&zn)
Move reset addressing and flip map from another zone.
virtual void write(Ostream &os) const
Write (dictionary entries).
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes in topology.
label max_index() const noexcept
The maximum index the zone may contain == mesh nFaces().
virtual void clearAddressing()
Clear addressing (remove lookup maps, patch/geometric information).
const labelList & backCells() const
The back cells layer. Cells on the negative normal side of faces.
const labelList & frontCells() const
The front cells layer. Cells on the positive normal side of faces.
virtual void movePoints(const pointField &pts)
Correct patch after moving points.
const faceZoneMesh & zoneMesh() const noexcept
Return reference to the zone mesh.
faceZone(const faceZone &)=delete
No copy construct.
virtual bool checkParallelSync(const bool report=false) const
Check whether all procs have faces synchronised.
void operator=(const faceZone &zn)
Assign addressing, clearing demand-driven data.
const labelList & meshEdges() const
Return global edge index for local edges.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reverseFaceMap() const noexcept
Reverse face map.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
Mesh consisting of general polyhedral cells.
label nInternalFaces() const noexcept
Number of internal faces.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
label index() const noexcept
The index of this zone in the zone list.
Base class for mesh zones.
virtual void clearPrimitives()
Clear primitive addressing.
virtual void write(Ostream &os) const
Write (dictionary entries).
zone()
Default construct: empty zone with name="", index=0.
virtual void clearAddressing()
Clear addressing (remove lookup maps and other auxiliary information).
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
#define DebugInFunction
Report an information message using Foam::Info.
const std::string patch
OpenFOAM patch number as a std::string.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< label > labelList
A List of labels.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
List< face > faceList
List of faces.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Ostream & endl(Ostream &os)
Add newline and flush stream.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
A PrimitivePatch with List storage for the faces, const reference for the point field.
errorManip< error > abort(error &err)
List< bool > boolList
A List of bools.
UList< bool > boolUList
A UList of bools.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
#define forAll(list, i)
Loop across all elements in list.