From 8d7329f3e5ad843e553c3c5503cecc28ef2eead6 Mon Sep 17 00:00:00 2001 From: Gard Spreemann Date: Thu, 20 Apr 2017 11:10:45 +0200 Subject: GUDHI 2.0.0 as released by upstream in a tarball. --- .../CGAL/NewKernel_d/Lazy_cartesian.h | 188 +++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 include/gudhi_patches/CGAL/NewKernel_d/Lazy_cartesian.h (limited to 'include/gudhi_patches/CGAL/NewKernel_d/Lazy_cartesian.h') diff --git a/include/gudhi_patches/CGAL/NewKernel_d/Lazy_cartesian.h b/include/gudhi_patches/CGAL/NewKernel_d/Lazy_cartesian.h new file mode 100644 index 00000000..9ecc2b63 --- /dev/null +++ b/include/gudhi_patches/CGAL/NewKernel_d/Lazy_cartesian.h @@ -0,0 +1,188 @@ +// Copyright (c) 2014 +// INRIA Saclay-Ile de France (France) +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser 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) : Marc Glisse + +#ifndef CGAL_KERNEL_D_LAZY_CARTESIAN_H +#define CGAL_KERNEL_D_LAZY_CARTESIAN_H + +#include +#include +#include +#include +#include +#include +#include + +namespace CGAL { + +template +struct Nth_iterator_element : private Store_kernel { + Nth_iterator_element(){} + Nth_iterator_element(K const&k):Store_kernel(k){} + typedef typename Get_type::value_tag>::type result_type; + template result_type operator()(CGAL_FORWARDABLE(U) u, int i) const { + typename Get_functor >::type ci(this->kernel()); + return *cpp0x::next(ci(CGAL_FORWARD(U,u),Begin_tag()),i); + } +}; + //typedef typename Functor::nth_element>::type nth_elem; +template::has_nth_element> +struct Select_nth_element_functor { + typedef Nth_iterator_element type; +}; +template +struct Select_nth_element_functor : + Get_functor::nth_element> {}; + +namespace internal { + template + struct Lazy_construction_maybe_nt { + typedef Lazy_construction type; + }; + template + struct Lazy_construction_maybe_nt { + typedef Lazy_construction_nt type; + }; +} + +template +struct Lazy_cartesian_types +{ + typedef typename typeset_intersection< + typename AK_::Object_list, + typename EK_::Object_list + >::type Object_list; + + typedef typename typeset_intersection< + typename AK_::Iterator_list, + typename EK_::Iterator_list + >::type Iterator_list; + + template ::type> struct Type {}; + template struct Type { + typedef Lazy< + typename Get_type::type, + typename Get_type::type, + typename Get_type::type, + E2A_> type; + }; + template struct Type { + typedef CGAL::Lazy_exact_nt::type> type; + }; + + template struct Iterator { + typedef typename iterator_tag_traits::value_tag Vt; + typedef typename Type::type V; + typedef typename Select_nth_element_functor::type AF; + typedef typename Select_nth_element_functor::type EF; + + typedef typename internal::Lazy_construction_maybe_nt< + Kernel_, AF, EF, is_NT_tag::value + >::type nth_elem; + + typedef Iterator_from_indices< + const typename Type::container>::type, + const V, V, nth_elem + > type; + }; +}; + +template +struct Lazy_cartesian : Dimension_base, + Lazy_cartesian_types > +{ + //CGAL_CONSTEXPR Lazy_cartesian(){} + //CGAL_CONSTEXPR Lazy_cartesian(int d):Base_(d){} + + //TODO: Do we want to store an AK and an EK? Or just references? + //FIXME: references would be better I guess. + //TODO: In any case, make sure that we don't end up storing this kernel for + //nothing (it is not empty but references empty kernels or something) + AK_ ak; EK_ ek; + AK_ const& approximate_kernel()const{return ak;} + EK_ const& exact_kernel()const{return ek;} + + typedef Lazy_cartesian Self; + typedef Lazy_cartesian_types Base; + //typedef typename Default::Get::type Kernel; + typedef Self Kernel; + typedef AK_ Approximate_kernel; + typedef EK_ Exact_kernel; + typedef E2A_ E2A; + typedef Approx_converter C2A; + typedef Exact_converter C2E; + + typedef typename Exact_kernel::Rep_tag Rep_tag; + typedef typename Exact_kernel::Kernel_tag Kernel_tag; + typedef typename Exact_kernel::Default_ambient_dimension Default_ambient_dimension; + typedef typename Exact_kernel::Max_ambient_dimension Max_ambient_dimension; + //typedef typename Exact_kernel::Flat_orientation Flat_orientation; + // Check that Approximate_kernel agrees with all that... + + template::type> struct Functor { + typedef Null_functor type; + }; + //FIXME: what do we do with D here? + template struct Functor { + typedef typename Get_functor::type FA; + typedef typename Get_functor::type FE; + typedef Filtered_predicate2 type; + }; + template struct Functor { + typedef typename Get_functor::type FA; + typedef typename Get_functor::type FE; + typedef Lazy_construction_nt type; + }; + template struct Functor { + typedef typename Get_functor::type FA; + typedef typename Get_functor::type FE; + typedef Lazy_construction type; + }; + + //typedef typename Iterator::type Point_cartesian_const_iterator; + //typedef typename Iterator::type Vector_cartesian_const_iterator; + + template + struct Construct_iter : private Store_kernel { + Construct_iter(){} + Construct_iter(Kernel const&k):Store_kernel(k){} + //FIXME: pass the kernel to the functor in the iterator + typedef U result_type; + template + result_type operator()(T const& t,Begin_tag)const{ + return result_type(t,0,this->kernel()); + } + template + result_type operator()(T const& t,End_tag)const{ + return result_type(t,Self().dimension(),this->kernel()); + } + }; + template struct Functor { + typedef Construct_iter::type>::type> type; + }; + + + //TODO: what about other functors of the Misc category? + // for Point_dimension, we should apply it to the approximate point + // for printing, we should??? just not do printing this way? +}; + + +} //namespace CGAL + +#endif // CGAL_KERNEL_D_LAZY_CARTESIAN_H -- cgit v1.2.3