00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef OPENMESH_ARRAY_KERNEL_HH
00040 #define OPENMESH_ARRAY_KERNEL_HH
00041
00042
00043
00044 #include <vector>
00045
00046 #include <OpenMesh/Core/System/config.h>
00047 #include <OpenMesh/Core/Utils/GenProg.hh>
00048
00049 #include <OpenMesh/Core/Mesh/ArrayItems.hh>
00050 #include <OpenMesh/Core/Mesh/BaseKernel.hh>
00051 #include <OpenMesh/Core/Mesh/Status.hh>
00052
00053
00054 namespace OpenMesh {
00055
00056
00057
00074 class ArrayKernel : public BaseKernel, public ArrayItems
00075 {
00076 public:
00077
00078
00079 typedef OpenMesh::VertexHandle VertexHandle;
00080 typedef OpenMesh::HalfedgeHandle HalfedgeHandle;
00081 typedef OpenMesh::EdgeHandle EdgeHandle;
00082 typedef OpenMesh::FaceHandle FaceHandle;
00083 typedef Attributes::StatusInfo StatusInfo;
00084 typedef VPropHandleT<StatusInfo> VertexStatusPropertyHandle;
00085 typedef HPropHandleT<StatusInfo> HalfedgeStatusPropertyHandle;
00086 typedef EPropHandleT<StatusInfo> EdgeStatusPropertyHandle;
00087 typedef FPropHandleT<StatusInfo> FaceStatusPropertyHandle;
00088
00089 public:
00090
00091
00092 ArrayKernel();
00093 virtual ~ArrayKernel();
00094
00101 void assign_connectivity(const ArrayKernel& _other);
00102
00103
00104 VertexHandle handle(const Vertex& _v) const
00105 {return VertexHandle(&_v - &vertices_.front()); }
00106
00107 HalfedgeHandle handle(const Halfedge& _he) const
00108 {
00109 uint eh(((char*)&edges_.front() - (char*)&_he) % sizeof(Edge));
00110 assert((&_he == &edges_[eh].halfedges_[0]) ||
00111 (&_he == &edges_[eh].halfedges_[1]));
00112 return ((&_he == &edges_[eh].halfedges_[0]) ?
00113 HalfedgeHandle(eh<<1) : HalfedgeHandle((eh<<1)+1));
00114 }
00115
00116 EdgeHandle handle(const Edge& _e) const
00117 { return EdgeHandle(&_e - &edges_.front()); }
00118
00119 FaceHandle handle(const Face& _f) const
00120 { return FaceHandle(&_f - &faces_.front()); }
00121
00122 #define SIGNED(x) signed( (x) )
00123
00124 bool is_valid_handle(VertexHandle _vh) const
00125 { return 0 <= _vh.idx() && _vh.idx() < SIGNED(n_vertices()); }
00126
00127 bool is_valid_handle(HalfedgeHandle _heh) const
00128 { return 0 <= _heh.idx() && _heh.idx() < SIGNED(n_edges()*2); }
00129
00130 bool is_valid_handle(EdgeHandle _eh) const
00131 { return 0 <= _eh.idx() && _eh.idx() < SIGNED(n_edges()); }
00132
00133 bool is_valid_handle(FaceHandle _fh) const
00134 { return 0 <= _fh.idx() && _fh.idx() < SIGNED(n_faces()); }
00135
00136
00137 const Vertex& vertex(VertexHandle _vh) const
00138 {
00139 assert(is_valid_handle(_vh));
00140 return vertices_[_vh.idx()];
00141 }
00142
00143 Vertex& vertex(VertexHandle _vh)
00144 {
00145 assert(is_valid_handle(_vh));
00146 return vertices_[_vh.idx()];
00147 }
00148
00149 const Halfedge& halfedge(HalfedgeHandle _heh) const
00150 {
00151 assert(is_valid_handle(_heh));
00152 return edges_[_heh.idx() >> 1].halfedges_[_heh.idx() & 1];
00153 }
00154
00155 Halfedge& halfedge(HalfedgeHandle _heh)
00156 {
00157 assert(is_valid_handle(_heh));
00158 return edges_[_heh.idx() >> 1].halfedges_[_heh.idx() & 1];
00159 }
00160
00161 const Edge& edge(EdgeHandle _eh) const
00162 {
00163 assert(is_valid_handle(_eh));
00164 return edges_[_eh.idx()];
00165 }
00166
00167 Edge& edge(EdgeHandle _eh)
00168 {
00169 assert(is_valid_handle(_eh));
00170 return edges_[_eh.idx()];
00171 }
00172
00173 const Face& face(FaceHandle _fh) const
00174 {
00175 assert(is_valid_handle(_fh));
00176 return faces_[_fh.idx()];
00177 }
00178
00179 Face& face(FaceHandle _fh)
00180 {
00181 assert(is_valid_handle(_fh));
00182 return faces_[_fh.idx()];
00183 }
00184
00185 #undef SIGNED
00186
00187
00188
00189 VertexHandle vertex_handle(uint _i) const
00190 { return (_i < n_vertices()) ? handle( vertices_[_i] ) : VertexHandle(); }
00191
00192 HalfedgeHandle halfedge_handle(uint _i) const
00193 {
00194 return (_i < n_halfedges()) ?
00195 halfedge_handle(edge_handle(_i/2), _i%2) : HalfedgeHandle();
00196 }
00197
00198 EdgeHandle edge_handle(uint _i) const
00199 { return (_i < n_edges()) ? handle(edges_[_i]) : EdgeHandle(); }
00200
00201 FaceHandle face_handle(uint _i) const
00202 { return (_i < n_faces()) ? handle(faces_[_i]) : FaceHandle(); }
00203
00204 public:
00205
00206 inline VertexHandle new_vertex()
00207 {
00208 vertices_.push_back(Vertex());
00209 vprops_resize(n_vertices());
00210
00211 return handle(vertices_.back());
00212 }
00213
00214 inline HalfedgeHandle new_edge(VertexHandle _start_vh, VertexHandle _end_vh)
00215 {
00216
00217 edges_.push_back(Edge());
00218 eprops_resize(n_edges());
00219 hprops_resize(n_halfedges());
00220
00221 EdgeHandle eh(handle(edges_.back()));
00222 HalfedgeHandle heh0(halfedge_handle(eh, 0));
00223 HalfedgeHandle heh1(halfedge_handle(eh, 1));
00224 set_vertex_handle(heh0, _end_vh);
00225 set_vertex_handle(heh1, _start_vh);
00226 return heh0;
00227 }
00228
00229 inline FaceHandle new_face()
00230 {
00231 faces_.push_back(Face());
00232 fprops_resize(n_faces());
00233 return handle(faces_.back());
00234 }
00235
00236 inline FaceHandle new_face(const Face& _f)
00237 {
00238 faces_.push_back(_f);
00239 fprops_resize(n_faces());
00240 return handle(faces_.back());
00241 }
00242
00243 public:
00244
00245 void resize( uint _n_vertices, uint _n_edges, uint _n_faces );
00246 void reserve(uint _n_vertices, uint _n_edges, uint _n_faces );
00247
00248
00249 void garbage_collection(bool _v=true, bool _e=true, bool _f=true);
00250 void clear();
00251
00252
00253 uint n_vertices() const { return vertices_.size(); }
00254 uint n_halfedges() const { return 2*edges_.size(); }
00255 uint n_edges() const { return edges_.size(); }
00256 uint n_faces() const { return faces_.size(); }
00257
00258 bool vertices_empty() const { return vertices_.empty(); }
00259 bool halfedges_empty() const { return edges_.empty(); }
00260 bool edges_empty() const { return edges_.empty(); }
00261 bool faces_empty() const { return faces_.empty(); }
00262
00263
00264
00265 HalfedgeHandle halfedge_handle(VertexHandle _vh) const
00266 { return vertex(_vh).halfedge_handle_; }
00267
00268 void set_halfedge_handle(VertexHandle _vh, HalfedgeHandle _heh)
00269 {
00270
00271 vertex(_vh).halfedge_handle_ = _heh;
00272 }
00273
00274 bool is_isolated(VertexHandle _vh) const
00275 { return !halfedge_handle(_vh).is_valid(); }
00276
00277 void set_isolated(VertexHandle _vh)
00278 { vertex(_vh).halfedge_handle_.invalidate(); }
00279
00280 uint delete_isolated_vertices();
00281
00282
00283 VertexHandle to_vertex_handle(HalfedgeHandle _heh) const
00284 { return halfedge(_heh).vertex_handle_; }
00285
00286 VertexHandle from_vertex_handle(HalfedgeHandle _heh) const
00287 { return to_vertex_handle(opposite_halfedge_handle(_heh)); }
00288
00289 void set_vertex_handle(HalfedgeHandle _heh, VertexHandle _vh)
00290 {
00291
00292 halfedge(_heh).vertex_handle_ = _vh;
00293 }
00294
00295 FaceHandle face_handle(HalfedgeHandle _heh) const
00296 { return halfedge(_heh).face_handle_; }
00297
00298 void set_face_handle(HalfedgeHandle _heh, FaceHandle _fh)
00299 {
00300
00301 halfedge(_heh).face_handle_ = _fh;
00302 }
00303
00304 void set_boundary(HalfedgeHandle _heh)
00305 { halfedge(_heh).face_handle_.invalidate(); }
00306
00308 bool is_boundary(HalfedgeHandle _heh) const
00309 { return !face_handle(_heh).is_valid(); }
00310
00311 HalfedgeHandle next_halfedge_handle(HalfedgeHandle _heh) const
00312 { return halfedge(_heh).next_halfedge_handle_; }
00313
00314 void set_next_halfedge_handle(HalfedgeHandle _heh, HalfedgeHandle _nheh)
00315 {
00316 assert(is_valid_handle(_nheh));
00317
00318 halfedge(_heh).next_halfedge_handle_ = _nheh;
00319 set_prev_halfedge_handle(_nheh, _heh);
00320 }
00321
00322
00323 void set_prev_halfedge_handle(HalfedgeHandle _heh, HalfedgeHandle _pheh)
00324 {
00325 assert(is_valid_handle(_pheh));
00326 set_prev_halfedge_handle(_heh, _pheh, HasPrevHalfedge());
00327 }
00328
00329 void set_prev_halfedge_handle(HalfedgeHandle _heh, HalfedgeHandle _pheh,
00330 GenProg::True)
00331 { halfedge(_heh).prev_halfedge_handle_ = _pheh; }
00332
00333 void set_prev_halfedge_handle(HalfedgeHandle , HalfedgeHandle ,
00334 GenProg::False)
00335 {}
00336
00337 HalfedgeHandle prev_halfedge_handle(HalfedgeHandle _heh) const
00338 { return prev_halfedge_handle(_heh, HasPrevHalfedge() ); }
00339
00340 HalfedgeHandle prev_halfedge_handle(HalfedgeHandle _heh, GenProg::True) const
00341 { return halfedge(_heh).prev_halfedge_handle_; }
00342
00343 HalfedgeHandle prev_halfedge_handle(HalfedgeHandle _heh, GenProg::False) const
00344 {
00345 if (is_boundary(_heh))
00346 {
00347 HalfedgeHandle curr_heh(opposite_halfedge_handle(_heh));
00348 HalfedgeHandle next_heh(next_halfedge_handle(curr_heh));
00349 do
00350 {
00351 curr_heh = opposite_halfedge_handle(next_heh);
00352 next_heh = next_halfedge_handle(curr_heh);
00353 }
00354 while (next_heh != _heh);
00355 return curr_heh;
00356 }
00357 else
00358 {
00359 HalfedgeHandle heh(_heh);
00360 HalfedgeHandle next_heh(next_halfedge_handle(heh));
00361 while (next_heh != _heh) {
00362 heh = next_heh;
00363 next_heh = next_halfedge_handle(next_heh);
00364 }
00365 return heh;
00366 }
00367 }
00368
00369
00370 HalfedgeHandle opposite_halfedge_handle(HalfedgeHandle _heh) const
00371 { return HalfedgeHandle((_heh.idx() & 1) ? _heh.idx()-1 : _heh.idx()+1); }
00372
00373
00374 HalfedgeHandle ccw_rotated_halfedge_handle(HalfedgeHandle _heh) const
00375 { return opposite_halfedge_handle(prev_halfedge_handle(_heh)); }
00376
00377
00378 HalfedgeHandle cw_rotated_halfedge_handle(HalfedgeHandle _heh) const
00379 { return next_halfedge_handle(opposite_halfedge_handle(_heh)); }
00380
00381
00382 HalfedgeHandle halfedge_handle(EdgeHandle _eh, uint _i) const
00383 {
00384 assert(_i<=1);
00385 return HalfedgeHandle((_eh.idx() << 1) + _i);
00386 }
00387
00388 EdgeHandle edge_handle(HalfedgeHandle _heh) const
00389 { return EdgeHandle(_heh.idx() >> 1); }
00390
00391
00392 HalfedgeHandle halfedge_handle(FaceHandle _fh) const
00393 { return face(_fh).halfedge_handle_; }
00394
00395 void set_halfedge_handle(FaceHandle _fh, HalfedgeHandle _heh)
00396 {
00397
00398 face(_fh).halfedge_handle_ = _heh;
00399 }
00400
00402
00403 const StatusInfo& status(VertexHandle _vh) const
00404 { return property(vertex_status_, _vh); }
00405
00406 StatusInfo& status(VertexHandle _vh)
00407 { return property(vertex_status_, _vh); }
00408
00409
00410 const StatusInfo& status(HalfedgeHandle _hh) const
00411 { return property(halfedge_status_, _hh); }
00412
00413 StatusInfo& status(HalfedgeHandle _hh)
00414 { return property(halfedge_status_, _hh); }
00415
00416
00417 const StatusInfo& status(EdgeHandle _eh) const
00418 { return property(edge_status_, _eh); }
00419
00420 StatusInfo& status(EdgeHandle _eh)
00421 { return property(edge_status_, _eh); }
00422
00423
00424 const StatusInfo& status(FaceHandle _fh) const
00425 { return property(face_status_, _fh); }
00426
00427 StatusInfo& status(FaceHandle _fh)
00428 { return property(face_status_, _fh); }
00429
00430 inline bool has_vertex_status() const
00431 { return vertex_status_.is_valid(); }
00432
00433 inline bool has_halfedge_status() const
00434 { return halfedge_status_.is_valid(); }
00435
00436 inline bool has_edge_status() const
00437 { return edge_status_.is_valid(); }
00438
00439 inline bool has_face_status() const
00440 { return face_status_.is_valid(); }
00441
00442 inline VertexStatusPropertyHandle vertex_status_pph() const
00443 { return vertex_status_; }
00444
00445 inline HalfedgeStatusPropertyHandle halfedge_status_pph() const
00446 { return halfedge_status_; }
00447
00448 inline EdgeStatusPropertyHandle edge_status_pph() const
00449 { return edge_status_; }
00450
00451 inline FaceStatusPropertyHandle face_status_pph() const
00452 { return face_status_; }
00453
00455 inline VertexStatusPropertyHandle status_pph(VertexHandle ) const
00456 { return vertex_status_pph(); }
00457
00458 inline HalfedgeStatusPropertyHandle status_pph(HalfedgeHandle ) const
00459 { return halfedge_status_pph(); }
00460
00461 inline EdgeStatusPropertyHandle status_pph(EdgeHandle ) const
00462 { return edge_status_pph(); }
00463
00464 inline FaceStatusPropertyHandle status_pph(FaceHandle ) const
00465 { return face_status_pph(); }
00466
00468 void request_vertex_status()
00469 {
00470 if (!refcount_vstatus_++)
00471 add_property( vertex_status_, "v:status" );
00472 }
00473
00474 void request_halfedge_status()
00475 {
00476 if (!refcount_hstatus_++)
00477 add_property( halfedge_status_, "h:status" );
00478 }
00479
00480 void request_edge_status()
00481 {
00482 if (!refcount_estatus_++)
00483 add_property( edge_status_, "e:status" );
00484 }
00485
00486 void request_face_status()
00487 {
00488 if (!refcount_fstatus_++)
00489 add_property( face_status_, "f:status" );
00490 }
00491
00493 void release_vertex_status()
00494 {
00495 if ((refcount_vstatus_ > 0) && (! --refcount_vstatus_))
00496 remove_property(vertex_status_);
00497 }
00498
00499 void release_halfedge_status()
00500 {
00501 if ((refcount_hstatus_ > 0) && (! --refcount_hstatus_))
00502 remove_property(halfedge_status_);
00503 }
00504
00505 void release_edge_status()
00506 {
00507 if ((refcount_estatus_ > 0) && (! --refcount_estatus_))
00508 remove_property(edge_status_);
00509 }
00510
00511 void release_face_status()
00512 {
00513 if ((refcount_fstatus_ > 0) && (! --refcount_fstatus_))
00514 remove_property(face_status_);
00515 }
00516
00518
00519 template <class Handle>
00520 class StatusSetT
00521 {
00522 protected:
00523 ArrayKernel& kernel_;
00524
00525 public:
00526 const uint bit_mask_;
00527
00528 public:
00529 StatusSetT(ArrayKernel& _kernel, uint _bit_mask)
00530 : kernel_(_kernel), bit_mask_(_bit_mask)
00531 {}
00532
00533 ~StatusSetT()
00534 {}
00535
00536 inline bool is_in(Handle _hnd) const
00537 { return kernel_.status(_hnd).is_bit_set(bit_mask_); }
00538
00539 inline void insert(Handle _hnd)
00540 { return kernel_.status(_hnd).set_bit(bit_mask_); }
00541
00542 inline void erase(Handle _hnd)
00543 { return kernel_.status(_hnd).unset_bit(bit_mask_); }
00544
00546 uint size() const
00547 {
00548 uint n_elements = kernel_.status_pph(Handle()).is_valid() ?
00549 kernel_.property(kernel_.status_pph(Handle())).n_elements() : 0;
00550 uint sz = 0;
00551 for (uint i = 0; i < n_elements; ++i)
00552 {
00553 sz += (uint)is_in(Handle(i));
00554 }
00555 return sz;
00556 }
00557
00559 void clear()
00560 {
00561 uint n_elements = kernel_.status_pph(Handle()).is_valid() ?
00562 kernel_.property(kernel_.status_pph(Handle())).n_elements() : 0;
00563 for (uint i = 0; i < n_elements; ++i)
00564 {
00565 erase(Handle(i));
00566 }
00567 }
00568 };
00569
00570 friend class StatusSetT<VertexHandle>;
00571 friend class StatusSetT<EdgeHandle>;
00572 friend class StatusSetT<FaceHandle>;
00573 friend class StatusSetT<HalfedgeHandle>;
00574
00576
00577 template <class Handle>
00578 class AutoStatusSetT : public StatusSetT<Handle>
00579 {
00580 private:
00581 typedef StatusSetT<Handle> Base;
00582 public:
00583 AutoStatusSetT(ArrayKernel& _kernel)
00584 : StatusSetT<Handle>(_kernel, _kernel.pop_bit_mask(Handle()))
00585 { }
00586
00587 ~AutoStatusSetT()
00588 {
00589
00590 Base::kernel_.push_bit_mask(Handle(), Base::bit_mask_);
00591 }
00592 };
00593
00594 friend class AutoStatusSetT<VertexHandle>;
00595 friend class AutoStatusSetT<EdgeHandle>;
00596 friend class AutoStatusSetT<FaceHandle>;
00597 friend class AutoStatusSetT<HalfedgeHandle>;
00598
00599 typedef AutoStatusSetT<VertexHandle> VertexStatusSet;
00600 typedef AutoStatusSetT<EdgeHandle> EdgeStatusSet;
00601 typedef AutoStatusSetT<FaceHandle> FaceStatusSet;
00602 typedef AutoStatusSetT<HalfedgeHandle> HalfedgeStatusSet;
00603
00605
00606 template <class Handle>
00607 class ExtStatusSetT : public AutoStatusSetT<Handle>
00608 {
00609 public:
00610 typedef AutoStatusSetT<Handle> Base;
00611
00612 protected:
00613 typedef std::vector<Handle> HandleContainer;
00614 HandleContainer handles_;
00615
00616 public:
00617 typedef typename HandleContainer::iterator
00618 iterator;
00619 typedef typename HandleContainer::const_iterator
00620 const_iterator;
00621 public:
00622 ExtStatusSetT(ArrayKernel& _kernel, uint _capacity_hint = 0)
00623 : Base(_kernel)
00624 { handles_.reserve(_capacity_hint); }
00625
00626 ~ExtStatusSetT()
00627 { clear(); }
00628
00629
00630
00631 inline void insert(Handle _hnd)
00632 {
00633 if (!is_in(_hnd))
00634 {
00635 Base::insert(_hnd);
00636 handles_.push_back(_hnd);
00637 }
00638 }
00639
00640
00641 inline void erase(Handle _hnd)
00642 {
00643 if (is_in(_hnd))
00644 {
00645 iterator it = std::find(begin(), end(), _hnd);
00646 erase(it);
00647 }
00648 }
00649
00650
00651 inline void erase(iterator _it)
00652 {
00653 assert(_it != end() && is_in(*_it));
00654 clear(*_it);
00655 *_it = handles_.back();
00656 *_it.pop_back();
00657 }
00658
00659 inline void clear()
00660 {
00661 for (iterator it = begin(); it != end(); ++it)
00662 {
00663 assert(is_in(*it));
00664 Base::erase(*it);
00665 }
00666 handles_.clear();
00667 }
00668
00670 inline uint size() const
00671 { return handles_.size(); }
00672 inline bool empty() const
00673 { return handles_.empty(); }
00674
00675
00676 inline iterator begin()
00677 { return handles_.begin(); }
00678 inline const_iterator begin() const
00679 { return handles_.begin(); }
00680
00681 inline iterator end()
00682 { return handles_.end(); }
00683 inline const_iterator end() const
00684 { return handles_.end(); }
00685
00686 inline Handle& front()
00687 { return handles_.front(); }
00688 inline const Handle& front() const
00689 { return handles_.front(); }
00690
00691 inline Handle& back()
00692 { return handles_.back(); }
00693 inline const Handle& back() const
00694 { return handles_.back(); }
00695 };
00696
00697 typedef ExtStatusSetT<FaceHandle> ExtFaceStatusSet;
00698 typedef ExtStatusSetT<VertexHandle> ExtVertexStatusSet;
00699 typedef ExtStatusSetT<EdgeHandle> ExtEdgeStatusSet;
00700 typedef ExtStatusSetT<HalfedgeHandle> ExtHalfedgeStatusSet;
00701
00702 private:
00703
00704 typedef std::vector<Vertex> VertexContainer;
00705 typedef std::vector<Edge> EdgeContainer;
00706 typedef std::vector<Face> FaceContainer;
00707 typedef VertexContainer::iterator KernelVertexIter;
00708 typedef VertexContainer::const_iterator KernelConstVertexIter;
00709 typedef EdgeContainer::iterator KernelEdgeIter;
00710 typedef EdgeContainer::const_iterator KernelConstEdgeIter;
00711 typedef FaceContainer::iterator KernelFaceIter;
00712 typedef FaceContainer::const_iterator KernelConstFaceIter;
00713 typedef std::vector<uint> BitMaskContainer;
00714
00715
00716 KernelVertexIter vertices_begin() { return vertices_.begin(); }
00717 KernelConstVertexIter vertices_begin() const { return vertices_.begin(); }
00718 KernelVertexIter vertices_end() { return vertices_.end(); }
00719 KernelConstVertexIter vertices_end() const { return vertices_.end(); }
00720
00721 KernelEdgeIter edges_begin() { return edges_.begin(); }
00722 KernelConstEdgeIter edges_begin() const { return edges_.begin(); }
00723 KernelEdgeIter edges_end() { return edges_.end(); }
00724 KernelConstEdgeIter edges_end() const { return edges_.end(); }
00725
00726 KernelFaceIter faces_begin() { return faces_.begin(); }
00727 KernelConstFaceIter faces_begin() const { return faces_.begin(); }
00728 KernelFaceIter faces_end() { return faces_.end(); }
00729 KernelConstFaceIter faces_end() const { return faces_.end(); }
00730
00732 inline BitMaskContainer& bit_masks(VertexHandle )
00733 { return vertex_bit_masks_; }
00734 inline BitMaskContainer& bit_masks(EdgeHandle )
00735 { return edge_bit_masks_; }
00736 inline BitMaskContainer& bit_masks(FaceHandle )
00737 { return face_bit_masks_; }
00738 inline BitMaskContainer& bit_masks(HalfedgeHandle )
00739 { return halfedge_bit_masks_; }
00740
00741 template <class Handle>
00742 uint pop_bit_mask(Handle _hnd)
00743 {
00744 assert(!bit_masks(_hnd).empty());
00745 uint bit_mask = bit_masks(_hnd).back();
00746 bit_masks(_hnd).pop_back();
00747 return bit_mask;
00748 }
00749
00750 template <class Handle>
00751 void push_bit_mask(Handle _hnd, uint _bit_mask)
00752 {
00753 assert(std::find(bit_masks(_hnd).begin(), bit_masks(_hnd).end(), _bit_mask) ==
00754 bit_masks(_hnd).end());
00755 bit_masks(_hnd).push_back(_bit_mask);
00756 }
00757
00758 void init_bit_masks(BitMaskContainer& _bmc);
00759 void init_bit_masks();
00760
00761 private:
00762 VertexContainer vertices_;
00763 EdgeContainer edges_;
00764 FaceContainer faces_;
00765
00766 VertexStatusPropertyHandle vertex_status_;
00767 HalfedgeStatusPropertyHandle halfedge_status_;
00768 EdgeStatusPropertyHandle edge_status_;
00769 FaceStatusPropertyHandle face_status_;
00770
00771 uint refcount_vstatus_;
00772 uint refcount_hstatus_;
00773 uint refcount_estatus_;
00774 uint refcount_fstatus_;
00775
00776 BitMaskContainer halfedge_bit_masks_;
00777 BitMaskContainer edge_bit_masks_;
00778 BitMaskContainer vertex_bit_masks_;
00779 BitMaskContainer face_bit_masks_;
00780 };
00781
00782
00783 }
00784
00785 #endif // OPENMESH_ARRAY_KERNEL_HH defined
00786