52void Foam::faceZone::setFlipMap(
const bool val)
55 if (flipMap_.
size() == this->size())
70void 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]];
111void 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;
167void 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
208 masterCellsPtr_(nullptr),
209 slaveCellsPtr_(nullptr),
218 const bool flipMapValue,
227 masterCellsPtr_(nullptr),
228 slaveCellsPtr_(nullptr),
240 const bool flipMapValue,
249 masterCellsPtr_(nullptr),
250 slaveCellsPtr_(nullptr),
271 masterCellsPtr_(nullptr),
272 slaveCellsPtr_(nullptr),
289 flipMap_(std::move(fm)),
292 masterCellsPtr_(nullptr),
293 slaveCellsPtr_(nullptr),
312 masterCellsPtr_(nullptr),
313 slaveCellsPtr_(nullptr),
329 zone(origZone, addr, index),
333 masterCellsPtr_(nullptr),
334 slaveCellsPtr_(nullptr),
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];
497 newFlipMap[
nFaces] = flipMap_[i];
505 transfer(newAddressing);
506 flipMap_.transfer(newFlipMap);
512 return zone::checkDefinition(zoneMesh().
mesh().faces().size(), report);
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);
631 flipMap().writeEntry(
"flipMap",
os);
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.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
void setSize(const label n)
Alias for resize()
void operator=(const UList< label > &a)
Assignment to UList operator. Takes linear time.
void resize(const label len)
Adjust allocated size of list.
void clear()
Clear the list, i.e. set size to zero.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & endBlock()
Write end block group.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
A list of faces which address into the list of points.
label size() const noexcept
The number of elements in the UList.
void size(const label n)
Older name for setAddressableSize.
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.
virtual bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
virtual void resetAddressing(const labelUList &addr, const bool flipMapValue)
Reset addressing - use uniform flip map value.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
const labelList & masterCells() const
const primitiveFacePatch & operator()() const
Return reference to primitive patch.
virtual void write(Ostream &os) const
Write.
static const char *const labelsName
virtual void clearAddressing()
Clear addressing.
virtual ~faceZone()
Destructor.
virtual bool checkParallelSync(const bool report=false) const
Check whether all procs have faces synchronised.
const labelList & slaveCells() const
Return labels of slave cells.
const labelList & meshEdges() const
Return global edge index for local edges.
virtual bool write()
Write the output fields.
Foam::dictionary writeDict() const
Write to dictionary.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reverseFaceMap() const
Reverse face map.
void movePoints()
Update for new mesh geometry.
void updateMesh()
Update for new mesh topology.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
label nInternalFaces() const noexcept
Number of internal faces.
Lookup type of boundary radiation properties.
transferModelList & transfer()
Transfer.
A class for handling words, derived from Foam::string.
Base class for mesh zones.
label localID(const label globalID) const
Lookup local address in zone for given global index.
virtual void clearAddressing()
Clear addressing.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
Template functions to aid in the implementation of demand driven data.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
#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)
List< label > labelList
A List of labels.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
List< bool > boolList
A List of bools.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
A PrimitivePatch with List storage for the faces, const reference for the point field.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
List< face > faceList
A List of faces.
void deleteDemandDrivenData(DataPtr &dataPtr)
constexpr char nl
The newline '\n' character (0x0a)
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
#define forAll(list, i)
Loop across all elements in list.