50 #ifndef OPENMESH_BASE_KERNEL_HH
51 #define OPENMESH_BASE_KERNEL_HH
57 #include <OpenMesh/Core/System/config.h>
63 #include <OpenMesh/Core/Utils/PropertyContainer.hh>
134 vprops_.resize(n_vertices());
141 hprops_.resize(n_halfedges());
148 eprops_.resize(n_edges());
155 fprops_.resize(n_faces());
180 template <
typename T>
188 template <
typename T>
196 template <
typename T>
204 template <
typename T>
212 template <
typename T>
237 const std::string& _name)
const
244 const std::string& _name)
const
251 const std::string& _name)
const
258 const std::string& _name)
const
265 const std::string& _name)
const
288 return vprops_.property(_ph);
292 return vprops_.property(_ph);
297 return hprops_.property(_ph);
301 return hprops_.property(_ph);
306 return eprops_.property(_ph);
310 return eprops_.property(_ph);
315 return fprops_.property(_ph);
319 return fprops_.property(_ph);
324 return mprops_.property(_ph);
328 return mprops_.property(_ph);
342 typename VPropHandleT<T>::reference
344 return vprops_.property(_ph)[_vh.
idx()];
348 typename VPropHandleT<T>::const_reference
350 return vprops_.property(_ph)[_vh.
idx()];
355 typename HPropHandleT<T>::reference
357 return hprops_.property(_ph)[_hh.
idx()];
361 typename HPropHandleT<T>::const_reference
363 return hprops_.property(_ph)[_hh.
idx()];
368 typename EPropHandleT<T>::reference
370 return eprops_.property(_ph)[_eh.
idx()];
374 typename EPropHandleT<T>::const_reference
376 return eprops_.property(_ph)[_eh.
idx()];
381 typename FPropHandleT<T>::reference
383 return fprops_.property(_ph)[_fh.
idx()];
387 typename FPropHandleT<T>::const_reference
389 return fprops_.property(_ph)[_fh.
idx()];
394 typename MPropHandleT<T>::reference
396 return mprops_.property(_ph)[0];
400 typename MPropHandleT<T>::const_reference
402 return mprops_.property(_ph)[0];
411 size_t n_vprops(
void)
const {
return vprops_.size(); }
413 size_t n_eprops(
void)
const {
return eprops_.size(); }
415 size_t n_hprops(
void)
const {
return hprops_.size(); }
417 size_t n_fprops(
void)
const {
return fprops_.size(); }
419 size_t n_mprops(
void)
const {
return mprops_.size(); }
421 BaseProperty* _get_vprop(
const std::string& _name)
422 {
return vprops_.property(_name); }
424 BaseProperty* _get_eprop(
const std::string& _name)
425 {
return eprops_.property(_name); }
427 BaseProperty* _get_hprop(
const std::string& _name)
428 {
return hprops_.property(_name); }
430 BaseProperty* _get_fprop(
const std::string& _name)
431 {
return fprops_.property(_name); }
433 BaseProperty* _get_mprop(
const std::string& _name)
434 {
return mprops_.property(_name); }
436 const BaseProperty* _get_vprop(
const std::string& _name)
const
437 {
return vprops_.property(_name); }
439 const BaseProperty* _get_eprop(
const std::string& _name)
const
440 {
return eprops_.property(_name); }
442 const BaseProperty* _get_hprop(
const std::string& _name)
const
443 {
return hprops_.property(_name); }
445 const BaseProperty* _get_fprop(
const std::string& _name)
const
446 {
return fprops_.property(_name); }
448 const BaseProperty* _get_mprop(
const std::string& _name)
const
449 {
return mprops_.property(_name); }
451 BaseProperty& _vprop(
size_t _idx ) {
return vprops_._property( _idx ); }
452 BaseProperty& _eprop(
size_t _idx ) {
return eprops_._property( _idx ); }
453 BaseProperty& _hprop(
size_t _idx ) {
return hprops_._property( _idx ); }
454 BaseProperty& _fprop(
size_t _idx ) {
return fprops_._property( _idx ); }
455 BaseProperty& _mprop(
size_t _idx ) {
return mprops_._property( _idx ); }
457 const BaseProperty& _vprop(
size_t _idx )
const
458 {
return vprops_._property( _idx ); }
459 const BaseProperty& _eprop(
size_t _idx )
const
460 {
return eprops_._property( _idx ); }
461 const BaseProperty& _hprop(
size_t _idx )
const
462 {
return hprops_._property( _idx ); }
463 const BaseProperty& _fprop(
size_t _idx )
const
464 {
return fprops_._property( _idx ); }
465 const BaseProperty& _mprop(
size_t _idx )
const
466 {
return mprops_._property( _idx ); }
468 size_t _add_vprop( BaseProperty* _bp ) {
return vprops_._add( _bp ); }
469 size_t _add_eprop( BaseProperty* _bp ) {
return eprops_._add( _bp ); }
470 size_t _add_hprop( BaseProperty* _bp ) {
return hprops_._add( _bp ); }
471 size_t _add_fprop( BaseProperty* _bp ) {
return fprops_._add( _bp ); }
472 size_t _add_mprop( BaseProperty* _bp ) {
return mprops_._add( _bp ); }
476 BaseProperty& _vprop( BaseHandle _h )
477 {
return vprops_._property( _h.idx() ); }
478 BaseProperty& _eprop( BaseHandle _h )
479 {
return eprops_._property( _h.idx() ); }
480 BaseProperty& _hprop( BaseHandle _h )
481 {
return hprops_._property( _h.idx() ); }
482 BaseProperty& _fprop( BaseHandle _h )
483 {
return fprops_._property( _h.idx() ); }
484 BaseProperty& _mprop( BaseHandle _h )
485 {
return mprops_._property( _h.idx() ); }
487 const BaseProperty& _vprop( BaseHandle _h )
const
488 {
return vprops_._property( _h.idx() ); }
489 const BaseProperty& _eprop( BaseHandle _h )
const
490 {
return eprops_._property( _h.idx() ); }
491 const BaseProperty& _hprop( BaseHandle _h )
const
492 {
return hprops_._property( _h.idx() ); }
493 const BaseProperty& _fprop( BaseHandle _h )
const
494 {
return fprops_._property( _h.idx() ); }
495 const BaseProperty& _mprop( BaseHandle _h )
const
496 {
return mprops_._property( _h.idx() ); }
502 virtual uint n_vertices()
const {
return 0; }
503 virtual uint n_halfedges()
const {
return 0; }
504 virtual uint n_edges()
const {
return 0; }
505 virtual uint n_faces()
const {
return 0; }
510 void vprops_reserve(
unsigned int _n)
const { vprops_.reserve(_n); }
511 void vprops_resize(
unsigned int _n)
const { vprops_.resize(_n); }
512 void vprops_clear() {
515 void vprops_swap(
unsigned int _i0,
unsigned int _i1)
const {
516 vprops_.swap(_i0, _i1);
519 void hprops_reserve(
unsigned int _n)
const { hprops_.reserve(_n); }
520 void hprops_resize(
unsigned int _n)
const { hprops_.resize(_n); }
521 void hprops_clear() {
524 void hprops_swap(
unsigned int _i0,
unsigned int _i1)
const {
525 hprops_.swap(_i0, _i1);
528 void eprops_reserve(
unsigned int _n)
const { eprops_.reserve(_n); }
529 void eprops_resize(
unsigned int _n)
const { eprops_.resize(_n); }
530 void eprops_clear() {
533 void eprops_swap(
unsigned int _i0,
unsigned int _i1)
const {
534 eprops_.swap(_i0, _i1);
537 void fprops_reserve(
unsigned int _n)
const { fprops_.reserve(_n); }
538 void fprops_resize(
unsigned int _n)
const { fprops_.resize(_n); }
539 void fprops_clear() {
542 void fprops_swap(
unsigned int _i0,
unsigned int _i1)
const {
543 fprops_.swap(_i0, _i1);
546 void mprops_resize(
unsigned int _n)
const { mprops_.resize(_n); }
547 void mprops_clear() {
553 void property_stats(std::ostream& _ostr = std::clog)
const;
555 void vprop_stats( std::string& _string )
const;
556 void hprop_stats( std::string& _string )
const;
557 void eprop_stats( std::string& _string )
const;
558 void fprop_stats( std::string& _string )
const;
559 void mprop_stats( std::string& _string )
const;
561 void vprop_stats(std::ostream& _ostr = std::clog)
const;
562 void hprop_stats(std::ostream& _ostr = std::clog)
const;
563 void eprop_stats(std::ostream& _ostr = std::clog)
const;
564 void fprop_stats(std::ostream& _ostr = std::clog)
const;
565 void mprop_stats(std::ostream& _ostr = std::clog)
const;
569 typedef PropertyContainer::iterator prop_iterator;
570 typedef PropertyContainer::const_iterator const_prop_iterator;
572 prop_iterator vprops_begin() {
return vprops_.begin(); }
573 prop_iterator vprops_end() {
return vprops_.end(); }
574 const_prop_iterator vprops_begin()
const {
return vprops_.begin(); }
575 const_prop_iterator vprops_end()
const {
return vprops_.end(); }
577 prop_iterator eprops_begin() {
return eprops_.begin(); }
578 prop_iterator eprops_end() {
return eprops_.end(); }
579 const_prop_iterator eprops_begin()
const {
return eprops_.begin(); }
580 const_prop_iterator eprops_end()
const {
return eprops_.end(); }
582 prop_iterator hprops_begin() {
return hprops_.begin(); }
583 prop_iterator hprops_end() {
return hprops_.end(); }
584 const_prop_iterator hprops_begin()
const {
return hprops_.begin(); }
585 const_prop_iterator hprops_end()
const {
return hprops_.end(); }
587 prop_iterator fprops_begin() {
return fprops_.begin(); }
588 prop_iterator fprops_end() {
return fprops_.end(); }
589 const_prop_iterator fprops_begin()
const {
return fprops_.begin(); }
590 const_prop_iterator fprops_end()
const {
return fprops_.end(); }
592 prop_iterator mprops_begin() {
return mprops_.begin(); }
593 prop_iterator mprops_end() {
return mprops_.end(); }
594 const_prop_iterator mprops_begin()
const {
return mprops_.begin(); }
595 const_prop_iterator mprops_end()
const {
return mprops_.end(); }
599 PropertyContainer vprops_;
600 PropertyContainer hprops_;
601 PropertyContainer eprops_;
602 PropertyContainer fprops_;
603 PropertyContainer mprops_;
610 #endif // OPENMESH_BASE_KERNEL_HH defined