OpenMD 3.2
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
OpenMD::OpenMDBitSet Class Reference

OpenMDBitSet is a wrapper class of std::vector<bool> to act as a growable std::bitset. More...

#include "OpenMDBitSet.hpp"

Public Member Functions

 OpenMDBitSet (size_t nbits)
int countBits ()
 Returns the number of bits set to true in this OpenMDBitSet.
void flip (size_t bitIndex)
 Sets the bit at the specified index to to the complement of its current value.
void flip (size_t fromIndex, size_t toIndex)
 Sets each bit from the specified fromIndex(inclusive) to the specified toIndex(exclusive) to the complement of its current value.
void flip ()
 Sets each bit to the complement of its current value.
bool get (size_t bitIndex)
 Returns the value of the bit with the specified index.
OpenMDBitSet get (size_t fromIndex, size_t toIndex)
 Returns a new OpenMDBitSet composed of bits from this OpenMDBitSet from fromIndex(inclusive) to toIndex(exclusive).
bool any ()
 Returns true if any bits are set to true.
bool none ()
 Returns true if no bits are set to true.
int firstOffBit () const
int nextOffBit (int fromIndex) const
 Returns the index of the first bit that is set to false that occurs on or after the specified starting index.
int nthOffBit (unsigned long int n) const
 Returns the index of the n^th bit that is set to false.
int firstOnBit () const
int nextOnBit (int fromIndex) const
 Returns the index of the first bit that is set to true that occurs on or after the specified starting index.
int nthOnBit (unsigned long int n) const
 Returns the index of the n^th bit that is set to true.
void andOperator (const OpenMDBitSet &bs)
 Performs a logical AND of this target bit set with the argument bit set.
void orOperator (const OpenMDBitSet &bs)
 Performs a logical OR of this bit set with the bit set argument.
void xorOperator (const OpenMDBitSet &bs)
 Performs a logical XOR of this bit set with the bit set argument.
void setBitOn (size_t bitIndex)
void setBitOff (size_t bitIndex)
void setRangeOn (size_t fromIndex, size_t toIndex)
void setRangeOff (size_t fromIndex, size_t toIndex)
void clearAll ()
 Sets all of the bits in this OpenMDBitSet to false.
void setAll ()
size_t size () const
 Returns the number of bits of space actually in use by this OpenMDBitSet to represent bit values.
void resize (size_t nbits)
 Changes the size of OpenMDBitSet.
OpenMDBitSet & operator&= (const OpenMDBitSet &bs)
OpenMDBitSet & operator|= (const OpenMDBitSet &bs)
OpenMDBitSet & operator^= (const OpenMDBitSet &bs)
OpenMDBitSet & operator-= (const OpenMDBitSet &bs)
OpenMDBitSet parallelReduce ()
bool operator[] (int bitIndex) const

Friends

OpenMDBitSet operator| (const OpenMDBitSet &bs1, const OpenMDBitSet &bs2)
OpenMDBitSet operator& (const OpenMDBitSet &bs1, const OpenMDBitSet &bs2)
OpenMDBitSet operator^ (const OpenMDBitSet &bs1, const OpenMDBitSet &bs2)
OpenMDBitSet operator- (const OpenMDBitSet &bs1, const OpenMDBitSet &bs2)
bool operator== (const OpenMDBitSet &bs1, const OpenMDBitSet &bs2)
std::ostream & operator<< (std::ostream &os, const OpenMDBitSet &bs)

Detailed Description

OpenMDBitSet is a wrapper class of std::vector<bool> to act as a growable std::bitset.

Definition at line 61 of file OpenMDBitSet.hpp.

Constructor & Destructor Documentation

◆ OpenMDBitSet() [1/2]

OpenMD::OpenMDBitSet::OpenMDBitSet ( )
inline

Definition at line 64 of file OpenMDBitSet.hpp.

◆ OpenMDBitSet() [2/2]

OpenMD::OpenMDBitSet::OpenMDBitSet ( size_t nbits)
inline

Definition at line 66 of file OpenMDBitSet.hpp.

Member Function Documentation

◆ andOperator()

