48 const bitSet& bitset = *
this;
49 if (shortLen < 0) shortLen = 1;
52 const label len = bitset.
size();
53 const label tocLen = (bitset.
any() ? bitset.
count() : 0);
66 if (len > 1 && uniformity.good())
84 else if (len <= 1 || !shortLen || (len <= shortLen))
100 for (; iter >= 0; iter = bitset.
find_next(iter))
125 if (column >= shortLen) {
os <<
nl; }
141 bitSet& bitset = *
this;
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;
296 <<
"> size=" << bitset.
size() <<
'/' << bitset.
capacity()
297 <<
" count=" << bitset.
count()
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
A helper class for outputting values to Ostream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
char readEndList(const char *funcName)
End read of list data, ends with ')' or '}'.
char readBeginList(const char *funcName)
Begin read of list data, starts with '(' or '{'.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
label capacity() const noexcept
Number of elements that can be stored without reallocating.
Ostream & writeList(Ostream &os, label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
static constexpr unsigned elem_per_block
label size() const noexcept
Number of entries.
void clear()
Clear the list, i.e. set addressable size to zero.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
unsigned int count(const bool on=true) const
Count number of bits set.
void fill(const bool val)
Assign all entries to the given value.
void set(const bitSet &bitset)
Set specified bits from another bitset.
constexpr bitSet() noexcept
Default construct an empty, zero-sized bitSet.
Istream & readListToc(Istream &is)
Read contents in "compact" format, which is the listing of the 'on' bits (toc).
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 ...
label find_next(label pos) const
Locate the next bit set, starting one beyond the specified position.
bool any() const
True if any bits in this bitset are set.
label find_first() const
Locate the first bit that is set.
A token holds an item read from Istream.
@ BEGIN_BLOCK
Begin block [isseparator].
@ END_BLOCK
End block [isseparator].
@ BEGIN_LIST
Begin list [isseparator].
@ END_LIST
End list [isseparator].
bool isLabel() const noexcept
Integral token is convertible to Foam::label.
label labelToken() const
Return integer type as label value or Error.
bool read(Istream &is)
Read a token from Istream, calls reset() first.
InfoProxy< token > info() const noexcept
Return info proxy, for printing token information to a stream.
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
bitSet bitset(const labelHashSet &locations)
Transform the on locations to a bitSet.
uniformity
Classification of list/container uniformity. The values can be used with bit-wise or reduction.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).