44 void Foam::faceZone::calcFaceZonePatch()
const
54 <<
"primitive face zone patch already calculated"
77 patch[facei] =
f[addr[facei]].reverseFace();
81 patch[facei] =
f[addr[facei]];
89 patch[facei] =
f[addr[facei]];
100 void Foam::faceZone::calcCellLayers()
const
109 if (masterCellsPtr_ || slaveCellsPtr_)
112 <<
"cell layers already calculated"
120 const labelList& own = zones().mesh().faceOwner();
121 const labelList& nei = zones().mesh().faceNeighbour();
125 masterCellsPtr_ =
new labelList(mf.size());
128 slaveCellsPtr_ =
new labelList(mf.size());
133 label ownCelli = own[mf[facei]];
136 zones().mesh().isInternalFace(mf[facei])
141 if (!oriented_ || !flipMap_[facei])
144 mc[facei] = neiCelli;
145 sc[facei] = ownCelli;
149 mc[facei] = ownCelli;
150 sc[facei] = neiCelli;
157 void Foam::faceZone::checkAddressing()
const
159 if (oriented_ && size() != flipMap_.size())
162 <<
"Size of addressing: " << size()
163 <<
" size of flip map: " << flipMap_.size()
170 const label nFaces = zones().mesh().faceOwner().size();
172 bool hasWarned =
false;
175 if (!hasWarned && (mf[i] < 0 || mf[i] >= nFaces))
178 <<
"Illegal face index " << mf[i] <<
" outside range 0.."
186 void Foam::faceZone::reset(
const Map<bool>& newIndices)
193 indices.
setSize(newIndices.size());
194 flipMap_.setSize(newIndices.size());
198 forAll(sortedNewIndices, i)
200 indices[i] = sortedNewIndices[i].key();
201 flipMap_[i] = sortedNewIndices[i]();
206 void Foam::faceZone::reset(
const labelHashSet& newIndices)
223 const bool moveUpdate,
224 const bool topoUpdate
231 masterCellsPtr_(nullptr),
232 slaveCellsPtr_(nullptr),
244 const bool moveUpdate,
245 const bool topoUpdate
251 masterCellsPtr_(nullptr),
252 slaveCellsPtr_(nullptr),
265 const bool moveUpdate,
266 const bool topoUpdate
273 masterCellsPtr_(nullptr),
274 slaveCellsPtr_(nullptr),
286 const bool moveUpdate,
287 const bool topoUpdate
293 masterCellsPtr_(nullptr),
294 slaveCellsPtr_(nullptr),
310 flipMap_(
dict.lookupOrDefault(
"flipMap",
boolList::null())),
312 masterCellsPtr_(nullptr),
313 slaveCellsPtr_(nullptr),
333 masterCellsPtr_(nullptr),
334 slaveCellsPtr_(nullptr),
352 masterCellsPtr_(nullptr),
353 slaveCellsPtr_(nullptr),
372 masterCellsPtr_(nullptr),
373 slaveCellsPtr_(nullptr),
390 masterCellsPtr_(nullptr),
391 slaveCellsPtr_(nullptr),
506 if (!masterCellsPtr_)
511 return *masterCellsPtr_;
522 return *slaveCellsPtr_;
535 zones().
mesh().edges(),
536 zones().
mesh().pointEdges()
587 zones().
mesh().faces().size(),
598 bool hasError =
false;
612 const label facei = operator[](i);
625 const label facei = operator[](i);
645 const label facei = operator[](i);
653 if (myZoneFace[bFacei] != neiZoneFace[bFacei])
659 Pout<<
" ***Problem with faceZone " <<
name()
660 <<
". Face " << facei
661 <<
" on coupled patch "
663 <<
" is not consistent with its coupled neighbour."
672 else if (oriented_ && myZoneFlip[bFacei] == neiZoneFlip[bFacei])
679 Pout<<
" ***Problem with faceZone " <<
name()
680 <<
". Face " << facei
681 <<
" on coupled patch "
683 <<
" does not have consistent flipMap"
684 <<
" across coupled faces."
706 <<
"Attempt to insert oriented faces into the unoriented faceZone "
712 indices.
insert(newIndices);
722 <<
"Attempt to insert unoriented faces into the oriented faceZone "
728 indices.
insert(newIndices);
736 Swap(oriented_, fz.oriented_);
737 flipMap_.swap(fz.flipMap_);
758 if (
faceMap[facei] >= 0 && i != -1)
763 flipFaceFlux.
found(facei)
770 forAll(reverseFaceMap, facei)
772 const label i = localIndex(facei);
773 if (reverseFaceMap[facei] >= 0 && i != -1)
777 reverseFaceMap[facei],
778 flipFaceFlux.
found(reverseFaceMap[facei])
785 reset(newIndicesMap);
799 patchPtr_->clearGeom();
821 oriented_ = zn.oriented_;
824 flipMap_ = zn.flipMap_;
832 oriented_ = zn.oriented_;
835 flipMap_ = move(zn.flipMap_);
#define forAll(list, i)
Loop across all elements in list.
bool insert(const Key &key)
Insert a new entry.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
bool found(const Key &) const
Return true if hashedEntry is found in table.
const word & name() const
Return name.
label size() const
Return the number of elements in the UList.
void operator=(const UList< label > &)
Assignment to UList operator. Takes linear time.
void setSize(const label)
Reset size of List.
A HashTable to objects of type <T> with a label key.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of faces which address into the list of points.
const T * const_iterator
Random access iterator for traversing UList.
const MeshType & mesh() const
Return the mesh reference.
void swap(Zone &)
Swap two zones.
void topoChange(const labelList &map, const labelList &reverseMap)
Update the addressing using the maps provided.
bool checkDefinition(const label maxSize, const bool report=false) const
Check zone definition with max size given. Return true if in error.
void clearAddressing()
Clear addressing.
void operator=(const Zone &)
Assignment operator.
const faceZoneList & zones() const
Return ZonesType reference.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Named list of face indices representing a sub-set of the mesh faces.
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
void swap(faceZone &)
Swap two faceZones.
void operator=(const faceZone &)
Assignment to zone, clearing demand-driven data.
faceZone(const word &name, const labelUList &addr, const boolList &fm, const faceZoneList &mz, const bool moveUpdate=false, const bool topoUpdate=false)
Construct from components.
const primitiveFacePatch & patch() const
Return reference to primitive patch.
autoPtr< faceZone > clone() const
Construct and return a clone.
const labelList & masterCells() const
Return labels of master cells (cells next to the master face.
void topoChange(const polyTopoChangeMap &)
Update zone using the given map.
void resetAddressing(const labelUList &, const boolList &)
Reset addressing and flip map (clearing demand-driven data)
static const char *const labelsName
The name associated with the zone-labels dictionary entry.
void writeDict(Ostream &) const
Write dictionary.
void insert(const Map< bool > &newIndices)
Insert given indices and corresponding face flips into zone.
void clearAddressing()
Clear addressing.
void movePoints(const pointField &)
Correct patch after moving points.
bool checkParallelSync(const bool report=false) const
Check whether all procs have faces synchronised. Return.
const labelList & slaveCells() const
Return labels of slave cells.
const labelList & meshEdges() const
Return global edge index for local edges.
const polyMesh & mesh() const
Return reference to polyMesh.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelHashSet & flipFaceFlux() const
Map of flipped face flux faces.
const labelList & reverseFaceMap() const
Reverse face map.
const labelList & faceMap() const
Old face map.
label nInternalFaces() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
#define InfoInFunction
Report an information message using Foam::Info.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void deleteDemandDrivenData(DataType *&dataPtr)
errorManip< error > abort(error &err)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(combustionModel, 0)
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
prefixOSstream Pout(cout, "Pout")
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
Foam::primitiveFacePatch.