Go to the documentation of this file.
63 auto* ctorPtr = wordConstructorTable(setType);
71 *wordConstructorTablePtr_
89 auto* ctorPtr = sizeConstructorTable(setType);
97 *sizeConstructorTablePtr_
115 auto* ctorPtr = setConstructorTable(setType);
123 *setConstructorTablePtr_
139 return mesh.facesInstance()/
mesh.dbDir()/polyMesh::meshSubDir/
"sets"/
name;
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);
408 const word& wantedType,
423 if (readStream(wantedType).good())
425 readStream(wantedType) >>
static_cast<labelHashSet&
>(*this);
510 return static_cast<const labelHashSet&
>(*this).found(
id);
547 resize(2*
max(64, (maxLen - original.size())));
549 for (label
id=0;
id < maxLen; ++id)
551 if (!original.found(
id))
582 this->subtractSet(
set);
598 if (size() <= maxLen)
600 writeDebug(
os, maxLen, iter,
n);
604 label halfLen = maxLen/2;
606 os <<
"Size larger than " << maxLen <<
". Printing first and last "
607 << halfLen <<
" elements:" <<
nl <<
endl;
609 writeDebug(
os, halfLen, iter,
n);
613 for (;
n < size() - halfLen; ++
n)
618 writeDebug(
os, halfLen, iter,
n);
625 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.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
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 assign.
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())
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.
OBJstream os(runTime.globalPath()/outputName)
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)
readOption readOpt() const noexcept
The read option.
const word & name() const noexcept
Return name.
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.
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.
bool good() const noexcept
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
const Time & time() const
Return the top-level database.
void size(const label n)
Older name for setAddressableSize.
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.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses 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?