This commit is contained in:
Jan Möbius
2019-05-29 08:00:32 +02:00
parent 8cffe1c3b9
commit 4afdd5adcc
6 changed files with 186 additions and 186 deletions

View File

@@ -20,7 +20,7 @@ echo -e "${NC}"
echo "Please Wait ..." echo "Please Wait ..."
# Run cppcheck and output into file # 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 ) COUNT=$(wc -l < cppcheck.log )
@@ -30,7 +30,7 @@ echo "CPPCHECK Summary"
echo "==============================================================================" echo "=============================================================================="
echo -e "${NC}" echo -e "${NC}"
MAX_COUNT=0 MAX_COUNT=100
if [ $COUNT -gt $MAX_COUNT ]; then if [ $COUNT -gt $MAX_COUNT ]; then
echo -e ${WARNING} echo -e ${WARNING}

View File

@@ -72,7 +72,7 @@ public:
typedef MeshViewerWidgetT<Mesh> Base; typedef MeshViewerWidgetT<Mesh> Base;
/// default constructor /// default constructor
MeshViewerWidget(QWidget* _parent=0) explicit MeshViewerWidget(QWidget* _parent=0)
: Base(_parent) : Base(_parent)
{} {}

View File

@@ -107,7 +107,7 @@ public:
public: // inherited public: // inherited
void initialize(void) void initialize(void) override
{ {
BaseModQ::initialize(); BaseModQ::initialize();
n_vertices_ = BaseModQ::mesh().n_vertices(); n_vertices_ = BaseModQ::mesh().n_vertices();

View File

@@ -86,6 +86,7 @@ struct CompositeTraits : public OpenMesh::DefaultTraits
FaceTraits FaceTraits
{ {
private: private:
typedef typename Refs::HalfedgeHandle HalfedgeHandle; typedef typename Refs::HalfedgeHandle HalfedgeHandle;
typedef typename Refs::Scalar Scalar; typedef typename Refs::Scalar Scalar;

View File

@@ -351,12 +351,11 @@ HeapT<HeapEntry, HeapInterface>::
downheap(size_t _idx) downheap(size_t _idx)
{ {
const HeapEntry h = entry(_idx); const HeapEntry h = entry(_idx);
size_t childIdx;
const size_t s = size(); const size_t s = size();
while(_idx < s) while(_idx < s)
{ {
childIdx = left(_idx); size_t childIdx = left(_idx);
if (childIdx >= s) break; if (childIdx >= s) break;
if ((childIdx + 1 < s) && (interface_.less(entry(childIdx + 1), entry(childIdx)))) if ((childIdx + 1 < s) && (interface_.less(entry(childIdx + 1), entry(childIdx))))

View File

@@ -37,183 +37,183 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* * * *
* ========================================================================= */ * ========================================================================= */
//============================================================================= //=============================================================================
// //
// CLASS newClass // CLASS newClass
// //
//============================================================================= //=============================================================================
#ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH #ifndef OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
#define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH #define OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
//== INCLUDES ================================================================= //== INCLUDES =================================================================
#include <OpenMesh/Tools/VDPM/VHierarchy.hh> #include <OpenMesh/Tools/VDPM/VHierarchy.hh>
#include <algorithm> #include <algorithm>
//== FORWARDDECLARATIONS ====================================================== //== FORWARDDECLARATIONS ======================================================
//== NAMESPACES =============================================================== //== NAMESPACES ===============================================================
namespace OpenMesh { namespace OpenMesh {
namespace VDPM { namespace VDPM {
//== CLASS DEFINITION ========================================================= //== CLASS DEFINITION =========================================================
/** \todo VHierarchyWindow documentation /** \todo VHierarchyWindow documentation
*/ */
class VHierarchyWindow class VHierarchyWindow
{ {
private: private:
// reference of vertex hierarchy // reference of vertex hierarchy
VHierarchy *vhierarchy_; VHierarchy *vhierarchy_;
// bits buffer (byte units) // bits buffer (byte units)
unsigned char *buffer_; unsigned char *buffer_;
int buffer_min_; int buffer_min_;
size_t buffer_max_; size_t buffer_max_;
int current_pos_; int current_pos_;
// window (byte units) // window (byte units)
int window_min_; int window_min_;
int window_max_; int window_max_;
// # of right shift (bit units) // # of right shift (bit units)
unsigned char n_shift_; // [0, 7] unsigned char n_shift_; // [0, 7]
unsigned char flag8(unsigned char n_shift) const unsigned char flag8(unsigned char n_shift) const
{ return 0x80 >> n_shift; } { return 0x80 >> n_shift; }
unsigned char flag8(VHierarchyNodeHandle _node_handle) const unsigned char flag8(VHierarchyNodeHandle _node_handle) const
{ {
assert(_node_handle.idx() >= 0); assert(_node_handle.idx() >= 0);
return 0x80 >> (unsigned int) (_node_handle.idx() % 8); return 0x80 >> (unsigned int) (_node_handle.idx() % 8);
} }
int byte_idx(VHierarchyNodeHandle _node_handle) const int byte_idx(VHierarchyNodeHandle _node_handle) const
{ {
assert(_node_handle.idx() >= 0); assert(_node_handle.idx() >= 0);
return _node_handle.idx() / 8; return _node_handle.idx() / 8;
} }
int buffer_idx(VHierarchyNodeHandle _node_handle) const int buffer_idx(VHierarchyNodeHandle _node_handle) const
{ return byte_idx(_node_handle) - buffer_min_; } { return byte_idx(_node_handle) - buffer_min_; }
bool before_window(VHierarchyNodeHandle _node_handle) const bool before_window(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < window_min_) ? true : false; } { return (_node_handle.idx()/8 < window_min_) ? true : false; }
bool after_window(VHierarchyNodeHandle _node_handle) const bool after_window(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < window_max_) ? false : true; } { return (_node_handle.idx()/8 < window_max_) ? false : true; }
bool underflow(VHierarchyNodeHandle _node_handle) const bool underflow(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < buffer_min_) ? true : false; } { return (_node_handle.idx()/8 < buffer_min_) ? true : false; }
bool overflow(VHierarchyNodeHandle _node_handle) const bool overflow(VHierarchyNodeHandle _node_handle) const
{ return (_node_handle.idx()/8 < int(buffer_max_) ) ? false : true; } { return (_node_handle.idx()/8 < int(buffer_max_) ) ? false : true; }
bool update_buffer(VHierarchyNodeHandle _node_handle); bool update_buffer(VHierarchyNodeHandle _node_handle);
public: public:
VHierarchyWindow(); VHierarchyWindow();
VHierarchyWindow(VHierarchy &_vhierarchy); explicit VHierarchyWindow(VHierarchy &_vhierarchy);
~VHierarchyWindow(void); ~VHierarchyWindow(void);
void set_vertex_hierarchy(VHierarchy &_vhierarchy) void set_vertex_hierarchy(VHierarchy &_vhierarchy)
{ vhierarchy_ = &_vhierarchy; } { vhierarchy_ = &_vhierarchy; }
void begin() void begin()
{ {
int new_window_min = window_min_; int new_window_min = window_min_;
for (current_pos_=window_min_-buffer_min_; for (current_pos_=window_min_-buffer_min_;
current_pos_ < window_size(); ++current_pos_) current_pos_ < window_size(); ++current_pos_)
{ {
if (buffer_[current_pos_] == 0) if (buffer_[current_pos_] == 0)
++new_window_min; ++new_window_min;
else else
{ {
n_shift_ = 0; n_shift_ = 0;
while ((buffer_[current_pos_] & flag8(n_shift_)) == 0) while ((buffer_[current_pos_] & flag8(n_shift_)) == 0)
++n_shift_; ++n_shift_;
break; break;
} }
} }
window_min_ = new_window_min; window_min_ = new_window_min;
} }
void next() void next()
{ {
++n_shift_; ++n_shift_;
if (n_shift_ == 8) if (n_shift_ == 8)
{ {
n_shift_ = 0; n_shift_ = 0;
++current_pos_; ++current_pos_;
} }
while (current_pos_ < window_max_-buffer_min_) while (current_pos_ < window_max_-buffer_min_)
{ {
if (buffer_[current_pos_] != 0) // if the current byte has non-zero bits if (buffer_[current_pos_] != 0) // if the current byte has non-zero bits
{ {
while (n_shift_ != 8) while (n_shift_ != 8)
{ {
if ((buffer_[current_pos_] & flag8(n_shift_)) != 0) if ((buffer_[current_pos_] & flag8(n_shift_)) != 0)
return; // find 1 bit in the current byte return; // find 1 bit in the current byte
++n_shift_; ++n_shift_;
} }
} }
n_shift_ = 0; n_shift_ = 0;
++current_pos_; ++current_pos_;
} }
} }
bool end() { return !(current_pos_ < window_max_-buffer_min_); } bool end() { return !(current_pos_ < window_max_-buffer_min_); }
int window_size() const { return window_max_ - window_min_; } int window_size() const { return window_max_ - window_min_; }
size_t buffer_size() const { return buffer_max_ - buffer_min_; } size_t buffer_size() const { return buffer_max_ - buffer_min_; }
VHierarchyNodeHandle node_handle() VHierarchyNodeHandle node_handle()
{ {
return VHierarchyNodeHandle(8*(buffer_min_+current_pos_) + (int)n_shift_); return VHierarchyNodeHandle(8*(buffer_min_+current_pos_) + (int)n_shift_);
} }
void activate(VHierarchyNodeHandle _node_handle) void activate(VHierarchyNodeHandle _node_handle)
{ {
update_buffer(_node_handle); update_buffer(_node_handle);
buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle); buffer_[buffer_idx(_node_handle)] |= flag8(_node_handle);
window_min_ = std::min(window_min_, byte_idx(_node_handle)); window_min_ = std::min(window_min_, byte_idx(_node_handle));
window_max_ = std::max(window_max_, 1+byte_idx(_node_handle)); window_max_ = std::max(window_max_, 1+byte_idx(_node_handle));
} }
void inactivate(VHierarchyNodeHandle _node_handle) void inactivate(VHierarchyNodeHandle _node_handle)
{ {
if (is_active(_node_handle) != true) return; if (is_active(_node_handle) != true) return;
buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle); buffer_[buffer_idx(_node_handle)] ^= flag8(_node_handle);
} }
bool is_active(VHierarchyNodeHandle _node_handle) const bool is_active(VHierarchyNodeHandle _node_handle) const
{ {
if (before_window(_node_handle) == true || if (before_window(_node_handle) == true ||
after_window(_node_handle) == true) after_window(_node_handle) == true)
return false; return false;
return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0); return ((buffer_[buffer_idx(_node_handle)] & flag8(_node_handle)) > 0);
} }
void init(VHierarchyNodeHandleContainer &_roots); void init(VHierarchyNodeHandleContainer &_roots);
void update_with_vsplit(VHierarchyNodeHandle _parent_handle); void update_with_vsplit(VHierarchyNodeHandle _parent_handle);
void update_with_ecol(VHierarchyNodeHandle _parent_handle); void update_with_ecol(VHierarchyNodeHandle _parent_handle);
}; };
//============================================================================= //=============================================================================
} // namespace VDPM } // namespace VDPM
} // namespace OpenMesh } // namespace OpenMesh
//============================================================================= //=============================================================================
#endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH #endif // OPENMESH_VDPROGMESH_VHIERARCHYWINDOWS_HH
//============================================================================= //=============================================================================