43#ifndef OPENVOLUMEMESHHANDLE_HH_
44#define OPENVOLUMEMESHHANDLE_HH_
50#include "../System/FunctionalInclude.hh"
52namespace OpenVolumeMesh {
55class OpenVolumeMeshHandle {
58 explicit OpenVolumeMeshHandle(
int _idx) : idx_(_idx) {};
60 OpenVolumeMeshHandle& operator=(
int _idx) {
65 OpenVolumeMeshHandle& operator=(
const OpenVolumeMeshHandle& _idx) {
70 inline bool is_valid()
const {
return idx_ != -1; }
72 inline bool operator<(
const OpenVolumeMeshHandle& _idx)
const {
return (this->idx_ < _idx.idx_); }
74 inline bool operator<(
int _idx)
const {
return idx_ < _idx; }
76 inline bool operator>(
const OpenVolumeMeshHandle& _idx)
const {
return (this->idx_ > _idx.idx_); }
78 inline bool operator>(
int _idx)
const {
return idx_ > _idx; }
80 inline bool operator==(
const OpenVolumeMeshHandle& _h)
const {
return _h.idx_ == this->idx_; }
82 inline bool operator!=(
const OpenVolumeMeshHandle& _h)
const {
return _h.idx_ != this->idx_; }
84 inline const int& idx()
const {
return idx_; }
86 void idx(
const int& _idx) { idx_ = _idx; }
88 inline operator int()
const {
return idx_; }
90 void reset() { idx_ = -1; }
98class VertexHandle :
public OpenVolumeMeshHandle {
public: VertexHandle(
int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
99class EdgeHandle :
public OpenVolumeMeshHandle {
public: EdgeHandle(
int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
100class FaceHandle :
public OpenVolumeMeshHandle {
public: FaceHandle(
int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
101class CellHandle :
public OpenVolumeMeshHandle {
public: CellHandle(
int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
102class HalfEdgeHandle :
public OpenVolumeMeshHandle {
public: HalfEdgeHandle(
int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
103class HalfFaceHandle :
public OpenVolumeMeshHandle {
public: HalfFaceHandle(
int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
108class VHandleCorrection {
112 if(_h > thld_) _h.idx(_h.idx() - 1);
117class HEHandleCorrection {
120 void correctVecValue(std::vector<HalfEdgeHandle>& _vec) {
121#if defined(__clang_major__) && (__clang_major__ >= 5)
122 for(std::vector<HalfEdgeHandle>::iterator it = _vec.begin(), end = _vec.end(); it != end; ++it) {
126 std::for_each(_vec.begin(), _vec.end(), fun::bind(&HEHandleCorrection::correctValue,
this, fun::placeholders::_1));
130 if(_h > thld_) _h.idx(_h.idx() - 2);
135class HFHandleCorrection {
138 void correctVecValue(std::vector<HalfFaceHandle>& _vec) {
139#if defined(__clang_major__) && (__clang_major__ >= 5)
140 for(std::vector<HalfFaceHandle>::iterator it = _vec.begin(), end = _vec.end(); it != end; ++it) {
144 std::for_each(_vec.begin(), _vec.end(), fun::bind(&HFHandleCorrection::correctValue,
this, fun::placeholders::_1));
148 if(_h > thld_) _h.idx(_h.idx() - 2);
153class CHandleCorrection {
155 CHandleCorrection(
CellHandle _thld) : thld_(_thld) {}
157 if(_h > thld_) _h.idx(_h.idx() - 1);
Definition OpenVolumeMeshHandle.hh:101
Definition OpenVolumeMeshHandle.hh:102
Definition OpenVolumeMeshHandle.hh:103
Definition OpenVolumeMeshHandle.hh:55
Definition OpenVolumeMeshHandle.hh:98