64 const label initialCapacity,
83 const auto& zones =
mesh.cellZones();
84 const auto* zonePtr = zones.cfindZone(
name);
91 <<
"Zone named " <<
name <<
" not found. " 92 <<
"List of available zone names: " << zones.names() <<
nl 98 const auto& zn = *zonePtr;
117 const auto* zonePtr = isA<cellZoneSet>(
set);
121 addressing_ = zonePtr->addressing();
125 addressing_ =
set.sortedToc();
139 for (label celli = 0; celli < maxLen; ++celli)
148 addressing_.resize_nocopy(
n);
151 for (label celli = 0; celli < maxLen; ++celli)
155 addressing_[
n] = celli;
166 DynamicList<label> newAddressing(addressing_.size());
168 for (
const label
id : elems)
172 newAddressing.push_back(
id);
176 addressing_.transfer(newAddressing);
183 const auto* zonePtr = isA<cellZoneSet>(
set);
188 this->
subset(zonePtr->addressing());
200 DynamicList<label> newAddressing(addressing_);
202 for (
const label
id : elems)
206 newAddressing.push_back(
id);
210 addressing_.transfer(newAddressing);
217 const auto* zonePtr = isA<cellZoneSet>(
set);
222 this->addSet(zonePtr->addressing());
227 this->addSet(refCast<const cellSet>(
set).
sortedToc());
234 DynamicList<label> newAddressing(addressing_.size());
238 for (
const label
id : addressing_)
243 newAddressing.push_back(
id);
247 addressing_.
transfer(newAddressing);
254 DynamicList<label> newAddressing(addressing_.size());
256 for (
const label
id : addressing_)
261 newAddressing.push_back(
id);
265 addressing_.transfer(newAddressing);
289 const bool writeOnProc
293 const word oldTypeName = typeName;
294 const_cast<word&
>(
type()) = cellSet::typeName;
296 const_cast<word&
>(
type()) = oldTypeName;
299 auto& zones =
const_cast<polyMesh&
>(mesh_).cellZones();
300 auto* zonePtr = zones.findZone(
name());
304 zonePtr->resetAddressing(addressing_);
318 return ok && zones.write(writeOnProc);
324 DynamicList<label> newAddressing(addressing_.size());
326 for (
const label celli : addressing_)
328 label newCelli = morphMap.reverseCellMap()[celli];
331 newAddressing.push_back(newCelli);
335 addressing_.transfer(newAddressing);
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.
const word & name() const noexcept
Return the object name.
Cell-face mesh analysis engine.
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
constexpr char nl
The newline '\n' character (0x0a)
virtual bool set(const label id)
Set an index.
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Like cellSet but -reads data from cellZone -updates cellZone when writing.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write cellZone using stream options.
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.
virtual void subtractSet(const labelUList &elems)
Subtract given elements from the set.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
defineTypeName(manifoldCellsMeshObject)
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
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.
void updateSet()
Sort addressing and make cellSet part consistent with addressing.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual void invert(const label maxLen)
Invert contents.
OBJstream os(runTime.globalPath()/outputName)
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
bool isReadRequired() const noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
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.
label nCells() const noexcept
Number of mesh cells.
A collection of cell labels.
void reserve(label numEntries)
Reserve space for at least the specified number of elements (not the number of buckets) and regenerat...
void transfer(HashTable< T, Key, Hash > &rhs)
Transfer contents into this table.
virtual void addSet(const labelUList &elems)
Add given elements to the set.
virtual void subset(const labelUList &elems)
Subset contents. Only elements present in both sets remain.
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
Mesh consisting of general polyhedral cells.
cellZoneSet(const polyMesh &mesh, const word &name, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, IOobjectOption::writeOption wOpt=IOobjectOption::NO_WRITE)
Construct from objectRegistry and name.
virtual void sync(const polyMesh &mesh)
Sync cellSet across coupled patches; update cellZone from cellSet.
virtual void check(const label maxSize)
Check limits on addressable range.
virtual void sync(const polyMesh &mesh)
Sync cellSet across coupled patches.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
void clearStorage()
Remove all entries from table and the table itself.
readOption
Enumeration defining read preferences.