Various bit-wise operations and adaptor methods for containers that are somewhat similar to bitSet (eg, boolList, labelHashSet). More...
Classes | |
| struct | bitInfo |
| An (unsigned) integral type adapter, for output of bit values. More... | |
Functions | |
| unsigned int | count (const UList< bool > &bools, const bool val=true) |
| Count number of 'true' entries. More... | |
| bool | all (const UList< bool > &bools) |
| True if all entries are 'true' or if the list is empty. More... | |
| bool | any (const UList< bool > &bools) |
| True if any entries are 'true'. More... | |
| bool | none (const UList< bool > &bools) |
| True if no entries are 'true'. More... | |
| void | set (List< bool > &bools, const labelUList &locations) |
| Set the listed locations (assign 'true'). More... | |
| void | set (List< bool > &bools, const labelRange &range) |
| Set the specified range 'on' in a boolList. More... | |
| void | set (labelHashSet &hashset, const labelRange &range) |
| Set the specified range in a labelHashSet. More... | |
| void | set (bitSet &bitset, const labelRange &range) |
| Forward to bitSet::set(labelRange) More... | |
| void | unset (List< bool > &bools, const labelUList &locations) |
| Unset the listed locations (assign 'false'). More... | |
| void | unset (List< bool > &bools, const labelRange &range) |
| Unset the specified range 'on' in a boolList. More... | |
| void | unset (labelHashSet &hashset, const labelRange &range) |
| Unset the specified range in a labelHashSet. More... | |
| void | unset (bitSet &bitset, const labelRange &range) |
| Forward to bitSet::unset(labelRange) More... | |
| List< bool > | select (const label n, const labelUList &locations) |
| Construct a selection list of bools (all false) with the given pre-size, subsequently add specified locations as true, auto-vivify entries if needed. More... | |
| List< bool > | select (const labelUList &locations) |
| Construct an auto-sized selection list of bools (all false), and populate the specified locations as true. More... | |
| unsigned int | count (const bitSet &bitset, const bool on=true) |
| Forward to bitSet::count() More... | |
| List< label > | toc (const UList< bool > &bools) |
| Return the (sorted) values corresponding to 'true' entries. More... | |
| List< label > | sortedToc (const UList< bool > &bools) |
| Return the (sorted) values corresponding to 'true' entries. More... | |
| List< label > | toc (const bitSet &bitset) |
| Forward to bitSet::toc(), the sorted values of the 'on' entries. More... | |
| List< label > | sortedToc (const bitSet &bitset) |
| Forward to bitSet::sortedToc(), the sorted values of the 'on' entries. More... | |
| List< label > | toc (const labelHashSet &hashset) |
| Forward to labelHashSet::sortedToc(), the sorted values of the 'on' entries. More... | |
| List< label > | sortedToc (const labelHashSet &hashset) |
| Forward to labelHashSet::sortedToc(), the sorted values of the 'on' entries. More... | |
| template<class UIntType > | |
| unsigned int | bit_count (UIntType x) |
| Count arbitrary number of bits (of an integral type) More... | |
| template<> | |
| unsigned int | bit_count (uint32_t x) |
| Count bits in a 32-bit value (Hamming weight method) More... | |
| template<> | |
| unsigned int | bit_count (uint64_t x) |
| Count bits in a 64-bit value (Hamming weight method) More... | |
| template<class UIntType , unsigned BitWidth> | |
| UIntType | repeat_value (unsigned val) |
| Repeat a value of the given BitWidth into the destination output type. More... | |
| template<class UIntType > | |
| Ostream & | print (Ostream &os, UIntType value, char off='0', char on='1') |
| Print 0/1 bits in the (unsigned) integral type. More... | |
Various bit-wise operations and adaptor methods for containers that are somewhat similar to bitSet (eg, boolList, labelHashSet).
The population count uses the Hamming weight (http://en.wikipedia.org/wiki/Hamming_weight).
|
inline |
Count number of 'true' entries.
| val | can be set to false to count the number of false values instead For compatibility with bitSet::count() |
Definition at line 73 of file BitOps.H.
References UList< T >::begin(), Foam::HashSetOps::bools(), count(), and UList< T >::end().
Referenced by geometric::add(), object::addData(), triSurfaceMesh::addFaceToEdge(), Foam::average(), UOPstreamBase::beginRawWrite(), isoSurfaceBase::blockCells(), faPatch::boundaryConnections(), faPatch::boundaryProcSizes(), faMesh::boundaryProcSizes(), CloudFunctionObjectList< KinematicCloud< Cloud< basicKinematicCollidingParcel > > >::CloudFunctionObjectList(), collector::collector(), hexRef8::consistentSlowRefinement(), ensightMesh::correct(), cellCellStencil::count(), objectRegistry::count(), IOobjectList::count(), isoSurfaceBase::countCutType(), HashTable< const regIOobject * >::countEntries(), IOobjectList::countImpl(), objectRegistry::countImpl(), HashTable< const regIOobject * >::countKeys(), IOobjectList::countTypeImpl(), objectRegistry::countTypeImpl(), HashTable< const regIOobject * >::countValues(), HashTable< const regIOobject * >::csorted(), decompositionMethod::decompose(), snappyVoxelMeshDriver::doRefine(), Foam::duplicateOrder(), limitFields::execute(), memorybuf::out_dynamic::extend(), memorybuf::out_dynamic::extend_exact(), sigFpe::fillNan(), sigFpe::fillNan_if(), manifoldCellsMeshObject::filter(), namesList< solutionEntry >::findNames(), NURBS3DVolume::findPointsInBox(), span< Type >::first(), UPstream::gather(), Foam::gAverage(), ISstream::getLine(), Histogram< List >::Histogram(), InjectionModelList< Foam::KinematicCloud< Cloud< basicKinematicCollidingParcel > > >::InjectionModelList(), Foam::inplaceSubset(), Foam::inplaceSubsetList(), UPstream::interNode_offsets(), span< Type >::last(), mapDistribute::mapDistribute(), wordRes::matching(), scalars::matching(), fileOperation::mergeTimes(), IOobjectList::namesImpl(), objectRegistry::namesImpl(), IOobjectList::namesTypeImpl(), objectRegistry::namesTypeImpl(), UPstream::newCommunicator(), UOprocess::newField(), vtuAdaptor::NewPoints(), Foam::vtk::Tools::NewPoints(), pointBoundaryMesh::nNonProcessor(), faBoundaryMesh::nNonProcessor(), polyBoundaryMesh::nNonProcessor(), faBoundaryMesh::nNonProcessorEdges(), polyBoundaryMesh::nNonProcessorFaces(), pointBoundaryMesh::nProcessorPatches(), faBoundaryMesh::nProcessorPatches(), polyBoundaryMesh::nProcessorPatches(), blockMesh::numZonedBlocks(), IOobjectList::objectsTypeImpl(), objectRegistry::objectsTypeImpl(), memorybuf::out_base::overwrite(), CompactListList< T >::pack_impl(), Foam::parseStream(), ParticleForceList< KinematicCloud< Cloud< basicKinematicCollidingParcel > > >::ParticleForceList(), points_delaunay_naive_2d(), ParticleTracks< CloudType >::postFace(), Foam::printHostsSubscription(), HashTable< const regIOobject * >::printInfo(), UPstream::printTopoControl(), FIRECore::putFireLabels(), ensightReadFile::read(), FixedValueConstraint< Type >::read(), UIPstreamBase::read(), ISstream::read(), CompactIOList< face >::readCompact(), CompactIOField< T >::readCompact(), lumpedPointState::readPlain(), UIPstreamBase::readRaw(), ISstream::readRaw(), FIREMeshReader::readSelections(), Foam::reduce(), AMIWeights::reportPatch(), porosityModelList::reset(), optionList::reset(), List< Field< scalar > >::resize_copy(), DynamicList< Foam::vector >::resize_copy(), DynamicField< Foam::vector >::resize_copy(), UPstream::scatter(), clockValue::seconds(), surfaceFeatures::selectFeatureEdges(), lumpedPointDisplacementPointPatchVectorField::setInterpolators(), lumpedPointDisplacementPointPatchVectorField::setPatchControls(), Foam::vtk::sizeofData(), ensightFaces::sizes(), ensightCells::sizes(), snappyVoxelMeshDriver::snappyVoxelMeshDriver(), HashTable< const regIOobject * >::sorted(), clockValue::str(), IndirectList< T >::subset(), IndirectList< T >::subset_if(), Foam::sumReduce(), surfaceFeatures::surfaceFeatures(), masterUncollatedFileOperation::sync(), toc(), bitSet::toc(), HashTable< const regIOobject * >::toc(), HashTable< const regIOobject * >::tocEntries(), HashTable< const regIOobject * >::tocKeys(), HashTable< const regIOobject * >::tocValues(), ensightFaces::totalSize(), ensightCells::totalSize(), wordRes::uniq(), IndirectList< T >::uniq(), Foam::uniqueOrder(), cellVolumeWeight::update(), inverseDistance::update(), cellCellStencil::walkFront(), prefixOSstream::write(), OSstream::write(), UOPstreamBase::write(), ensightFile::write(), Foam::writeAllAreaFields(), Foam::writeAllDimFields(), Foam::writeAllEdgeFields(), Foam::writeAllPointFields(), Foam::writeAllVolFields(), Foam::writeAreaFields(), Foam::writeCoordHeader(), Foam::writeDimFields(), Foam::writeEdgeFields(), advancingFrontAMI::writeIntersectionOBJ(), Foam::meshTools::writeOBJ(), Foam::writePointFields(), OSstream::writeQuoted(), OSstream::writeRaw(), UOPstreamBase::writeRaw(), cellClassification::writeStats(), surfaceNoise::writeSurfaceData(), Foam::writeVolFields(), memorybuf::in_base::xsgetn(), memorybuf::out_base::xsputn(), and memorybuf::out_dynamic::xsputn().

|
inline |
True if all entries are 'true' or if the list is empty.
For compatibility with bitSet::all()
Definition at line 83 of file BitOps.H.
References UList< T >::all(), and Foam::HashSetOps::bools().
Referenced by Foam::PstreamGlobals::printDataTypes().


|
inline |
True if any entries are 'true'.
For compatibility with bitSet::any()
Definition at line 90 of file BitOps.H.
References UList< T >::any(), and Foam::HashSetOps::bools().
Referenced by boolVector::none(), and bitSet::toc().


|
inline |
True if no entries are 'true'.
For compatibility with bitSet::none()
Definition at line 97 of file BitOps.H.
References Foam::HashSetOps::bools(), and UList< T >::none().

| void set | ( | List< bool > & | bools, |
| const labelUList & | locations | ||
| ) |
Set the listed locations (assign 'true').
Does auto-vivify for non-existent entries.
For compatibility with bitSet::set(labelUList)
Definition at line 35 of file BitOps.C.
References UList< T >::begin(), Foam::HashSetOps::bools(), UList< T >::end(), Foam::max(), List< T >::resize(), and UList< T >::size().
Referenced by HashPtrTable< exprResult >::emplace(), PtrList< transferModel >::release(), select(), PtrList< transferModel >::set(), PtrDynList< Foam::profilingInformation >::set(), and HashPtrTable< exprResult >::set().


| void set | ( | List< bool > & | bools, |
| const labelRange & | range | ||
| ) |
Set the specified range 'on' in a boolList.
For compatibility with bitSet::set(labelRange)
Definition at line 57 of file BitOps.C.
References labelRange::adjust(), Foam::HashSetOps::bools(), IntRange< IntType >::empty(), IntRange< IntType >::end_value(), range, List< T >::resize(), List< T >::set(), and UList< T >::size().

| void set | ( | labelHashSet & | hashset, |
| const labelRange & | range | ||
| ) |
Set the specified range in a labelHashSet.
For compatibility with bitSet::set(labelRange)
Definition at line 86 of file BitOps.C.
References labelRange::adjust(), range, and HashSet< Key, Hash >::set().

| void set | ( | bitSet & | bitset, |
| const labelRange & | range | ||
| ) |
Forward to bitSet::set(labelRange)
Definition at line 98 of file BitOps.C.
References Foam::HashSetOps::bitset(), range, and bitSet::set().

| void unset | ( | List< bool > & | bools, |
| const labelUList & | locations | ||
| ) |
Unset the listed locations (assign 'false').
No auto-vivify non-existent entries.
For compatibility with bitSet::set(labelUList)
Definition at line 104 of file BitOps.C.
References Foam::HashSetOps::bools(), and UList< T >::unset().
Referenced by Foam::debug::listDebugSwitches(), Foam::debug::listInfoSwitches(), Foam::debug::listOptimisationSwitches(), Foam::debug::listRegisteredDebugSwitches(), Foam::debug::listRegisteredInfoSwitches(), Foam::debug::listRegisteredOptimisationSwitches(), Foam::debug::listRegisteredSwitches(), Foam::debug::listSwitches(), Foam::listSwitches(), and HashSet< word, Hash< word > >::unset().


| void unset | ( | List< bool > & | bools, |
| const labelRange & | range | ||
| ) |
Unset the specified range 'on' in a boolList.
For compatibility with bitSet::unset(labelRange)
Definition at line 114 of file BitOps.C.
References Foam::HashSetOps::bools(), range, and UList< T >::unset().

| void unset | ( | labelHashSet & | hashset, |
| const labelRange & | range | ||
| ) |
Unset the specified range in a labelHashSet.
For compatibility with bitSet::unset(labelRange)
Definition at line 123 of file BitOps.C.
References range, and HashSet< Key, Hash >::unset().

| void unset | ( | bitSet & | bitset, |
| const labelRange & | range | ||
| ) |
Forward to bitSet::unset(labelRange)
Definition at line 132 of file BitOps.C.
References Foam::HashSetOps::bitset(), range, and bitSet::unset().

| Foam::List< bool > select | ( | const label | n, |
| const labelUList & | locations | ||
| ) |
Construct a selection list of bools (all false) with the given pre-size, subsequently add specified locations as true, auto-vivify entries if needed.
Similar to bitSet construction from locations
Definition at line 139 of file BitOps.C.
References Foam::HashSetOps::bools(), n, and set().
Referenced by Foam::BitSetOps::create(), fvMeshDistribute::distribute(), zeroGradient::execute(), ddt2::execute(), decompositionMethod::findCoeffsDict(), if(), Foam::inplaceSubset(), wordRes::match(), wordRes::matched(), wordRes::matching(), ParticleErosion< CloudType >::ParticleErosion(), polyBoundaryMesh::patchSet(), ABAQUSCore::readHelper::purge_solids(), randomDecomp::randomDecomp(), IndirectList< T >::subset(), Foam::subsetAdjacency(), extendedEdgeMesh::trim(), Foam::HashSetOps::used(), and writeObjects::write().


| Foam::List< bool > select | ( | const labelUList & | locations | ) |
Construct an auto-sized selection list of bools (all false), and populate the specified locations as true.
Similar to bitSet construction from locations
Definition at line 152 of file BitOps.C.
References Foam::HashSetOps::bools(), and set().

| unsigned int count | ( | const bitSet & | bitset, |
| const bool | on = true |
||
| ) |
Forward to bitSet::count()
Definition at line 28 of file BitOps.C.
References Foam::HashSetOps::bitset(), and bitSet::count().
Referenced by count().


| Foam::List< Foam::label > toc | ( | const UList< bool > & | bools | ) |
Return the (sorted) values corresponding to 'true' entries.
Similar to bitSet::toc()
Definition at line 163 of file BitOps.C.
References Foam::constant::physicoChemical::b, Foam::HashSetOps::bools(), count(), and UList< T >::size().
Referenced by HashTable< const regIOobject * >::at(), Foam::FOAM_DEPRECATED_FOR(), distribution::mean(), sortedToc(), HashTable< const regIOobject * >::sortedToc(), and topoSet::writeDebug().


| Foam::List< Foam::label > sortedToc | ( | const UList< bool > & | bools | ) |
Return the (sorted) values corresponding to 'true' entries.
Similar to bitSet::sortedToc() and labelHashSet::sortedToc()
Definition at line 200 of file BitOps.C.
References Foam::HashSetOps::bools(), and toc().
Referenced by cellZoneSet::addSet(), pointZoneSet::addSet(), faceZoneSet::addSet(), regIOobject::checkIn(), Foam::FOAM_DEPRECATED_FOR(), fvExprDriver::getTopoSetLabels(), distribution::insertMissingKeys(), Foam::debug::listDebugSwitches(), Foam::debug::listInfoSwitches(), Foam::debug::listOptimisationSwitches(), Foam::debug::listRegisteredDebugSwitches(), Foam::debug::listRegisteredInfoSwitches(), Foam::debug::listRegisteredOptimisationSwitches(), Foam::debug::listRegisteredSwitches(), Foam::debug::listSwitches(), UnsortedMeshedSurface< Face >::New(), MeshedSurface< Foam::face >::New(), triSurface::New(), distribution::normalised(), sampledPatch::patchIDs(), argList::printCompat(), distribution::raw(), binModel::read(), lumpedPointMovement::setInterpolator(), pointZoneSet::subset(), cellZoneSet::subset(), faceZoneSet::subset(), faceZoneSet::subtractSet(), cellZoneSet::sync(), pointZoneSet::sync(), MeshedSurfaceProxy< Face >::write(), UnsortedMeshedSurface< Face >::write(), MeshedSurface< Foam::face >::write(), triSurface::write(), and searchableSurfaces::writeStats().


| Foam::List< Foam::label > toc | ( | const bitSet & | bitset | ) |
Forward to bitSet::toc(), the sorted values of the 'on' entries.
Definition at line 206 of file BitOps.C.
References Foam::HashSetOps::bitset(), and bitSet::toc().

| Foam::List< Foam::label > sortedToc | ( | const bitSet & | bitset | ) |
Forward to bitSet::sortedToc(), the sorted values of the 'on' entries.
Definition at line 212 of file BitOps.C.
References Foam::HashSetOps::bitset(), and bitSet::sortedToc().

| Foam::List< Foam::label > toc | ( | const labelHashSet & | hashset | ) |
Forward to labelHashSet::sortedToc(), the sorted values of the 'on' entries.
Definition at line 218 of file BitOps.C.
References HashTable< T, Key, Hash >::sortedToc().

| Foam::List< Foam::label > sortedToc | ( | const labelHashSet & | hashset | ) |
Forward to labelHashSet::sortedToc(), the sorted values of the 'on' entries.
Definition at line 224 of file BitOps.C.
References HashTable< T, Key, Hash >::sortedToc().

|
inline |
Count arbitrary number of bits (of an integral type)
Definition at line 242 of file BitOps.H.
Referenced by bitSet::count().

|
inline |
|
inline |
|
inline |
Print 0/1 bits in the (unsigned) integral type.
Definition at line 320 of file BitOps.H.
References IOstreamOption::BINARY, and IOstreamOption::format().
Referenced by if(), Foam::operator<<(), dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::print(), indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::print(), PackedList< 2 >::printBits(), Foam::PstreamGlobals::printDataTypes(), sampledPlane::update(), and sampledPatch::update().

