Go to the documentation of this file.
52 void Foam::faceZone::setFlipMap(
const bool val)
55 if (flipMap_.size() == this->size())
63 flipMap_.
resize(this->size(), val);
70 void Foam::faceZone::calcFaceZonePatch()
const
77 <<
"primitive face zone patch already calculated"
90 const faceList&
f = zoneMesh().mesh().faces();
99 patch[facei] =
f[addr[facei]].reverseFace();
103 patch[facei] =
f[addr[facei]];
111 void Foam::faceZone::calcCellLayers()
const
117 if (masterCellsPtr_ || slaveCellsPtr_)
120 <<
"cell layers already calculated"
128 const labelList& own = zoneMesh().mesh().faceOwner();
129 const labelList& nei = zoneMesh().mesh().faceNeighbour();
133 const boolList& faceFlip = flipMap();
135 masterCellsPtr_ =
new labelList(mf.size());
138 slaveCellsPtr_ =
new labelList(mf.size());
143 const label ownCelli = own[mf[facei]];
144 const label neiCelli =
146 zoneMesh().mesh().isInternalFace(mf[facei])
151 if (!faceFlip[facei])
154 mc[facei] = neiCelli;
155 sc[facei] = ownCelli;
159 mc[facei] = ownCelli;
160 sc[facei] = neiCelli;
167 void Foam::faceZone::checkAddressing()
const
171 if (addr.size() != flipMap_.size())
174 <<
"Size of addressing: " << addr.size()
175 <<
" size of flip map: " << flipMap_.size()
180 const label nFaces = zoneMesh().mesh().faceOwner().size();
182 for (
const label facei : addr)
184 if (facei < 0 || facei >= nFaces)
187 <<
"Illegal face index " << facei
188 <<
" outside range 0.." << nFaces-1 <<
endl;
197 Foam::faceZone::faceZone
208 masterCellsPtr_(
nullptr),
209 slaveCellsPtr_(
nullptr),
214 Foam::faceZone::faceZone
218 const bool flipMapValue,
227 masterCellsPtr_(
nullptr),
228 slaveCellsPtr_(
nullptr),
231 flipMap_.
resize(size(), flipMapValue);
236 Foam::faceZone::faceZone
240 const bool flipMapValue,
249 masterCellsPtr_(
nullptr),
250 slaveCellsPtr_(
nullptr),
253 flipMap_.
resize(size(), flipMapValue);
258 Foam::faceZone::faceZone
271 masterCellsPtr_(
nullptr),
272 slaveCellsPtr_(
nullptr),
279 Foam::faceZone::faceZone
289 flipMap_(std::move(fm)),
292 masterCellsPtr_(
nullptr),
293 slaveCellsPtr_(
nullptr),
300 Foam::faceZone::faceZone
312 masterCellsPtr_(
nullptr),
313 slaveCellsPtr_(
nullptr),
320 Foam::faceZone::faceZone
329 zone(origZone, addr, index),
333 masterCellsPtr_(
nullptr),
334 slaveCellsPtr_(
nullptr),
341 Foam::faceZone::faceZone
350 zone(origZone, std::move(addr), index),
351 flipMap_(std::move(fm)),
354 masterCellsPtr_(
nullptr),
355 slaveCellsPtr_(
nullptr),
391 if (!masterCellsPtr_)
396 return *masterCellsPtr_;
407 return *slaveCellsPtr_;
418 operator()().meshEdges
420 zoneMesh().
mesh().edges(),
421 zoneMesh().
mesh().pointEdges()
446 const bool flipMapValue
451 setFlipMap(flipMapValue);
470 const bool flipMapValue
475 setFlipMap(flipMapValue);
484 boolList newFlipMap(flipMap_.size());
492 const label facei = addr[i];
496 newAddressing[nFaces] =
faceMap[facei];
497 newFlipMap[nFaces] = flipMap_[i];
503 newFlipMap.setSize(nFaces);
505 transfer(newAddressing);
506 flipMap_.transfer(newFlipMap);
521 bool hasError =
false;
535 const label facei = addr[i];
550 const label facei = addr[i];
553 if (patchi != -1 && bm[patchi].
coupled())
558 if (myZoneFace[bFacei] != neiZoneFace[bFacei])
564 Pout<<
" ***Problem with faceZone " << index()
565 <<
" named " <<
name()
566 <<
". Face " << facei
567 <<
" on coupled patch "
569 <<
" is not consistent with its coupled neighbour."
578 else if (myZoneFlip[bFacei] == neiZoneFlip[bFacei])
585 Pout<<
" ***Problem with faceZone " << index()
586 <<
" named " <<
name()
587 <<
". Face " << facei
588 <<
" on coupled patch "
590 <<
" does not have consistent flipMap"
591 <<
" across coupled faces."
612 patchPtr_->movePoints(pts);
619 << nl << static_cast<const labelList&>(*
this)
630 writeEntry(this->labelsName,
os);
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
List< label > labelList
A List of labels.
virtual void clearAddressing()
Clear addressing.
static const char *const labelsName
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
A class for handling words, derived from Foam::string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
void resize(const label len)
Adjust allocated size of list.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
const labelList & meshEdges() const
Return global edge index for local edges.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
A PrimitivePatch with List storage for the faces, const reference for the point field.
Template functions to aid in the implementation of demand driven data.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
virtual void resetAddressing(const labelUList &addr, const bool flipMapValue)
Reset addressing - use uniform flip map value.
Base class for mesh zones.
List< bool > boolList
A List of bools.
virtual void clearAddressing()
Clear addressing.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
virtual ~faceZone()
Destructor.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
void deleteDemandDrivenData(DataPtr &dataPtr)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
A subset of mesh faces organised as a primitive patch.
#define DebugInFunction
Report an information message using Foam::Info.
virtual bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
void setSize(const label n)
Alias for resize()
void transfer(List< T > &list)
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes in topology.
const labelList & slaveCells() const
Return labels of slave cells.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
void operator=(const UList< T > &a)
Assignment to UList operator. Takes linear time.
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
virtual Ostream & endBlock()
Write end block group.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
Macros for easy insertion into run-time selection tables.
virtual void movePoints(const pointField &pts)
Correct patch after moving points.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
errorManip< error > abort(error &err)
void writeEntry(Ostream &os) const
Write the UList with its compound type.
const labelList & reverseFaceMap() const
Reverse face map.
const word & name() const noexcept
Return name.
virtual bool checkParallelSync(const bool report=false) const
Check whether all procs have faces synchronised.
const labelList & masterCells() const
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
const primitiveFacePatch & operator()() const
Return reference to primitive patch.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInfo
Report an information message using Foam::Info.
void write(Ostream &os) const
const std::string patch
OpenFOAM patch number as a std::string.
List< face > faceList
A List of faces.
virtual void writeDict(Ostream &os) const
Write dictionary.
label nInternalFaces() const noexcept
Number of internal faces.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
void clear()
Clear the list, i.e. set size to zero.
label localID(const label globalID) const
Lookup local address in zone for given global index.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
virtual void write(Ostream &os) const
Write.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
A list of faces which address into the list of points.
virtual bool checkDefinition(const bool report=false) const =0
Check zone definition. Return true if in error.