Commit c373d3ef authored by Jan Möbius's avatar Jan Möbius

Merge branch 'adjust-compiler-warnings' into 'master'

cmake compiler flag cleanup, enable many clang warnings and fix them

See merge request !63
parents bdd674be d37341fb
Pipeline #10598 passed with stage
in 3 minutes and 58 seconds
...@@ -4,10 +4,12 @@ ...@@ -4,10 +4,12 @@
if (UNIX) if (UNIX)
set ( ADDITIONAL_CXX_FLAGS )
set ( ADDITIONAL_CXX_DEBUG_FLAGS ) set ( ADDITIONAL_CXX_DEBUG_FLAGS )
set ( ADDITIONAL_CXX_RELEASE_FLAGS ) set ( ADDITIONAL_CXX_RELEASE_FLAGS )
set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS ) set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS )
set ( ADDITIONAL_C_FLAGS )
set ( ADDITIONAL_C_DEBUG_FLAGS ) set ( ADDITIONAL_C_DEBUG_FLAGS )
set ( ADDITIONAL_C_RELEASE_FLAGS ) set ( ADDITIONAL_C_RELEASE_FLAGS )
set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS ) set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS )
...@@ -17,29 +19,15 @@ if (UNIX) ...@@ -17,29 +19,15 @@ if (UNIX)
################################################################################ ################################################################################
# add our standard flags for Template inclusion # add our standard flags for Template inclusion
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" ) list(APPEND ADDITIONAL_CXX_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" ) list(APPEND ADDITIONAL_C_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
# add our standard flags for Template inclusion
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
# Increase the template depth as this might be exceeded from time to time # Increase the template depth as this might be exceeded from time to time
IF( NOT CMAKE_SYSTEM MATCHES "SunOS*") IF( NOT CMAKE_SYSTEM MATCHES "SunOS*")
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-ftemplate-depth-100" ) list(APPEND ADDITIONAL_CXX_FLAGS "-ftemplate-depth-100" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-ftemplate-depth-100" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-ftemplate-depth-100" )
ENDIF() ENDIF()
################################################################################
# OS Defines
################################################################################
if (APPLE)
add_definitions( -DARCH_DARWIN )
endif()
################################################################################ ################################################################################
# Build/Release Defines # Build/Release Defines
...@@ -59,21 +47,23 @@ if (UNIX) ...@@ -59,21 +47,23 @@ if (UNIX)
################################################################################ ################################################################################
IF( NOT CMAKE_SYSTEM MATCHES "SunOS*") IF( NOT CMAKE_SYSTEM MATCHES "SunOS*")
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-W" "-Wall" "-Wno-unused" ) list(APPEND ADDITIONAL_CXX_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-W" "-Wall" "-Wno-unused" ) list(APPEND ADDITIONAL_C_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-W" "-Wall" "-Wno-unused" )
ENDIF() ENDIF()
if (APPLE)
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-Wno-non-virtual-dtor" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-Wno-non-virtual-dtor" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-Wno-non-virtual-dtor" )
endif ()
if ("${CMAKE_CXX_COMPILER}" MATCHES ".*clang.*")
list(APPEND ADDITIONAL_CXX_FLAGS "-Weverything")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-c++98-compat")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-padded")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-old-style-cast")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-documentation-unknown-command")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-unreachable-code-return")
# enable later:
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-sign-conversion")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-deprecated")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-weak-vtables")
endif()
################################################################################ ################################################################################
# STL Vector checks # STL Vector checks
################################################################################ ################################################################################
...@@ -101,43 +91,49 @@ if (UNIX) ...@@ -101,43 +91,49 @@ if (UNIX)
################################################################################ ################################################################################
# Add the debug flags # Add the debug flags
foreach( flag ${ADDITIONAL_CXX_DEBUG_FLAGS} ) foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_DEBUG_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "${flag}" ) list (FIND ${CMAKE_CXX_FLAGS_DEBUG} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ") set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release flags # Add the release flags
foreach( flag ${ADDITIONAL_CXX_RELEASE_FLAGS} ) foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELEASE_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_RELEASE MATCHES "${flag}" ) list (FIND ${CMAKE_CXX_FLAGS_RELEASE} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ") set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release with debug info flags # Add the release with debug info flags
foreach( flag ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} ) foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "${flag}" ) list (FIND ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ") set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the debug flags # Add the debug flags
foreach( flag ${ADDITIONAL_C_DEBUG_FLAGS} ) foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_DEBUG_FLAGS} )
if( NOT CMAKE_C_FLAGS_DEBUG MATCHES "${flag}" ) list (FIND ${CMAKE_C_FLAGS_DEBUG} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ") set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release flags # Add the release flags
foreach( flag ${ADDITIONAL_C_RELEASE_FLAGS} ) foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELEASE_FLAGS} )
if( NOT CMAKE_C_FLAGS_RELEASE MATCHES "${flag}" ) list (FIND ${CMAKE_C_FLAGS_RELEASE} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ") set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release with debug info flags # Add the release with debug info flags
foreach( flag ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} ) foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} )
if( NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "${flag}" ) list (FIND ${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ") set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ")
endif() endif()
endforeach() endforeach()
......
...@@ -58,9 +58,6 @@ public: ...@@ -58,9 +58,6 @@ public:
toVertex_(_toVertex) { toVertex_(_toVertex) {
} }
virtual ~OpenVolumeMeshEdge() {
}
const VertexHandle from_vertex() const { const VertexHandle from_vertex() const {
return fromVertex_; return fromVertex_;
} }
...@@ -94,9 +91,6 @@ public: ...@@ -94,9 +91,6 @@ public:
halfedges_(_halfedges) { halfedges_(_halfedges) {
} }
virtual ~OpenVolumeMeshFace() {
}
const std::vector<HalfEdgeHandle>& halfedges() const & { const std::vector<HalfEdgeHandle>& halfedges() const & {
return halfedges_; return halfedges_;
} }
...@@ -128,9 +122,6 @@ public: ...@@ -128,9 +122,6 @@ public:
halffaces_(_halffaces) { halffaces_(_halffaces) {
} }
virtual ~OpenVolumeMeshCell() {
}
const std::vector<HalfFaceHandle>& halffaces() const & { const std::vector<HalfFaceHandle>& halffaces() const & {
return halffaces_; return halffaces_;
} }
......
...@@ -8,9 +8,6 @@ class BaseProperty; ...@@ -8,9 +8,6 @@ class BaseProperty;
template <class T> template <class T>
class OpenVolumeMeshPropertyT; class OpenVolumeMeshPropertyT;
template <class E, typename >
class PropHandleT;
template <class PropT, typename Entity> template <class PropT, typename Entity>
class PropertyPtr; class PropertyPtr;
......
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
GeometryKernel() = default; GeometryKernel() = default;
/// Destructor /// Destructor
~GeometryKernel() = default; ~GeometryKernel() override = default;
template<class OtherTopoKernel> template<class OtherTopoKernel>
void assign(const GeometryKernel<VecT, OtherTopoKernel> *other) { void assign(const GeometryKernel<VecT, OtherTopoKernel> *other) {
......
...@@ -73,8 +73,8 @@ public: ...@@ -73,8 +73,8 @@ public:
valid_(true), mesh_(_mesh) {} valid_(true), mesh_(_mesh) {}
// STL compliance (needs to have default constructor) // STL compliance (needs to have default constructor)
BaseIterator() : valid_(false), mesh_(0) {} BaseIterator() : valid_(false), mesh_(nullptr) {}
virtual ~BaseIterator() {} virtual ~BaseIterator() = default;
bool operator== (const BaseIterator& _c) const { bool operator== (const BaseIterator& _c) const {
return (this->cur_handle_ == _c.cur_handle() && return (this->cur_handle_ == _c.cur_handle() &&
this->valid_ == _c.valid() && this->valid_ == _c.valid() &&
...@@ -185,7 +185,7 @@ public: ...@@ -185,7 +185,7 @@ public:
max_laps_(1) max_laps_(1)
{} {}
virtual ~BaseCirculator() {} virtual ~BaseCirculator() = default;
bool operator== (const BaseCirculator& _c) const { bool operator== (const BaseCirculator& _c) const {
return (BaseIter::operator==(_c) && return (BaseIter::operator==(_c) &&
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "OpenVolumeMeshHandle.hh" #include "OpenVolumeMeshHandle.hh"
//== CLASS DEFINITION ========================================================= namespace OpenVolumeMesh {
/** \class OpenVolumeMeshBaseProperty /** \class OpenVolumeMeshBaseProperty
...@@ -49,8 +49,6 @@ ...@@ -49,8 +49,6 @@
**/ **/
namespace OpenVolumeMesh {
class OpenVolumeMeshBaseProperty { class OpenVolumeMeshBaseProperty {
public: public:
......
...@@ -44,7 +44,7 @@ bool operator==(const int& _lhs, const OpenVolumeMeshHandle& _rhs) { ...@@ -44,7 +44,7 @@ bool operator==(const int& _lhs, const OpenVolumeMeshHandle& _rhs) {
bool operator==(const unsigned int& _lhs, const OpenVolumeMeshHandle& _rhs) { bool operator==(const unsigned int& _lhs, const OpenVolumeMeshHandle& _rhs) {
return _lhs == (unsigned int)_rhs.idx(); return _lhs == _rhs.uidx();
} }
bool operator!=(const int& _lhs, const OpenVolumeMeshHandle& _rhs) { bool operator!=(const int& _lhs, const OpenVolumeMeshHandle& _rhs) {
......
...@@ -50,7 +50,7 @@ namespace OpenVolumeMesh { ...@@ -50,7 +50,7 @@ namespace OpenVolumeMesh {
class OpenVolumeMeshHandle { class OpenVolumeMeshHandle {
public: public:
// Default constructor // Default constructor
explicit OpenVolumeMeshHandle(int _idx) : idx_(_idx) {} explicit constexpr OpenVolumeMeshHandle(int _idx) : idx_(_idx) {}
OpenVolumeMeshHandle& operator=(int _idx) { OpenVolumeMeshHandle& operator=(int _idx) {
idx_ = _idx; idx_ = _idx;
...@@ -90,14 +90,24 @@ private: ...@@ -90,14 +90,24 @@ private:
int idx_; int idx_;
}; };
template<typename EntityTag, template<typename EntityTag,
typename = typename std::enable_if<is_entity<EntityTag>::value>::type> typename = typename std::enable_if<is_entity<EntityTag>::value>::type>
class PropHandleTag {};
template <typename T> struct is_prop_handle_tag : std::false_type {};
template<typename T>
struct is_prop_handle_tag<PropHandleTag<T>> : std::true_type {};
template<typename T>
using is_handle_tag = std::enable_if<is_entity<T>::value || is_prop_handle_tag<T>::value>;
template<typename EntityTag, typename = typename is_handle_tag<EntityTag>::type>
class HandleT : public OpenVolumeMeshHandle class HandleT : public OpenVolumeMeshHandle
{ {
public: public:
using Entity = EntityTag; using Entity = EntityTag;
explicit HandleT(int _idx = -1) : OpenVolumeMeshHandle(_idx) {} explicit constexpr HandleT(int _idx = -1) : OpenVolumeMeshHandle(_idx) {}
static HandleT<EntityTag> static HandleT<EntityTag>
from_unsigned(size_t _idx) from_unsigned(size_t _idx)
......
...@@ -40,14 +40,8 @@ ...@@ -40,14 +40,8 @@
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
template<typename EntityTag, template<typename EntityTag>
typename = typename std::enable_if<is_entity<EntityTag>::value>::type> using PropHandleT = HandleT<PropHandleTag<EntityTag>>;
class PropHandleT : public OpenVolumeMeshHandle
{
public:
using Entity = EntityTag;
using OpenVolumeMeshHandle::OpenVolumeMeshHandle;
};
using VertexPropHandle = PropHandleT<Entity::Vertex>; using VertexPropHandle = PropHandleT<Entity::Vertex>;
using EdgePropHandle = PropHandleT<Entity::Edge>; using EdgePropHandle = PropHandleT<Entity::Edge>;
......
...@@ -100,7 +100,7 @@ protected: ...@@ -100,7 +100,7 @@ protected:
{ {
PropIterator p_iter = _begin; PropIterator p_iter = _begin;
for (; p_iter != _end; ++p_iter) for (; p_iter != _end; ++p_iter)
(*p_iter)->swap_elements(_h1.idx(), _h2.idx()); (*p_iter)->swap_elements(_h1.uidx(), _h2.uidx());
} }
...@@ -237,10 +237,10 @@ private: ...@@ -237,10 +237,10 @@ private:
{ {
if((*it)->name() == _name ) if((*it)->name() == _name )
{ {
#if OVM_FORCE_STATIC_CAST #if defined OVM_FORCE_STATIC_CAST && OVM_FORCE_STATIC_CAST
return true; return true;
#else #else
if(dynamic_cast<FullPropT*>(*it) != NULL) if(dynamic_cast<FullPropT*>(*it) != nullptr)
{ {
return true; return true;
} }
......
...@@ -32,14 +32,6 @@ ...@@ -32,14 +32,6 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Date$ *
* $LastChangedBy$ *
* *
\*===========================================================================*/
#define RESOURCEMANAGERT_CC #define RESOURCEMANAGERT_CC
#include "ResourceManager.hh" #include "ResourceManager.hh"
...@@ -107,7 +99,7 @@ PropT ResourceManager::internal_request_property(StdVecT& _vec, const std::strin ...@@ -107,7 +99,7 @@ PropT ResourceManager::internal_request_property(StdVecT& _vec, const std::strin
} }
} }
HandleT handle((int)_vec.size()); auto handle = HandleT::from_unsigned(_vec.size());
PropT* prop = new PropT(_name, type_name, *this, handle, _def); PropT* prop = new PropT(_name, type_name, *this, handle, _def);
prop->resize(_size); prop->resize(_size);
...@@ -200,7 +192,7 @@ void ResourceManager::entity_deleted(StdVecT& _vec, const OpenVolumeMeshHandle& ...@@ -200,7 +192,7 @@ void ResourceManager::entity_deleted(StdVecT& _vec, const OpenVolumeMeshHandle&
for(typename StdVecT::iterator it = _vec.begin(); for(typename StdVecT::iterator it = _vec.begin();
it != _vec.end(); ++it) { it != _vec.end(); ++it) {
(*it)->delete_element(_h.idx()); (*it)->delete_element(_h.uidx());
} }
} }
...@@ -219,7 +211,7 @@ void ResourceManager::updatePropHandles(StdVecT &_vec) ...@@ -219,7 +211,7 @@ void ResourceManager::updatePropHandles(StdVecT &_vec)
{ {
size_t n = _vec.size(); size_t n = _vec.size();
for(size_t i = 0; i < n; ++i) { for(size_t i = 0; i < n; ++i) {
_vec[i]->set_handle(OpenVolumeMeshHandle((int)i)); _vec[i]->set_handle(OpenVolumeMeshHandle(static_cast<int>(i)));
} }
} }
......
...@@ -57,7 +57,7 @@ std::ostream& serialize(std::ostream& _ostr, const std::string& _rhs) ...@@ -57,7 +57,7 @@ std::ostream& serialize(std::ostream& _ostr, const std::string& _rhs)
std::istream& deserialize(std::istream& _istr, std::string& _rhs) std::istream& deserialize(std::istream& _istr, std::string& _rhs)
{ {
int len; size_t len;
char delimiter; char delimiter;
_istr >> len; //deserialize size of string _istr >> len; //deserialize size of string
_istr >> delimiter; _istr >> delimiter;
......
...@@ -65,7 +65,7 @@ private: ...@@ -65,7 +65,7 @@ private:
template<class U> static false_type test(...); template<class U> static false_type test(...);
public: public:
enum { bool_value = sizeof(true_type) == sizeof(test<T>(0)) }; enum { bool_value = sizeof(true_type) == sizeof(test<T>(nullptr)) };
typedef bool_type<bool_value> type; typedef bool_type<bool_value> type;
static type value; static type value;
}; };
...@@ -82,7 +82,7 @@ private: ...@@ -82,7 +82,7 @@ private:
template<class U> static false_type test(...); template<class U> static false_type test(...);
public: public:
enum { bool_value = sizeof(true_type) == sizeof(test<T>(0)) }; enum { bool_value = sizeof(true_type) == sizeof(test<T>(nullptr)) };
typedef bool_type<bool_value> type; typedef bool_type<bool_value> type;
static type value; static type value;
}; };
......
...@@ -252,14 +252,12 @@ FaceHandle TopologyKernel::add_face(const std::vector<VertexHandle>& _vertices) ...@@ -252,14 +252,12 @@ FaceHandle TopologyKernel::add_face(const std::vector<VertexHandle>& _vertices)
// Swap halfedge if edge already existed and // Swap halfedge if edge already existed and
// has been initially defined in reverse orientation // has been initially defined in reverse orientation
int swap = 0; char swap = edge(e_idx).to_vertex() == *it;
if(edge(e_idx).to_vertex() == *it) swap = 1;
halfedges.push_back(halfedge_handle(e_idx, swap)); halfedges.push_back(halfedge_handle(e_idx, swap));
} }
EdgeHandle e_idx = add_edge(*it, *_vertices.begin()); EdgeHandle e_idx = add_edge(*it, *_vertices.begin());
int swap = 0; char swap = edge(e_idx).to_vertex() == *it;
if(edge(e_idx).to_vertex() == *it) swap = 1;
halfedges.push_back(halfedge_handle(e_idx, swap)); halfedges.push_back(halfedge_handle(e_idx, swap));
// Add face // Add face
......
...@@ -462,7 +462,7 @@ public: ...@@ -462,7 +462,7 @@ public:
/// Get valence of vertex (number of incident edges) /// Get valence of vertex (number of incident edges)
inline size_t valence(const VertexHandle& _vh) const { inline size_t valence(const VertexHandle& _vh) const {
assert(has_vertex_bottom_up_incidences()); assert(has_vertex_bottom_up_incidences());
assert(_vh.is_valid() && (size_t)_vh.idx() < outgoing_hes_per_vertex_.size()); assert(_vh.is_valid() && _vh.uidx() < outgoing_hes_per_vertex_.size());
return outgoing_hes_per_vertex_[_vh.idx()].size(); return outgoing_hes_per_vertex_[_vh.idx()].size();
} }
...@@ -470,22 +470,22 @@ public: ...@@ -470,22 +470,22 @@ public:
/// Get valence of edge (number of incident faces) /// Get valence of edge (number of incident faces)
inline size_t valence(const EdgeHandle& _eh) const { inline size_t valence(const EdgeHandle& _eh) const {
assert(has_edge_bottom_up_incidences()); assert(has_edge_bottom_up_incidences());
assert(_eh.is_valid() && (size_t)_eh.idx() < edges_.size()); assert(_eh.is_valid() && _eh.uidx() < edges_.size());
assert((size_t)halfedge_handle(_eh, 0).idx() < incident_hfs_per_he_.size()); assert(halfedge_handle(_eh, 0).uidx() < incident_hfs_per_he_.size());
return incident_hfs_per_he_[halfedge_handle(_eh, 0).idx()].size(); return incident_hfs_per_he_[halfedge_handle(_eh, 0).idx()].size();
} }
/// Get valence of face (number of incident edges) /// Get valence of face (number of incident edges)
inline size_t valence(const FaceHandle& _fh) const { inline size_t valence(const FaceHandle& _fh) const {
assert(_fh.is_valid() && (size_t)_fh.idx() < faces_.size()); assert(_fh.is_valid() && _fh.uidx() < faces_.size());
return face(_fh).halfedges().size(); return face(_fh).halfedges().size();
} }
/// Get valence of cell (number of incident faces) /// Get valence of cell (number of incident faces)
inline size_t valence(const CellHandle& _ch) const { inline size_t valence(const CellHandle& _ch) const {
assert(_ch.is_valid() && (size_t)_ch.idx() < cells_.size()); assert(_ch.is_valid() && _ch.uidx() < cells_.size());
return cell(_ch).halffaces().size(); return cell(_ch).halffaces().size();
} }
...@@ -581,7 +581,7 @@ protected: ...@@ -581,7 +581,7 @@ protected:
he_end = hes.end(); he_it != he_end; ++he_it) { he_end = hes.end(); he_it != he_end; ++he_it) {
EdgeHandle eh = edge_handle(*he_it); EdgeHandle eh = edge_handle(*he_it);
unsigned char opp = (he_it->idx() - halfedge_handle(eh, 0).idx()); unsigned char opp = he_it->idx() == halfedge_handle(eh, 1).idx();
*he_it = halfedge_handle(EdgeHandle(newIndices_[eh.idx()]), opp); *he_it = halfedge_handle(EdgeHandle(newIndices_[eh.idx()]), opp);
} }
_face.set_halfedges(hes); _face.set_halfedges(hes);
...@@ -601,7 +601,7 @@ protected: ...@@ -601,7 +601,7 @@ protected:
hf_end = hfs.end(); hf_it != hf_end; ++hf_it) { hf_end = hfs.end(); hf_it != hf_end; ++hf_it) {
FaceHandle fh = face_handle(*hf_it); FaceHandle fh = face_handle(*hf_it);
unsigned char opp = (hf_it->idx() - halfface_handle(fh, 0).idx()); unsigned char opp = hf_it->idx() == halfface_handle(fh, 1).idx();
*hf_it = halfface_handle(FaceHandle(newIndices_[fh.idx()]), opp); *hf_it = halfface_handle(FaceHandle(newIndices_[fh.idx()]), opp);
} }
_cell.set_halffaces(hfs); _cell.set_halffaces(hfs);
...@@ -820,14 +820,14 @@ public: ...@@ -820,14 +820,14 @@ public:
bool is_boundary(const HalfFaceHandle& _halfFaceHandle) const { bool is_boundary(const HalfFaceHandle& _halfFaceHandle) const {
assert(_halfFaceHandle.is_valid() && (size_t)_halfFaceHandle.idx() < faces_.size() * 2u); assert(_halfFaceHandle.is_valid() && _halfFaceHandle.uidx() < faces_.size() * 2u);
assert(has_face_bottom_up_incidences()); assert(has_face_bottom_up_incidences());
assert((size_t)_halfFaceHandle.idx() < incident_cell_per_hf_.size()); assert(_halfFaceHandle.