49 if (shortLen < 0) shortLen = 1;
84 else if (len <= 1 || !shortLen || (len <= shortLen))
125 if (column >= shortLen) { os <<
nl; }
152 int errorCode(errorType::ErrorNone);
162 is.fatalCheck(
"bitSet::readTocList() : reading first token");
166 len = tok.labelToken();
171 tocLen = tok.labelToken();
172 if (len < tocLen) { errorCode = errorType::ErrorSizing; }
176 errorCode = errorType::ErrorToken2;
181 errorCode = errorType::ErrorToken1;
184 if (errorCode == errorType::ErrorNone)
do 193 const char delimiter = is.readBeginList(
"bitSet");
198 for (label i = 0; i < tocLen; ++i)
203 "bitSet::readCompact(Istream&) : " 207 if (tocEntry < 0 || tocEntry >= len)
209 errorCode = errorType::ErrorBounds;
225 "bitSet::readTocList() : " 226 "reading the single entry" 235 if (errorCode == errorType::ErrorNone)
237 is.readEndList(
"bitSet");
243 if (errorCode != errorType::ErrorNone)
247 if (errorType::ErrorToken1 == errorCode)
249 err <<
"Incorrect first token [size], expected <int>, found " 252 else if (errorType::ErrorToken2 == errorCode)
254 err <<
"Incorrect second token [toc size], expected <int>, found " 257 else if (errorType::ErrorSizing == errorCode)
259 err <<
"Bad sizing: has " << tocLen
260 <<
" entries for a bitSet with size " << len <<
nl;
262 else if (errorType::ErrorBounds == errorCode)
264 err <<
"Entry " << tocEntry
265 <<
" not within the expected bounds [0," << len <<
"]" <<
nl;
269 err <<
"Unspecified error" <<
nl;
290 const InfoProxy<bitSet>& iproxy
293 const auto&
bitset = *iproxy;
Begin block [isseparator].
unsigned int count(const bool on=true) const
Count number of bits set.
void set(const bitSet &bitset)
Set specified bits from another bitset.
void fill(const bool val)
Assign all entries to the given value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
label find_first() const
Locate the first bit that is set.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
Begin list [isseparator].
label find_next(label pos) const
Locate the next bit set, starting one beyond the specified position.
Ostream & writeListToc(Ostream &os, label shortLen=0) const
Write contents in "compact" format, which is the listing of the 'on' bits (toc), with line-breaks in ...
bool any() const
True if any bits in this bitset are set.
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Ostream & writeList(Ostream &os, label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
A class for handling words, derived from Foam::string.
errorType
Enumeration for possible parsing error.
void clear()
Clear the list, i.e. set addressable size to zero.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
static constexpr unsigned elem_per_block
The number of elements stored per data block.
label capacity() const noexcept
Number of elements that can be stored without reallocating.
uniformity
Classification of list/container uniformity. The values can be used with bit-wise or reduction...
bitSet bitset(const labelHashSet &locations)
Transform the on locations to a bitSet.
label size() const noexcept
Number of entries.
Istream & readListToc(Istream &is)
Read contents in "compact" format, which is the listing of the 'on' bits (toc)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...