63 auto* ctorPtr = wordConstructorTable(setType);
71 *wordConstructorTablePtr_
89 auto* ctorPtr = sizeConstructorTable(setType);
97 *sizeConstructorTablePtr_
109 const polyMesh&
mesh,
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
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)
360 const polyMesh&
mesh,
370 mesh.time().findInstance
372 mesh.meshDir()/
"sets",
384 if (!
io.typeHeaderOk<topoSet>(
false) && disallowGenericSets != 0)
469 const word& wantedType,
486 const label initialCapacity,
542 return static_cast<const labelHashSet&
>(*this).contains(
id);
548 return static_cast<const labelHashSet&
>(*this).contains(
id);
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();
705 mesh.facesInstance(),
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void push_back(const T &val)
Copy append an element to the end of this list.
typename parent_type::const_key_iterator const_iterator
const_iterator cbegin() const
constexpr const_iterator cend() const noexcept
bool set(const Key &key)
Same as insert (no value to overwrite).
void operator=(const this_type &rhs)
List< Key > toc() const
The table of contents (the keys) in unsorted order.
bool contains(const Key &key) const
True if hashed key is contained (found) in table.
void transfer(HashTable< T, Key, Hash > &rhs)
Transfer contents into this table.
label size() const noexcept
The number of elements in table.
registerOption
Enumeration for use with registerObject(). Values map to bool (false/true).
static bool isReadOptional(readOption opt) noexcept
True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].
static bool isReadRequired(readOption opt) noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
readOption
Enumeration defining read preferences.
@ NO_READ
Nothing to be read.
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ MUST_READ
Reading required.
writeOption
Enumeration defining write preferences.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
bool good() const noexcept
True if next operation might succeed.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void size(const label n)
Older name for setAddressableSize.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A bounding box defined in terms of min/max extrema points.
const point & max() const noexcept
Maximum describing the bounding box.
const point & min() const noexcept
Minimum describing the bounding box.
A class for handling file names.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Mesh consisting of general polyhedral cells.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
void close()
Close Istream.
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
bool headerOk()
Read and check header info. Does not check the headerClassName.
General set of labels of mesh quantity (points, cells, faces).
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
virtual bool writeData(Ostream &) const
Write contents.
virtual void invert(const label maxLen)
Invert contents.
virtual bool unset(const label id)
Unset an index.
bool readIOcontents(const word &wantedType, labelHashSet &contents)
Read into labelHashSet if IOobject flags set. Return true if read.
static fileName localPath(const polyMesh &mesh, const word &name)
Name of file set will use.
void operator=(const topoSet &)
Copy labelHashSet part only.
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.
void checkLabels(const labelUList &labels, const label maxSize)
Check limits on addressable range.
virtual bool found(const label id) const
Has the given index?
topoSet(const topoSet &)=delete
No copy construct.
virtual label maxSize(const polyMesh &mesh) const =0
Return max allowable index (+1). Not implemented.
static int disallowGenericSets
Debug switch to disallow the use of generic sets.
virtual void sync(const polyMesh &mesh)
Sync set across coupled patches.
virtual void subset(const labelUList &elems)
Subset contents. Only elements present in both sets remain.
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).
virtual void subtractSet(const labelUList &elems)
Subtract given elements from the set.
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels. Not implemented.
label writeDebug(Ostream &os, const label maxElem, labelHashSet::const_iterator &iter) const
Write part of contents nicely formatted.
virtual bool contains(const label id) const
Has the given index?
virtual void updateLabels(const labelUList &map)
Update map from map.
virtual bool set(const label id)
Set an index.
virtual void check(const label maxSize)
Check limits on addressable range.
virtual void addSet(const labelUList &elems)
Add given elements to the set.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define DebugInfo
Report an information message using Foam::Info.
#define DebugVar(var)
Report a variable name and value.
Namespace for handling debugging switches.
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
constexpr char nl
The newline '\n' character (0x0a).
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
triangles reserve(surf.size())