3 #ifndef DUNE_BLOCK_BITFIELD_HH
4 #define DUNE_BLOCK_BITFIELD_HH
20 template <
int block_size,
class Alloc>
class BitSetVector;
21 template <
int block_size,
class Alloc>
class BitSetVectorReference;
33 template <
int block_size,
class Alloc>
42 blockBitField(blockBitField),
43 block_number(block_number)
51 typedef std::bitset<block_size>
bitset;
54 typedef typename std::vector<bool, Alloc>::const_reference
reference;
159 for(
int i=0; i<block_size; ++i)
178 for(
int i=0; i<block_size; ++i)
179 eq &= (
getBit(i) == bs[i]);
205 template <
int block_size,
class Alloc>
217 blockBitField(blockBitField)
221 typedef std::bitset<block_size>
bitset;
226 typedef typename std::vector<bool, Alloc>::reference
reference;
237 for(
int i=0; i<block_size; ++i)
245 for(
int i=0; i<block_size; ++i)
253 for(
int i=0; i<block_size; ++i)
261 for(
int i=0; i<block_size; ++i)
372 using BitSetVectorConstReference::operator[];
393 template<
int block_size,
class Alloc>
399 template<
int block_size,
class Alloc>
405 template<
int block_size,
class Alloc>
411 template<
int block_size,
class Alloc>
420 template <
int block_size,
class Allocator=std::allocator<
bool> >
424 typedef std::vector<bool, Allocator> BlocklessBaseClass;
446 typedef typename std::vector<bool, Allocator>::size_type
size_type;
485 BlocklessBaseClass(blocklessBitField)
487 if (blocklessBitField.size()%block_size != 0)
495 BlocklessBaseClass(n*block_size)
500 BlocklessBaseClass(n*block_size,v)
523 this->assign(BlocklessBaseClass::size(),
true);
528 this->assign(BlocklessBaseClass::size(),
false);
558 return std::count(BlocklessBaseClass::begin(), BlocklessBaseClass::end(),
true);
574 for (
size_t i=0; i<v.
size(); i++)
585 for(
int j=0; j<block_size; ++j)
586 bits.set(j, getBit(i,j));