51 void Foam::faceZone::setFlipMap(
const bool val)
61 void Foam::faceZone::calcFaceZonePatch()
const 68 <<
"primitive face zone patch already calculated" 80 auto&
patch = *patchPtr_;
82 const faceList&
f = zoneMesh().mesh().faces();
91 patch[facei] =
f[addr[facei]].reverseFace();
95 patch[facei] =
f[addr[facei]];
103 void Foam::faceZone::calcCellLayers()
const 107 if (frontCellsPtr_ || backCellsPtr_)
110 <<
"cell layers already calculated" 118 const labelList& own = zoneMesh().mesh().faceOwner();
119 const labelList& nei = zoneMesh().mesh().faceNeighbour();
124 frontCellsPtr_.reset(
new labelList(addr.size()));
125 backCellsPtr_.reset(
new labelList(addr.size()));
127 auto& fronts = *frontCellsPtr_;
128 auto& backs = *backCellsPtr_;
132 const label ownCelli = own[addr[facei]];
133 const label neiCelli =
135 zoneMesh().mesh().isInternalFace(addr[facei])
142 fronts[facei] = ownCelli;
143 backs[facei] = neiCelli;
147 fronts[facei] = neiCelli;
148 backs[facei] = ownCelli;
191 void Foam::faceZone::checkAddressing()
const 195 if (addr.size() != flipMap_.size())
198 <<
"Size of addressing: " << addr.size()
199 <<
" size of flip map: " << flipMap_.size()
204 const label nFaces = zoneMesh().mesh().faceOwner().size();
206 for (
const label facei : addr)
208 if (facei < 0 || facei >= nFaces)
211 <<
"Illegal face index " << facei
212 <<
" outside range 0.." << nFaces-1 <<
endl;
243 const bool flipMapValue,
261 const bool flipMapValue,
396 flipMap_.transfer(fm);
426 return *frontCellsPtr_;
436 return *backCellsPtr_;
448 this->
patch().meshEdges
450 zoneMesh().
mesh().edges(),
451 zoneMesh().
mesh().pointEdges()
461 void Foam::faceZone::clearGeom()
463 patchPtr_.reset(
nullptr);
464 frontCellsPtr_.reset(
nullptr);
465 backCellsPtr_.reset(
nullptr);
466 mePtr_.reset(
nullptr);
494 flipMap_.transfer(zn.flipMap_);
495 zn.clearAddressing();
509 flipMap_ = zn.flipMap_;
516 const bool flipMapValue
521 setFlipMap(flipMapValue);
528 const bool flipMapValue
533 setFlipMap(flipMapValue);
554 boolList newFlipMap(flipMap_.size());
563 const label facei = addr[i];
567 newAddressing[nFaces] =
faceMap[facei];
568 newFlipMap[nFaces] = flips[i];
573 newAddressing.
resize(nFaces);
574 newFlipMap.resize(nFaces);
577 flipMap_.transfer(newFlipMap);
592 bool hasError =
false;
607 const label facei = addr[i];
612 neiZoneFace[bFacei] =
true;
613 neiZoneFlip[bFacei] = flips[i];
623 const label facei = addr[i];
626 if (patchi != -1 && bm[patchi].
coupled())
631 if (myZoneFace[bFacei] != neiZoneFace[bFacei])
637 Pout<<
" ***Problem with faceZone " << index()
638 <<
" named " <<
name()
639 <<
". Face " << facei
640 <<
" on coupled patch " << bm[patchi].
name()
641 <<
" is inconsistent with its coupled neighbour." 650 else if (myZoneFlip[bFacei] == neiZoneFlip[bFacei])
657 Pout<<
" ***Problem with faceZone " << index()
658 <<
" named " <<
name()
659 <<
". Face " << facei
660 <<
" on coupled patch " << bm[patchi].
name()
661 <<
" has inconsistent flipMap across coupled faces." 682 patchPtr_->movePoints(
pts);
689 << nl << static_cast<const labelList&>(*this)
700 writeEntry(this->labelsName,
os);
718 flipMap_ = zn.flipMap_;
virtual void clearAddressing()
Clear addressing (remove lookup maps and other auxiliary information)
virtual void movePoints(const pointField &pts)
Correct patch after moving points.
label localID(const label globalID) const
Lookup local address in zone for given global index.
void resize(const label len)
Adjust allocated size of list.
void transfer(List< label > &list)
Transfer the contents of the argument List into this list and annul the argument list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
const word & name() const noexcept
Return the object name.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool checkParallelSync(const bool report=false) const
Check whether all procs have faces synchronised.
virtual void clearPrimitives()
Clear primitive addressing.
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
const labelList & frontCells() const
The front cells layer. Cells on the positive normal side of faces.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
Lookup type of boundary radiation properties.
faceZone(const faceZone &)=delete
No copy construct.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
const labelList & backCells() const
The back cells layer. Cells on the negative normal side of faces.
#define forAll(list, i)
Loop across all elements in list.
const labelList & reverseFaceMap() const noexcept
Reverse face map.
void operator=(const faceZone &zn)
Assign addressing, clearing demand-driven data.
List< face > faceList
List of faces.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
A list of faces which address into the list of points.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void operator=(const UList< label > &list)
Assignment to UList operator. Takes linear time.
Base class for mesh zones.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
#define DebugInFunction
Report an information message using Foam::Info.
virtual void writeDict(Ostream &os) const
Write dictionary.
virtual Ostream & endBlock()
Write end block group.
virtual bool checkDefinition(const bool report=false) const =0
Check zone definition. Return true if in error.
virtual void resetAddressing(faceZone &&zn)
Move reset addressing and flip map from another zone.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
virtual void clearPrimitives()
Clear primitive addressing.
const labelList & meshEdges() const
Return global edge index for local edges.
label nInternalFaces() const noexcept
Number of internal faces.
void write(Ostream &os) const
Write (physicalType, inGroups) dictionary entries (without surrounding braces)
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
errorManip< error > abort(error &err)
#define DebugInfo
Report an information message using Foam::Info.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
const primitiveFacePatch & patch() const
Return [demand-driven] reference to an equivalent primitive patch, with faces oriented according to f...
virtual void write(Ostream &os) const
Write.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
label size() const noexcept
The number of elements in the container.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
A PrimitivePatch with List storage for the faces, const reference for the point field.
virtual void clearAddressing()
Clear addressing (remove lookup maps, patch/geometric information)
static const char *const labelsName
The name associated with the zone-labels dictionary entry ("faceLabels")
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
#define WarningInFunction
Report a warning using Foam::Warning.
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes in topology.
virtual bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
const std::string patch
OpenFOAM patch number as a std::string.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
void writeEntry(Ostream &os) const
Write the UList with its compound type.
Mesh consisting of general polyhedral cells.
A subset of mesh faces organised as a primitive patch.
List< label > labelList
A List of labels.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)