From c524232f734de875d69e2f190f01a6c976024368 Mon Sep 17 00:00:00 2001 From: Gard Spreemann Date: Thu, 14 Jun 2018 20:39:01 +0200 Subject: GUDHI 2.2.0 as released by upstream in a tarball. --- .../CGAL/internal/Combination_enumerator.h | 148 --------------------- 1 file changed, 148 deletions(-) delete mode 100644 include/gudhi_patches/CGAL/internal/Combination_enumerator.h (limited to 'include/gudhi_patches/CGAL/internal/Combination_enumerator.h') diff --git a/include/gudhi_patches/CGAL/internal/Combination_enumerator.h b/include/gudhi_patches/CGAL/internal/Combination_enumerator.h deleted file mode 100644 index f411e827..00000000 --- a/include/gudhi_patches/CGAL/internal/Combination_enumerator.h +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) 2009-2014 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// You can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Samuel Hornus - -#ifndef CGAL_INTERNAL_COMBINATION_ENUMERATOR_H -#define CGAL_INTERNAL_COMBINATION_ENUMERATOR_H - -#include -#include - -namespace CGAL { - -namespace internal { - -class Combination_enumerator -{ - // types and member data - typedef std::vector Combination; - Combination combi_; - const int k_; - const int min_; - const int max_; - const int max_at_pos_0_; - -public: - - // For generating all the combinations of |k| distinct elements in the - // interval [min, max] (both included) - Combination_enumerator(const int k, const int min, const int max) - : combi_(k), k_(k), min_(min), max_(max), max_at_pos_0_(max + 1 - k) - { - CGAL_assertion_msg( min <= max, "min is larger than max"); - CGAL_assertion_msg( 1 <= k && k <= ( max - min + 1 ), "wrong value of k"); - init(); - } - - Combination_enumerator(const Combination_enumerator & c) - : combi_(c.combi_), k_(c.k_), min_(c.min_), max_(c.max_), max_at_pos_0_(c.max_at_pos_0_) - {} - - int number_of_elements() - { - return k_; - } - - void init() - { - combi_.resize(k_); - for( int i = 0; i < k_; ++i ) - element(i) = min_ + i; - } - - bool end() const - { - return ( element(0) > max_at_pos_0_ ); - } - - int element(const int i) const - { - CGAL_assertion( 0 <= i && i < k_ ); - return combi_[i]; - } - - int & element(const int i) - { - CGAL_assertion( 0 <= i && i < k_ ); - return combi_[i]; - } - - int operator[](const int i) const - { - return element(i); - } - - int & operator[](const int i) - { - return element(i); - } - - void operator++() - { - int i = k_ - 1; - int max_at_pos_i(max_); - while( ( i >= 0 ) && ( element(i) >= max_at_pos_i ) ) - { - --i; - --max_at_pos_i; - } - if( -1 == i ) - { - if( element(0) == max_at_pos_0_ ) - ++element(0); // mark then end of the enumeration with an impossible value - // Note than when we have arrived at the end of the enumeration, applying - // operator++() again does not change anything, so it is safe to - // apply it too many times. - } - else - { - ++element(i); - for( int j = i + 1; j < k_; ++j ) - element(j) = element(i) + j - i; - } - } - - Combination_enumerator operator++(int) - { - Combination_enumerator tmp(*this); - ++(*this); - return tmp; - } - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - TESTING -#if 0 - void test() - { - std::cerr << '\n'; - while( ! end() ) - { - std::cerr << '\n'; - for( int i = 0; i < k_; ++i ) - std::cerr << element(i) << ' '; - ++(*this); - } - init(); - } -#endif -}; - -} // end of namespace internal - -} // end of namespace CGAL - -#endif // CGAL_INTERNAL_COMBINATION_ENUMERATOR_H -- cgit v1.2.3