87 const faceZone& fz = faceZones[zoneID];
139 for (label facei = 0; facei < maxLen; ++facei)
148 addressing_.setSize(
n);
152 for (label facei = 0; facei < maxLen; ++facei)
156 addressing_[
n] = facei;
169 DynamicList<label> newAddressing(addressing_.size());
170 DynamicList<bool> newFlipMap(flipMap_.size());
172 Map<label> faceToIndex(addressing_.size());
175 faceToIndex.insert(addressing_[i], i);
178 const faceZoneSet& zoneSet = refCast<const faceZoneSet>(
set);
180 forAll(zoneSet.addressing(), i)
182 const label facei = zoneSet.addressing()[i];
184 const auto iter = faceToIndex.cfind(facei);
188 const label index = iter.val();
190 if (zoneSet.flipMap()[i] != flipMap_[index])
194 newAddressing.append(facei);
195 newFlipMap.append(flipMap_[index]);
202 <<
"subset : there are " << nConflict
203 <<
" faces with different orientation in faceZonesSets " 204 <<
name() <<
" and " <<
set.name() <<
endl;
207 addressing_.transfer(newAddressing);
208 flipMap_.transfer(newFlipMap);
223 faceToIndex.insert(addressing_[i], i);
226 const faceZoneSet& zoneSet = refCast<const faceZoneSet>(
set);
228 forAll(zoneSet.addressing(), i)
230 label facei = zoneSet.addressing()[i];
232 const auto iter = faceToIndex.cfind(facei);
236 const label index = iter.val();
238 if (zoneSet.flipMap()[i] != flipMap_[index])
245 newAddressing.append(facei);
246 newFlipMap.append(zoneSet.flipMap()[i]);
253 <<
"addSet : there are " << nConflict
254 <<
" faces with different orientation in faceZonesSets " 255 <<
name() <<
" and " <<
set.name() <<
endl;
258 addressing_.transfer(newAddressing);
259 flipMap_.transfer(newFlipMap);
271 const faceZoneSet& zoneSet = refCast<const faceZoneSet>(
set);
274 forAll(zoneSet.addressing(), i)
276 faceToIndex.insert(zoneSet.addressing()[i], i);
281 const label facei = addressing_[i];
283 const auto iter = faceToIndex.cfind(facei);
287 const label index = iter.val();
289 if (zoneSet.flipMap()[index] != flipMap_[i])
297 newAddressing.append(facei);
298 newFlipMap.append(zoneSet.flipMap()[i]);
305 <<
"subtractSet : there are " << nConflict
306 <<
" faces with different orientation in faceZonesSets " 307 <<
name() <<
" and " <<
set.name() <<
endl;
310 addressing_.transfer(newAddressing);
311 flipMap_.transfer(newFlipMap);
331 <<
" faces that are in the faceZone but not" 332 <<
" in the faceSet or vice versa." 333 <<
" The faceZoneSet should only be manipulated" 334 <<
" using " << setsToFaceZone::typeName
335 <<
" or " << setToFaceZone::typeName <<
endl;
347 const label UNFLIPPED = 1;
348 const label FLIPPED = -1;
359 myZoneFace[bFacei] = FLIPPED;
363 myZoneFace[bFacei] = UNFLIPPED;
378 DynamicList<label> newAddressing(addressing_.size());
379 DynamicList<bool> newFlipMap(flipMap_.size());
383 const label facei = addressing_[i];
386 newAddressing.append(facei);
387 newFlipMap.append(flipMap_[i]);
398 if (neiStat == UNFLIPPED)
401 newAddressing.append(facei);
402 newFlipMap.append(
true);
404 else if (neiStat == FLIPPED)
406 newAddressing.append(facei);
407 newFlipMap.append(
false);
412 if (myStat == neiStat)
415 newAddressing.append(facei);
416 if (isMasterFace[facei])
418 newFlipMap.append(myStat == FLIPPED);
422 newFlipMap.append(neiStat == UNFLIPPED);
427 newAddressing.append(facei);
428 newFlipMap.append(myStat == FLIPPED);
433 addressing_.transfer(newAddressing);
434 flipMap_.transfer(newFlipMap);
448 const bool writeOnProc
452 word oldTypeName = typeName;
453 const_cast<word&
>(
type()) = faceSet::typeName;
455 const_cast<word&
>(
type()) = oldTypeName;
463 zoneID = faceZones.
size();
476 faceZones[zoneID].resetAddressing(addressing_, flipMap_);
480 return ok && faceZones.
write(writeOnProc);
487 labelList newAddressing(addressing_.size());
488 boolList newFlipMap(flipMap_.size(),
false);
493 label facei = addressing_[i];
497 newAddressing[
n] = newFacei;
498 newFlipMap[
n] = flipMap_[i];
502 newAddressing.setSize(
n);
503 newFlipMap.setSize(
n);
505 addressing_.transfer(newAddressing);
506 flipMap_.transfer(newFlipMap);
writeOption
Enumeration defining write preferences.
void size(const label n)
Older name for setAddressableSize.
void clearAddressing()
Clear addressing.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
const word & name() const noexcept
Return the object name.
Cell-face mesh analysis engine.
virtual void invert(const label maxLen)
Invert contents.
Type & refCast(U &obj)
A dynamic_cast (for references). Generates a FatalError on failed casts and uses the virtual type() m...
UIndirectList< label > labelUIndList
UIndirectList of labels.
virtual bool set(const label id)
Set an index.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple container for options an IOstream can normally have.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
label nFaces() const noexcept
Number of mesh faces.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
bool isReadOptional() const noexcept
True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].
T & emplace_back(Args &&... args)
Construct and append an element to the end of the list, return reference to the new list element...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
#define forAll(list, i)
Loop across all elements in list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of entries in the list.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
label nInternalFaces() const noexcept
Number of internal faces.
const labelList & addressing() const noexcept
The addressing (face IDs) used for the zone.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual void subtractSet(const topoSet &set)
Subtract elements present in set.
virtual void subset(const topoSet &set)
Subset contents. Only elements present in both sets remain.
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
virtual void sync(const polyMesh &mesh)
Sync faceZoneSet across coupled patches.
bool isReadRequired() const noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
faceZoneSet(const polyMesh &mesh, const word &name, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, IOobjectOption::writeOption wOpt=IOobjectOption::NO_WRITE)
Construct from objectRegistry and name.
void updateSet()
Sort addressing and make faceSet part consistent with addressing.
Like faceSet but -reads data from faceZone -updates faceZone when writing.
General set of labels of mesh quantity (points, cells, faces).
#define WarningInFunction
Report a warning using Foam::Warning.
virtual void addSet(const topoSet &set)
Add elements present in set.
void reserve(label numEntries)
Reserve space for at least the specified number of elements (not the number of buckets) and regenerat...
const boolList & flipMap() const noexcept
Return face flip map.
Mesh consisting of general polyhedral cells.
A subset of mesh faces organised as a primitive patch.
List< label > labelList
A List of labels.
virtual void check(const label maxSize)
Check limits on addressable range.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write faceZone using stream options.
UIndirectList< bool > boolUIndList
UIndirectList of bools.
const labelList & reverseFaceMap() const
Reverse face map.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
void clearStorage()
Remove all entries from table and the table itself.
static constexpr const zero Zero
Global zero (0)
readOption
Enumeration defining read preferences.