54 if (flipMap_.
size() == addressing_.
size())
79 const label initialCapacity,
98 const auto& zones =
mesh.faceZones();
99 const auto* zonePtr = zones.cfindZone(
name);
106 <<
"Zone named " <<
name <<
" not found. " 107 <<
"List of available zone names: " << zones.names() <<
nl 113 const auto& zn = *zonePtr;
114 addressing_ = zn.addressing();
115 flipMap_ = zn.flipMap();
133 const auto* zonePtr = isA<faceZoneSet>(
set);
137 addressing_ = zonePtr->addressing();
138 flipMap_ = zonePtr->flipMap();
143 addressing_ =
set.sortedToc();
157 for (label
id = 0;
id < maxLen; ++id)
166 addressing_.resize_nocopy(
n);
167 flipMap_.resize_nocopy(
n);
170 for (label
id = 0;
id < maxLen; ++id)
183 void Foam::faceZoneSet::subset
187 const UList<bool>& setFlipMap
192 DynamicList<label> newAddressing(addressing_.size());
193 DynamicList<bool> newFlipMap(flipMap_.size());
199 const label facei = setAddressing[i];
201 const auto iter = faceToIndex.cfind(facei);
205 const label index = iter.val();
207 if (setFlipMap.size() && (setFlipMap[i] != flipMap_[index]))
211 newAddressing.append(facei);
212 newFlipMap.append(flipMap_[index]);
219 <<
"subset : there are " << nConflict
220 <<
" faces with different orientation in faceZoneSets " 221 <<
name() <<
" and " << setName <<
endl;
224 addressing_.transfer(newAddressing);
225 flipMap_.transfer(newFlipMap);
230 void Foam::faceZoneSet::subset(
const topoSet&
set)
232 const auto* zonePtr = isA<faceZoneSet>(
set);
236 subset(zonePtr->name(), zonePtr->addressing(), zonePtr->flipMap());
251 void Foam::faceZoneSet::subset(
const labelUList& elems)
257 void Foam::faceZoneSet::addSet
261 const UList<bool>& setFlipMap
266 DynamicList<label> newAddressing(addressing_);
267 DynamicList<bool> newFlipMap(flipMap_);
273 const label facei = setAddressing[i];
274 const auto iter = faceToIndex.cfind(facei);
278 const label index = iter.val();
280 if (setFlipMap.size() && (setFlipMap[i] != flipMap_[index]))
287 newAddressing.append(facei);
288 newFlipMap.append(setFlipMap.size() ? setFlipMap[i] :
false);
295 <<
"addSet : there are " << nConflict
296 <<
" faces with different orientation in faceZonesSets " 297 <<
name() <<
" and " << setName <<
endl;
300 addressing_.transfer(newAddressing);
301 flipMap_.transfer(newFlipMap);
306 void Foam::faceZoneSet::addSet(
const topoSet&
set)
308 const auto* zonePtr = isA<faceZoneSet>(
set);
312 addSet(zonePtr->name(), zonePtr->addressing(), zonePtr->flipMap());
327 void Foam::faceZoneSet::addSet(
const labelUList& elems)
333 void Foam::faceZoneSet::subtractSet
337 const UList<bool>& setFlipMap
342 DynamicList<label> newAddressing(addressing_.size());
343 DynamicList<bool> newFlipMap(flipMap_.size());
345 Map<label> faceToIndex(
invertToMap(setAddressing));
349 const label facei = addressing_[i];
351 const auto iter = faceToIndex.cfind(facei);
355 const label index = iter.val();
357 if (setFlipMap.size() && (setFlipMap[index] != flipMap_[i]))
365 newAddressing.append(facei);
366 newFlipMap.append(setFlipMap.size() ? setFlipMap[i] :
false);
373 <<
"subtractSet : there are " << nConflict
374 <<
" faces with different orientation in faceZonesSets " 375 <<
name() <<
" and " << setName <<
endl;
378 addressing_.transfer(newAddressing);
379 flipMap_.transfer(newFlipMap);
384 void Foam::faceZoneSet::subtractSet(
const topoSet&
set)
386 const auto* zonePtr = isA<faceZoneSet>(
set);
390 subtractSet(zonePtr->name(), zonePtr->addressing(), zonePtr->flipMap());
405 void Foam::faceZoneSet::subtractSet(
const labelUList& elems)
425 const label UNFLIPPED = 1;
426 const label FLIPPED = -1;
431 const label facei = addressing_[i];
460 DynamicList<label> newAddressing(
set.size());
461 DynamicList<bool> newFlipMap(
set.size());
463 for (
const label facei :
set)
468 newAddressing.append(facei);
469 newFlipMap.append(myZoneFace[facei] == FLIPPED);
473 const label myStat = myZoneFace[facei];
480 if (neiStat == UNFLIPPED)
483 newAddressing.append(facei);
484 newFlipMap.append(
true);
486 else if (neiStat == FLIPPED)
488 newAddressing.append(facei);
489 newFlipMap.append(
false);
494 newAddressing.append(facei);
495 newFlipMap.append(!isMasterFace[facei]);
500 if (myStat == neiStat)
503 newAddressing.append(facei);
504 if (isMasterFace[facei])
506 newFlipMap.append(myStat == FLIPPED);
510 newFlipMap.append(neiStat == UNFLIPPED);
515 newAddressing.append(facei);
516 newFlipMap.append(myStat == FLIPPED);
522 addressing_.transfer(newAddressing);
523 flipMap_.transfer(newFlipMap);
537 const bool writeOnProc
541 const word oldTypeName = typeName;
542 const_cast<word&
>(
type()) = faceSet::typeName;
544 const_cast<word&
>(
type()) = oldTypeName;
547 auto& zones =
const_cast<polyMesh&
>(mesh_).faceZones();
548 auto* zonePtr = zones.findZone(
name());
552 zonePtr->resetAddressing(addressing_, flipMap_);
567 return ok && zones.write(writeOnProc);
578 label facei = addressing_[i];
583 newFlipMap.push_back(flipMap_[i]);
587 addressing_.transfer(newAddressing);
588 flipMap_.transfer(newFlipMap);
writeOption
Enumeration defining write preferences.
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void clearAddressing(const bool isMeshUpdate=false)
Clear addressing.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.
constexpr char nl
The newline '\n' character (0x0a)
UIndirectList< label > labelUIndList
UIndirectList of labels.
virtual bool set(const label id)
Set an index.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
A simple container for options an IOstream can normally have.
bool isAnyRead() const noexcept
True if any reading may be required (ie, != NO_READ)
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
label nFaces() const noexcept
Number of mesh faces.
void push_back(const T &val)
Append an element at the end of the list.
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
virtual bool contains(const label id) const
Has the given index?
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
const labelList & reverseFaceMap() const noexcept
Reverse face map.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
defineTypeName(manifoldCellsMeshObject)
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.
A class for handling words, derived from Foam::string.
void sort(UList< T > &list)
Sort the list.
static const word null
An empty word.
label nInternalFaces() const noexcept
Number of internal faces.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
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).
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
#define WarningInFunction
Report a warning using Foam::Warning.
void reserve(label numEntries)
Reserve space for at least the specified number of elements (not the number of buckets) and regenerat...
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
Mesh consisting of general polyhedral cells.
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)
Map< label > invertToMap(const labelUList &values)
Create inverse mapping, which is a lookup table into the given list.
static const List< bool > & null() noexcept
Return a null List (reference to a nullObject). Behaves like an empty List.
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.
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.