Go to the documentation of this file.
62 auto cstrIter = wordConstructorTablePtr_->cfind(setType);
64 if (!cstrIter.found())
70 *wordConstructorTablePtr_
87 auto cstrIter = sizeConstructorTablePtr_->cfind(setType);
89 if (!cstrIter.found())
95 *sizeConstructorTablePtr_
112 auto cstrIter = setConstructorTablePtr_->cfind(setType);
114 if (!cstrIter.found())
120 *setConstructorTablePtr_
136 return mesh.facesInstance()/
mesh.dbDir()/polyMesh::meshSubDir/
"sets"/
name;
150 bool changed =
false;
152 for (
const label oldId : labels)
154 if (oldId < 0 || oldId >= map.
size())
157 <<
"Illegal content " << oldId <<
" of set:" <<
name()
158 <<
" of type " <<
type() <<
nl
159 <<
"Value should be between [0," << map.
size() <<
')'
164 const label newId = map[oldId];
186 for (
const label oldId : labels)
188 const label newId = map[oldId];
192 newLabels.set(newId);
196 labels.transfer(newLabels);
204 for (
const label oldId : labels)
206 if (oldId < 0 || oldId >= maxSize)
209 <<
"Illegal content " << oldId <<
" of set:" <<
name()
210 <<
" of type " <<
type() <<
nl
211 <<
"Value should be between [0," << maxSize <<
')'
230 for (; (iter !=
cend()) && (
n < maxElem); ++iter)
232 if (
n && ((
n % 10) == 0))
236 os << iter.key() <<
' ';
256 for (; (iter !=
cend()) && (
n < maxElem); ++iter)
258 if (
n && ((
n % 3) == 0))
262 os << iter.key() << coords[iter.key()] <<
' ';
280 os <<
"Set bounding box: min = "
281 << bb.
min() <<
" max = " << bb.
max() <<
" metres." <<
nl <<
endl;
287 if (size() <= maxLen)
289 writeDebug(os, coords, maxLen, iter,
n);
293 label halfLen = maxLen/2;
295 os <<
"Size larger than " << maxLen <<
". Printing first and last "
296 << halfLen <<
" elements:" <<
nl <<
endl;
298 writeDebug(os, coords, halfLen, iter,
n);
302 for (;
n < size() - halfLen; ++
n)
307 writeDebug(os, coords, halfLen, iter,
n);
408 const word& wantedType,
426 if (readStream(wantedType).good())
428 readStream(wantedType) >>
static_cast<labelHashSet&
>(*this);
552 for (label
id=0;
id < maxLen; ++id)
554 if (!original.
found(
id))
585 this->subtractSet(set);
601 if (size() <= maxLen)
603 writeDebug(os, maxLen, iter,
n);
607 label halfLen = maxLen/2;
609 os <<
"Size larger than " << maxLen <<
". Printing first and last "
610 << halfLen <<
" elements:" <<
nl <<
endl;
612 writeDebug(os, halfLen, iter,
n);
616 for (;
n < size() - halfLen; ++
n)
621 writeDebug(os, halfLen, iter,
n);
628 return (os << *
this).good();
void writeDebug(Ostream &os, const label maxElem, topoSet::const_iterator &iter, label &elemI) const
Write part of contents nicely formatted. Prints labels only.
int debug
Static debugging option.
static fileName localPath(const polyMesh &mesh, const word &name)
Name of file set will use.
topoSet(const topoSet &)=delete
No copy construct.
vectorField pointField
pointField is a vectorField.
label size() const noexcept
The number of elements in table.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const word & name() const
Return name.
A class for handling words, derived from Foam::string.
A class for handling file names.
void operator=(const topoSet &)
Copy labelHashSet part only.
void operator=(const this_type &rhs)
Copy assignment.
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
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.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
virtual const fileName & dbDir() const
Override the objectRegistry dbDir for a single-region case.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
const fileName & facesInstance() const
Return the current instance directory for faces.
virtual void deleteSet(const topoSet &set)
Deprecated(2018-10) subtract elements present in set.
static int disallowGenericSets
Debug switch to disallow the use of generic sets.
virtual void subset(const topoSet &set)
Subset contents. Only elements present in both sets remain.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const point & max() const
Maximum describing the bounding box.
static autoPtr< topoSet > New(const word &setType, const polyMesh &mesh, const word &name, readOption r=MUST_READ, writeOption w=NO_WRITE)
Return a pointer to a toposet read from file.
virtual void invert(const label maxLen)
Invert contents.
Mesh consisting of general polyhedral cells.
const point & min() const
Minimum describing the bounding box.
static IOobject findIOobject(const polyMesh &mesh, const word &name, readOption r=MUST_READ, writeOption w=NO_WRITE)
Find IOobject in the polyMesh/sets (used as constructor helper)
typename parent_type::const_key_iterator const_iterator
A const_iterator, returning reference to the key.
virtual void addSet(const topoSet &set)
Add elements present in set.
writeOption
Enumeration defining the write options.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
virtual bool found(const label id) const
Has the given index?
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels. Not implemented.
patchWriters resize(patchIds.size())
word name(const complex &c)
Return string representation of complex.
virtual bool set(const label id)
Set an index.
virtual void subtractSet(const topoSet &set)
Subtract elements present in set.
General set of labels of mesh quantity (points, cells, faces).
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
bool unset(const Key &key)
Unset the specified key - same as erase.
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
errorManip< error > abort(error &err)
constexpr auto cend(const C &c) -> decltype(c.end())
Return const_iterator to the end of the container c.
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
errorManipArg< error, int > exit(error &err, const int errNo=1)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInfo
Report an information message using Foam::Info.
constexpr auto cbegin(const C &c) -> decltype(c.begin())
Return const_iterator to the beginning of the container c.
bool rmDir(const fileName &directory, const bool silent=false)
Remove a directory and its contents (optionally silencing warnings)
void close()
Close Istream.
virtual bool writeData(Ostream &) const
Write contents.
readOption readOpt() const
The read option.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static const word null
An empty word.
virtual bool unset(const label id)
Unset an index.
virtual void check(const label maxSize)
Check limits on addressable range.
A bounding box defined in terms of min/max extrema points.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
const Time & time() const
Return the top-level database.
readOption
Enumeration defining the read options.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Istream & readStream(const word &, const bool valid=true)
Return Istream and check object type against that given.
virtual void sync(const polyMesh &mesh)
Sync set across coupled patches.
bool found(const Key &key) const
Return true if hashed entry is found in table.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys and label hasher.
virtual void updateLabels(const labelUList &map)
Update map from map.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
#define DebugVar(var)
Report a variable name and value.
defineTypeNameAndDebug(combustionModel, 0)
bool headerOk()
Read and check header info.
bool set(const Key &key)
Same as insert (no value to overwrite)
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?