52#ifndef OPENMESH_BASE_KERNEL_HH
53#define OPENMESH_BASE_KERNEL_HH
66#include <OpenMesh/Core/Utils/PropertyContainer.hh>
144 vprops_.resize(n_vertices());
151 hprops_.resize(n_halfedges());
158 eprops_.resize(n_edges());
165 fprops_.resize(n_faces());
193 template <
typename T>
201 template <
typename T>
209 template <
typename T>
217 template <
typename T>
225 template <
typename T>
255 const std::string& _name)
const
262 const std::string& _name)
const
269 const std::string& _name)
const
276 const std::string& _name)
const
283 const std::string& _name)
const
311 return vprops_.property(_ph);
315 return vprops_.property(_ph);
320 return hprops_.property(_ph);
324 return hprops_.property(_ph);
329 return eprops_.property(_ph);
333 return eprops_.property(_ph);
338 return fprops_.property(_ph);
342 return fprops_.property(_ph);
347 return mprops_.property(_ph);
351 return mprops_.property(_ph);
368 typename VPropHandleT<T>::reference
370 return vprops_.property(_ph)[_vh.
idx()];
374 typename VPropHandleT<T>::const_reference
376 return vprops_.property(_ph)[_vh.
idx()];
381 typename HPropHandleT<T>::reference
383 return hprops_.property(_ph)[_hh.
idx()];
387 typename HPropHandleT<T>::const_reference
389 return hprops_.property(_ph)[_hh.
idx()];
394 typename EPropHandleT<T>::reference
396 return eprops_.property(_ph)[_eh.
idx()];
400 typename EPropHandleT<T>::const_reference
402 return eprops_.property(_ph)[_eh.
idx()];
407 typename FPropHandleT<T>::reference
409 return fprops_.property(_ph)[_fh.
idx()];
413 typename FPropHandleT<T>::const_reference
415 return fprops_.property(_ph)[_fh.
idx()];
420 typename MPropHandleT<T>::reference
422 return mprops_.property(_ph)[0];
426 typename MPropHandleT<T>::const_reference
428 return mprops_.property(_ph)[0];
449 vprops_.property(_ph)[_vh_to.
idx()] = vprops_.property(_ph)[_vh_from.
idx()];
465 hprops_.property(_ph)[_hh_to.
idx()] = hprops_.property(_ph)[_hh_from.
idx()];
481 eprops_.property(_ph)[_eh_to.
idx()] = eprops_.property(_ph)[_eh_from.
idx()];
497 fprops_.property(_ph)[_fh_to.
idx()] = fprops_.property(_ph)[_fh_from.
idx()];
513 for( PropertyContainer::iterator p_it = vprops_.begin();
514 p_it != vprops_.end(); ++p_it) {
518 if ( *p_it && ( _copyBuildIn || (*p_it)->name().substr(0,2) !=
"v:" ) )
519 (*p_it)->copy(
static_cast<size_t>(_vh_from.
idx()),
static_cast<size_t>(_vh_to.
idx()));
532 for( PropertyContainer::iterator p_it = hprops_.begin();
533 p_it != hprops_.end(); ++p_it) {
537 if ( *p_it && ( _copyBuildIn || (*p_it)->name().substr(0,2) !=
"h:") )
538 (*p_it)->copy(_hh_from.
idx(), _hh_to.
idx());
550 for( PropertyContainer::iterator p_it = eprops_.begin();
551 p_it != eprops_.end(); ++p_it) {
555 if ( *p_it && ( _copyBuildIn || (*p_it)->name().substr(0,2) !=
"e:") )
556 (*p_it)->copy(_eh_from.
idx(), _eh_to.
idx());
570 for( PropertyContainer::iterator p_it = fprops_.begin();
571 p_it != fprops_.end(); ++p_it) {
575 if ( *p_it && ( _copyBuildIn || (*p_it)->name().substr(0,2) !=
"f:") )
576 (*p_it)->copy(_fh_from.
idx(), _fh_to.
idx());
587 this->vprops_ = _other.
vprops_;
588 this->eprops_ = _other.
eprops_;
589 this->hprops_ = _other.
hprops_;
590 this->fprops_ = _other.
fprops_;
597 size_t n_vprops(
void)
const {
return vprops_.size(); }
599 size_t n_eprops(
void)
const {
return eprops_.size(); }
601 size_t n_hprops(
void)
const {
return hprops_.size(); }
603 size_t n_fprops(
void)
const {
return fprops_.size(); }
605 size_t n_mprops(
void)
const {
return mprops_.size(); }
608 {
return vprops_.property(_name); }
611 {
return eprops_.property(_name); }
614 {
return hprops_.property(_name); }
617 {
return fprops_.property(_name); }
620 {
return mprops_.property(_name); }
623 {
return vprops_.property(_name); }
626 {
return eprops_.property(_name); }
629 {
return hprops_.property(_name); }
632 {
return fprops_.property(_name); }
635 {
return mprops_.property(_name); }
644 {
return vprops_._property( _idx ); }
646 {
return eprops_._property( _idx ); }
648 {
return hprops_._property( _idx ); }
650 {
return fprops_._property( _idx ); }
652 {
return mprops_._property( _idx ); }
663 {
return vprops_._property( _h.
idx() ); }
665 {
return eprops_._property( _h.
idx() ); }
667 {
return hprops_._property( _h.
idx() ); }
669 {
return fprops_._property( _h.
idx() ); }
671 {
return mprops_._property( _h.
idx() ); }
674 {
return vprops_._property( _h.
idx() ); }
676 {
return eprops_._property( _h.
idx() ); }
678 {
return hprops_._property( _h.
idx() ); }
680 {
return fprops_._property( _h.
idx() ); }
682 {
return mprops_._property( _h.
idx() ); }
693 template <
typename HandleT>
720 vprops_.swap(_i0, _i1);
729 hprops_.swap(_i0, _i1);
738 eprops_.swap(_i0, _i1);
747 fprops_.swap(_i0, _i1);
758 void property_stats()
const;
759 void property_stats(std::ostream& _ostr)
const;
761 void vprop_stats( std::string& _string )
const;
762 void hprop_stats( std::string& _string )
const;
763 void eprop_stats( std::string& _string )
const;
764 void fprop_stats( std::string& _string )
const;
765 void mprop_stats( std::string& _string )
const;
768 void vprop_stats()
const;
769 void hprop_stats()
const;
770 void eprop_stats()
const;
771 void fprop_stats()
const;
772 void mprop_stats()
const;
774 void vprop_stats(std::ostream& _ostr)
const;
775 void hprop_stats(std::ostream& _ostr)
const;
776 void eprop_stats(std::ostream& _ostr)
const;
777 void fprop_stats(std::ostream& _ostr)
const;
778 void mprop_stats(std::ostream& _ostr)
const;
821inline size_t BaseKernel::n_elements<VertexHandle>()
const {
return n_vertices(); }
823inline size_t BaseKernel::n_elements<HalfedgeHandle>()
const {
return n_halfedges(); }
825inline size_t BaseKernel::n_elements<EdgeHandle>()
const {
return n_edges(); }
827inline size_t BaseKernel::n_elements<FaceHandle>()
const {
return n_faces(); }
Base class for all handle types.
bool is_valid() const
The handle is valid iff the index is not negative.
void reset()
reset handle to be invalid
int idx() const
Get the underlying index of this handle.
BaseProperty & _hprop(BaseHandle _h)
PropertyContainer::iterator prop_iterator
prop_iterator mprops_begin()
BaseProperty * _get_eprop(const std::string &_name)
virtual size_t n_vertices() const
void remove_property(EPropHandleT< T > &_ph)
size_t n_eprops(void) const
PropertyContainer fprops_
prop_iterator vprops_end()
bool get_property_handle(HPropHandleT< T > &_ph, const std::string &_name) const
const BaseProperty & _eprop(size_t _idx) const
const BaseProperty * _get_mprop(const std::string &_name) const
const BaseProperty * _get_hprop(const std::string &_name) const
bool get_property_handle(EPropHandleT< T > &_ph, const std::string &_name) const
void remove_property(VPropHandleT< T > &_ph)
BaseProperty & _eprop(BaseHandle _h)
const BaseProperty * _get_fprop(const std::string &_name) const
void add_property(MPropHandleT< T > &_ph, const std::string &_name="<mprop>")
size_t _add_eprop(BaseProperty *_bp)
prop_iterator vprops_begin()
const_prop_iterator vprops_begin() const
void eprops_swap(unsigned int _i0, unsigned int _i1) const
void vprops_swap(unsigned int _i0, unsigned int _i1) const
size_t n_mprops(void) const
prop_iterator hprops_end()
BaseProperty & _mprop(BaseHandle _h)
PropertyT< T > & property(FPropHandleT< T > _ph)
BaseProperty * _get_vprop(const std::string &_name)
const BaseProperty * _get_eprop(const std::string &_name) const
prop_iterator hprops_begin()
BaseProperty * _get_fprop(const std::string &_name)
BaseProperty & _vprop(size_t _idx)
PropertyT< T > & mproperty(MPropHandleT< T > _ph)
size_t n_vprops(void) const
const PropertyT< T > & property(VPropHandleT< T > _ph) const
const BaseProperty & _mprop(BaseHandle _h) const
void copy_property(EPropHandleT< T > _ph, EdgeHandle _eh_from, EdgeHandle _eh_to)
virtual size_t n_halfedges() const
const PropertyT< T > & property(EPropHandleT< T > _ph) const
void remove_property(HPropHandleT< T > &_ph)
const_prop_iterator fprops_end() const
void hprops_resize(size_t _n) const
const_prop_iterator vprops_end() const
BaseProperty & _eprop(size_t _idx)
const PropertyT< T > & property(FPropHandleT< T > _ph) const
const_prop_iterator eprops_begin() const
void vprops_resize_if_smaller(size_t _n) const
void remove_property(FPropHandleT< T > &_ph)
BaseProperty & _fprop(size_t _idx)
void copy_all_kernel_properties(const BaseKernel &_other)
copy_all_kernel_properties uses the = operator to copy all properties from a given other BaseKernel.
void copy_all_properties(EdgeHandle _eh_from, EdgeHandle _eh_to, bool _copyBuildIn=false)
size_t n_hprops(void) const
const BaseProperty & _fprop(size_t _idx) const
const BaseProperty & _hprop(size_t _idx) const
size_t _add_vprop(BaseProperty *_bp)
PropertyT< T > & property(HPropHandleT< T > _ph)
PropertyContainer eprops_
FPropHandleT< T >::reference property(FPropHandleT< T > _ph, FaceHandle _fh)
const_prop_iterator hprops_begin() const
virtual size_t n_edges() const
void vprops_reserve(size_t _n) const
Reserves space for _n elements in all vertex property vectors.
const_prop_iterator hprops_end() const
prop_iterator fprops_begin()
void copy_all_properties(FaceHandle _fh_from, FaceHandle _fh_to, bool _copyBuildIn=false)
void hprops_swap(unsigned int _i0, unsigned int _i1) const
bool get_property_handle(MPropHandleT< T > &_ph, const std::string &_name) const
PropertyT< T > & property(VPropHandleT< T > _ph)
const_prop_iterator eprops_end() const
void fprops_resize(size_t _n) const
size_t _add_hprop(BaseProperty *_bp)
PropertyT< T > & property(EPropHandleT< T > _ph)
prop_iterator mprops_end()
BaseProperty & _fprop(BaseHandle _h)
void add_property(VPropHandleT< T > &_ph, const std::string &_name="<vprop>")
const_prop_iterator fprops_begin() const
const BaseProperty & _hprop(BaseHandle _h) const
const BaseProperty & _vprop(BaseHandle _h) const
prop_iterator eprops_begin()
VPropHandleT< T >::reference property(VPropHandleT< T > _ph, VertexHandle _vh)
PropertyContainer mprops_
MPropHandleT< T >::reference property(MPropHandleT< T > _ph)
EPropHandleT< T >::reference property(EPropHandleT< T > _ph, EdgeHandle _eh)
const_prop_iterator mprops_end() const
const BaseProperty & _mprop(size_t _idx) const
void eprops_resize(size_t _n) const
virtual size_t n_faces() const
HPropHandleT< T >::reference property(HPropHandleT< T > _ph, HalfedgeHandle _hh)
void copy_all_properties(VertexHandle _vh_from, VertexHandle _vh_to, bool _copyBuildIn=false)
BaseProperty & _hprop(size_t _idx)
void fprops_reserve(size_t _n) const
void copy_all_properties(HalfedgeHandle _hh_from, HalfedgeHandle _hh_to, bool _copyBuildIn=false)
BaseProperty & _vprop(BaseHandle _h)
void fprops_swap(unsigned int _i0, unsigned int _i1) const
bool get_property_handle(VPropHandleT< T > &_ph, const std::string &_name) const
bool get_property_handle(FPropHandleT< T > &_ph, const std::string &_name) const
prop_iterator eprops_end()
const BaseProperty & _fprop(BaseHandle _h) const
void remove_property(MPropHandleT< T > &_ph)
PropertyContainer::const_iterator const_prop_iterator
void mprops_resize(size_t _n) const
void hprops_reserve(size_t _n) const
FPropHandleT< T >::const_reference property(FPropHandleT< T > _ph, FaceHandle _fh) const
size_t _add_mprop(BaseProperty *_bp)
BaseProperty & _mprop(size_t _idx)
HPropHandleT< T >::const_reference property(HPropHandleT< T > _ph, HalfedgeHandle _hh) const
EPropHandleT< T >::const_reference property(EPropHandleT< T > _ph, EdgeHandle _eh) const
PropertyContainer hprops_
BaseProperty * _get_mprop(const std::string &_name)
size_t _add_fprop(BaseProperty *_bp)
void add_property(FPropHandleT< T > &_ph, const std::string &_name="<fprop>")
void vprops_resize(size_t _n) const
Resizes all vertex property vectors to the specified size.
const BaseProperty * _get_vprop(const std::string &_name) const
void add_property(HPropHandleT< T > &_ph, const std::string &_name="<hprop>")
const BaseProperty & _vprop(size_t _idx) const
const BaseProperty & _eprop(BaseHandle _h) const
void copy_property(VPropHandleT< T > &_ph, VertexHandle _vh_from, VertexHandle _vh_to)
void eprops_reserve(size_t _n) const
const_prop_iterator mprops_begin() const
MPropHandleT< T >::const_reference property(MPropHandleT< T > _ph) const
const PropertyT< T > & property(HPropHandleT< T > _ph) const
void copy_property(FPropHandleT< T > _ph, FaceHandle _fh_from, FaceHandle _fh_to)
PropertyContainer vprops_
void add_property(EPropHandleT< T > &_ph, const std::string &_name="<eprop>")
BaseProperty * _get_hprop(const std::string &_name)
const PropertyT< T > & mproperty(MPropHandleT< T > _ph) const
prop_iterator fprops_end()
void copy_property(HPropHandleT< T > _ph, HalfedgeHandle _hh_from, HalfedgeHandle _hh_to)
size_t n_elements() const
size_t n_fprops(void) const
VPropHandleT< T >::const_reference property(VPropHandleT< T > _ph, VertexHandle _vh) const
A a container for properties.
Default property class for any type T.
Handle for a edge entity.
Handle for a face entity.
Handle for a halfedge entity.
Handle for a vertex entity.