diff --git a/CI/ci-cppcheck.sh b/CI/ci-cppcheck.sh old mode 100644 new mode 100755 index 9c354d43..520ed1be --- a/CI/ci-cppcheck.sh +++ b/CI/ci-cppcheck.sh @@ -20,7 +20,7 @@ echo -e "${NC}" echo "Please Wait ..." # Run cppcheck and output into file -cppcheck --enable=all . -I src -i Doc/ --force --suppress=unusedFunction -UCTIME --suppress=missingIncludeSystem --inline-suppr --quiet -Umin -Umax -DOPENMESHDLLEXPORT="" -UPRIVATE_NODE_TYPESYSTEM_SOURCE -USO_NODE_ABSTRACT_SOURCE -USO_NODE_SOURCE -UCLOCK_REALTIME_HR -i src/OpenMesh/Apps/Unsupported/ 2>&1 | tee cppcheck.log +cppcheck --enable=all . -I src -i Doc/ -i src/Unittests --force --suppress=unusedFunction -UCTIME --suppress=missingIncludeSystem --inline-suppr --quiet -Umin -Umax -DOPENMESHDLLEXPORT="" -UPRIVATE_NODE_TYPESYSTEM_SOURCE -USO_NODE_ABSTRACT_SOURCE -USO_NODE_SOURCE -UCLOCK_REALTIME_HR -i src/OpenMesh/Apps/Unsupported/ 2>&1 | tee cppcheck.log COUNT=$(wc -l < cppcheck.log ) @@ -30,7 +30,7 @@ echo "CPPCHECK Summary" echo "==============================================================================" echo -e "${NC}" -MAX_COUNT=0 +MAX_COUNT=27 if [ $COUNT -gt $MAX_COUNT ]; then echo -e ${WARNING} diff --git a/cmake/ACGCompiler.cmake b/cmake/ACGCompiler.cmake index 140803f6..f5260c9b 100644 --- a/cmake/ACGCompiler.cmake +++ b/cmake/ACGCompiler.cmake @@ -19,7 +19,7 @@ if ( WIN32 ) list(APPEND ADDITIONAL_CMAKE_EXE_LINKER_FLAGS "/LARGEADDRESSAWARE" ) list(APPEND ADDITIONAL_CMAKE_SHARED_LINKER_FLAGS "/LARGEADDRESSAWARE" ) list(APPEND ADDITIONAL_CMAKE_MODULE_LINKER_FLAGS "/LARGEADDRESSAWARE" ) - endif() + endif() endif() @@ -45,10 +45,12 @@ endif( WIN32 ) if (UNIX) + set ( ADDITIONAL_CXX_FLAGS ) set ( ADDITIONAL_CXX_DEBUG_FLAGS ) set ( ADDITIONAL_CXX_RELEASE_FLAGS ) set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS ) + set ( ADDITIONAL_C_FLAGS ) set ( ADDITIONAL_C_DEBUG_FLAGS ) set ( ADDITIONAL_C_RELEASE_FLAGS ) set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS ) @@ -58,19 +60,13 @@ if (UNIX) ################################################################################ # add our standard flags for Template inclusion - list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" ) - list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" ) - list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" ) + list(APPEND ADDITIONAL_CXX_FLAGS "-DINCLUDE_TEMPLATES" ) + list(APPEND ADDITIONAL_C_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" ) - ################################################################################ # OS Defines ################################################################################ - + if (APPLE) add_definitions( -DARCH_DARWIN ) endif() @@ -91,7 +87,7 @@ if (UNIX) ################################################################################ # Warnings ################################################################################ - + # Add the standard compiler warnings if ( NOT COMPILER_WARNINGS ) @@ -104,18 +100,27 @@ if (UNIX) set ( COMPILER_WARNINGS "" CACHE STRINGLIST "This list contains the warning flags used during compilation " ) ELSE () set ( COMPILER_WARNINGS "-W" "-Wall" "-Wno-unused" "-Wextra" "-Wno-variadic-macros" CACHE STRINGLIST "This list contains the warning flags used during compilation " ) - ENDIF() + ENDIF() endif ( NOT COMPILER_WARNINGS ) - list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS ${COMPILER_WARNINGS} ) - list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS ${COMPILER_WARNINGS} ) - list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} ) - - list(APPEND ADDITIONAL_C_DEBUG_FLAGS ${COMPILER_WARNINGS} ) - list(APPEND ADDITIONAL_C_RELEASE_FLAGS ${COMPILER_WARNINGS} ) - list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} ) - + list(APPEND ADDITIONAL_CXX_FLAGS ${COMPILER_WARNINGS} ) + list(APPEND ADDITIONAL_C_FLAGS ${COMPILER_WARNINGS} ) + + + 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 ################################################################################ @@ -147,43 +152,49 @@ if (UNIX) ################################################################################ # Add the debug flags - foreach( flag ${ADDITIONAL_CXX_DEBUG_FLAGS} ) - if( NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "${flag}" ) + foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_DEBUG_FLAGS} ) + list (FIND ${CMAKE_CXX_FLAGS_DEBUG} ${flag} _index) + if (${_index} EQUAL -1) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ") endif() endforeach() # Add the release flags - foreach( flag ${ADDITIONAL_CXX_RELEASE_FLAGS} ) - if( NOT CMAKE_CXX_FLAGS_RELEASE MATCHES "${flag}" ) + foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELEASE_FLAGS} ) + list (FIND ${CMAKE_CXX_FLAGS_RELEASE} ${flag} _index) + if (${_index} EQUAL -1) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ") endif() endforeach() # Add the release with debug info flags - foreach( flag ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} ) - if( NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "${flag}" ) + foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} ) + list (FIND ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} _index) + if (${_index} EQUAL -1) set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ") endif() endforeach() # Add the debug flags - foreach( flag ${ADDITIONAL_C_DEBUG_FLAGS} ) - if( NOT CMAKE_C_FLAGS_DEBUG MATCHES "${flag}" ) + foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_DEBUG_FLAGS} ) + list (FIND ${CMAKE_C_FLAGS_DEBUG} ${flag} _index) + if (${_index} EQUAL -1) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ") endif() endforeach() # Add the release flags - foreach( flag ${ADDITIONAL_C_RELEASE_FLAGS} ) - if( NOT CMAKE_C_FLAGS_RELEASE MATCHES "${flag}" ) + foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELEASE_FLAGS} ) + list (FIND ${CMAKE_C_FLAGS_RELEASE} ${flag} _index) + if (${_index} EQUAL -1) set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ") endif() endforeach() # Add the release with debug info flags - foreach( flag ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} ) - if( NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "${flag}" ) + foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} ) + list (FIND ${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} _index) + if (${_index} EQUAL -1) set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ") endif() endforeach() diff --git a/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh b/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh index 3da9a6c9..6069ca3b 100644 --- a/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh +++ b/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh @@ -144,7 +144,7 @@ public: public: // inherited - bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) + bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) override { bool rc; @@ -170,7 +170,7 @@ protected slots: protected: - virtual void keyPressEvent(QKeyEvent* _event); + virtual void keyPressEvent(QKeyEvent* _event) override; private: diff --git a/src/OpenMesh/Apps/Decimating/decimater.cc b/src/OpenMesh/Apps/Decimating/decimater.cc index 0e1818be..313c33f8 100644 --- a/src/OpenMesh/Apps/Decimating/decimater.cc +++ b/src/OpenMesh/Apps/Decimating/decimater.cc @@ -216,7 +216,7 @@ decimate(const std::string &_ifname, using namespace std; Mesh mesh; - OpenMesh::IO::Options opt; + OpenMesh::IO::Options readopt; OpenMesh::Utils::Timer timer; // ---------------------------------------- read source mesh @@ -227,7 +227,7 @@ decimate(const std::string &_ifname, if (gverbose) clog << _ifname << endl; - if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, opt)) ) + if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, readopt)) ) { cerr << " ERROR: read failed!" << endl; return rc; @@ -238,7 +238,7 @@ decimate(const std::string &_ifname, { // ---- 0 - For module NormalFlipping one needs face normals - if ( !opt.check( OpenMesh::IO::Options::FaceNormal ) ) + if ( !readopt.check( OpenMesh::IO::Options::FaceNormal ) ) { if ( !mesh.has_face_normals() ) mesh.request_face_normals(); @@ -420,11 +420,11 @@ decimate(const std::string &_ifname, ofname.insert(++pos, n ); } - OpenMesh::IO::Options opt; + OpenMesh::IO::Options writeopt; //opt += OpenMesh::IO::Options::Binary; - if ( !OpenMesh::IO::write_mesh(mesh, ofname, opt ) ) + if ( !OpenMesh::IO::write_mesh(mesh, ofname, writeopt ) ) { std::cerr << " Cannot write decimated mesh to file '" << ofname << "'\n"; diff --git a/src/OpenMesh/Apps/ProgViewer/ProgViewerWidget.hh b/src/OpenMesh/Apps/ProgViewer/ProgViewerWidget.hh index bc644622..4dbd182e 100644 --- a/src/OpenMesh/Apps/ProgViewer/ProgViewerWidget.hh +++ b/src/OpenMesh/Apps/ProgViewer/ProgViewerWidget.hh @@ -94,8 +94,12 @@ public: public: /// default constructor - ProgViewerWidget(QWidget* _parent=0) - : MeshViewerWidget(_parent) + explicit ProgViewerWidget(QWidget* _parent=0) + : MeshViewerWidget(_parent), + n_base_vertices_(0), + n_base_faces_(0), + n_detail_vertices_(0), + n_max_vertices_(0) { timer_ = new QTimer(this); @@ -133,7 +137,7 @@ private: /// coarsen mesh down to _n vertices void coarsen(unsigned int _n); - virtual void keyPressEvent(QKeyEvent* _event); + virtual void keyPressEvent(QKeyEvent* _event) override; // mesh data bool animateRefinement_; diff --git a/src/OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh b/src/OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh index 02d97139..fcf6762d 100644 --- a/src/OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh +++ b/src/OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh @@ -77,7 +77,7 @@ public: public: /// default constructor - MeshViewerWidgetT(QWidget* _parent=0) + explicit MeshViewerWidgetT(QWidget* _parent=0) : QGLViewerWidget(_parent), f_strips_(false), tex_id_(0), @@ -85,7 +85,8 @@ public: strips_(mesh_), use_color_(true), show_vnormals_(false), - show_fnormals_(false) + show_fnormals_(false), + normal_scale_(1.0) { add_draw_mode("Points"); add_draw_mode("Hidden-Line"); @@ -116,7 +117,7 @@ public: protected: /// inherited drawing method - virtual void draw_scene(const std::string& _draw_mode); + virtual void draw_scene(const std::string& _draw_mode) override; protected: @@ -170,7 +171,7 @@ protected: // Strip support protected: // inherited - virtual void keyPressEvent( QKeyEvent* _event); + virtual void keyPressEvent( QKeyEvent* _event) override; protected: diff --git a/src/OpenMesh/Apps/QtViewer/QGLViewerWidget.hh b/src/OpenMesh/Apps/QtViewer/QGLViewerWidget.hh index cd4cf8eb..44bf295a 100644 --- a/src/OpenMesh/Apps/QtViewer/QGLViewerWidget.hh +++ b/src/OpenMesh/Apps/QtViewer/QGLViewerWidget.hh @@ -74,7 +74,7 @@ public: typedef QGLWidget Super; // Default constructor. - QGLViewerWidget( QWidget* _parent=0 ); + explicit QGLViewerWidget( QWidget* _parent=0 ); // QGLViewerWidget( QGLFormat& _fmt, QWidget* _parent=0 ); diff --git a/src/OpenMesh/Apps/Subdivider/MeshViewerWidget.hh b/src/OpenMesh/Apps/Subdivider/MeshViewerWidget.hh index 073a08f9..c5b5e81f 100644 --- a/src/OpenMesh/Apps/Subdivider/MeshViewerWidget.hh +++ b/src/OpenMesh/Apps/Subdivider/MeshViewerWidget.hh @@ -72,7 +72,7 @@ public: typedef MeshViewerWidgetT Base; /// default constructor - MeshViewerWidget(QWidget* _parent=0) + explicit MeshViewerWidget(QWidget* _parent=0) : Base(_parent) {} @@ -80,7 +80,7 @@ public: ~MeshViewerWidget() {} /// open mesh - inline bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) + inline bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) override { if ( Base::open_mesh( _filename, _opt ) ) { diff --git a/src/OpenMesh/Apps/VDProgMesh/Synthesizer/VDPMSynthesizerViewerWidget.cc b/src/OpenMesh/Apps/VDProgMesh/Synthesizer/VDPMSynthesizerViewerWidget.cc index 2c6d28d4..026c7318 100644 --- a/src/OpenMesh/Apps/VDProgMesh/Synthesizer/VDPMSynthesizerViewerWidget.cc +++ b/src/OpenMesh/Apps/VDProgMesh/Synthesizer/VDPMSynthesizerViewerWidget.cc @@ -78,7 +78,14 @@ namespace OpenMesh { //== IMPLEMENTATION ========================================================== VDPMSynthesizerViewerWidget::VDPMSynthesizerViewerWidget(QWidget* _parent, const char* _name) - : MeshViewerWidget(_parent) + : MeshViewerWidget(_parent), + kappa_square_(0.0), + adaptive_mode_(false), + n_base_vertices_(0), + n_base_edges_(0), + n_base_faces_(0), + n_details_(0) + { adaptive_mode_ = true; } diff --git a/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc b/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc index 699da8a3..ae3e7077 100644 --- a/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc +++ b/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc @@ -107,7 +107,7 @@ public: public: // inherited - void initialize(void) + void initialize(void) override { BaseModQ::initialize(); n_vertices_ = BaseModQ::mesh().n_vertices(); diff --git a/src/OpenMesh/Core/Geometry/LoopSchemeMaskT.hh b/src/OpenMesh/Core/Geometry/LoopSchemeMaskT.hh index adf5c5f5..9ae62691 100644 --- a/src/OpenMesh/Core/Geometry/LoopSchemeMaskT.hh +++ b/src/OpenMesh/Core/Geometry/LoopSchemeMaskT.hh @@ -89,17 +89,17 @@ protected: inline static Scalar compute_limit_weight(uint _valence) { - double proj_weight = compute_proj_weight(_valence); - proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight - double weight = (3.0/8.0)/(1.0 - proj_weight + (3.0/8.0)); + double proj_weight_value = compute_proj_weight(_valence); + proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight + double weight = (3.0/8.0)/(1.0 - proj_weight_value + (3.0/8.0)); return (Scalar)weight; } inline static Scalar compute_step_weight(uint _valence) { - double proj_weight = compute_proj_weight(_valence); - proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight - double weight = proj_weight - (3.0/8.0); + double proj_weight_value = compute_proj_weight(_valence); + proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight + double weight = proj_weight_value - (3.0/8.0); return (Scalar)weight; } diff --git a/src/OpenMesh/Core/Geometry/QuadricT.hh b/src/OpenMesh/Core/Geometry/QuadricT.hh index 3376f32f..1c6c9fa5 100644 --- a/src/OpenMesh/Core/Geometry/QuadricT.hh +++ b/src/OpenMesh/Core/Geometry/QuadricT.hh @@ -112,7 +112,7 @@ public: {} template - QuadricT(const _Point& _pt) + explicit QuadricT(const _Point& _pt) { set_distance_to_point(_pt); } diff --git a/src/OpenMesh/Core/IO/IOManager.hh b/src/OpenMesh/Core/IO/IOManager.hh index fea9e46e..ce958c79 100644 --- a/src/OpenMesh/Core/IO/IOManager.hh +++ b/src/OpenMesh/Core/IO/IOManager.hh @@ -147,7 +147,7 @@ public: bool write(const std::string& _filename, BaseExporter& _be, Options _opt=Options::Default, - std::streamsize _precision = 6); + std::streamsize _precision = 6); /** Write a mesh to open std::ostream _os. The source data structure is specified by the given BaseExporter. The \c save method consecutively queries all @@ -159,7 +159,7 @@ public: const std::string& _ext, BaseExporter& _be, Options _opt=Options::Default, - std::streamsize _precision = 6); + std::streamsize _precision = 6); /// Returns true if the format is supported by one of the reader modules. diff --git a/src/OpenMesh/Core/IO/OMFormat.hh b/src/OpenMesh/Core/IO/OMFormat.hh index 96b2a4fc..66aaf26a 100644 --- a/src/OpenMesh/Core/IO/OMFormat.hh +++ b/src/OpenMesh/Core/IO/OMFormat.hh @@ -252,7 +252,7 @@ namespace OMFormat { PropertyName( ) { } - PropertyName( const std::string& _name ) { *this = _name; } + explicit PropertyName( const std::string& _name ) { *this = _name; } bool is_valid() const { return is_valid( size() ); } diff --git a/src/OpenMesh/Core/IO/exporter/ExporterT.hh b/src/OpenMesh/Core/IO/exporter/ExporterT.hh index b788988c..9de326ca 100644 --- a/src/OpenMesh/Core/IO/exporter/ExporterT.hh +++ b/src/OpenMesh/Core/IO/exporter/ExporterT.hh @@ -84,7 +84,7 @@ class ExporterT : public BaseExporter public: // Constructor - ExporterT(const Mesh& _mesh) : mesh_(_mesh) {} + explicit ExporterT(const Mesh& _mesh) : mesh_(_mesh) {} // get vertex data diff --git a/src/OpenMesh/Core/IO/importer/ImporterT.hh b/src/OpenMesh/Core/IO/importer/ImporterT.hh index f1ffdf68..50ee3192 100644 --- a/src/OpenMesh/Core/IO/importer/ImporterT.hh +++ b/src/OpenMesh/Core/IO/importer/ImporterT.hh @@ -89,7 +89,7 @@ public: typedef std::vector VHandles; - ImporterT(Mesh& _mesh) : mesh_(_mesh), halfedgeNormals_() {} + explicit ImporterT(Mesh& _mesh) : mesh_(_mesh), halfedgeNormals_() {} virtual VertexHandle add_vertex(const Vec3f& _point) override diff --git a/src/OpenMesh/Core/IO/reader/OBJReader.cc b/src/OpenMesh/Core/IO/reader/OBJReader.cc index 78df8a1b..bdefcd7d 100644 --- a/src/OpenMesh/Core/IO/reader/OBJReader.cc +++ b/src/OpenMesh/Core/IO/reader/OBJReader.cc @@ -135,13 +135,13 @@ read(const std::string& _filename, BaseImporter& _bi, Options& _opt) { #if defined(WIN32) - std::string::size_type dot = _filename.find_last_of("\\/"); + std::string::size_type dot_pos = _filename.find_last_of("\\/"); #else - std::string::size_type dot = _filename.rfind("/"); + std::string::size_type dot_pos = _filename.rfind("/"); #endif - path_ = (dot == std::string::npos) + path_ = (dot_pos == std::string::npos) ? "./" - : std::string(_filename.substr(0,dot+1)); + : std::string(_filename.substr(0,dot_pos+1)); } bool result = read(in, _bi, _opt); diff --git a/src/OpenMesh/Core/IO/reader/OBJReader.hh b/src/OpenMesh/Core/IO/reader/OBJReader.hh index 3dc1fcc2..2de77bc4 100644 --- a/src/OpenMesh/Core/IO/reader/OBJReader.hh +++ b/src/OpenMesh/Core/IO/reader/OBJReader.hh @@ -87,16 +87,16 @@ public: virtual ~_OBJReader_() { } - std::string get_description() const { return "Alias/Wavefront"; } - std::string get_extensions() const { return "obj"; } + std::string get_description() const override { return "Alias/Wavefront"; } + std::string get_extensions() const override { return "obj"; } bool read(const std::string& _filename, BaseImporter& _bi, - Options& _opt); + Options& _opt) override; bool read(std::istream& _in, BaseImporter& _bi, - Options& _opt); + Options& _opt) override; private: @@ -105,7 +105,7 @@ private: { public: - Material() { cleanup(); } + Material():Tr_(0),index_Kd_(0) { cleanup(); } void cleanup() { @@ -137,7 +137,7 @@ private: void set_Tr( float t ) { Tr_=t; Tr_is_set_=true; } - void set_map_Kd( std::string _name, int _index_Kd ) + void set_map_Kd( const std::string& _name, int _index_Kd ) { map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ = true; }; const Vec3f& Kd( void ) const { return Kd_; } diff --git a/src/OpenMesh/Core/IO/reader/OFFReader.hh b/src/OpenMesh/Core/IO/reader/OFFReader.hh index 061b2d14..25717b6f 100644 --- a/src/OpenMesh/Core/IO/reader/OFFReader.hh +++ b/src/OpenMesh/Core/IO/reader/OFFReader.hh @@ -118,17 +118,17 @@ public: /// Destructor virtual ~_OFFReader_() {}; - std::string get_description() const { return "Object File Format"; } - std::string get_extensions() const { return "off"; } - std::string get_magic() const { return "OFF"; } + std::string get_description() const override { return "Object File Format"; } + std::string get_extensions() const override { return "off"; } + std::string get_magic() const override { return "OFF"; } bool read(const std::string& _filename, BaseImporter& _bi, - Options& _opt); + Options& _opt) override; - bool can_u_read(const std::string& _filename) const; + bool can_u_read(const std::string& _filename) const override; - bool read(std::istream& _in, BaseImporter& _bi, Options& _opt ); + bool read(std::istream& _in, BaseImporter& _bi, Options& _opt ) override; private: diff --git a/src/OpenMesh/Core/IO/reader/OMReader.cc b/src/OpenMesh/Core/IO/reader/OMReader.cc index 3098c4e7..41a4b3a9 100644 --- a/src/OpenMesh/Core/IO/reader/OMReader.cc +++ b/src/OpenMesh/Core/IO/reader/OMReader.cc @@ -387,10 +387,12 @@ bool _OMReader_::read_binary_vertex_chunk(std::istream &_is, BaseImporter &_bi, default: // skip unknown chunks { omerr() << "Unknown chunk type ignored!\n"; - size_t size_of = header_.n_vertices_ * OMFormat::vector_size(chunk_header_); - _is.ignore(size_of); - bytes_ += size_of; + size_t chunk_size = header_.n_vertices_ * OMFormat::vector_size(chunk_header_); + _is.ignore(chunk_size); + bytes_ += chunk_size; + break; } + } // all chunk data has been read..?! @@ -505,9 +507,9 @@ bool _OMReader_::read_binary_face_chunk(std::istream &_is, BaseImporter &_bi, Op default: // skip unknown chunks { omerr() << "Unknown chunk type ignore!\n"; - size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_); - _is.ignore(size_of); - bytes_ += size_of; + size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_); + _is.ignore(chunk_size); + bytes_ += chunk_size; } } return fidx == header_.n_faces_; @@ -549,9 +551,9 @@ bool _OMReader_::read_binary_edge_chunk(std::istream &_is, BaseImporter &_bi, Op default: // skip unknown type - size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_); - _is.ignore(size_of); - bytes_ += size_of; + size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_); + _is.ignore(chunk_size); + bytes_ += chunk_size; } return b < bytes_; @@ -627,9 +629,9 @@ bool _OMReader_::read_binary_halfedge_chunk(std::istream &_is, BaseImporter &_bi default: // skip unknown chunk omerr() << "Unknown chunk type ignored!\n"; - size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_); - _is.ignore(size_of); - bytes_ += size_of; + size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_); + _is.ignore(chunk_size); + bytes_ += chunk_size; } return b < bytes_; @@ -655,9 +657,9 @@ bool _OMReader_::read_binary_mesh_chunk(std::istream &_is, BaseImporter &_bi, Op default: // skip unknown chunk - size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_); - _is.ignore(size_of); - bytes_ += size_of; + size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_); + _is.ignore(chunk_size); + bytes_ += chunk_size; } return b < bytes_; diff --git a/src/OpenMesh/Core/IO/reader/OMReader.hh b/src/OpenMesh/Core/IO/reader/OMReader.hh index 9f6707ff..5e04e378 100644 --- a/src/OpenMesh/Core/IO/reader/OMReader.hh +++ b/src/OpenMesh/Core/IO/reader/OMReader.hh @@ -89,20 +89,20 @@ public: _OMReader_(); virtual ~_OMReader_() { } - std::string get_description() const { return "OpenMesh File Format"; } - std::string get_extensions() const { return "om"; } - std::string get_magic() const { return "OM"; } + std::string get_description() const override { return "OpenMesh File Format"; } + std::string get_extensions() const override { return "om"; } + std::string get_magic() const override { return "OM"; } bool read(const std::string& _filename, BaseImporter& _bi, - Options& _opt ); + Options& _opt ) override; //! Stream Reader for std::istream input in binary format bool read(std::istream& _is, BaseImporter& _bi, - Options& _opt ); + Options& _opt ) override; - virtual bool can_u_read(const std::string& _filename) const; + virtual bool can_u_read(const std::string& _filename) const override; virtual bool can_u_read(std::istream& _is) const; diff --git a/src/OpenMesh/Core/IO/reader/PLYReader.hh b/src/OpenMesh/Core/IO/reader/PLYReader.hh index 7b3abcf4..b1304c0c 100644 --- a/src/OpenMesh/Core/IO/reader/PLYReader.hh +++ b/src/OpenMesh/Core/IO/reader/PLYReader.hh @@ -97,19 +97,19 @@ public: _PLYReader_(); - std::string get_description() const { return "PLY polygon file format"; } - std::string get_extensions() const { return "ply"; } - std::string get_magic() const { return "PLY"; } + std::string get_description() const override { return "PLY polygon file format"; } + std::string get_extensions() const override { return "ply"; } + std::string get_magic() const override { return "PLY"; } bool read(const std::string& _filename, BaseImporter& _bi, - Options& _opt); + Options& _opt) override; bool read(std::istream& _is, BaseImporter& _bi, - Options& _opt); + Options& _opt) override; - bool can_u_read(const std::string& _filename) const; + bool can_u_read(const std::string& _filename) const override; enum ValueType { Unsupported, diff --git a/src/OpenMesh/Core/IO/reader/STLReader.hh b/src/OpenMesh/Core/IO/reader/STLReader.hh index b8f21f0d..ff094d0f 100644 --- a/src/OpenMesh/Core/IO/reader/STLReader.hh +++ b/src/OpenMesh/Core/IO/reader/STLReader.hh @@ -92,17 +92,17 @@ public: virtual ~_STLReader_() {}; - std::string get_description() const + std::string get_description() const override { return "Stereolithography Interface Format"; } - std::string get_extensions() const { return "stl stla stlb"; } + std::string get_extensions() const override { return "stl stla stlb"; } bool read(const std::string& _filename, BaseImporter& _bi, - Options& _opt); + Options& _opt) override; bool read(std::istream& _in, BaseImporter& _bi, - Options& _opt); + Options& _opt) override; /** Set the threshold to be used for considering two point to be equal. Can be used to merge small gaps */ diff --git a/src/OpenMesh/Core/IO/writer/BaseWriter.hh b/src/OpenMesh/Core/IO/writer/BaseWriter.hh index 49b97b7e..fb1c1962 100644 --- a/src/OpenMesh/Core/IO/writer/BaseWriter.hh +++ b/src/OpenMesh/Core/IO/writer/BaseWriter.hh @@ -133,11 +133,13 @@ protected: bool check(BaseExporter& _be, Options _opt) const { - return (_opt.check(Options::VertexNormal ) <= _be.has_vertex_normals()) - && (_opt.check(Options::VertexTexCoord)<= _be.has_vertex_texcoords()) - && (_opt.check(Options::VertexColor) <= _be.has_vertex_colors()) - && (_opt.check(Options::FaceNormal) <= _be.has_face_normals()) - && (_opt.check(Options::FaceColor) <= _be.has_face_colors()); + // Check for all Options. When we want to write them (_opt.check() ) , they have to be available ( has_ ) + // Converts to not A (write them) or B (available) + return ( !_opt.check(Options::VertexNormal ) || _be.has_vertex_normals()) + && ( !_opt.check(Options::VertexTexCoord)|| _be.has_vertex_texcoords()) + && ( !_opt.check(Options::VertexColor) || _be.has_vertex_colors()) + && ( !_opt.check(Options::FaceNormal) || _be.has_face_normals()) + && ( !_opt.check(Options::FaceColor) || _be.has_face_colors()); } }; diff --git a/src/OpenMesh/Core/IO/writer/OBJWriter.cc b/src/OpenMesh/Core/IO/writer/OBJWriter.cc index c949066b..eb2bcf99 100644 --- a/src/OpenMesh/Core/IO/writer/OBJWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OBJWriter.cc @@ -100,24 +100,24 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream { #if defined(WIN32) - std::string::size_type dot = _filename.find_last_of("\\/"); + std::string::size_type dotposition = _filename.find_last_of("\\/"); #else - std::string::size_type dot = _filename.rfind("/"); + std::string::size_type dotposition = _filename.rfind("/"); #endif - if (dot == std::string::npos){ + if (dotposition == std::string::npos){ path_ = "./"; objName_ = _filename; }else{ - path_ = _filename.substr(0,dot+1); - objName_ = _filename.substr(dot+1); + path_ = _filename.substr(0,dotposition+1); + objName_ = _filename.substr(dotposition+1); } //remove the file extension - dot = objName_.find_last_of("."); + dotposition = objName_.find_last_of("."); - if(dot != std::string::npos) - objName_ = objName_.substr(0,dot); + if(dotposition != std::string::npos) + objName_ = objName_.substr(0,dotposition); } bool result = write(out, _be, _opt, _precision); @@ -206,7 +206,7 @@ _OBJWriter_:: write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const { unsigned int idx; - size_t i, j,nV, nF; + size_t nV, nF; Vec3f v, n; Vec2f t; VertexHandle vh; @@ -273,7 +273,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec std::vector texCoords; //add all texCoords to map unsigned int num = _be.get_face_texcoords(texCoords); - for(unsigned int i = 0; i < num ; ++i) + for(size_t i = 0; i < num ; ++i) { texMap[texCoords[i]] = i; } @@ -303,7 +303,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec } // vertex data (point, normals, texcoords) - for (i=0, nV=_be.n_vertices(); i Base; public: - AutoStatusSetT(ArrayKernel& _kernel) + explicit AutoStatusSetT(ArrayKernel& _kernel) : StatusSetT(_kernel, _kernel.pop_bit_mask(Handle())) { /*assert(size() == 0);*/ } //the set should be empty on creation diff --git a/src/OpenMesh/Core/Mesh/PolyConnectivity.hh b/src/OpenMesh/Core/Mesh/PolyConnectivity.hh index 650e2f93..78e8a3f9 100644 --- a/src/OpenMesh/Core/Mesh/PolyConnectivity.hh +++ b/src/OpenMesh/Core/Mesh/PolyConnectivity.hh @@ -1121,7 +1121,7 @@ public: typedef ITER_TYPE iterator; typedef ITER_TYPE const_iterator; - EntityRange(CONTAINER_TYPE &container) : container_(container) {} + explicit EntityRange(CONTAINER_TYPE &container) : container_(container) {} ITER_TYPE begin() const { return (container_.*begin_fn)(); } ITER_TYPE end() const { return (container_.*end_fn)(); } diff --git a/src/OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh b/src/OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh index 3c825561..5111faff 100644 --- a/src/OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh +++ b/src/OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh @@ -97,7 +97,7 @@ class PolyMesh_ArrayKernelT public: PolyMesh_ArrayKernelT() {} template - PolyMesh_ArrayKernelT( const TriMesh_ArrayKernelT & t) + explicit PolyMesh_ArrayKernelT( const TriMesh_ArrayKernelT & t) { //assign the connectivity and standard properties this->assign(t, true); diff --git a/src/OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh b/src/OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh index 2040be05..21d1654c 100644 --- a/src/OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh +++ b/src/OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh @@ -97,7 +97,7 @@ class TriMesh_ArrayKernelT public: TriMesh_ArrayKernelT() {} template - TriMesh_ArrayKernelT( const PolyMesh_ArrayKernelT & t) + explicit TriMesh_ArrayKernelT( const PolyMesh_ArrayKernelT & t) { //assign the connectivity and standard properties this->assign(t,true); diff --git a/src/OpenMesh/Core/System/mostream.hh b/src/OpenMesh/Core/System/mostream.hh index 79956485..5463750d 100644 --- a/src/OpenMesh/Core/System/mostream.hh +++ b/src/OpenMesh/Core/System/mostream.hh @@ -92,7 +92,7 @@ class multiplex_target : public basic_multiplex_target { public: explicit multiplex_target(T& _t) : target_(_t) {} - virtual void operator<<(const std::string& _s) { target_ << _s; } + virtual void operator<<(const std::string& _s) override { target_ << _s; } private: T& target_; }; diff --git a/src/OpenMesh/Core/Utils/Property.hh b/src/OpenMesh/Core/Utils/Property.hh index fcea04d9..cda3f9bf 100644 --- a/src/OpenMesh/Core/Utils/Property.hh +++ b/src/OpenMesh/Core/Utils/Property.hh @@ -99,7 +99,7 @@ public: public: /// Default constructor - PropertyT(const std::string& _name = "") + explicit PropertyT(const std::string& _name = "") : BaseProperty(_name) {} @@ -109,22 +109,22 @@ public: public: // inherited from BaseProperty - virtual void reserve(size_t _n) { data_.reserve(_n); } - virtual void resize(size_t _n) { data_.resize(_n); } - virtual void clear() { data_.clear(); vector_type().swap(data_); } - virtual void push_back() { data_.push_back(T()); } - virtual void swap(size_t _i0, size_t _i1) + virtual void reserve(size_t _n) override { data_.reserve(_n); } + virtual void resize(size_t _n) override { data_.resize(_n); } + virtual void clear() override { data_.clear(); vector_type().swap(data_); } + virtual void push_back() override { data_.push_back(T()); } + virtual void swap(size_t _i0, size_t _i1) override { std::swap(data_[_i0], data_[_i1]); } - virtual void copy(size_t _i0, size_t _i1) + virtual void copy(size_t _i0, size_t _i1) override { data_[_i1] = data_[_i0]; } public: - virtual void set_persistent( bool _yn ) + virtual void set_persistent( bool _yn ) override { check_and_set_persistent( _yn ); } - virtual size_t n_elements() const { return data_.size(); } - virtual size_t element_size() const { return IO::size_of(); } + virtual size_t n_elements() const override { return data_.size(); } + virtual size_t element_size() const override { return IO::size_of(); } #ifndef DOXY_IGNORE_THIS struct plus { @@ -133,17 +133,17 @@ public: }; #endif - virtual size_t size_of(void) const + virtual size_t size_of(void) const override { if (element_size() != IO::UnknownSize) return this->BaseProperty::size_of(n_elements()); return std::accumulate(data_.begin(), data_.end(), size_t(0), plus()); } - virtual size_t size_of(size_t _n_elem) const + virtual size_t size_of(size_t _n_elem) const override { return this->BaseProperty::size_of(_n_elem); } - virtual size_t store( std::ostream& _ostr, bool _swap ) const + virtual size_t store( std::ostream& _ostr, bool _swap ) const override { if ( IO::is_streamable() ) return IO::store(_ostr, data_, _swap ); @@ -153,7 +153,7 @@ public: return bytes; } - virtual size_t restore( std::istream& _istr, bool _swap ) + virtual size_t restore( std::istream& _istr, bool _swap ) override { if ( IO::is_streamable() ) return IO::restore(_istr, data_, _swap ); @@ -199,7 +199,7 @@ public: // data access interface } /// Make a copy of self. - PropertyT* clone() const + PropertyT* clone() const override { PropertyT* p = new PropertyT( *this ); return p; @@ -230,37 +230,37 @@ public: public: - PropertyT(const std::string& _name = "") + explicit PropertyT(const std::string& _name = "") : BaseProperty(_name) { } public: // inherited from BaseProperty - virtual void reserve(size_t _n) { data_.reserve(_n); } - virtual void resize(size_t _n) { data_.resize(_n); } - virtual void clear() { data_.clear(); vector_type().swap(data_); } - virtual void push_back() { data_.push_back(bool()); } - virtual void swap(size_t _i0, size_t _i1) + virtual void reserve(size_t _n) override { data_.reserve(_n); } + virtual void resize(size_t _n) override { data_.resize(_n); } + virtual void clear() override { data_.clear(); vector_type().swap(data_); } + virtual void push_back() override { data_.push_back(bool()); } + virtual void swap(size_t _i0, size_t _i1) override { bool t(data_[_i0]); data_[_i0]=data_[_i1]; data_[_i1]=t; } - virtual void copy(size_t _i0, size_t _i1) + virtual void copy(size_t _i0, size_t _i1) override { data_[_i1] = data_[_i0]; } public: - virtual void set_persistent( bool _yn ) + virtual void set_persistent( bool _yn ) override { check_and_set_persistent( _yn ); } - virtual size_t n_elements() const { return data_.size(); } - virtual size_t element_size() const { return UnknownSize; } - virtual size_t size_of() const { return size_of( n_elements() ); } - virtual size_t size_of(size_t _n_elem) const + virtual size_t n_elements() const override { return data_.size(); } + virtual size_t element_size() const override { return UnknownSize; } + virtual size_t size_of() const override { return size_of( n_elements() ); } + virtual size_t size_of(size_t _n_elem) const override { return _n_elem / 8 + ((_n_elem % 8)!=0); } - size_t store( std::ostream& _ostr, bool /* _swap */ ) const + size_t store( std::ostream& _ostr, bool /* _swap */ ) const override { size_t bytes = 0; @@ -299,7 +299,7 @@ public: return bytes; } - size_t restore( std::istream& _istr, bool /* _swap */ ) + size_t restore( std::istream& _istr, bool /* _swap */ ) override { size_t bytes = 0; @@ -394,40 +394,40 @@ public: public: - PropertyT(const std::string& _name = "") + explicit PropertyT(const std::string& _name = "") : BaseProperty(_name) { } public: // inherited from BaseProperty - virtual void reserve(size_t _n) { data_.reserve(_n); } - virtual void resize(size_t _n) { data_.resize(_n); } - virtual void clear() { data_.clear(); vector_type().swap(data_); } - virtual void push_back() { data_.push_back(std::string()); } - virtual void swap(size_t _i0, size_t _i1) { + virtual void reserve(size_t _n) override { data_.reserve(_n); } + virtual void resize(size_t _n) override { data_.resize(_n); } + virtual void clear() override { data_.clear(); vector_type().swap(data_); } + virtual void push_back() override { data_.push_back(std::string()); } + virtual void swap(size_t _i0, size_t _i1) override { std::swap(data_[_i0], data_[_i1]); } - virtual void copy(size_t _i0, size_t _i1) + virtual void copy(size_t _i0, size_t _i1) override { data_[_i1] = data_[_i0]; } public: - virtual void set_persistent( bool _yn ) + virtual void set_persistent( bool _yn ) override { check_and_set_persistent( _yn ); } - virtual size_t n_elements() const { return data_.size(); } - virtual size_t element_size() const { return UnknownSize; } - virtual size_t size_of() const + virtual size_t n_elements() const override { return data_.size(); } + virtual size_t element_size() const override { return UnknownSize; } + virtual size_t size_of() const override { return IO::size_of( data_ ); } - virtual size_t size_of(size_t /* _n_elem */) const + virtual size_t size_of(size_t /* _n_elem */) const override { return UnknownSize; } /// Store self as one binary block. Max. length of a string is 65535 bytes. - size_t store( std::ostream& _ostr, bool _swap ) const + size_t store( std::ostream& _ostr, bool _swap ) const override { return IO::store( _ostr, data_, _swap ); } - size_t restore( std::istream& _istr, bool _swap ) + size_t restore( std::istream& _istr, bool _swap ) override { return IO::restore( _istr, data_, _swap ); } public: diff --git a/src/OpenMesh/Core/Utils/PropertyContainer.hh b/src/OpenMesh/Core/Utils/PropertyContainer.hh index 2ce55e0e..fd5a5fad 100644 --- a/src/OpenMesh/Core/Utils/PropertyContainer.hh +++ b/src/OpenMesh/Core/Utils/PropertyContainer.hh @@ -322,21 +322,21 @@ private: #ifndef DOXY_IGNORE_THIS struct Reserve { - Reserve(size_t _n) : n_(_n) {} + explicit Reserve(size_t _n) : n_(_n) {} void operator()(BaseProperty* _p) const { if (_p) _p->reserve(n_); } size_t n_; }; struct Resize { - Resize(size_t _n) : n_(_n) {} + explicit Resize(size_t _n) : n_(_n) {} void operator()(BaseProperty* _p) const { if (_p) _p->resize(n_); } size_t n_; }; struct ResizeIfSmaller { - ResizeIfSmaller(size_t _n) : n_(_n) {} + explicit ResizeIfSmaller(size_t _n) : n_(_n) {} void operator()(BaseProperty* _p) const { if (_p && _p->n_elements() < n_) _p->resize(n_); } size_t n_; }; @@ -357,7 +357,7 @@ private: struct Delete { Delete() {} - void operator()(BaseProperty* _p) const { if (_p) delete _p; _p=NULL; } + void operator()(BaseProperty* _p) const { if (_p) delete _p; } }; #endif diff --git a/src/OpenMesh/Tools/Decimater/BaseDecimaterT.hh b/src/OpenMesh/Tools/Decimater/BaseDecimaterT.hh index 97c2d064..0d2cf864 100644 --- a/src/OpenMesh/Tools/Decimater/BaseDecimaterT.hh +++ b/src/OpenMesh/Tools/Decimater/BaseDecimaterT.hh @@ -94,7 +94,7 @@ public: //-------------------------------------------------------- public types typedef typename ModuleList::iterator ModuleListIterator; public: //------------------------------------------------------ public methods - BaseDecimaterT(Mesh& _mesh); + explicit BaseDecimaterT(Mesh& _mesh); virtual ~BaseDecimaterT(); /** Initialize decimater and decimating modules. diff --git a/src/OpenMesh/Tools/Decimater/DecimaterT.hh b/src/OpenMesh/Tools/Decimater/DecimaterT.hh index ceddd554..6fe852cd 100644 --- a/src/OpenMesh/Tools/Decimater/DecimaterT.hh +++ b/src/OpenMesh/Tools/Decimater/DecimaterT.hh @@ -89,7 +89,7 @@ public: //-------------------------------------------------------- public types public: //------------------------------------------------------ public methods /// Constructor - DecimaterT( Mesh& _mesh ); + explicit DecimaterT( Mesh& _mesh ); /// Destructor ~DecimaterT(); diff --git a/src/OpenMesh/Tools/Decimater/ModIndependentSetsT.hh b/src/OpenMesh/Tools/Decimater/ModIndependentSetsT.hh index 88d62b8b..c7c4895c 100644 --- a/src/OpenMesh/Tools/Decimater/ModIndependentSetsT.hh +++ b/src/OpenMesh/Tools/Decimater/ModIndependentSetsT.hh @@ -72,7 +72,7 @@ class ModIndependentSetsT: public ModBaseT { ; /// Constructor - ModIndependentSetsT(MeshT &_mesh) : + explicit ModIndependentSetsT(MeshT &_mesh) : Base(_mesh, true) { } diff --git a/src/OpenMesh/Tools/Decimater/ModNormalDeviationT.hh b/src/OpenMesh/Tools/Decimater/ModNormalDeviationT.hh index 191c0c2a..1c11a93c 100644 --- a/src/OpenMesh/Tools/Decimater/ModNormalDeviationT.hh +++ b/src/OpenMesh/Tools/Decimater/ModNormalDeviationT.hh @@ -208,9 +208,9 @@ public: // the smaller the factor, the smaller normal_deviation_ gets // thus creating a stricter constraint // division by error_tolerance_factor_ is for normalization - Scalar normal_deviation = normal_deviation_ * static_cast( 180.0 / M_PI * _factor / this->error_tolerance_factor_); + Scalar normal_deviation_value = normal_deviation_ * static_cast( 180.0 / M_PI * _factor / this->error_tolerance_factor_); - set_normal_deviation(normal_deviation); + set_normal_deviation(normal_deviation_value); this->error_tolerance_factor_ = _factor; } } diff --git a/src/OpenMesh/Tools/Decimater/ModNormalFlippingT.hh b/src/OpenMesh/Tools/Decimater/ModNormalFlippingT.hh index b58fb568..9833e182 100644 --- a/src/OpenMesh/Tools/Decimater/ModNormalFlippingT.hh +++ b/src/OpenMesh/Tools/Decimater/ModNormalFlippingT.hh @@ -86,7 +86,7 @@ public: public: /// Constructor - ModNormalFlippingT( MeshT &_mesh) : Base(_mesh, true) + explicit ModNormalFlippingT( MeshT &_mesh) : Base(_mesh, true) { set_max_normal_deviation( 90.0f ); const bool mesh_has_normals = _mesh.has_face_normals(); @@ -159,8 +159,8 @@ public: // the smaller the factor, the smaller max_deviation_ gets // thus creating a stricter constraint // division by error_tolerance_factor_ is for normalization - double max_normal_deviation = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_; - set_max_normal_deviation(max_normal_deviation); + double max_normal_deviation_value = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_; + set_max_normal_deviation(max_normal_deviation_value); this->error_tolerance_factor_ = _factor; } } diff --git a/src/OpenMesh/Tools/Decimater/ModProgMeshT.hh b/src/OpenMesh/Tools/Decimater/ModProgMeshT.hh index 5d1c3c65..43c02982 100644 --- a/src/OpenMesh/Tools/Decimater/ModProgMeshT.hh +++ b/src/OpenMesh/Tools/Decimater/ModProgMeshT.hh @@ -90,7 +90,7 @@ public: { /// Initializing constructor copies appropriate handles from /// collapse information \c _ci. - Info( const CollapseInfo& _ci ) + explicit Info( const CollapseInfo& _ci ) : v0(_ci.v0), v1(_ci.v1), vl(_ci.vl),vr(_ci.vr) {} @@ -108,7 +108,7 @@ public: public: /// Constructor - ModProgMeshT( MeshT &_mesh ) : Base(_mesh, true) + explicit ModProgMeshT( MeshT &_mesh ) : Base(_mesh, true) { Base::mesh().add_property( idx_ ); } diff --git a/src/OpenMesh/Tools/Decimater/ModQuadricT.hh b/src/OpenMesh/Tools/Decimater/ModQuadricT.hh index 9d86a067..444c1098 100644 --- a/src/OpenMesh/Tools/Decimater/ModQuadricT.hh +++ b/src/OpenMesh/Tools/Decimater/ModQuadricT.hh @@ -85,7 +85,7 @@ public: /** Constructor * \internal */ - ModQuadricT( MeshT &_mesh ) + explicit ModQuadricT( MeshT &_mesh ) : Base(_mesh, false) { unset_max_err(); @@ -103,7 +103,7 @@ public: public: // inherited /// Initalize the module and prepare the mesh for decimation. - virtual void initialize(void); + virtual void initialize(void) override; /** Compute collapse priority based on error quadrics. * @@ -138,7 +138,7 @@ public: // inherited } /// set the percentage of maximum quadric error - void set_error_tolerance_factor(double _factor); + void set_error_tolerance_factor(double _factor) override; diff --git a/src/OpenMesh/Tools/Decimater/ModRoundnessT.hh b/src/OpenMesh/Tools/Decimater/ModRoundnessT.hh index 32fde82a..5b3c1485 100644 --- a/src/OpenMesh/Tools/Decimater/ModRoundnessT.hh +++ b/src/OpenMesh/Tools/Decimater/ModRoundnessT.hh @@ -97,7 +97,7 @@ class ModRoundnessT : public ModBaseT public: /// Constructor - ModRoundnessT( MeshT &_dec ) : + explicit ModRoundnessT( MeshT &_dec ) : Base(_dec, false), min_r_(-1.0) { } diff --git a/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.hh b/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.hh index ee7e8900..d4a52c29 100644 --- a/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.hh +++ b/src/OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.hh @@ -79,7 +79,7 @@ private: public: - JacobiLaplaceSmootherT( Mesh& _mesh ) : LaplaceSmootherT(_mesh) {} + explicit JacobiLaplaceSmootherT( Mesh& _mesh ) : LaplaceSmootherT(_mesh) {} // override: alloc umbrellas void smooth(unsigned int _n); diff --git a/src/OpenMesh/Tools/Smoother/LaplaceSmootherT.hh b/src/OpenMesh/Tools/Smoother/LaplaceSmootherT.hh index 32e8cfca..c50ec078 100644 --- a/src/OpenMesh/Tools/Smoother/LaplaceSmootherT.hh +++ b/src/OpenMesh/Tools/Smoother/LaplaceSmootherT.hh @@ -83,7 +83,7 @@ public: typedef typename SmootherT::EdgeHandle EdgeHandle; - LaplaceSmootherT( Mesh& _mesh ); + explicit LaplaceSmootherT( Mesh& _mesh ); virtual ~LaplaceSmootherT(); diff --git a/src/OpenMesh/Tools/Smoother/LaplaceSmootherT_impl.hh b/src/OpenMesh/Tools/Smoother/LaplaceSmootherT_impl.hh index 780ff09f..8e53e912 100644 --- a/src/OpenMesh/Tools/Smoother/LaplaceSmootherT_impl.hh +++ b/src/OpenMesh/Tools/Smoother/LaplaceSmootherT_impl.hh @@ -134,7 +134,6 @@ compute_weights(LaplaceWeighting _weighting) typename Mesh::EdgeIter e_it, e_end(Base::mesh_.edges_end()); typename Mesh::HalfedgeHandle heh0, heh1, heh2; typename Mesh::VertexHandle v0, v1; - const typename Mesh::Point *p0, *p1, *p2; typename Mesh::Normal d0, d1; typename Mesh::Scalar weight, lb(-1.0), ub(1.0); @@ -171,7 +170,9 @@ compute_weights(LaplaceWeighting _weighting) case CotWeighting: { for (e_it=Base::mesh_.edges_begin(); e_it!=e_end; ++e_it) - { + { + const typename Mesh::Point *p0, *p1, *p2; + weight = 0.0; heh0 = Base::mesh_.halfedge_handle(*e_it, 0); diff --git a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/CompositeT.hh b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/CompositeT.hh index bb341216..2d5d0c35 100644 --- a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/CompositeT.hh +++ b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/CompositeT.hh @@ -146,7 +146,7 @@ public: public: /// Constructor - CompositeT(Mesh& _mesh) + explicit CompositeT(Mesh& _mesh) : subdiv_type_(0), subdiv_rule_(NULL), /*first_rule_(NULL), last_rule_(NULL),*/ mesh_(_mesh) { } @@ -256,15 +256,15 @@ protected: protected: // helper // get current generation from state - state_t generation(state_t _s) { return _s-(_s % n_rules()); } - state_t generation( VH _vh ) { return generation(mesh_.data(_vh).state()); } - state_t generation( EH _eh ) { return generation(mesh_.data(_eh).state()); } - state_t generation( FH _fh ) { return generation(mesh_.data(_fh).state()); } + state_t generation(state_t _s) const { return _s-(_s % n_rules()); } + state_t generation( VH _vh ) const { return generation(mesh_.data(_vh).state()); } + state_t generation( EH _eh ) const { return generation(mesh_.data(_eh).state()); } + state_t generation( FH _fh ) const { return generation(mesh_.data(_fh).state()); } private: // short cuts - Rule* t_rule() { return subdiv_rule_; } + Rule* t_rule() const { return subdiv_rule_; } Rule* f_rule() { return rule_sequence_.front(); } Rule* l_rule() { return rule_sequence_.back(); } diff --git a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RuleInterfaceT.hh b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RuleInterfaceT.hh index bf5867ef..dc133148 100644 --- a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RuleInterfaceT.hh +++ b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RuleInterfaceT.hh @@ -96,7 +96,7 @@ struct RuleHandleT : public BaseHandle protected:\ friend class CompositeT; \ public: \ - const char *type() const { return #classname; } \ + const char *type() const override { return #classname; } \ typedef classname Self; \ typedef RuleHandleT< Self > Handle @@ -118,7 +118,7 @@ public: protected: /// Default constructor - RuleInterfaceT(Mesh& _mesh) : mesh_(_mesh) {}; + RuleInterfaceT(Mesh& _mesh) : mesh_(_mesh),prev_rule_(nullptr),subdiv_rule_(nullptr),subdiv_type_(0),number_(0),n_rules_(0) {}; public: @@ -358,12 +358,12 @@ protected: Self* prev_rule() { return prev_rule_; } void set_subdiv_rule(Self*& _n) { subdiv_rule_ = _n; } - Self* subdiv_rule() { return subdiv_rule_; } + Self* subdiv_rule() const { return subdiv_rule_; } void set_number(int _n) { number_ = _n; } void set_n_rules(int _n) { n_rules_ = _n; } - int n_rules() { return n_rules_; } + int n_rules() const { return n_rules_; } void set_subdiv_type(int _n) { assert(_n == 3 || _n == 4); subdiv_type_ = _n; } diff --git a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.hh b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.hh index 0fdf3e79..576193de 100644 --- a/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.hh +++ b/src/OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.hh @@ -242,7 +242,7 @@ public: explicit FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); } - void raise(typename M::VertexHandle& _vh, state_t _target_state); + void raise(typename M::VertexHandle& _vh, state_t _target_state) override; MIPS_WARN_WA(Face) // avoid warning MIPS_WARN_WA(Edge) // avoid warning @@ -412,7 +412,7 @@ public: explicit EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); } - void raise(typename M::VertexHandle& _vh, state_t _target_state); + void raise(typename M::VertexHandle& _vh, state_t _target_state) override; MIPS_WARN_WA(Face) // avoid warning MIPS_WARN_WA(Edge) // avoid warning diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.hh index 2d6faa35..a1d71f97 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.hh @@ -114,15 +114,15 @@ public: public: - const char *name() const { return "Uniform CatmullClark"; } + const char *name() const override { return "Uniform CatmullClark"; } protected: /// Initialize properties and weights - virtual bool prepare( MeshType& _m ); + virtual bool prepare( MeshType& _m ) override; /// Remove properties and weights - virtual bool cleanup( MeshType& _m ); + virtual bool cleanup( MeshType& _m ) override; /** \brief Execute n subdivision steps * @@ -131,7 +131,7 @@ protected: * @param _update_points Unused here * @return successful? */ - virtual bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true); + virtual bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) override; private: diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.hh index 66327cd0..3227ded9 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.hh @@ -102,13 +102,13 @@ public: public: // inherited interface - virtual const char *name( void ) const = 0; + virtual const char *name( void ) const override = 0; protected: // inherited interface - bool prepare( MeshType& _m ); + bool prepare( MeshType& _m ) override; - bool subdivide( MeshType& _m, size_t _n, const bool _update_points = true ) + bool subdivide( MeshType& _m, size_t _n, const bool _update_points = true ) override { assert( p_mesh_ == &_m ); @@ -124,7 +124,7 @@ protected: // inherited interface #ifdef NDEBUG bool cleanup( MeshType& ) #else - bool cleanup( MeshType& _m ) + bool cleanup( MeshType& _m ) override #endif { assert( p_mesh_ == &_m ); diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeTraits.hh b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeTraits.hh index 2241cc26..9a90362d 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeTraits.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeTraits.hh @@ -86,6 +86,7 @@ struct CompositeTraits : public OpenMesh::DefaultTraits FaceTraits { + private: typedef typename Refs::HalfedgeHandle HalfedgeHandle; typedef typename Refs::Scalar Scalar; diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/CompositeLoopT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/CompositeLoopT.hh index a52db9f4..f8266fd2 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/CompositeLoopT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/CompositeLoopT.hh @@ -82,16 +82,16 @@ public: public: CompositeLoopT() : Inherited() {}; - CompositeLoopT(MeshType& _mesh) : Inherited(_mesh) {}; + explicit CompositeLoopT(MeshType& _mesh) : Inherited(_mesh) {}; ~CompositeLoopT() {} public: - const char *name() const { return "Uniform Composite Loop"; } + const char *name() const override { return "Uniform Composite Loop"; } protected: // inherited interface - void apply_rules(void) + void apply_rules(void) override { Inherited::Tvv4(); Inherited::VdE(); @@ -119,7 +119,7 @@ protected: weights_.end(), compute_weight() ); } - double operator()(size_t _valence) { return weights_[_valence]; } + double operator()(size_t _valence) override { return weights_[_valence]; } /// \internal struct compute_weight diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/CompositeSqrt3T.hh b/src/OpenMesh/Tools/Subdivider/Uniform/CompositeSqrt3T.hh index c9af0fcb..bcc72002 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/CompositeSqrt3T.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/CompositeSqrt3T.hh @@ -82,16 +82,16 @@ public: public: CompositeSqrt3T() : Inherited() {}; - CompositeSqrt3T(MeshType& _mesh) : Inherited(_mesh) {}; + explicit CompositeSqrt3T(MeshType& _mesh) : Inherited(_mesh) {}; ~CompositeSqrt3T() {} public: - const char *name() const { return "Uniform Composite Sqrt3"; } + const char *name() const override { return "Uniform Composite Sqrt3"; } protected: // inherited interface - void apply_rules(void) + void apply_rules(void) override { Inherited::Tvv3(); Inherited::VF(); @@ -117,7 +117,7 @@ protected: weights_.end(), compute_weight() ); } - double operator()(size_t _valence) { return weights_[_valence]; } + double operator()(size_t _valence) override { return weights_[_valence]; } /** \internal */ diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh index f7253c1d..f1d113b8 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/LoopT.hh @@ -106,7 +106,7 @@ public: { init_weights(); } - LoopT( mesh_t& _m ) : parent_t(_m), _1over8( 1.0/8.0 ), _3over8( 3.0/8.0 ) + explicit LoopT( mesh_t& _m ) : parent_t(_m), _1over8( 1.0/8.0 ), _3over8( 3.0/8.0 ) { init_weights(); } @@ -116,7 +116,7 @@ public: public: - const char *name() const { return "Uniform Loop"; } + const char *name() const override { return "Uniform Loop"; } /// Pre-compute weights @@ -130,7 +130,7 @@ public: protected: - bool prepare( mesh_t& _m ) + bool prepare( mesh_t& _m ) override { _m.add_property( vp_pos_ ); _m.add_property( ep_pos_ ); @@ -138,7 +138,7 @@ protected: } - bool cleanup( mesh_t& _m ) + bool cleanup( mesh_t& _m ) override { _m.remove_property( vp_pos_ ); _m.remove_property( ep_pos_ ); @@ -146,7 +146,7 @@ protected: } - bool subdivide( mesh_t& _m, size_t _n, const bool _update_points = true) + bool subdivide( mesh_t& _m, size_t _n, const bool _update_points = true) override { ///TODO:Implement fixed positions diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh index 61ac23b9..a9927f93 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh @@ -107,7 +107,7 @@ public: { init_weights(); } - ModifiedButterflyT( mesh_t& _m) : parent_t(_m) + explicit ModifiedButterflyT( mesh_t& _m) : parent_t(_m) { init_weights(); } @@ -117,7 +117,7 @@ public: public: - const char *name() const { return "Uniform Spectral"; } + const char *name() const override { return "Uniform Spectral"; } /// Pre-compute weights @@ -158,7 +158,7 @@ public: protected: - bool prepare( mesh_t& _m ) + bool prepare( mesh_t& _m ) override { _m.add_property( vp_pos_ ); _m.add_property( ep_pos_ ); @@ -166,7 +166,7 @@ protected: } - bool cleanup( mesh_t& _m ) + bool cleanup( mesh_t& _m ) override { _m.remove_property( vp_pos_ ); _m.remove_property( ep_pos_ ); @@ -174,7 +174,7 @@ protected: } - bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) + bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) override { ///TODO:Implement fixed positions diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh b/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh index 5d4182cc..6330797e 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh @@ -119,7 +119,7 @@ public: InterpolatingSqrt3LGT(void) : parent_t() { init_weights(); } - InterpolatingSqrt3LGT(MeshType &_m) : parent_t(_m) + explicit InterpolatingSqrt3LGT(MeshType &_m) : parent_t(_m) { init_weights(); } virtual ~InterpolatingSqrt3LGT() {} @@ -128,7 +128,7 @@ public: public: - const char *name() const { return "Uniform Interpolating Sqrt3"; } + const char *name() const override { return "Uniform Interpolating Sqrt3"; } /// Pre-compute weights void init_weights(size_t _max_valence=50) @@ -170,7 +170,7 @@ public: protected: - bool prepare( MeshType& _m ) + bool prepare( MeshType& _m ) override { _m.request_edge_status(); _m.add_property( fp_pos_ ); @@ -183,7 +183,7 @@ protected: } - bool cleanup( MeshType& _m ) + bool cleanup( MeshType& _m ) override { _m.release_edge_status(); _m.remove_property( fp_pos_ ); @@ -193,7 +193,7 @@ protected: } - bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) + bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) override { ///TODO:Implement fixed positions diff --git a/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh b/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh index dcea039b..9e793184 100644 --- a/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh +++ b/src/OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh @@ -112,7 +112,7 @@ public: Sqrt3T(void) : parent_t(), _1over3( real_t(1.0/3.0) ), _1over27( real_t(1.0/27.0) ) { init_weights(); } - Sqrt3T(MeshType &_m) : parent_t(_m), _1over3( real_t(1.0/3.0) ), _1over27( real_t(1.0/27.0) ) + explicit Sqrt3T(MeshType &_m) : parent_t(_m), _1over3( real_t(1.0/3.0) ), _1over27( real_t(1.0/27.0) ) { init_weights(); } virtual ~Sqrt3T() {} @@ -121,7 +121,7 @@ public: public: - const char *name() const { return "Uniform Sqrt3"; } + const char *name() const override { return "Uniform Sqrt3"; } /// Pre-compute weights @@ -135,7 +135,7 @@ public: protected: - bool prepare( MeshType& _m ) + bool prepare( MeshType& _m ) override { _m.request_edge_status(); _m.add_property( vp_pos_ ); @@ -148,7 +148,7 @@ protected: } - bool cleanup( MeshType& _m ) + bool cleanup( MeshType& _m ) override { _m.release_edge_status(); _m.remove_property( vp_pos_ ); @@ -157,7 +157,7 @@ protected: return true; } - bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) + bool subdivide( MeshType& _m, size_t _n , const bool _update_points = true) override { ///TODO:Implement fixed positions diff --git a/src/OpenMesh/Tools/Utils/HeapT.hh b/src/OpenMesh/Tools/Utils/HeapT.hh index e4f0ba63..7f1b3a8e 100644 --- a/src/OpenMesh/Tools/Utils/HeapT.hh +++ b/src/OpenMesh/Tools/Utils/HeapT.hh @@ -152,7 +152,7 @@ public: {} #else /// Construct with a given \c HeapIterface. - HeapT(const HeapInterface &_interface) + explicit HeapT(const HeapInterface &_interface) : HeapVector(), interface_(_interface) {} #endif @@ -258,9 +258,9 @@ public: bool check() { bool ok(true); - unsigned int i, j; - for (i=0; i:: downheap(size_t _idx) { const HeapEntry h = entry(_idx); - size_t childIdx; const size_t s = size(); while(_idx < s) { - childIdx = left(_idx); + size_t childIdx = left(_idx); if (childIdx >= s) break; if ((childIdx + 1 < s) && (interface_.less(entry(childIdx + 1), entry(childIdx)))) diff --git a/src/OpenMesh/Tools/Utils/StripifierT.hh b/src/OpenMesh/Tools/Utils/StripifierT.hh index 4f27a856..21ebc00c 100644 --- a/src/OpenMesh/Tools/Utils/StripifierT.hh +++ b/src/OpenMesh/Tools/Utils/StripifierT.hh @@ -88,7 +88,7 @@ public: /// Default constructor - StripifierT(Mesh& _mesh); + explicit StripifierT(Mesh& _mesh); /// Destructor ~StripifierT(); diff --git a/src/OpenMesh/Tools/Utils/Timer.cc b/src/OpenMesh/Tools/Utils/Timer.cc index 28d8f5e1..459db75d 100644 --- a/src/OpenMesh/Tools/Utils/Timer.cc +++ b/src/OpenMesh/Tools/Utils/Timer.cc @@ -100,11 +100,11 @@ public: TimerImplWin32(void); ~TimerImplWin32(void) { ; } - virtual void reset(void); - virtual void start(void); - virtual void stop(void); - virtual void cont(void); - virtual double seconds(void) const; + virtual void reset(void) override; + virtual void start(void) override; + virtual void stop(void) override; + virtual void cont(void) override; + virtual double seconds(void) const override; }; TimerImplWin32::TimerImplWin32(void) @@ -198,10 +198,10 @@ public: ~TimerImplGToD() { } - virtual void reset(void) { seconds_ = 0.0; } - virtual void start(void) { seconds_ = 0.0; gettimeofday( &start_, &tz_ ); } + virtual void reset(void) override { seconds_ = 0.0; } + virtual void start(void) override { seconds_ = 0.0; gettimeofday( &start_, &tz_ ); } - virtual void stop(void) + virtual void stop(void) override { gettimeofday( &stop_, &tz_ ); @@ -209,9 +209,9 @@ public: seconds_ += (double)(stop_.tv_usec- start_.tv_usec)*1e-6; } - virtual void cont(void) { gettimeofday( &start_, &tz_); } + virtual void cont(void) override { gettimeofday( &start_, &tz_); } - virtual double seconds() const { return seconds_; } + virtual double seconds() const override { return seconds_; } private: @@ -234,11 +234,11 @@ public: TimerImplStd() : freq_(clockticks),count_(0),start_(0) { reset(); } ~TimerImplStd() { ; } - virtual void reset(void) { count_ = 0; } - virtual void start(void) { count_ = 0; start_ = clock(); } - virtual void stop(void); - virtual void cont(void) { start_ = clock(); } - virtual double seconds(void) const { return (double)count_/(double)freq_; } + virtual void reset(void) override { count_ = 0; } + virtual void start(void) override { count_ = 0; start_ = clock(); } + virtual void stop(void) override; + virtual void cont(void) override { start_ = clock(); } + virtual double seconds(void) const override { return (double)count_/(double)freq_; } protected: unsigned long freq_; diff --git a/src/OpenMesh/Tools/VDPM/VHierarchyWindow.hh b/src/OpenMesh/Tools/VDPM/VHierarchyWindow.hh index 44d2e2af..9aff879e 100644 --- a/src/OpenMesh/Tools/VDPM/VHierarchyWindow.hh +++ b/src/OpenMesh/Tools/VDPM/VHierarchyWindow.hh @@ -37,183 +37,183 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * - * ========================================================================= */ - - - -//============================================================================= -// -// CLASS newClass -// -//============================================================================= - -#ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH -#define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH - - -//== INCLUDES ================================================================= - -#include -#include - -//== FORWARDDECLARATIONS ====================================================== - - -//== NAMESPACES =============================================================== - -namespace OpenMesh { -namespace VDPM { - -//== CLASS DEFINITION ========================================================= - - -/** \todo VHierarchyWindow documentation -*/ -class VHierarchyWindow -{ -private: - - // reference of vertex hierarchy - VHierarchy *vhierarchy_; - - // bits buffer (byte units) - unsigned char *buffer_; - int buffer_min_; - size_t buffer_max_; - int current_pos_; - - // window (byte units) - int window_min_; - int window_max_; - - - // # of right shift (bit units) - unsigned char n_shift_; // [0, 7] - - unsigned char flag8(unsigned char n_shift) const - { return 0x80 >> n_shift; } - - unsigned char flag8(VHierarchyNodeHandle _node_handle) const - { - assert(_node_handle.idx() >= 0); - return 0x80 >> (unsigned int) (_node_handle.idx() % 8); - } - int byte_idx(VHierarchyNodeHandle _node_handle) const - { - assert(_node_handle.idx() >= 0); - return _node_handle.idx() / 8; - } - int buffer_idx(VHierarchyNodeHandle _node_handle) const - { return byte_idx(_node_handle) - buffer_min_; } - - bool before_window(VHierarchyNodeHandle _node_handle) const - { return (_node_handle.idx()/8 < window_min_) ? true : false; } - - bool after_window(VHierarchyNodeHandle _node_handle) const - { return (_node_handle.idx()/8 < window_max_) ? false : true; } - - bool underflow(VHierarchyNodeHandle _node_handle) const - { return (_node_handle.idx()/8 < buffer_min_) ? true : false; } - - bool overflow(VHierarchyNodeHandle _node_handle) const - { return (_node_handle.idx()/8 < int(buffer_max_) ) ? false : true; } - - bool update_buffer(VHierarchyNodeHandle _node_handle); - -public: - VHierarchyWindow(); - VHierarchyWindow(VHierarchy &_vhierarchy); - ~VHierarchyWindow(void); - - void set_vertex_hierarchy(VHierarchy &_vhierarchy) - { vhierarchy_ = &_vhierarchy; } - - void begin() - { - int new_window_min = window_min_; - for (current_pos_=window_min_-buffer_min_; - current_pos_ < window_size(); ++current_pos_) - { - if (buffer_[current_pos_] == 0) - ++new_window_min; - else - { - n_shift_ = 0; - while ((buffer_[current_pos_] & flag8(n_shift_)) == 0) - ++n_shift_; - break; - } - } - window_min_ = new_window_min; - } - - void next() - { - ++n_shift_; - if (n_shift_ == 8) - { - n_shift_ = 0; - ++current_pos_; - } - - while (current_pos_ < window_max_-buffer_min_) - { - if (buffer_[current_pos_] != 0) // if the current byte has non-zero bits - { - while (n_shift_ != 8) - { - if ((buffer_[current_pos_] & flag8(n_shift_)) != 0) - return; // find 1 bit in the current byte - ++n_shift_; - } - } - n_shift_ = 0; - ++current_pos_; - } - } - bool end() { return !(current_pos_ < window_max_-buffer_min_); } - - int window_size() const { return window_max_ - window_min_; } - size_t buffer_size() const { return buffer_max_ - buffer_min_; } - - VHierarchyNodeHandle node_handle() - { - return VHierarchyNodeHandle(8*(buffer_min_+current_pos_) + (int)n_shift_); - } - - void activate(VHierarchyNodeHandle _node_handle) - { - update_buffer(_node_handle); - buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle); - window_min_ = std::min(window_min_, byte_idx(_node_handle)); - window_max_ = std::max(window_max_, 1+byte_idx(_node_handle)); - } - - - void inactivate(VHierarchyNodeHandle _node_handle) - { - if (is_active(_node_handle) != true) return; - buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle); - } - - - bool is_active(VHierarchyNodeHandle _node_handle) const - { - if (before_window(_node_handle) == true || - after_window(_node_handle) == true) - return false; - return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0); - } - - void init(VHierarchyNodeHandleContainer &_roots); - void update_with_vsplit(VHierarchyNodeHandle _parent_handle); - void update_with_ecol(VHierarchyNodeHandle _parent_handle); -}; - -//============================================================================= -} // namespace VDPM -} // namespace OpenMesh -//============================================================================= -#endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH -//============================================================================= - + * ========================================================================= */ + + + +//============================================================================= +// +// CLASS newClass +// +//============================================================================= + +#ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH +#define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH + + +//== INCLUDES ================================================================= + +#include +#include + +//== FORWARDDECLARATIONS ====================================================== + + +//== NAMESPACES =============================================================== + +namespace OpenMesh { +namespace VDPM { + +//== CLASS DEFINITION ========================================================= + + +/** \todo VHierarchyWindow documentation +*/ +class VHierarchyWindow +{ +private: + + // reference of vertex hierarchy + VHierarchy *vhierarchy_; + + // bits buffer (byte units) + unsigned char *buffer_; + int buffer_min_; + size_t buffer_max_; + int current_pos_; + + // window (byte units) + int window_min_; + int window_max_; + + + // # of right shift (bit units) + unsigned char n_shift_; // [0, 7] + + unsigned char flag8(unsigned char n_shift) const + { return 0x80 >> n_shift; } + + unsigned char flag8(VHierarchyNodeHandle _node_handle) const + { + assert(_node_handle.idx() >= 0); + return 0x80 >> (unsigned int) (_node_handle.idx() % 8); + } + int byte_idx(VHierarchyNodeHandle _node_handle) const + { + assert(_node_handle.idx() >= 0); + return _node_handle.idx() / 8; + } + int buffer_idx(VHierarchyNodeHandle _node_handle) const + { return byte_idx(_node_handle) - buffer_min_; } + + bool before_window(VHierarchyNodeHandle _node_handle) const + { return (_node_handle.idx()/8 < window_min_) ? true : false; } + + bool after_window(VHierarchyNodeHandle _node_handle) const + { return (_node_handle.idx()/8 < window_max_) ? false : true; } + + bool underflow(VHierarchyNodeHandle _node_handle) const + { return (_node_handle.idx()/8 < buffer_min_) ? true : false; } + + bool overflow(VHierarchyNodeHandle _node_handle) const + { return (_node_handle.idx()/8 < int(buffer_max_) ) ? false : true; } + + bool update_buffer(VHierarchyNodeHandle _node_handle); + +public: + VHierarchyWindow(); + explicit VHierarchyWindow(VHierarchy &_vhierarchy); + ~VHierarchyWindow(void); + + void set_vertex_hierarchy(VHierarchy &_vhierarchy) + { vhierarchy_ = &_vhierarchy; } + + void begin() + { + int new_window_min = window_min_; + for (current_pos_=window_min_-buffer_min_; + current_pos_ < window_size(); ++current_pos_) + { + if (buffer_[current_pos_] == 0) + ++new_window_min; + else + { + n_shift_ = 0; + while ((buffer_[current_pos_] & flag8(n_shift_)) == 0) + ++n_shift_; + break; + } + } + window_min_ = new_window_min; + } + + void next() + { + ++n_shift_; + if (n_shift_ == 8) + { + n_shift_ = 0; + ++current_pos_; + } + + while (current_pos_ < window_max_-buffer_min_) + { + if (buffer_[current_pos_] != 0) // if the current byte has non-zero bits + { + while (n_shift_ != 8) + { + if ((buffer_[current_pos_] & flag8(n_shift_)) != 0) + return; // find 1 bit in the current byte + ++n_shift_; + } + } + n_shift_ = 0; + ++current_pos_; + } + } + bool end() { return !(current_pos_ < window_max_-buffer_min_); } + + int window_size() const { return window_max_ - window_min_; } + size_t buffer_size() const { return buffer_max_ - buffer_min_; } + + VHierarchyNodeHandle node_handle() + { + return VHierarchyNodeHandle(8*(buffer_min_+current_pos_) + (int)n_shift_); + } + + void activate(VHierarchyNodeHandle _node_handle) + { + update_buffer(_node_handle); + buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle); + window_min_ = std::min(window_min_, byte_idx(_node_handle)); + window_max_ = std::max(window_max_, 1+byte_idx(_node_handle)); + } + + + void inactivate(VHierarchyNodeHandle _node_handle) + { + if (is_active(_node_handle) != true) return; + buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle); + } + + + bool is_active(VHierarchyNodeHandle _node_handle) const + { + if (before_window(_node_handle) == true || + after_window(_node_handle) == true) + return false; + return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0); + } + + void init(VHierarchyNodeHandleContainer &_roots); + void update_with_vsplit(VHierarchyNodeHandle _parent_handle); + void update_with_ecol(VHierarchyNodeHandle _parent_handle); +}; + +//============================================================================= +} // namespace VDPM +} // namespace OpenMesh +//============================================================================= +#endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH +//============================================================================= +