Commit cd7ad95d authored by Martin Heistermann's avatar Martin Heistermann

avoid deprecated size_t property indexing

parent 46e21d5d
...@@ -67,13 +67,13 @@ public: ...@@ -67,13 +67,13 @@ public:
//================== //==================
const ColT& operator[](const VertexHandle& _h) const { const ColT& operator[](const VertexHandle& _h) const {
assert((unsigned int)_h.idx() < kernel_.n_vertices()); assert((unsigned int)_h.idx() < kernel_.n_vertices());
return vcolor_prop_[_h.idx()]; return vcolor_prop_[_h];
} }
ColT& operator[](const VertexHandle& _h) { ColT& operator[](const VertexHandle& _h) {
assert((unsigned int)_h.idx() < kernel_.n_vertices()); assert((unsigned int)_h.idx() < kernel_.n_vertices());
vertex_colors_available_ = true; vertex_colors_available_ = true;
return vcolor_prop_[_h.idx()]; return vcolor_prop_[_h];
} }
//================== //==================
...@@ -81,13 +81,13 @@ public: ...@@ -81,13 +81,13 @@ public:
//================== //==================
const ColT& operator[](const EdgeHandle& _h) const { const ColT& operator[](const EdgeHandle& _h) const {
assert((unsigned int)_h.idx() < kernel_.n_edges()); assert((unsigned int)_h.idx() < kernel_.n_edges());
return ecolor_prop_[_h.idx()]; return ecolor_prop_[_h];
} }
ColT& operator[](const EdgeHandle& _h) { ColT& operator[](const EdgeHandle& _h) {
assert((unsigned int)_h.idx() < kernel_.n_edges()); assert((unsigned int)_h.idx() < kernel_.n_edges());
edge_colors_available_ = true; edge_colors_available_ = true;
return ecolor_prop_[_h.idx()]; return ecolor_prop_[_h];
} }
//================== //==================
...@@ -95,13 +95,13 @@ public: ...@@ -95,13 +95,13 @@ public:
//================== //==================
const ColT& operator[](const HalfEdgeHandle& _h) const { const ColT& operator[](const HalfEdgeHandle& _h) const {
assert((unsigned int)_h.idx() < kernel_.n_halfedges()); assert((unsigned int)_h.idx() < kernel_.n_halfedges());
return hecolor_prop_[_h.idx()]; return hecolor_prop_[_h];
} }
ColT& operator[](const HalfEdgeHandle& _h) { ColT& operator[](const HalfEdgeHandle& _h) {
assert((unsigned int)_h.idx() < kernel_.n_halfedges()); assert((unsigned int)_h.idx() < kernel_.n_halfedges());
halfedge_colors_available_ = true; halfedge_colors_available_ = true;
return hecolor_prop_[_h.idx()]; return hecolor_prop_[_h];
} }
//================== //==================
...@@ -109,13 +109,13 @@ public: ...@@ -109,13 +109,13 @@ public:
//================== //==================
const ColT& operator[](const FaceHandle& _h) const { const ColT& operator[](const FaceHandle& _h) const {
assert((unsigned int)_h.idx() < kernel_.n_faces()); assert((unsigned int)_h.idx() < kernel_.n_faces());
return fcolor_prop_[_h.idx()]; return fcolor_prop_[_h];
} }
ColT& operator[](const FaceHandle& _h) { ColT& operator[](const FaceHandle& _h) {
assert((unsigned int)_h.idx() < kernel_.n_faces()); assert((unsigned int)_h.idx() < kernel_.n_faces());
face_colors_available_ = true; face_colors_available_ = true;
return fcolor_prop_[_h.idx()]; return fcolor_prop_[_h];
} }
//================== //==================
...@@ -123,13 +123,13 @@ public: ...@@ -123,13 +123,13 @@ public:
//================== //==================
const ColT& operator[](const HalfFaceHandle& _h) const { const ColT& operator[](const HalfFaceHandle& _h) const {
assert((unsigned int)_h.idx() < kernel_.n_halffaces()); assert((unsigned int)_h.idx() < kernel_.n_halffaces());
return hfcolor_prop_[_h.idx()]; return hfcolor_prop_[_h];
} }
ColT& operator[](const HalfFaceHandle& _h) { ColT& operator[](const HalfFaceHandle& _h) {
assert((unsigned int)_h.idx() < kernel_.n_halffaces()); assert((unsigned int)_h.idx() < kernel_.n_halffaces());
halfface_colors_available_ = true; halfface_colors_available_ = true;
return hfcolor_prop_[_h.idx()]; return hfcolor_prop_[_h];
} }
//================== //==================
...@@ -137,13 +137,13 @@ public: ...@@ -137,13 +137,13 @@ public:
//================== //==================
const ColT& operator[](const CellHandle& _h) const { const ColT& operator[](const CellHandle& _h) const {
assert((unsigned int)_h.idx() < kernel_.n_cells()); assert((unsigned int)_h.idx() < kernel_.n_cells());
return ccolor_prop_[_h.idx()]; return ccolor_prop_[_h];
} }
ColT& operator[](const CellHandle& _h) { ColT& operator[](const CellHandle& _h) {
assert((unsigned int)_h.idx() < kernel_.n_cells()); assert((unsigned int)_h.idx() < kernel_.n_cells());
cell_colors_available_ = true; cell_colors_available_ = true;
return ccolor_prop_[_h.idx()]; return ccolor_prop_[_h];
} }
......
...@@ -74,48 +74,54 @@ ColorAttrib<ColT>::~ColorAttrib() { ...@@ -74,48 +74,54 @@ ColorAttrib<ColT>::~ColorAttrib() {
template <class ColT> template <class ColT>
void ColorAttrib<ColT>::clear_vertex_colors() void ColorAttrib<ColT>::clear_vertex_colors()
{ {
for (VertexIter v_it = kernel_.vertices_begin(); v_it != kernel_.vertices_end(); ++v_it) for (const auto vh: kernel_.vertices()) {
vcolor_prop_[v_it->idx()] = default_color_; vcolor_prop_[vh] = default_color_;
}
vertex_colors_available_ = false; vertex_colors_available_ = false;
} }
template <class ColT> template <class ColT>
void ColorAttrib<ColT>::clear_halfedge_colors() void ColorAttrib<ColT>::clear_halfedge_colors()
{ {
for (HalfEdgeIter he_it = kernel_.halfedges_begin(); he_it != kernel_.halfedges_end(); ++he_it) for (const auto heh: kernel_.halfedges()) {
hecolor_prop_[he_it->idx()] = default_color_; hecolor_prop_[heh] = default_color_;
}
halfedge_colors_available_ = false; halfedge_colors_available_ = false;
} }
template <class ColT> template <class ColT>
void ColorAttrib<ColT>::clear_edge_colors() void ColorAttrib<ColT>::clear_edge_colors()
{ {
for (EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it) for (const auto eh: kernel_.edges()) {
ecolor_prop_[e_it->idx()] = default_color_; ecolor_prop_[eh] = default_color_;
}
edge_colors_available_ = false; edge_colors_available_ = false;
} }
template <class ColT> template <class ColT>
void ColorAttrib<ColT>::clear_halfface_colors() void ColorAttrib<ColT>::clear_halfface_colors()
{ {
for (HalfFaceIter hf_it = kernel_.halffaces_begin(); hf_it != kernel_.halffaces_end(); ++hf_it) for (const auto hfh: kernel_.halffaces()) {
hfcolor_prop_[hf_it->idx()] = default_color_; hfcolor_prop_[hfh] = default_color_;
}
halfface_colors_available_ = false; halfface_colors_available_ = false;
} }
template <class ColT> template <class ColT>
void ColorAttrib<ColT>::clear_face_colors() void ColorAttrib<ColT>::clear_face_colors()
{ {
for (FaceIter f_it = kernel_.faces_begin(); f_it != kernel_.faces_end(); ++f_it) for (const auto fh: kernel_.faces()) {
fcolor_prop_[f_it->idx()] = default_color_; fcolor_prop_[fh] = default_color_;
}
face_colors_available_ = false; face_colors_available_ = false;
} }
template <class ColT> template <class ColT>
void ColorAttrib<ColT>::clear_cell_colors() void ColorAttrib<ColT>::clear_cell_colors()
{ {
for (CellIter c_it = kernel_.cells_begin(); c_it != kernel_.cells_end(); ++c_it) for (const auto ch: kernel_.cells()) {
ccolor_prop_[c_it->idx()] = default_color_; ccolor_prop_[ch] = default_color_;
}
cell_colors_available_ = false; cell_colors_available_ = false;
} }
......
...@@ -94,19 +94,19 @@ public: ...@@ -94,19 +94,19 @@ public:
typename GeomKernelT::PointT& operator[](const VertexHandle& _h) { typename GeomKernelT::PointT& operator[](const VertexHandle& _h) {
assert((unsigned int)_h.idx() < kernel_.n_vertices()); assert((unsigned int)_h.idx() < kernel_.n_vertices());
return v_normals_[_h.idx()]; return v_normals_[_h];
} }
typename GeomKernelT::PointT& operator[](const FaceHandle& _h) { typename GeomKernelT::PointT& operator[](const FaceHandle& _h) {
assert((unsigned int)_h.idx() < kernel_.n_faces()); assert((unsigned int)_h.idx() < kernel_.n_faces());
return f_normals_[_h.idx()]; return f_normals_[_h];
} }
typename GeomKernelT::PointT operator[](const HalfFaceHandle& _h) { typename GeomKernelT::PointT operator[](const HalfFaceHandle& _h) {
assert((unsigned int)_h.idx() < kernel_.n_halffaces()); assert((unsigned int)_h.idx() < kernel_.n_halffaces());
double mult = 1.0; double mult = 1.0;
if(_h.idx() % 2 == 1) mult = -1.0; if(_h.idx() % 2 == 1) mult = -1.0;
return f_normals_[kernel_.face_handle(_h).idx()] * mult; return f_normals_[kernel_.face_handle(_h)] * mult;
} }
private: private:
......
...@@ -117,7 +117,7 @@ void NormalAttrib<GeomKernelT>::compute_vertex_normal(const VertexHandle& _vh) { ...@@ -117,7 +117,7 @@ void NormalAttrib<GeomKernelT>::compute_vertex_normal(const VertexHandle& _vh) {
normal.normalize(); normal.normalize();
v_normals_[_vh.idx()] = normal; v_normals_[_vh] = normal;
} }
template <class GeomKernelT> template <class GeomKernelT>
...@@ -139,7 +139,7 @@ void NormalAttrib<GeomKernelT>::compute_face_normal(const FaceHandle& _fh) { ...@@ -139,7 +139,7 @@ void NormalAttrib<GeomKernelT>::compute_face_normal(const FaceHandle& _fh) {
typename GeomKernelT::PointT n = (p2 - p1) % (p3 - p2); typename GeomKernelT::PointT n = (p2 - p1) % (p3 - p2);
n.normalize(); n.normalize();
f_normals_[_fh.idx()] = n; f_normals_[_fh] = n;
} }
} // Namespace OpenVolumeMesh } // Namespace OpenVolumeMesh
...@@ -74,19 +74,19 @@ void StatusAttrib::mark_higher_dim_entities() { ...@@ -74,19 +74,19 @@ void StatusAttrib::mark_higher_dim_entities() {
if(kernel_.has_vertex_bottom_up_incidences()) { if(kernel_.has_vertex_bottom_up_incidences()) {
for(VertexIter v_it = kernel_.vertices_begin(); v_it != kernel_.vertices_end(); ++v_it) { for(VertexIter v_it = kernel_.vertices_begin(); v_it != kernel_.vertices_end(); ++v_it) {
if(v_status_[v_it->idx()].deleted()) { if(v_status_[*v_it].deleted()) {
for(VertexOHalfEdgeIter voh_it = kernel_.voh_iter(*v_it); for(VertexOHalfEdgeIter voh_it = kernel_.voh_iter(*v_it);
voh_it.valid(); ++voh_it) { voh_it.valid(); ++voh_it) {
e_status_[kernel_.edge_handle(*voh_it).idx()].set_deleted(true); e_status_[kernel_.edge_handle(*voh_it)].set_deleted(true);
} }
} }
} }
} else { } else {
for(EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it) { for(EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it) {
if(v_status_[kernel_.edge(*e_it).from_vertex().idx()].deleted() || if(v_status_[kernel_.edge(*e_it).from_vertex()].deleted() ||
v_status_[kernel_.edge(*e_it).to_vertex().idx()].deleted()) { v_status_[kernel_.edge(*e_it).to_vertex()].deleted()) {
e_status_[e_it->idx()].set_deleted(true); e_status_[*e_it].set_deleted(true);
} }
} }
} }
...@@ -95,10 +95,10 @@ void StatusAttrib::mark_higher_dim_entities() { ...@@ -95,10 +95,10 @@ void StatusAttrib::mark_higher_dim_entities() {
if(kernel_.has_edge_bottom_up_incidences()) { if(kernel_.has_edge_bottom_up_incidences()) {
for(EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it) { for(EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it) {
if(e_status_[e_it->idx()].deleted()) { if(e_status_[*e_it].deleted()) {
for(HalfEdgeHalfFaceIter hehf_it = kernel_.hehf_iter(kernel_.halfedge_handle(*e_it, 0)); for(HalfEdgeHalfFaceIter hehf_it = kernel_.hehf_iter(kernel_.halfedge_handle(*e_it, 0));
hehf_it.valid(); ++hehf_it) { hehf_it.valid(); ++hehf_it) {
f_status_[kernel_.face_handle(*hehf_it).idx()].set_deleted(true); f_status_[kernel_.face_handle(*hehf_it)].set_deleted(true);
} }
} }
} }
...@@ -121,7 +121,7 @@ void StatusAttrib::mark_higher_dim_entities() { ...@@ -121,7 +121,7 @@ void StatusAttrib::mark_higher_dim_entities() {
if(kernel_.has_face_bottom_up_incidences()) { if(kernel_.has_face_bottom_up_incidences()) {
for(FaceIter f_it = kernel_.faces_begin(); f_it != kernel_.faces_end(); ++f_it) { for(FaceIter f_it = kernel_.faces_begin(); f_it != kernel_.faces_end(); ++f_it) {
if(f_status_[f_it->idx()].deleted()) { if(f_status_[*f_it].deleted()) {
CellHandle c0 = kernel_.incident_cell(kernel_.halfface_handle(*f_it, 0)); CellHandle c0 = kernel_.incident_cell(kernel_.halfface_handle(*f_it, 0));
CellHandle c1 = kernel_.incident_cell(kernel_.halfface_handle(*f_it, 1)); CellHandle c1 = kernel_.incident_cell(kernel_.halfface_handle(*f_it, 1));
if(c0.is_valid()) { if(c0.is_valid()) {
......
...@@ -60,61 +60,61 @@ public: ...@@ -60,61 +60,61 @@ public:
~StatusAttrib(); ~StatusAttrib();
const OpenVolumeMeshStatus& operator[](const VertexHandle& _h) const { const OpenVolumeMeshStatus& operator[](const VertexHandle& _h) const {
return v_status_[_h.idx()]; return v_status_[_h];
} }
OpenVolumeMeshStatus& operator[](const VertexHandle& _h) { OpenVolumeMeshStatus& operator[](const VertexHandle& _h) {
return v_status_[_h.idx()]; return v_status_[_h];
} }
const OpenVolumeMeshStatus& operator[](const EdgeHandle& _h) const { const OpenVolumeMeshStatus& operator[](const EdgeHandle& _h) const {
return e_status_[_h.idx()]; return e_status_[_h];
} }
OpenVolumeMeshStatus& operator[](const EdgeHandle& _h) { OpenVolumeMeshStatus& operator[](const EdgeHandle& _h) {
return e_status_[_h.idx()]; return e_status_[_h];
} }
const OpenVolumeMeshStatus& operator[](const HalfEdgeHandle& _h) const { const OpenVolumeMeshStatus& operator[](const HalfEdgeHandle& _h) const {
return he_status_[_h.idx()]; return he_status_[_h];
} }
OpenVolumeMeshStatus& operator[](const HalfEdgeHandle& _h) { OpenVolumeMeshStatus& operator[](const HalfEdgeHandle& _h) {
return he_status_[_h.idx()]; return he_status_[_h];
} }
const OpenVolumeMeshStatus& operator[](const FaceHandle& _h) const { const OpenVolumeMeshStatus& operator[](const FaceHandle& _h) const {
return f_status_[_h.idx()]; return f_status_[_h];
} }
OpenVolumeMeshStatus& operator[](const FaceHandle& _h) { OpenVolumeMeshStatus& operator[](const FaceHandle& _h) {
return f_status_[_h.idx()]; return f_status_[_h];
} }
const OpenVolumeMeshStatus& operator[](const HalfFaceHandle& _h) const { const OpenVolumeMeshStatus& operator[](const HalfFaceHandle& _h) const {
return hf_status_[_h.idx()]; return hf_status_[_h];
} }
OpenVolumeMeshStatus& operator[](const HalfFaceHandle& _h) { OpenVolumeMeshStatus& operator[](const HalfFaceHandle& _h) {
return hf_status_[_h.idx()]; return hf_status_[_h];
} }
const OpenVolumeMeshStatus& operator[](const CellHandle& _h) const { const OpenVolumeMeshStatus& operator[](const CellHandle& _h) const {
return c_status_[_h.idx()]; return c_status_[_h];
} }
OpenVolumeMeshStatus& operator[](const CellHandle& _h) { OpenVolumeMeshStatus& operator[](const CellHandle& _h) {
return c_status_[_h.idx()]; return c_status_[_h];
} }
const OpenVolumeMeshStatus& mesh_status() const { const OpenVolumeMeshStatus& mesh_status() const {
OpenVolumeMeshHandle h(0); OpenVolumeMeshHandle h(0);
return m_status_[h.idx()]; return m_status_[h];
} }
OpenVolumeMeshStatus& mesh_status() { OpenVolumeMeshStatus& mesh_status() {
OpenVolumeMeshHandle h(0); OpenVolumeMeshHandle h(0);
return m_status_[h.idx()]; return m_status_[h];
} }
typedef VertexPropertyT<OpenVolumeMeshStatus>::const_iterator const_vstatus_iterator; typedef VertexPropertyT<OpenVolumeMeshStatus>::const_iterator const_vstatus_iterator;
......
...@@ -143,10 +143,10 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up ...@@ -143,10 +143,10 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up
std::vector<bool>::iterator tag_it = tags.begin(); std::vector<bool>::iterator tag_it = tags.begin();
for(CellIter c_it = kernel_.cells_begin(); c_it != kernel_.cells_end(); ++c_it, ++tag_it) { for(CellIter c_it = kernel_.cells_begin(); c_it != kernel_.cells_end(); ++c_it, ++tag_it) {
*tag_it = c_status_[c_it->idx()].deleted(); *tag_it = c_status_[*c_it].deleted();
if (track_ch) { if (track_ch) {
if (c_status_[c_it->idx()].deleted()) { if (c_status_[*c_it].deleted()) {
++offset_ch; ++offset_ch;
if (ch_map.find(c_it->idx()) != ch_map.end()) if (ch_map.find(c_it->idx()) != ch_map.end())
ch_map[c_it->idx()] = -1; ch_map[c_it->idx()] = -1;
...@@ -162,11 +162,11 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up ...@@ -162,11 +162,11 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up
tag_it = tags.begin(); tag_it = tags.begin();
for(FaceIter f_it = kernel_.faces_begin(); f_it != kernel_.faces_end(); ++f_it, ++tag_it) { for(FaceIter f_it = kernel_.faces_begin(); f_it != kernel_.faces_end(); ++f_it, ++tag_it) {
*tag_it = f_status_[f_it->idx()].deleted(); *tag_it = f_status_[*f_it].deleted();
if (track_hfh) { if (track_hfh) {
int halfface_idx = f_it->idx() * 2; int halfface_idx = f_it->idx() * 2;
if (f_status_[f_it->idx()].deleted()) { if (f_status_[*f_it].deleted()) {
offset_hfh += 2; offset_hfh += 2;
if (hfh_map.find(halfface_idx) != hfh_map.end()) { if (hfh_map.find(halfface_idx) != hfh_map.end()) {
hfh_map[halfface_idx] = -1; hfh_map[halfface_idx] = -1;
...@@ -190,11 +190,11 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up ...@@ -190,11 +190,11 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up
tag_it = tags.begin(); tag_it = tags.begin();
for(EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it, ++tag_it) { for(EdgeIter e_it = kernel_.edges_begin(); e_it != kernel_.edges_end(); ++e_it, ++tag_it) {
*tag_it = e_status_[e_it->idx()].deleted(); *tag_it = e_status_[*e_it].deleted();
if (track_hh) { if (track_hh) {
int halfedge_idx = e_it->idx() * 2; int halfedge_idx = e_it->idx() * 2;
if (e_status_[e_it->idx()].deleted()) { if (e_status_[*e_it].deleted()) {
offset_hh += 2; offset_hh += 2;
if (hh_map.find(halfedge_idx) != hh_map.end()) { if (hh_map.find(halfedge_idx) != hh_map.end()) {
hh_map[halfedge_idx] = -1; hh_map[halfedge_idx] = -1;
...@@ -218,10 +218,10 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up ...@@ -218,10 +218,10 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up
tag_it = tags.begin(); tag_it = tags.begin();
for(VertexIter v_it = kernel_.vertices_begin(); v_it != kernel_.vertices_end(); ++v_it, ++tag_it) { for(VertexIter v_it = kernel_.vertices_begin(); v_it != kernel_.vertices_end(); ++v_it, ++tag_it) {
*tag_it = v_status_[v_it->idx()].deleted(); *tag_it = v_status_[*v_it].deleted();
if (track_vh) { if (track_vh) {
if (v_status_[v_it->idx()].deleted()) { if (v_status_[*v_it].deleted()) {
if (vh_map.find(v_it->idx()) != vh_map.end()) { if (vh_map.find(v_it->idx()) != vh_map.end()) {
++offset_vh; ++offset_vh;
vh_map[v_it->idx()] = -1; vh_map[v_it->idx()] = -1;
...@@ -291,7 +291,7 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up ...@@ -291,7 +291,7 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up
if(kernel_.incident_cell(hf0) == TopologyKernel::InvalidCellHandle && if(kernel_.incident_cell(hf0) == TopologyKernel::InvalidCellHandle &&
kernel_.incident_cell(hf1) == TopologyKernel::InvalidCellHandle) { kernel_.incident_cell(hf1) == TopologyKernel::InvalidCellHandle) {
f_status_[f_it->idx()].set_deleted(true); f_status_[*f_it].set_deleted(true);
} }
} }
...@@ -307,18 +307,18 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up ...@@ -307,18 +307,18 @@ void StatusAttrib::garbage_collection(std_API_Container_VHandlePointer &vh_to_up
if(!hehf_it.valid()) { if(!hehf_it.valid()) {
e_status_[e_it->idx()].set_deleted(true); e_status_[*e_it].set_deleted(true);