MeshLib Documentation
Loading...
Searching...
No Matches
MRMesh/MRBitSet.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRId.h"
5#include "MRphmap.h"
6#include "MRVector.h"
7#include "MRPch/MRBindingMacros.h"
8#define BOOST_DYNAMIC_BITSET_DONT_USE_FRIENDS
9#pragma warning(push)
10#pragma warning(disable: 4643) //Forward declaring in namespace std is not permitted by the C++ Standard.
11#include <boost/dynamic_bitset.hpp>
12#pragma warning(pop)
13#include <iterator>
14#include <functional>
15
16namespace MR
17{
18
26class BitSet : public boost::dynamic_bitset<std::uint64_t>
27{
28public:
29 using base = boost::dynamic_bitset<std::uint64_t>;
30 using base::base;
31 using IndexType = size_t;
32
34 explicit BitSet( size_t numBits, bool fillValue ) { resize( numBits, fillValue ); }
35
36 // all bits after size() we silently consider as not-set
37 [[nodiscard]] bool test( IndexType n ) const { return n < size() && base::test( n ); }
38 [[nodiscard]] bool test_set( IndexType n, bool val = true ) { return ( val || n < size() ) ? base::test_set( n, val ) : false; }
39
40 BitSet & set( IndexType n, size_type len, bool val ) { base::set( n, len, val ); return * this; }
41 BitSet & set( IndexType n, bool val = true ) { base::set( n, val ); return * this; }
42 BitSet & set() { base::set(); return * this; }
43 BitSet & reset( IndexType n, size_type len ) { if ( n < size() ) base::reset( n, len ); return * this; }
44 BitSet & reset( IndexType n ) { if ( n < size() ) base::reset( n ); return * this; }
45 BitSet & reset() { base::reset(); return * this; }
46 BitSet & flip( IndexType n, size_type len ) { base::flip( n, len ); return * this; }
47 BitSet & flip( IndexType n ) { base::flip( n ); return * this; }
48 BitSet & flip() { base::flip(); return * this; }
49
51 const auto & bits() const { return m_bits; }
52
56
59 MRMESH_API BitSet & subtract( const BitSet & b, int bShiftInBlocks );
60
62 [[nodiscard]] MRMESH_API IndexType find_last() const;
63
65 [[nodiscard]] MRMESH_API size_t nthSetBit( size_t n ) const;
66
68 void resizeWithReserve( size_t newSize )
69 {
70 auto reserved = capacity();
71 if ( reserved > 0 && newSize > reserved )
72 {
73 while ( newSize > reserved )
74 reserved <<= 1;
75 reserve( reserved );
76 }
77 resize( newSize );
78 }
79
81 void autoResizeSet( size_t pos, size_type len, bool val = true )
82 {
83 if ( pos + len > size() )
84 resizeWithReserve( pos + len );
85 set( pos, len, val );
86 }
87 void autoResizeSet( size_t pos, bool val = true ) { autoResizeSet( pos, 1, val ); }
88
90 [[nodiscard]] bool autoResizeTestSet( size_t pos, bool val = true )
91 {
92 bool const b = test( pos );
93 if ( b != val )
94 autoResizeSet( pos, val );
95 return b;
96 }
97
99 [[nodiscard]] size_t heapBytes() const { return capacity() / 8; }
100
102 [[nodiscard]] IndexType backId() const { assert( !empty() ); return IndexType{ size() - 1 }; }
103
105 [[nodiscard]] static IndexType beginId() { return IndexType{ 0 }; }
106 [[nodiscard]] IndexType endId() const { return IndexType{ size() }; }
107
108 // Normally those are inherited from `boost::dynamic_bitset`, but MRBind currently chokes on it, so we provide those manually.
109 #if defined(MR_PARSING_FOR_PB11_BINDINGS) || defined(MR_COMPILING_PB11_BINDINGS)
110 std::size_t size() const { return dynamic_bitset::size(); }
111 std::size_t count() const { return dynamic_bitset::count(); }
112 void resize( std::size_t num_bits, bool value = false ) { dynamic_bitset::resize( num_bits, value ); }
113 void clear() { dynamic_bitset::clear(); }
114 void push_back( bool bit ) { dynamic_bitset::push_back( bit ); }
115 void pop_back() { dynamic_bitset::pop_back(); }
116 #endif
117
118private:
119 using base::m_highest_block;
120 using base::m_bits;
121 using base::m_num_bits;
122};
123
125template <typename T>
126class TaggedBitSet : public BitSet
127{
128 using base = BitSet;
129public:
130 using base::base;
132
134 explicit TaggedBitSet( const BitSet & src ) : BitSet( src ) {}
135
137 explicit TaggedBitSet( BitSet && src ) : BitSet( std::move( src ) ) {}
138
139 TaggedBitSet & set( IndexType n, size_type len, bool val ) { base::set( n, len, val ); return * this; }
140 TaggedBitSet & set( IndexType n, bool val = true ) { base::set( n, val ); return * this; }
141 TaggedBitSet & set() { base::set(); return * this; }
142 TaggedBitSet & reset( IndexType n, size_type len ) { base::reset( n, len ); return * this; }
143 TaggedBitSet & reset( IndexType n ) { base::reset( n ); return * this; }
144 TaggedBitSet & reset() { base::reset(); return * this; }
145 TaggedBitSet & flip( IndexType n, size_type len ) { base::flip( n, len ); return * this; }
146 TaggedBitSet & flip( IndexType n ) { base::flip( n ); return * this; }
147 TaggedBitSet & flip() { base::flip(); return * this; }
148 [[nodiscard]] bool test( IndexType n ) const { return base::test( n ); }
149 [[nodiscard]] bool test_set( IndexType n, bool val = true ) { return base::test_set( n, val ); }
150
151 // Disable for python bindings, because MRBind chokes on `boost::dynamic_bitset::reference`.
152 [[nodiscard]] MR_BIND_IGNORE reference operator[]( IndexType pos ) { return base::operator[]( pos ); }
153 [[nodiscard]] bool operator[]( IndexType pos ) const { return base::operator[]( pos ); }
154
155 [[nodiscard]] IndexType find_first() const { return IndexType( base::find_first() ); }
156 [[nodiscard]] IndexType find_next( IndexType pos ) const { return IndexType( base::find_next( pos ) ); }
157 [[nodiscard]] IndexType find_last() const { return IndexType( base::find_last() ); }
159 [[nodiscard]] IndexType nthSetBit( size_t n ) const { return IndexType( base::nthSetBit( n ) ); }
160
161 TaggedBitSet & operator &= ( const TaggedBitSet & b ) { base::operator &= ( b ); return * this; }
162 TaggedBitSet & operator |= ( const TaggedBitSet & b ) { base::operator |= ( b ); return * this; }
163 TaggedBitSet & operator ^= ( const TaggedBitSet & b ) { base::operator ^= ( b ); return * this; }
164 TaggedBitSet & operator -= ( const TaggedBitSet & b ) { base::operator -= ( b ); return * this; }
166 TaggedBitSet & subtract( const TaggedBitSet & b, int bShiftInBlocks ) { base::subtract( b, bShiftInBlocks ); return * this; }
167
168 void autoResizeSet( IndexType pos, size_type len, bool val = true ) { base::autoResizeSet( pos, len, val ); }
169 void autoResizeSet( IndexType pos, bool val = true ) { base::autoResizeSet( pos, val ); }
170 [[nodiscard]] bool autoResizeTestSet( IndexType pos, bool val = true ) { return base::autoResizeTestSet( pos, val ); }
171
173 template <typename M>
174 [[nodiscard]] TaggedBitSet getMapping( const M & map ) const;
175 [[nodiscard]] TaggedBitSet getMapping( const Vector<IndexType, IndexType> & map ) const
176 { return getMapping( [&map]( IndexType i ) { return map[i]; } ); }
177 [[nodiscard]] TaggedBitSet getMapping( const BMap<IndexType, IndexType> & map ) const
178 { return getMapping( [&map]( IndexType i ) { return map.b[i]; }, map.tsize ); }
179 [[nodiscard]] TaggedBitSet getMapping( const HashMap<IndexType, IndexType> & map ) const
180 { return getMapping( [&map]( IndexType i ) { return getAt( map, i ); } ); }
182 template <typename M>
183 [[nodiscard]] TaggedBitSet getMapping( const M & map, size_t resSize ) const;
184 [[nodiscard]] TaggedBitSet getMapping( const Vector<IndexType, IndexType> & map, size_t resSize ) const
185 { return getMapping( [&map]( IndexType i ) { return map[i]; }, resSize ); }
186 [[nodiscard]] TaggedBitSet getMapping( const HashMap<IndexType, IndexType> & map, size_t resSize ) const
187 { return getMapping( [&map]( IndexType i ) { return getAt( map, i ); }, resSize ); }
188
190 [[nodiscard]] IndexType backId() const { assert( !empty() ); return IndexType{ size() - 1 }; }
191
193 [[nodiscard]] static IndexType beginId() { return IndexType{ size_t( 0 ) }; }
194 [[nodiscard]] IndexType endId() const { return IndexType{ size() }; }
195};
196
198[[nodiscard]] MRMESH_API bool operator == ( const BitSet & a, const BitSet & b );
199template <typename T>
200[[nodiscard]] inline bool operator == ( const TaggedBitSet<T> & a, const TaggedBitSet<T> & b )
201 { return static_cast<const BitSet &>( a ) == static_cast<const BitSet &>( b ); }
203template <typename T, typename U>
204void operator == ( const TaggedBitSet<T> & a, const TaggedBitSet<U> & b ) = delete;
205
206template <typename T>
207[[nodiscard]] inline std::function<bool( Id<T> )> makePredicate( const TaggedBitSet<T> * bitset )
208{
209 std::function<bool( Id<T> )> res;
210 if ( bitset )
211 res = [bitset]( Id<T> id ) { return bitset->test( id ); };
212 return res;
213}
214
215template <typename T>
216[[nodiscard]] inline std::function<bool( Id<T> )> makePredicate( const TaggedBitSet<T> & bitset )
217 { return makePredicate( &bitset ); }
218
219template <typename T>
220[[nodiscard]] inline bool contains( const TaggedBitSet<T> * bitset, Id<T> id )
221{
222 return id.valid() && ( !bitset || bitset->test( id ) );
223}
224
225template <typename T>
226[[nodiscard]] inline bool contains( const TaggedBitSet<T> & bitset, Id<T> id )
227{
228 return id.valid() && bitset.test( id );
229}
230
232template <typename T>
234{
235public:
236 using IndexType = typename T::IndexType;
237
238 using iterator_category = std::forward_iterator_tag;
240 using difference_type = std::ptrdiff_t;
241 using reference = const IndexType;
242 using pointer = const IndexType *;
243
245 SetBitIteratorT() = default;
248 : bitset_( &bitset ), index_( bitset.find_first() )
249 {
250 }
252 {
253 index_ = bitset_->find_next( index_ );
254 return * this;
255 }
256 [[nodiscard]] SetBitIteratorT operator++( int )
257 {
258 SetBitIteratorT ret = *this;
259 operator++();
260 return ret;
261 }
262
263 [[nodiscard]] const T * bitset() const { return bitset_; }
264 [[nodiscard]] reference operator *() const { return index_; }
265
266private:
267 const T * bitset_ = nullptr;
268 IndexType index_ = IndexType( ~size_t( 0 ) );
269};
270
271template <typename T>
272[[nodiscard]] inline bool operator ==( const SetBitIteratorT<T> & a, const SetBitIteratorT<T> & b )
273 { return *a == *b; }
274
275template <typename T>
276[[nodiscard]] inline bool operator !=( const SetBitIteratorT<T> & a, const SetBitIteratorT<T> & b )
277 { return *a != *b; }
278
279
280[[nodiscard]] inline auto begin( const BitSet & a )
281 { return SetBitIteratorT<BitSet>(a); }
282[[nodiscard]] inline auto end( const BitSet & )
283 { return SetBitIteratorT<BitSet>(); }
284
285template <typename T>
286[[nodiscard]] inline auto begin( const TaggedBitSet<T> & a )
287 { return SetBitIteratorT<TaggedBitSet<T>>(a); }
288template <typename T>
289[[nodiscard]] inline auto end( const TaggedBitSet<T> & )
291
293template <typename T>
295{
296 Vector<int, Id<T>> res( bs.size(), -1 );
297 int n = 0;
298 for ( auto v : bs )
299 res[v] = n++;
300 return res;
301}
302
304template <typename T>
305[[nodiscard]] HashMap<Id<T>, int> makeHashMapWithSeqNums( const TaggedBitSet<T> & bs )
306{
307 HashMap<Id<T>, int> res;
308 int n = 0;
309 for ( auto v : bs )
310 res[v] = n++;
311 return res;
312}
313
314template <typename T>
315template <typename M>
316[[nodiscard]] TaggedBitSet<T> TaggedBitSet<T>::getMapping( const M & map ) const
317{
318 TaggedBitSet<T> res;
319 for ( auto b : *this )
320 if ( auto mapped = map( b ) )
321 res.autoResizeSet( mapped );
322 return res;
323}
324
325template <typename T>
326template <typename M>
327[[nodiscard]] TaggedBitSet<T> TaggedBitSet<T>::getMapping( const M & map, size_t resSize ) const
328{
329 TaggedBitSet<T> res;
330 if ( !any() )
331 return res;
332 res.resize( resSize );
333 for ( auto b : *this )
334 if ( auto mapped = map( b ) )
335 res.set( mapped );
336 return res;
337}
338
339[[nodiscard]] inline BitSet operator & ( const BitSet & a, const BitSet & b ) { BitSet res{ a }; res &= b; return res; }
340[[nodiscard]] inline BitSet operator | ( const BitSet & a, const BitSet & b ) { BitSet res{ a }; res |= b; return res; }
341[[nodiscard]] inline BitSet operator ^ ( const BitSet & a, const BitSet & b ) { BitSet res{ a }; res ^= b; return res; }
342[[nodiscard]] inline BitSet operator - ( const BitSet & a, const BitSet & b ) { BitSet res{ a }; res -= b; return res; }
343
344template <typename T> [[nodiscard]] inline TaggedBitSet<T> operator & ( const TaggedBitSet<T> & a, const TaggedBitSet<T> & b ) { auto res{ a }; res &= b; return res; }
345template <typename T> [[nodiscard]] inline TaggedBitSet<T> operator | ( const TaggedBitSet<T> & a, const TaggedBitSet<T> & b ) { auto res{ a }; res |= b; return res; }
346template <typename T> [[nodiscard]] inline TaggedBitSet<T> operator ^ ( const TaggedBitSet<T> & a, const TaggedBitSet<T> & b ) { auto res{ a }; res ^= b; return res; }
347template <typename T> [[nodiscard]] inline TaggedBitSet<T> operator - ( const TaggedBitSet<T> & a, const TaggedBitSet<T> & b ) { auto res{ a }; res -= b; return res; }
348
350
351} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
#define M(T)
container of bits
Definition MRMesh/MRBitSet.h:27
size_t IndexType
Definition MRMesh/MRBitSet.h:31
IndexType endId() const
Definition MRMesh/MRBitSet.h:106
boost::dynamic_bitset< std::uint64_t > base
Definition MRMesh/MRBitSet.h:29
static IndexType beginId()
[beginId(), endId()) is the range of all bits in the set
Definition MRMesh/MRBitSet.h:105
MRMESH_API IndexType find_last() const
return the highest index i such as bit i is set, or npos if *this has no on bits.
BitSet & reset()
Definition MRMesh/MRBitSet.h:45
MRMESH_API size_t nthSetBit(size_t n) const
returns the location of nth set bit (where the first bit corresponds to n=0) or npos if there are les...
MRMESH_API BitSet & subtract(const BitSet &b, int bShiftInBlocks)
subtracts b from this, considering that bits in b are shifted right on bShiftInBlocks*bits_per_block
MRMESH_API BitSet & operator-=(const BitSet &b)
BitSet & set(IndexType n, size_type len, bool val)
Definition MRMesh/MRBitSet.h:40
BitSet & set()
Definition MRMesh/MRBitSet.h:42
void autoResizeSet(size_t pos, bool val=true)
Definition MRMesh/MRBitSet.h:87
BitSet & reset(IndexType n, size_type len)
Definition MRMesh/MRBitSet.h:43
BitSet & set(IndexType n, bool val=true)
Definition MRMesh/MRBitSet.h:41
bool autoResizeTestSet(size_t pos, bool val=true)
same as autoResizeSet and returns previous value of pos-bit
Definition MRMesh/MRBitSet.h:90
bool test_set(IndexType n, bool val=true)
Definition MRMesh/MRBitSet.h:38
BitSet & flip(IndexType n, size_type len)
Definition MRMesh/MRBitSet.h:46
BitSet & reset(IndexType n)
Definition MRMesh/MRBitSet.h:44
bool test(IndexType n) const
Definition MRMesh/MRBitSet.h:37
BitSet & flip()
Definition MRMesh/MRBitSet.h:48
void autoResizeSet(size_t pos, size_type len, bool val=true)
sets elements [pos, pos+len) to given value, adjusting the size of the set to include new elements
Definition MRMesh/MRBitSet.h:81
IndexType backId() const
returns the identifier of the back() element
Definition MRMesh/MRBitSet.h:102
void resizeWithReserve(size_t newSize)
doubles reserved memory until resize(newSize) can be done without reallocation
Definition MRMesh/MRBitSet.h:68
const auto & bits() const
read-only access to all bits stored as a vector of uint64 blocks
Definition MRMesh/MRBitSet.h:51
size_t heapBytes() const
returns the amount of memory this object occupies on heap
Definition MRMesh/MRBitSet.h:99
BitSet(size_t numBits, bool fillValue)
creates bitset of given size filled with given value
Definition MRMesh/MRBitSet.h:34
MRMESH_API BitSet & operator|=(const BitSet &b)
MRMESH_API BitSet & operator^=(const BitSet &b)
MRMESH_API BitSet & operator&=(const BitSet &b)
BitSet & flip(IndexType n)
Definition MRMesh/MRBitSet.h:47
Definition MRMesh/MRId.h:13
iterator to enumerate all indices with set bits in BitSet class or its derivatives
Definition MRMesh/MRBitSet.h:234
SetBitIteratorT operator++(int)
Definition MRMesh/MRBitSet.h:256
const IndexType * pointer
Definition MRMesh/MRBitSet.h:242
SetBitIteratorT()=default
constructs end iterator
std::forward_iterator_tag iterator_category
Definition MRMesh/MRBitSet.h:238
const T * bitset() const
Definition MRMesh/MRBitSet.h:263
IndexType value_type
Definition MRMesh/MRBitSet.h:239
const IndexType reference
intentionally not a reference
Definition MRMesh/MRBitSet.h:241
typename T::IndexType IndexType
Definition MRMesh/MRBitSet.h:236
reference operator*() const
Definition MRMesh/MRBitSet.h:264
SetBitIteratorT & operator++()
Definition MRMesh/MRBitSet.h:251
SetBitIteratorT(const T &bitset)
constructs begin iterator
Definition MRMesh/MRBitSet.h:247
std::ptrdiff_t difference_type
Definition MRMesh/MRBitSet.h:240
container of bits representing specific indices (faces, verts or edges)
Definition MRMesh/MRBitSet.h:127
TaggedBitSet & operator^=(const TaggedBitSet &b)
Definition MRMesh/MRBitSet.h:163
TaggedBitSet getMapping(const Vector< IndexType, IndexType > &map, size_t resSize) const
Definition MRMesh/MRBitSet.h:184
bool test_set(IndexType n, bool val=true)
Definition MRMesh/MRBitSet.h:149
TaggedBitSet(BitSet &&src)
moves all bits from another BitSet (or a descending class, e.g. TaggedBitSet)
Definition MRMesh/MRBitSet.h:137
TaggedBitSet & operator-=(const TaggedBitSet &b)
Definition MRMesh/MRBitSet.h:164
bool test(IndexType n) const
Definition MRMesh/MRBitSet.h:148
TaggedBitSet & operator|=(const TaggedBitSet &b)
Definition MRMesh/MRBitSet.h:162
TaggedBitSet & reset(IndexType n, size_type len)
Definition MRMesh/MRBitSet.h:142
bool autoResizeTestSet(IndexType pos, bool val=true)
Definition MRMesh/MRBitSet.h:170
IndexType endId() const
Definition MRMesh/MRBitSet.h:194
MR_BIND_IGNORE reference operator[](IndexType pos)
Definition MRMesh/MRBitSet.h:152
TaggedBitSet & flip()
Definition MRMesh/MRBitSet.h:147
void autoResizeSet(IndexType pos, size_type len, bool val=true)
Definition MRMesh/MRBitSet.h:168
IndexType find_next(IndexType pos) const
Definition MRMesh/MRBitSet.h:156
TaggedBitSet & reset(IndexType n)
Definition MRMesh/MRBitSet.h:143
IndexType find_first() const
Definition MRMesh/MRBitSet.h:155
TaggedBitSet & set(IndexType n, size_type len, bool val)
Definition MRMesh/MRBitSet.h:139
IndexType find_last() const
Definition MRMesh/MRBitSet.h:157
TaggedBitSet & subtract(const TaggedBitSet &b, int bShiftInBlocks)
subtracts b from this, considering that bits in b are shifted right on bShiftInBlocks*bits_per_block
Definition MRMesh/MRBitSet.h:166
TaggedBitSet & flip(IndexType n)
Definition MRMesh/MRBitSet.h:146
TaggedBitSet getMapping(const M &map) const
constructs another bit set from this where every set bit index is transformed using given map
TaggedBitSet getMapping(const Vector< IndexType, IndexType > &map) const
Definition MRMesh/MRBitSet.h:175
TaggedBitSet & operator&=(const TaggedBitSet &b)
Definition MRMesh/MRBitSet.h:161
TaggedBitSet & set()
Definition MRMesh/MRBitSet.h:141
TaggedBitSet(const BitSet &src)
copies all bits from another BitSet (or a descending class, e.g. TaggedBitSet)
Definition MRMesh/MRBitSet.h:134
TaggedBitSet getMapping(const HashMap< IndexType, IndexType > &map) const
Definition MRMesh/MRBitSet.h:179
IndexType backId() const
returns the identifier of the back() element
Definition MRMesh/MRBitSet.h:190
TaggedBitSet getMapping(const BMap< IndexType, IndexType > &map) const
Definition MRMesh/MRBitSet.h:177
bool operator[](IndexType pos) const
Definition MRMesh/MRBitSet.h:153
TaggedBitSet getMapping(const HashMap< IndexType, IndexType > &map, size_t resSize) const
Definition MRMesh/MRBitSet.h:186
static IndexType beginId()
[beginId(), endId()) is the range of all bits in the set
Definition MRMesh/MRBitSet.h:193
IndexType nthSetBit(size_t n) const
returns the location of nth set bit (where the first bit corresponds to n=0) or IndexType(npos) if th...
Definition MRMesh/MRBitSet.h:159
void autoResizeSet(IndexType pos, bool val=true)
Definition MRMesh/MRBitSet.h:169
TaggedBitSet & reset()
Definition MRMesh/MRBitSet.h:144
TaggedBitSet getMapping(const M &map, size_t resSize) const
this is a faster version if the result size is known beforehand
Id< T > IndexType
Definition MRMesh/MRBitSet.h:131
TaggedBitSet & set(IndexType n, bool val=true)
Definition MRMesh/MRBitSet.h:140
TaggedBitSet & flip(IndexType n, size_type len)
Definition MRMesh/MRBitSet.h:145
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:20
BitSet operator-(const BitSet &a, const BitSet &b)
Definition MRMesh/MRBitSet.h:342
auto begin(const BitSet &a)
Definition MRMesh/MRBitSet.h:280
MRMESH_API bool operator==(const BitSet &a, const BitSet &b)
compare that two bit sets have the same set bits (they can be equal even if sizes are distinct but la...
auto end(const BitSet &)
Definition MRMesh/MRBitSet.h:282
BitSet operator&(const BitSet &a, const BitSet &b)
Definition MRMesh/MRBitSet.h:339
std::function< bool(Id< T >)> makePredicate(const TaggedBitSet< T > *bitset)
Definition MRMesh/MRBitSet.h:207
Vector< int, Id< T > > makeVectorWithSeqNums(const TaggedBitSet< T > &bs)
creates a Vector where for each set bit of input bitset its sequential number starting from 0 is retu...
Definition MRMesh/MRBitSet.h:294
BitSet operator|(const BitSet &a, const BitSet &b)
Definition MRMesh/MRBitSet.h:340
BitSet operator^(const BitSet &a, const BitSet &b)
Definition MRMesh/MRBitSet.h:341
bool contains(const TaggedBitSet< T > *bitset, Id< T > id)
Definition MRMesh/MRBitSet.h:220
HashMap< Id< T >, int > makeHashMapWithSeqNums(const TaggedBitSet< T > &bs)
creates a HashMap where for each set bit of input bitset its sequential number starting from 0 is ret...
Definition MRMesh/MRBitSet.h:305
bool operator!=(const SetBitIteratorT< T > &a, const SetBitIteratorT< T > &b)
Definition MRMesh/MRBitSet.h:276
Definition MRCameraOrientationPlugin.h:8
class MRMESH_CLASS BitSet
Definition MRMesh/MRMeshFwd.h:102
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:32
T getAt(const Buffer< T, I > &bmap, I key)
given some buffer map and a key, returns the value associated with the key, or default value if key i...
Definition MRBuffer.h:119
SetBitIteratorT< BitSet >(FaceSetBitIterator, SetBitIteratorT< FaceBitSet >)(VertSetBitIterator
phmap::flat_hash_map< K, V, Hash, Eq > HashMap
Definition MRMesh/MRMeshFwd.h:460
flat map: I -> T
Definition MRBuffer.h:143
Buffer< T, I > b
Definition MRBuffer.h:144
size_t tsize
target size, all values inside b must be less than this value
Definition MRBuffer.h:145