Commit cd7ad95d authored by Martin Heistermann's avatar Martin Heistermann

avoid deprecated size_t property indexing

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