void OpenMD::OpenMDBitSet::andOperator ( const OpenMDBitSet & bs)

Performs a logical AND of this target bit set with the argument bit set.

Definition at line 144 of file OpenMDBitSet.cpp.

References size().

◆ any()

bool OpenMD::OpenMDBitSet::any ( )
inline

Returns true if any bits are set to true.

Definition at line 90 of file OpenMDBitSet.hpp.

References none().

◆ clearAll()

void OpenMD::OpenMDBitSet::clearAll ( )
inline

Sets all of the bits in this OpenMDBitSet to false.

Definition at line 136 of file OpenMDBitSet.hpp.

References size().

◆ countBits()

int OpenMD::OpenMDBitSet::countBits ( )

Returns the number of bits set to true in this OpenMDBitSet.

Definition at line 62 of file OpenMDBitSet.cpp.

◆ firstOffBit()

int OpenMD::OpenMDBitSet::firstOffBit ( ) const
inline

Definition at line 95 of file OpenMDBitSet.hpp.

◆ firstOnBit()

int OpenMD::OpenMDBitSet::firstOnBit ( ) const
inline

Definition at line 104 of file OpenMDBitSet.hpp.

◆ flip() [1/3]

void OpenMD::OpenMDBitSet::flip ( )
inline

Sets each bit to the complement of its current value.

Definition at line 80 of file OpenMDBitSet.hpp.

References flip(), and size().

Referenced by flip().

◆ flip() [2/3]

void OpenMD::OpenMDBitSet::flip ( size_t bitIndex)
inline

Sets the bit at the specified index to to the complement of its current value.

Definition at line 73 of file OpenMDBitSet.hpp.

◆ flip() [3/3]

void OpenMD::OpenMDBitSet::flip ( size_t fromIndex,
size_t toIndex )

Sets each bit from the specified fromIndex(inclusive) to the specified toIndex(exclusive) to the complement of its current value.

Definition at line 66 of file OpenMDBitSet.cpp.

References size().

◆ get() [1/2]

bool OpenMD::OpenMDBitSet::get ( size_t bitIndex)
inline

Returns the value of the bit with the specified index.

Definition at line 83 of file OpenMDBitSet.hpp.

◆ get() [2/2]

OpenMDBitSet OpenMD::OpenMDBitSet::get ( size_t fromIndex,
size_t toIndex )

Returns a new OpenMDBitSet composed of bits from this OpenMDBitSet from fromIndex(inclusive) to toIndex(exclusive).

Definition at line 76 of file OpenMDBitSet.cpp.

References size().

◆ nextOffBit()

int OpenMD::OpenMDBitSet::nextOffBit ( int fromIndex) const

Returns the index of the first bit that is set to false that occurs on or after the specified starting index.

Definition at line 94 of file OpenMDBitSet.cpp.

References size().

Referenced by nthOffBit().

◆ nextOnBit()

int OpenMD::OpenMDBitSet::nextOnBit ( int fromIndex) const

Returns the index of the first bit that is set to true that occurs on or after the specified starting index.

Definition at line 119 of file OpenMDBitSet.cpp.

References size().

Referenced by nthOnBit().

◆ none()

bool OpenMD::OpenMDBitSet::none ( )

Returns true if no bits are set to true.

Definition at line 88 of file OpenMDBitSet.cpp.

Referenced by any().

◆ nthOffBit()

int OpenMD::OpenMDBitSet::nthOffBit ( unsigned long int n) const

Returns the index of the n^th bit that is set to false.

Definition at line 109 of file OpenMDBitSet.cpp.

References nextOffBit().

◆ nthOnBit()

int OpenMD::OpenMDBitSet::nthOnBit ( unsigned long int n) const

Returns the index of the n^th bit that is set to true.

Definition at line 134 of file OpenMDBitSet.cpp.

References nextOnBit().

◆ operator&=()

OpenMDBitSet & OpenMD::OpenMDBitSet::operator&= ( const OpenMDBitSet & bs)
inline

Definition at line 147 of file OpenMDBitSet.hpp.

◆ operator-=()

