CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.67k stars 1.35k forks source link

Inconsistent base type and self type using Linear Cell Complex with cell attribute with point and id, when Info_!=void #8251

Open petlenz opened 4 weeks ago

petlenz commented 4 weeks ago

Issue Details

The typedef Selfand Base1 in the class Cell_attribute_withpoint are wrongly declared. Using a Linear Cell Complex with cell attribute with point and id, when Info!=void:

Cell_attribute_with_point.h:108:18: error: type ‘CGAL::Cell_attribute_with_point<CGAL::CMap_linear_cell_complex_storage_with_index<2, 2, CGAL::Linear_cell_complex_traits<2, CGAL::Epick>, dartItem, std::allocator<int> >, std::vector<double>, CGAL::Boolean_tag<true>, CGAL::Null_functor, CGAL::Null_functor, CGAL::Boolean_tag<true> >::Base1’ {aka ‘CGAL::Cell_attribute<CGAL::CMap_linear_cell_complex_storage_with_index<2, 2, CGAL::Linear_cell_complex_traits<2, CGAL::Epick>, dartItem, std::allocator<int> >, std::vector<double>, CGAL::Boolean_tag<true>, CGAL::Null_functor, CGAL::Null_functor, CGAL::Boolean_tag<false> >’} is not a base type for type ‘CGAL::Cell_attribute_with_point<CGAL::CMap_linear_cell_complex_storage_with_index<2, 2, CGAL::Linear_cell_complex_traits<2, CGAL::Epick>, dartItem, std::allocator<int> >, std::vector<double>, CGAL::Boolean_tag<true>, CGAL::Null_functor, CGAL::Null_functor, CGAL::Boolean_tag<true> >’
  108 |     using Base1::info;
      |                  ^~~~

Source Code

struct dartItem
{
    using Use_index=CGAL::Tag_true; // use indices
    using Index_type=std::size_t;
    template<class Refs>
    struct Dart_wrapper
    {
        using Vertex_attribute = CGAL::Cell_attribute_with_point_and_id<Refs, std::vector<double>, CGAL::Tag_true>;
        using Edge_attribute   = CGAL::Cell_attribute_with_point_and_id<Refs, std::vector<double>, CGAL::Tag_true>;
        using Facet_attribute  = CGAL::Cell_attribute_with_point_and_id<Refs, std::vector<double>, CGAL::Tag_true>;
        using Attributes       = std::tuple<Vertex_attribute, Edge_attribute, Facet_attribute>;
    };
};

using Kernel            = CGAL::Exact_predicates_inexact_constructions_kernel;
using cgalLCCTraits     = CGAL::Linear_cell_complex_traits<2, Kernel> ;
using LCC_2             = CGAL::Linear_cell_complex_for_generalized_map<2, 2, cgalLCCTraits, dartItem>;

int main(){
LCC_2 t_lcc2;
}

Solution

Change the typedef

    typedef Cell_attribute_with_point<LCC, Info_, Tag, Functor_on_merge_,
                                      Functor_on_split_> Self;

    typedef Cell_attribute<LCC, Info_, Tag,
                           Functor_on_merge_, Functor_on_split_> Base1;

to

    typedef Cell_attribute_with_point<LCC, Info_, Tag, Functor_on_merge_,
                                      Functor_on_split_, WithID> Self;

    typedef Cell_attribute<LCC, Info_, Tag,
                           Functor_on_merge_, Functor_on_split_, WithID> Base1;
gdamiand commented 4 weeks ago

Thanks @petlenz for the issue. This is solved in https://github.com/CGAL/cgal/pull/8257.

petlenz commented 4 weeks ago

Thanks for the fast response @gdamiand Unfortunately, I ran into a few more issues when using the same setup in combination with the linear cell complex incremental builder. Maybe you can have a look at #8255

gdamiand commented 4 weeks ago

I am on it.