63 auto* ctorPtr = wordConstructorTable(setType);
71 *wordConstructorTablePtr_
89 auto* ctorPtr = sizeConstructorTable(setType);
97 *sizeConstructorTablePtr_
115 auto* ctorPtr = setConstructorTable(setType);
123 *setConstructorTablePtr_
147 const word& wantedType,
151 if (isReadRequired() || (isReadOptional() && headerOk()))
153 Istream& is = readStream(wantedType);
177 bool changed =
false;
179 for (
const label oldId : labels)
181 if (oldId < 0 || oldId >= map.
size())
184 <<
"Illegal content " << oldId <<
" of set:" <<
name()
185 <<
" of type " <<
type() <<
nl 186 <<
"Value should be between [0," << map.
size() <<
')' 191 const label newId = map[oldId];
213 for (
const label oldId : labels)
215 const label newId = map[oldId];
219 newLabels.set(newId);
223 labels.transfer(newLabels);
229 for (
const label oldId : labels)
231 if (oldId < 0 || oldId >= maxSize)
234 <<
"Illegal content " << oldId <<
" of set:" <<
name()
235 <<
" of type " <<
type() <<
nl 236 <<
"Value should be between [0," << maxSize <<
')' <<
nl 245 for (
const label oldId : labels)
247 if (oldId < 0 || oldId >= maxSize)
250 <<
"Illegal content " << oldId <<
" of set:" <<
name()
251 <<
" of type " <<
type() <<
nl 252 <<
"Value should be between [0," << maxSize <<
')' <<
nl 261 checkLabels(*
this, maxSize);
275 for (; (iter !=
cend()) && (
n < maxElem); ++iter)
277 if (
n && ((
n % 10) == 0))
281 os << iter.key() <<
' ';
301 for (; (iter !=
cend()) && (
n < maxElem); ++iter)
303 if (
n && ((
n % 3) == 0))
307 os << iter.key() << coords[iter.key()] <<
' ';
326 os <<
"Set bounding box: min = " 327 << bb.min() <<
" max = " << bb.max() <<
" metres." <<
nl <<
endl;
331 if (size() <= maxLen)
333 writeDebug(
os, coords, maxLen, iter);
337 const label halfLen = maxLen/2;
339 os <<
"Size larger than " << maxLen <<
". Printing first and last " 340 << halfLen <<
" elements:" <<
nl <<
endl;
342 label
n = writeDebug(
os, coords, halfLen, iter);
346 for (;
n < size() - halfLen; ++
n)
351 writeDebug(
os, coords, halfLen, iter);
360 const polyMesh&
mesh,
435 readIOcontents(wantedType, static_cast<labelHashSet&>(*
this));
469 const word& wantedType,
478 readIOcontents(wantedType, static_cast<labelHashSet&>(*
this));
486 const label initialCapacity,
581 std::move(static_cast<labelHashSet&>(*
this))
587 for (label
id = 0;
id < maxLen; ++id)
589 if (!original.contains(
id))
611 for (
const label elem : elems)
613 if (currentSet.contains(elem))
615 newElems.push_back(elem);
618 if (newElems.size() < currentSet.size())
620 currentSet = newElems;
663 if (size() <= maxLen)
665 writeDebug(
os, maxLen, iter);
669 const label halfLen = maxLen/2;
671 os <<
"Size larger than " << maxLen <<
". Printing first and last " 672 << halfLen <<
" elements:" <<
nl <<
endl;
674 label
n = writeDebug(
os, halfLen, iter);
678 for (;
n < size() - halfLen; ++
n)
683 writeDebug(
os, halfLen, iter);
690 return (
os << *
this).good();
virtual void subset(const labelUList &elems)
Subset contents. Only elements present in both sets remain.
virtual bool writeData(Ostream &) const
Write contents.
writeOption
Enumeration defining write preferences.
bool set(const Key &key)
Same as insert (no value to overwrite)
void operator=(const topoSet &)
Copy labelHashSet part only.
void size(const label n)
Older name for setAddressableSize.
A class for handling file names.
readOption readOpt() const noexcept
Get the read option.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & facesInstance() const
Return the current instance directory for faces.
virtual bool unset(const label id)
Unset an index.
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.
static int disallowGenericSets
Debug switch to disallow the use of generic sets.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
virtual bool set(const label id)
Set an index.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void operator=(const this_type &rhs)
Copy assign.
const Time & time() const
Return the top-level database.
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
UList< label > labelUList
A UList of labels.
virtual bool contains(const label id) const
Has the given index?
fileName path() const
The complete path for the object (with instance, local,...).
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static IOobject findIOobject(const polyMesh &mesh, const word &name, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, IOobjectOption::writeOption wOpt=IOobjectOption::NO_WRITE, IOobjectOption::registerOption reg=IOobjectOption::LEGACY_REGISTER)
Find IOobject in the polyMesh/sets/ (used as constructor helper)
bool unset(const Key &key)
Unset the specified key - same as erase.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
bool contains(const Key &key) const
True if hashed key is contained (found) in table.
word findInstance(const fileName &directory, const word &name=word::null, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, const word &stopInstance=word::null, const bool constant_fallback=true) const
Return time instance (location) of directory containing the file name (eg, used in reading mesh data)...
A class for handling words, derived from Foam::string.
topoSet(const topoSet &)=delete
No copy construct.
Reading is optional [identical to LAZY_READ].
static const word null
An empty word.
void checkLabels(const labelUList &labels, const label maxSize)
Check limits on addressable range.
constexpr auto cend(const C &c) -> decltype(c.end())
Return const_iterator to the end of the container c.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
virtual void addSet(const labelUList &elems)
Add given elements to the set.
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info.
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
#define DebugInfo
Report an information message using Foam::Info.
static autoPtr< topoSet > New(const word &setType, const polyMesh &mesh, const word &name, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, IOobjectOption::writeOption wOpt=IOobjectOption::NO_WRITE)
Return a pointer to a toposet read from file.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
int debug
Static debugging option.
label writeDebug(Ostream &os, const label maxElem, labelHashSet::const_iterator &iter) const
Write part of contents nicely formatted.
virtual void updateLabels(const labelUList &map)
Update map from map.
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
General set of labels of mesh quantity (points, cells, faces).
registerOption
Enumeration for use with registerObject(). Values map to bool (false/true)
virtual bool found(const label id) const
Has the given index?
bool good() const noexcept
True if next operation might succeed.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir)
triangles reserve(surf.size())
virtual void subtractSet(const labelUList &elems)
Subtract given elements from the set.
virtual void sync(const polyMesh &mesh)
Sync set across coupled patches.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
virtual void invert(const label maxLen)
Invert contents.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
typename parent_type::const_key_iterator const_iterator
A const_iterator, returning reference to the key.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
#define DebugVar(var)
Report a variable name and value.
Mesh consisting of general polyhedral cells.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
const_iterator cbegin() const
virtual void check(const label maxSize)
Check limits on addressable range.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Defines the attributes of an object for which implicit objectRegistry management is supported...
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels. Not implemented.
List< label > toc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
static fileName localPath(const polyMesh &mesh, const word &name)
Name of file set will use.
bool readIOcontents(const word &wantedType, labelHashSet &contents)
Read into labelHashSet if IOobject flags set. Return true if read.
readOption
Enumeration defining read preferences.