Skip to content

TDS_3: use indices, and keep backward compatibility with handles - #8909

Draft
afabri wants to merge 216 commits into
CGAL:mainfrom
afabri:Triangulation_3-Handles-GF
Draft

TDS_3: use indices, and keep backward compatibility with handles#8909
afabri wants to merge 216 commits into
CGAL:mainfrom
afabri:Triangulation_3-Handles-GF

Conversation

@afabri

@afabri afabri commented May 26, 2025

Copy link
Copy Markdown
Member

Summary of Changes

Instead of changing the API of TDS, Triangulation, and everything using it, this PR takes another approach:
We store indices in the data structures instead of handles, and generate the handles on the fly, which hold a pointer to the TDS and an index.

We also split Triangulation_data_structure_3 in two: A base class which knows about storage and index/vs pointer and provides an API with handles. And a derived class that uses this API with handles, which works for both base classes as in the derived class we do not use pointers or indices directly.

We checked that the Triangulation with indexed storage can be used in Alpha Wrapping without as only change of code the typedef of the TDS.

Todo

See tracking issue #8969.

Release Management

  • Affected package(s): TDS_3
  • Feature/Small Feature (if any):
  • Link to compiled documentation (obligatory for small feature) wrong link name to be changed
  • License and copyright ownership:

*it.second++ = d; // = tds().to_cell_descriptor(d);

auto check_this_facet_must_be_in_the_cz = [&](cell_descriptor cd, int i, bool on_boundary = false) {
if(!this_facet_must_be_in_the_cz || !the_facet_is_in_its_cz) return;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In vtune I see both lambdas. Before we performed the test of line above to decide if we call the lambda or not. I guess what we see in vtune is the parameters getting copied.

Comment thread Triangulation_3/include/CGAL/Delaunay_triangulation_3.h
Comment thread Triangulation_3/include/CGAL/Delaunay_triangulation_3.h
@afabri

afabri commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

DT3_benchmark.cpp is 10% slower in this branch than in afabri/Triangulation_3-benchmark-GF which is main with DT3_benchmark.cpp added.
The branch [afabri/Triangulation_3_Indices-GF]((https://github.com/afabri/cgal/tree/Triangulation_3-Indices-GF) goes further and completely removes handles, without being faster.

The benchmark of main:
image

The benchmark of afabri:Triangulation_3-Handles-GF
image

The benchmark of afabri:Triangulation_3-Indices-GF
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants