cgal icon indicating copy to clipboard operation
cgal copied to clipboard

TDS_3: Index in Handle

Open afabri opened this issue 7 months ago • 1 comments

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 theTDS`.

Todo

  • [ ] Move code out of the package Surface_mesh as this is currently a dependency we get reported in the CI.
  • [ ] For the cell with cached circumcenter we use std::optional<Point> instead of a pointer to a 3D point and it should probably be a std::unique_ptr.
  • [ ] Separate the point property from the connectivity property. I am even wondering why the connectivity must be in the vertex and cell classes, and is not just in the storage class. Are there uses cases where one would like to have aother kind of connectivity?
  • [ ] Deal with the parallel code.
  • [x] Deal with time stamper.
  • [x] Deal with erase counter.
  • [ ] Finalize the specialization for the Fast_policy.
  • [ ] Find a cleaner solution for Is_CGAL_TDS_3 (only revealed by this PR)
  • [x] Cleanup the move_vertex() inside a for all vertices. Should be forbidden as it can also break with a Compact_container. This is not in the code itself but in the testsuite.

Problems

  • [ ] When we copy a triangulation with a cell or vertex that stores a handle, then the tds pointer in the handle must be updated. That concerns for example the hierarchy as it stores handles as up and down to link the hierarchy levels and is done properly.

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:

afabri avatar May 26 '25 15:05 afabri

With last push, on Linux, the testsuite of TDS_3, Triangulation_3, and STL_Extension, pass in Debug (with ASAN and UBSAN):

STL_Extension_Examples      =   2.27 sec*proc (14 tests)
STL_Extension_Tests         =  19.46 sec*proc (72 tests)
TDS_3_Examples              =   1.29 sec*proc (8 tests)
TDS_3_Tests                 =   1.11 sec*proc (6 tests)
Triangulation_3_Demo        =   0.18 sec*proc (1 test)
Triangulation_3_Examples    =  29.26 sec*proc (42 tests)
Triangulation_3_Tests       = 608.20 sec*proc (46 tests)

lrineau avatar Jun 02 '25 21:06 lrineau