OpenMDBitSet & OpenMD::OpenMDBitSet::operator-= ( const OpenMDBitSet & bs)
inline

Definition at line 159 of file OpenMDBitSet.hpp.

◆ operator[]()

bool OpenMD::OpenMDBitSet::operator[] ( int bitIndex) const
inline

Definition at line 167 of file OpenMDBitSet.hpp.

◆ operator^=()

OpenMDBitSet & OpenMD::OpenMDBitSet::operator^= ( const OpenMDBitSet & bs)
inline

Definition at line 155 of file OpenMDBitSet.hpp.

◆ operator|=()

OpenMDBitSet & OpenMD::OpenMDBitSet::operator|= ( const OpenMDBitSet & bs)
inline

Definition at line 151 of file OpenMDBitSet.hpp.

◆ orOperator()

void OpenMD::OpenMDBitSet::orOperator ( const OpenMDBitSet & bs)

Performs a logical OR of this bit set with the bit set argument.

Definition at line 151 of file OpenMDBitSet.cpp.

References size().

◆ parallelReduce()

OpenMDBitSet OpenMD::OpenMDBitSet::parallelReduce ( )

Definition at line 218 of file OpenMDBitSet.cpp.

◆ resize()

void OpenMD::OpenMDBitSet::resize ( size_t nbits)

Changes the size of OpenMDBitSet.

Definition at line 172 of file OpenMDBitSet.cpp.

References size().

◆ setAll()

void OpenMD::OpenMDBitSet::setAll ( )
inline

Definition at line 138 of file OpenMDBitSet.hpp.

◆ setBitOff()

void OpenMD::OpenMDBitSet::setBitOff ( size_t bitIndex)
inline

Definition at line 125 of file OpenMDBitSet.hpp.

◆ setBitOn()

void OpenMD::OpenMDBitSet::setBitOn ( size_t bitIndex)
inline

Definition at line 123 of file OpenMDBitSet.hpp.

◆ setRangeOff()

void OpenMD::OpenMDBitSet::setRangeOff ( size_t fromIndex,
size_t toIndex )
inline

Definition at line 131 of file OpenMDBitSet.hpp.

◆ setRangeOn()

void OpenMD::OpenMDBitSet::setRangeOn ( size_t fromIndex,
size_t toIndex )
inline

Definition at line 127 of file OpenMDBitSet.hpp.

◆ size()

size_t OpenMD::OpenMDBitSet::size ( ) const
inline

Returns the number of bits of space actually in use by this OpenMDBitSet to represent bit values.

Definition at line 142 of file OpenMDBitSet.hpp.

Referenced by andOperator(), clearAll(), flip(), flip(), get(), nextOffBit(), nextOnBit(), orOperator(), resize(), and xorOperator().

◆ xorOperator()

void OpenMD::OpenMDBitSet::xorOperator ( const OpenMDBitSet & bs)

Performs a logical XOR of this bit set with the bit set argument.

Definition at line 157 of file OpenMDBitSet.cpp.

References size().

◆ operator&

OpenMDBitSet operator& ( const OpenMDBitSet & bs1,
const OpenMDBitSet & bs2 )
friend

Definition at line 188 of file OpenMDBitSet.cpp.

◆ operator-

OpenMDBitSet operator- ( const OpenMDBitSet & bs1,
const OpenMDBitSet & bs2 )
friend

Definition at line 204 of file OpenMDBitSet.cpp.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const OpenMDBitSet & bs )
friend

Definition at line 251 of file OpenMDBitSet.cpp.

◆ operator==

bool operator== ( const OpenMDBitSet & bs1,
const OpenMDBitSet & bs2 )
friend

Definition at line 212 of file OpenMDBitSet.cpp.

◆ operator^

OpenMDBitSet operator^ ( const OpenMDBitSet & bs1,
const OpenMDBitSet & bs2 )
friend

Definition at line 196 of file OpenMDBitSet.cpp.

◆ operator|

OpenMDBitSet operator| ( const OpenMDBitSet & bs1,
const OpenMDBitSet & bs2 )
friend

Definition at line 180 of file OpenMDBitSet.cpp.


The documentation for this class was generated from the following files: