43 #include "Entities.hh" 44 #include "../System/FunctionalInclude.hh" 45 #include "../System/Deprecation.hh" 46 #include "OpenVolumeMesh/Config/Export.hh" 56 OpenVolumeMeshHandle& operator=(
int _idx) {
61 OpenVolumeMeshHandle(
const OpenVolumeMeshHandle& _idx) =
default;
62 OpenVolumeMeshHandle& operator=(
const OpenVolumeMeshHandle& _idx) =
default;
64 inline bool is_valid()
const {
return idx_ != -1; }
66 inline bool operator<(
const OpenVolumeMeshHandle& _idx)
const {
return (this->idx_ < _idx.idx_); }
68 inline bool operator<(
int _idx)
const {
return idx_ < _idx; }
70 inline bool operator>(
const OpenVolumeMeshHandle& _idx)
const {
return (this->idx_ > _idx.idx_); }
72 inline bool operator>(
int _idx)
const {
return idx_ > _idx; }
74 inline bool operator==(
const OpenVolumeMeshHandle& _h)
const {
return _h.idx_ == this->idx_; }
76 inline bool operator!=(
const OpenVolumeMeshHandle& _h)
const {
return _h.idx_ != this->idx_; }
78 inline const int& idx()
const {
return idx_; }
81 inline size_t uidx()
const { assert(is_valid());
return static_cast<size_t>(idx_); }
83 void idx(
const int& _idx) { idx_ = _idx; }
85 #if OVM_ENABLE_DEPRECATED_APIS 86 OVM_DEPRECATED(
"use explicit .idx() instead")
87 inline operator int()
const {
return idx_; }
90 void reset() { idx_ = -1; }
96 template<
typename EntityTag,
97 typename =
typename std::enable_if<is_entity<EntityTag>::value>::type>
108 template<typename EntityTag, typename = typename is_handle_tag<EntityTag>::type>
112 using Entity = EntityTag;
116 from_unsigned(
size_t _idx)
118 if (_idx <= static_cast<size_t>(std::numeric_limits<int>::max())) {
152 if(_h > thld_) _h.idx(_h.idx() - 1);
160 void correctVecValue(std::vector<HalfEdgeHandle>& _vec) {
161 #if defined(__clang_major__) && (__clang_major__ >= 5) 162 for(std::vector<HalfEdgeHandle>::iterator it = _vec.begin(), end = _vec.end(); it != end; ++it) {
166 std::for_each(_vec.begin(), _vec.end(),
fun::bind(&HEHandleCorrection::correctValue,
this, fun::placeholders::_1));
170 if(_h > thld_) _h.idx(_h.idx() - 2);
178 void correctVecValue(std::vector<HalfFaceHandle>& _vec) {
179 #if defined(__clang_major__) && (__clang_major__ >= 5) 180 for(std::vector<HalfFaceHandle>::iterator it = _vec.begin(), end = _vec.end(); it != end; ++it) {
184 std::for_each(_vec.begin(), _vec.end(),
fun::bind(&HFHandleCorrection::correctValue,
this, fun::placeholders::_1));
188 if(_h > thld_) _h.idx(_h.idx() - 2);
197 if(_h > thld_) _h.idx(_h.idx() - 1);
size_t uidx() const
return unsigned idx - handle must be valid
bool bind(osg::GeometryPtr &_geo, Mesh &_mesh)