43 #include "Entities.hh" 44 #include "../System/FunctionalInclude.hh" 45 #include "../System/Deprecation.hh" 55 OpenVolumeMeshHandle& operator=(
int _idx) {
60 OpenVolumeMeshHandle(
const OpenVolumeMeshHandle& _idx) =
default;
61 OpenVolumeMeshHandle& operator=(
const OpenVolumeMeshHandle& _idx) =
default;
63 inline bool is_valid()
const {
return idx_ != -1; }
65 inline bool operator<(
const OpenVolumeMeshHandle& _idx)
const {
return (this->idx_ < _idx.idx_); }
67 inline bool operator<(
int _idx)
const {
return idx_ < _idx; }
69 inline bool operator>(
const OpenVolumeMeshHandle& _idx)
const {
return (this->idx_ > _idx.idx_); }
71 inline bool operator>(
int _idx)
const {
return idx_ > _idx; }
73 inline bool operator==(
const OpenVolumeMeshHandle& _h)
const {
return _h.idx_ == this->idx_; }
75 inline bool operator!=(
const OpenVolumeMeshHandle& _h)
const {
return _h.idx_ != this->idx_; }
77 inline const int& idx()
const {
return idx_; }
80 inline size_t uidx()
const { assert(is_valid());
return static_cast<size_t>(idx_); }
82 void idx(
const int& _idx) { idx_ = _idx; }
84 #if OVM_ENABLE_DEPRECATED_APIS 85 OVM_DEPRECATED(
"use explicit .idx() instead")
86 inline operator int()
const {
return idx_; }
89 void reset() { idx_ = -1; }
95 template<
typename EntityTag,
96 typename =
typename std::enable_if<is_entity<EntityTag>::value>::type>
107 template<typename EntityTag, typename = typename is_handle_tag<EntityTag>::type>
111 using Entity = EntityTag;
115 from_unsigned(
size_t _idx)
117 if (_idx <= static_cast<size_t>(std::numeric_limits<int>::max())) {
143 if(_h > thld_) _h.idx(_h.idx() - 1);
151 void correctVecValue(std::vector<HalfEdgeHandle>& _vec) {
152 #if defined(__clang_major__) && (__clang_major__ >= 5) 153 for(std::vector<HalfEdgeHandle>::iterator it = _vec.begin(), end = _vec.end(); it != end; ++it) {
157 std::for_each(_vec.begin(), _vec.end(),
fun::bind(&HEHandleCorrection::correctValue,
this, fun::placeholders::_1));
161 if(_h > thld_) _h.idx(_h.idx() - 2);
169 void correctVecValue(std::vector<HalfFaceHandle>& _vec) {
170 #if defined(__clang_major__) && (__clang_major__ >= 5) 171 for(std::vector<HalfFaceHandle>::iterator it = _vec.begin(), end = _vec.end(); it != end; ++it) {
175 std::for_each(_vec.begin(), _vec.end(),
fun::bind(&HFHandleCorrection::correctValue,
this, fun::placeholders::_1));
179 if(_h > thld_) _h.idx(_h.idx() - 2);
188 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)