Commit 34b2e958 authored by Max Lyon's avatar Max Lyon
Browse files

add convenience function n_elements returning n_vertices, n_halfedges,...

add convenience function n_elements returning n_vertices, n_halfedges, n_edges, or n_faces depending on the template argument
parent eb38f6e5
......@@ -516,7 +516,7 @@ public:
// Copy all properties, if build in is true
// Otherwise, copy only properties without build in specifier
if ( *p_it && ( _copyBuildIn || (*p_it)->name().substr(0,2) != "v:" ) )
(*p_it)->copy(_vh_from.idx(), _vh_to.idx());
(*p_it)->copy(static_cast<size_t>(_vh_from.idx()), static_cast<size_t>(_vh_to.idx()));
}
}
......@@ -690,6 +690,9 @@ public: //----------------------------------------------------- element numbers
virtual size_t n_edges() const { return 0; }
virtual size_t n_faces() const { return 0; }
template <typename HandleT>
size_t n_elements() const;
protected: //------------------------------------------- synchronize properties
......@@ -814,6 +817,16 @@ private:
};
template <>
inline size_t BaseKernel::n_elements<VertexHandle>() const { return n_vertices(); }
template <>
inline size_t BaseKernel::n_elements<HalfedgeHandle>() const { return n_halfedges(); }
template <>
inline size_t BaseKernel::n_elements<EdgeHandle>() const { return n_edges(); }
template <>
inline size_t BaseKernel::n_elements<FaceHandle>() const { return n_faces(); }
//=============================================================================
} // namespace OpenMesh
//=============================================================================
......
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