42#define OPENMESH_SMARTTAGGERT_C
46#include "SmartTaggerT.hh"
57template <
class Mesh,
class EHandle,
class EPHandle>
62 tag_range_(_tag_range)
65 mesh_.add_property(ep_tag_);
75template <
class Mesh,
class EHandle,
class EPHandle>
79 mesh_.remove_property(ep_tag_);
86template <
class Mesh,
class EHandle,
class EPHandle>
91 unsigned int max_uint = std::numeric_limits<unsigned int>::max();
93 if( current_base_ < max_uint - 2*tag_range_)
94 current_base_ += tag_range_;
98#ifdef STV_DEBUG_CHECKS
99 std::cerr <<
"Tagging Overflow occured...\n";
110template <
class Mesh,
class EHandle,
class EPHandle>
113untag_all(
const unsigned int _new_tag_range)
115 set_tag_range(_new_tag_range);
121template <
class Mesh,
class EHandle,
class EPHandle>
124set_tag (
const EHandle _eh,
unsigned int _tag)
126#ifdef STV_DEBUG_CHECKS
127 if( _tag > tag_range_)
128 std::cerr <<
"ERROR in set_tag tag range!!!\n";
131 mesh_.property(ep_tag_, _eh) = current_base_ + _tag;
138template <
class Mesh,
class EHandle,
class EPHandle>
141get_tag (
const EHandle _eh)
const
143 unsigned int t = mesh_.property(ep_tag_, _eh);
145#ifdef STV_DEBUG_CHECKS
146 if( t > current_base_ + tag_range_)
147 std::cerr <<
"ERROR in get_tag tag range!!!\n";
150 if( t<= current_base_)
return 0;
151 else return t-current_base_;
158template <
class Mesh,
class EHandle,
class EPHandle>
163 return bool(get_tag(_eh));
170template <
class Mesh,
class EHandle,
class EPHandle>
175 if( _tag_range <= tag_range_)
178 tag_range_ = _tag_range;
182 tag_range_ = _tag_range;
191template <
class Mesh,
class EHandle,
class EPHandle>
197 for(
unsigned int i=0; i<mesh_.property(ep_tag_).n_elements(); ++i)
199 mesh_.property(ep_tag_)[i] = 0;
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Smart Tagger.
Definition: SmartTaggerT.hh:125
unsigned int get_tag(const EHandle _eh) const
get tag value in range [0..tag_range]
Definition: SmartTaggerT_impl.hh:141
bool is_tagged(const EHandle _eh) const
overloaded member for boolean tags
Definition: SmartTaggerT_impl.hh:161
void set_tag(const EHandle _eh, unsigned int _tag=1)
set tag to a value in [0..tag_range]
Definition: SmartTaggerT_impl.hh:124
void set_tag_range(const unsigned int _tag_range)
set new tag range and untag_all
Definition: SmartTaggerT_impl.hh:173
void untag_all()
untag all elements
Definition: SmartTaggerT_impl.hh:89
~SmartTaggerT()
Destructor.
Definition: SmartTaggerT_impl.hh:77
SmartTaggerT(Mesh &_mesh, unsigned int _tag_range=1)
Constructor.
Definition: SmartTaggerT_impl.hh:59