52 void Foam::faceZone::setFlipMap(
const bool 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];
502 newAddressing.setSize(nFaces);
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);
virtual void clearAddressing()
Clear addressing.
virtual void movePoints(const pointField &pts)
Correct patch after moving points.
void size(const label n)
Older name for setAddressableSize.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
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.
virtual ~faceZone()
Destructor.
const word & name() const noexcept
Return the object name.
constexpr char nl
The newline '\n' character (0x0a)
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelList & masterCells() const
Return labels of master cells (cells next to the master face zone in the prescribed direction) ...
virtual bool checkParallelSync(const bool report=false) const
Check whether all procs have faces synchronised.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
void operator=(const UList< label > &a)
Assignment to UList operator. Takes linear time.
Lookup type of boundary radiation properties.
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)
#define forAll(list, i)
Loop across all elements in list.
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 INVALID.
virtual void resetAddressing(const labelUList &addr, const bool flipMapValue)
Reset addressing - use uniform flip map value.
Base class for mesh zones.
void clear()
Clear the list, i.e. set size to zero.
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 bool write(const token &tok)=0
Write token to stream or otherwise handle it.
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...
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 List.
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.
const labelList & slaveCells() const
Return labels of slave cells.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
virtual void clearAddressing()
Clear addressing.
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)
Template functions to aid in the implementation of demand driven data.
#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.
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.
void deleteDemandDrivenData(DataPtr &dataPtr)
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const primitiveFacePatch & operator()() const
Return reference to primitive patch.
const labelList & reverseFaceMap() const
Reverse face map.