63 auto* ctorPtr = wordConstructorTable(setType);
71 *wordConstructorTablePtr_
89 auto* ctorPtr = sizeConstructorTable(setType);
97 *sizeConstructorTablePtr_
115 auto* ctorPtr = setConstructorTable(setType);
123 *setConstructorTablePtr_
153 bool changed =
false;
155 for (
const label oldId : labels)
157 if (oldId < 0 || oldId >= map.
size())
160 <<
"Illegal content " << oldId <<
" of set:" <<
name()
161 <<
" of type " <<
type() <<
nl 162 <<
"Value should be between [0," << map.
size() <<
')' 167 const label newId = map[oldId];
189 for (
const label oldId : labels)
191 const label newId = map[oldId];
195 newLabels.set(newId);
199 labels.transfer(newLabels);
207 for (
const label oldId : labels)
209 if (oldId < 0 || oldId >= maxSize)
212 <<
"Illegal content " << oldId <<
" of set:" <<
name()
213 <<
" of type " <<
type() <<
nl 214 <<
"Value should be between [0," << maxSize <<
')' 233 for (; (iter !=
cend()) && (
n < maxElem); ++iter)
235 if (
n && ((
n % 10) == 0))
239 os << iter.key() <<
' ';
259 for (; (iter !=
cend()) && (
n < maxElem); ++iter)
261 if (
n && ((
n % 3) == 0))
265 os << iter.key() << coords[iter.key()] <<
' ';
283 os <<
"Set bounding box: min = " 284 << bb.min() <<
" max = " << bb.max() <<
" metres." <<
nl <<
endl;
290 if (size() <= maxLen)
292 writeDebug(
os, coords, maxLen, iter,
n);
296 label halfLen = maxLen/2;
298 os <<
"Size larger than " << maxLen <<
". Printing first and last " 299 << halfLen <<
" elements:" <<
nl <<
endl;
301 writeDebug(
os, coords, halfLen, iter,
n);
305 for (;
n < size() - halfLen; ++
n)
310 writeDebug(
os, coords, halfLen, iter,
n);
319 const polyMesh&
mesh,
390 if (readStream(wantedType).
good())
392 readStream(wantedType) >>
static_cast<labelHashSet&
>(*this);
402 const polyMesh&
mesh,
403 const word& wantedType,
409 regIOobject(findIOobject(
mesh,
name, rOpt, wOpt))
425 const polyMesh&
mesh,
533 std::move(static_cast<labelHashSet&>(*
this))
537 resize(2*
max(64, (maxLen - original.size())));
539 for (label
id=0;
id < maxLen; ++id)
541 if (!original.found(
id))
572 this->subtractSet(
set);
588 if (size() <= maxLen)
590 writeDebug(
os, maxLen, iter,
n);
594 label halfLen = maxLen/2;
596 os <<
"Size larger than " << maxLen <<
". Printing first and last " 597 << halfLen <<
" elements:" <<
nl <<
endl;
599 writeDebug(
os, halfLen, iter,
n);
603 for (;
n < size() - halfLen; ++
n)
608 writeDebug(
os, halfLen, iter,
n);
615 return (
os << *
this).good();
static IOobject findIOobject(const polyMesh &mesh, const word &name, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, IOobjectOption::writeOption wOpt=IOobjectOption::NO_WRITE)
Find IOobject in the polyMesh/sets (used as constructor helper)
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.
word findInstance(const fileName &dir, const word &name=word::null, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, const word &stopInstance=word::null) const
Return time instance (location) of dir that contains the file name (eg, used in reading mesh data)...
patchWriters resize(patchIds.size())
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.
bool found(const Key &key) const
Same as contains()
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.
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.
bool headerOk()
Read and check header info. Does not check the headerClassName.
void operator=(const this_type &rhs)
Copy assign.
virtual const fileName & dbDir() const
Override the objectRegistry dbDir for a single-region case.
bool good() const noexcept
Did last readHeader() succeed?
const Time & time() const
Return the top-level database.
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
bool isReadOptional() const noexcept
True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
fileName path() const
The complete path.
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.
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.
virtual void addSet(const topoSet &set)
Add elements present in set.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
void close()
Close Istream.
A class for handling words, derived from Foam::string.
void writeDebug(Ostream &os, const label maxElem, topoSet::const_iterator &iter, label &elemI) const
Write part of contents nicely formatted. Prints labels only.
topoSet(const topoSet &)=delete
No copy construct.
Reading is optional [identical to LAZY_READ].
static const word null
An empty word.
virtual void subset(const topoSet &set)
Subset contents. Only elements present in both sets remain.
virtual void subtractSet(const topoSet &set)
Subtract elements present in set.
constexpr auto cend(const C &c) -> decltype(c.end())
Return const_iterator to the end of the container c.
errorManip< error > abort(error &err)
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) 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.
virtual void updateLabels(const labelUList &map)
Update map from map.
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
constexpr auto cbegin(const C &c) -> decltype(c.begin())
Return const_iterator to the beginning of the container c.
bool isReadRequired() const noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
General set of labels of mesh quantity (points, cells, faces).
virtual bool found(const label id) const
Has the given index?
virtual void deleteSet(const topoSet &set)
Deprecated(2018-10) subtract elements present in 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.
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)
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.
Istream & readStream(const word &, const bool readOnProc=true)
Return Istream and check object type against that given.
readOption
Enumeration defining read preferences.