From 8c6dd114920a23053bd525dbe48296226e7dde48 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 26 Nov 2025 14:05:51 +0100 Subject: [PATCH] add new test case and a new class Exception_ostream --- ...ing_constrained_Delaunay_triangulation_3.h | 41 +- .../CMakeLists.txt | 1 + .../data/734961-min1.off | 592 ++++++++++++++++++ STL_Extension/doc/STL_Extension/Doxyfile.in | 1 + .../include/CGAL/Exception_ostream.h | 72 +++ 5 files changed, 697 insertions(+), 10 deletions(-) create mode 100644 Constrained_triangulation_3/test/Constrained_triangulation_3/data/734961-min1.off create mode 100644 STL_Extension/include/CGAL/Exception_ostream.h diff --git a/Constrained_triangulation_3/include/CGAL/Conforming_constrained_Delaunay_triangulation_3.h b/Constrained_triangulation_3/include/CGAL/Conforming_constrained_Delaunay_triangulation_3.h index 92b0f4b6f36..d3753480920 100644 --- a/Constrained_triangulation_3/include/CGAL/Conforming_constrained_Delaunay_triangulation_3.h +++ b/Constrained_triangulation_3/include/CGAL/Conforming_constrained_Delaunay_triangulation_3.h @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -2628,13 +2629,14 @@ private: std::set> non_intersecting_edges_set; - if constexpr (cdt_3_can_use_cxx20_format()) if(this->debug().regions()) { - expensive_debug_dump_tetrahedra_intersect_region(face_index, region_index, cdt_2, fh_region); - } - detect_edges_and_cells_intersecting_region(face_index, region_index, cdt_2, fh_region, region_border_vertices, first_intersecting_edge, intersecting_edges, intersecting_cells, non_intersecting_edges_set); + if constexpr (cdt_3_can_use_cxx20_format()) if(this->debug().regions()) { + expensive_debug_dump_tetrahedra_intersect_region(face_index, region_index, cdt_2, fh_region, + std::as_const(intersecting_cells)); + } + if(this->use_older_cavity_algorithm()) { process_older_cavity_algorithm(intersecting_edges, cr_intersecting_cells, vertices_of_upper_cavity, vertices_of_lower_cavity, facets_of_upper_cavity, facets_of_lower_cavity); @@ -3457,6 +3459,9 @@ private: int i; typename CDT_2::Locate_type lt; const auto fh = cdt_2.locate(p, lt, i, hint); + if(lt != CDT_2::VERTEX) { + exception_ostream() << cdt_3_format("vertex_of_cdt_2_functor: point {} lt = {}\n", IO::oformat(p), int(lt)); + } CGAL_assume(lt == CDT_2::VERTEX); hint = fh; return fh->vertex(i); @@ -4491,11 +4496,13 @@ public: return b; })) { - std::cerr << cdt_3_format( - "ERROR: The following tetrahedron (#{}) does not intersect the region:\n {}\n {}\n {}\n {}\n", - ch->time_stamp(), - IO::oformat(ch->vertex(0), with_point_and_info), IO::oformat(ch->vertex(1), with_point_and_info), - IO::oformat(ch->vertex(2), with_point_and_info), IO::oformat(ch->vertex(3), with_point_and_info)); + exception_ostream() + << cdt_3_format( + "ERROR: The following tetrahedron (#{}) does not intersect the region:\n {}\n {}\n {}\n {}", + ch->time_stamp(), IO::oformat(ch->vertex(0), with_point_and_info), + IO::oformat(ch->vertex(1), with_point_and_info), IO::oformat(ch->vertex(2), with_point_and_info), + IO::oformat(ch->vertex(3), with_point_and_info)) + << std::endl; } } } @@ -4504,7 +4511,8 @@ public: void expensive_debug_dump_tetrahedra_intersect_region(CDT_3_signed_index face_index, int region_index, const CDT_2& cdt_2, - const Fh_region& fh_region) + const Fh_region& fh_region, + const std::set& intersecting_cells_to_check) { using Mesh = Surface_mesh; using Face_index = typename Mesh::Face_index; @@ -4516,12 +4524,18 @@ public: auto [color_vpmap, _] = tets_intersect_region_mesh.template add_property_map("f:patch_id"); for(auto ch : tr().finite_cell_handles()) { + const bool is_in_set = intersecting_cells_to_check.find(ch) != intersecting_cells_to_check.end(); auto tetrahedron = tr().tetrahedron(ch); if(!std::any_of(fh_region.begin(), fh_region.end(), [&](auto fh) { const auto triangle = cdt_2.triangle(fh); return does_tetrahedron_intersect_triangle_interior(tetrahedron, triangle, tr().geom_traits()); })) { + if(is_in_set) { + exception_ostream() << cdt_3_format( + "ERROR: tetrahedron #{} is in the intersecting_cells_to_check set but it does not intersect the region", + ch->time_stamp()) << std::endl; + } continue; } bool intersects = false; @@ -4536,6 +4550,13 @@ public: if(!intersects) { std::cerr << "ERROR: tetrahedron #" << ch->time_stamp() << " has no edge intersecting the region\n"; } + if(is_in_set != intersects) { + exception_ostream() << cdt_3_format( + "ERROR: tetrahedron #{} is {} in the intersecting_cells_to_check set but it {}intersects the region\n", + ch->time_stamp(), + is_in_set ? "" : "not", + intersects ? "" : "does not ")<< std::endl; + } std::ofstream dump_tetrahedron( cdt_3_format("dump_intersecting_{}_{}_tetrahedron_{}.off", face_index, region_index, ch->time_stamp())); dump_tetrahedron.precision(17); diff --git a/Constrained_triangulation_3/test/Constrained_triangulation_3/CMakeLists.txt b/Constrained_triangulation_3/test/Constrained_triangulation_3/CMakeLists.txt index a7603521751..9cf4e9e707c 100644 --- a/Constrained_triangulation_3/test/Constrained_triangulation_3/CMakeLists.txt +++ b/Constrained_triangulation_3/test/Constrained_triangulation_3/CMakeLists.txt @@ -130,6 +130,7 @@ if (CGAL_CDT_TEST_USE_THINGI) CGAL_add_cdt3_from_local_off_test(40985-min3) CGAL_add_cdt3_from_local_off_test(505036-min1) CGAL_add_cdt3_from_local_off_test(57811-min) + CGAL_add_cdt3_from_local_off_test(734961-min1) CGAL_add_cdt3_from_local_off_test(error_mesh-p_not_equal_0-min2) CGAL_add_cdt3_from_local_off_test(thingi-1036467-selection3) diff --git a/Constrained_triangulation_3/test/Constrained_triangulation_3/data/734961-min1.off b/Constrained_triangulation_3/test/Constrained_triangulation_3/data/734961-min1.off new file mode 100644 index 00000000000..935916a46f2 --- /dev/null +++ b/Constrained_triangulation_3/test/Constrained_triangulation_3/data/734961-min1.off @@ -0,0 +1,592 @@ +OFF +284 304 0 + +-36.779350280761719 -23.099626541137695 18.701873779296875 +-42.555007934570312 -19.583858489990234 23.548229217529297 +-42.555007934570312 19.583858489990234 23.548229217529297 +-42.931419372558594 -19.638389587402344 23.76545524597168 +-42.931419372558594 19.638389587402344 23.76545524597168 +-43.321365356445312 -19.682565689086914 23.840118408203125 +-43.321365356445312 19.682565689086914 23.840118408203125 +-43.58544921875 -19.706684112548828 23.819894790649414 +-43.58544921875 19.706684112548828 23.819894790649414 +-43.839744567871094 -19.725315093994141 23.744318008422852 +-43.839744567871094 19.725315093994141 23.744318008422852 +-44.072181701660156 -19.737567901611328 23.616901397705078 +-44.072181701660156 19.737567901611328 23.616901397705078 +-44.272682189941406 -19.742908477783203 23.443172454833984 +-44.272682189941406 19.742908477783203 23.443172454833984 +-37.944908142089844 24.230958938598633 18.133537292480469 +-43.83099365234375 20.647974014282227 23.072547912597656 +-37.682060241699219 24.161458969116211 18.396366119384766 +-43.64532470703125 20.612237930297852 23.258724212646484 +-43.446907043457031 20.530267715454102 23.414690017700195 +-37.410129547119141 23.994781494140625 18.599523544311523 +-43.244354248046875 20.405618667602539 23.533679962158203 +-37.154006958007812 23.746179580688477 18.724409103393555 +-43.047248840332031 20.244251251220703 23.610109329223633 +-42.779983520507812 19.948694229125977 23.638385772705078 +-36.779350280761719 23.099626541137695 18.701873779296875 +-36.937129974365234 23.438405990600586 18.759601593017578 +-36.297103881835938 23.479263305664062 18.371559143066406 +-36.620006561279297 23.682655334472656 18.507028579711914 +-34.850986480712891 24.316011428833008 18.000007629394531 +-35.311180114746094 24.090059280395508 18.035511016845703 +-35.752426147460938 23.839736938476562 18.138641357421875 +-34.850986480712891 14.027206420898438 18.000007629394531 +-34.850986480712891 -24.316011428833008 18.000007629394531 +-34.850986480712891 -14.027389526367188 18.000007629394531 +-36.507049560546875 -23.322196960449219 18.498517990112305 +-35.142234802246094 -24.177053451538086 18.014181137084961 +-35.62921142578125 -23.913114547729492 18.102706909179688 +-36.087120056152344 -23.625667572021484 18.266511917114258 +-37.018566131591797 31.353113174438477 0.57017076015472412 +-31.488866806030273 33.198989868164062 0.79087954759597778 +-32.837959289550781 32.925224304199219 0.73261791467666626 +-34.1419677734375 32.558513641357422 0.67864316701889038 +-36.223121643066406 31.745574951171875 0.59852051734924316 +-35.401527404785156 32.101917266845703 0.62917023897171021 +-45.971839904785156 21.947345733642578 0.36052587628364563 +-46.772842407226562 20.331201553344727 0.35106539726257324 +-47.610565185546875 18.363397598266602 0.34236899018287659 +-48.338508605957031 16.342769622802734 0.33569896221160889 +-48.963981628417969 14.277647018432617 0.33057129383087158 +-49.492584228515625 12.175520896911621 0.32660263776779175 +-50.32745361328125 7.5033769607543945 0.32097962498664856 +-50.589942932128906 5.1325240135192871 0.31935694813728333 +-50.752395629882812 2.7478582859039307 0.31838774681091309 +-50.816146850585938 0.35597807168960571 0.31801745295524597 +-35.191650390625 8.0233678817749023 16.466701507568359 +-34.508567810058594 12.283490180969238 16.345012664794922 +-34.134033203125 13.834349632263184 16.330089569091797 +-33.933021545410156 14.552207946777344 16.331699371337891 +-33.168899536132812 16.9285888671875 16.338346481323242 +-32.733959197998047 18.091268539428711 16.342527389526367 +-31.360790252685547 21.144365310668945 16.357900619506836 +-30.864288330078125 22.072181701660156 16.364362716674805 +-22.254966735839844 30.377103805541992 17.169248580932617 +-21.388984680175781 30.713247299194336 17.389657974243164 +-20.500434875488281 31.004573822021484 17.645532608032227 +-19.419178009033203 31.294624328613281 17.998111724853516 +-18.323799133300781 31.525302886962891 18.402353286743164 +-17.169727325439453 31.708671569824219 18.880874633789062 +-16.018253326416016 31.838802337646484 19.413871765136719 +-14.776437759399414 31.928308486938477 20.053590774536133 +-35.607261657714844 1.5982358455657959 16.604997634887695 +-35.535102844238281 3.7208642959594727 16.577224731445312 +-35.398593902587891 5.877772331237793 16.529092788696289 +47.098747253417969 33.880203247070312 74.279922485351562 +46.244697570800781 33.886741638183594 74.747245788574219 +47.17083740234375 34 74.316596984863281 +46.16943359375 34 74.865982055664062 +47.305160522460938 34.414215087890625 74.604652404785156 +46.3402099609375 34.414215087890625 75.134048461914062 +47.480216979980469 34.732051849365234 74.980056762695312 +46.562767028808594 34.732051849365234 75.483390808105469 +47.684074401855469 34.931850433349609 75.417228698730469 +46.821937561035156 34.931850433349609 75.890205383300781 +47.667686462402344 35 76.001419067382812 +45.102317810058594 34.931850433349609 87.062767028808594 +44.520851135253906 34.931850433349609 86.269744873046875 +44.732803344726562 34.732051849365234 87.372817993164062 +44.114028930664062 34.732051849365234 86.528915405273438 +44.415496826171875 34.414215087890625 87.639068603515625 +43.764686584472656 34.414215087890625 86.751472473144531 +44.172019958496094 34 87.843376159667969 +43.496627807617188 34 86.922248840332031 +44.018966674804688 33.51763916015625 87.9718017578125 +43.328117370605469 33.51763916015625 87.02960205078125 +43.306808471679688 33 87.122528076171875 +57.755561828613281 33 76.4454345703125 +57.061042785644531 33 75.70660400390625 +57.703361511230469 33.51763916015625 76.489234924316406 +56.895431518554688 33.51763916015625 75.645271301269531 +57.550300598144531 34 76.617668151855469 +56.760452270507812 34 75.792579650878906 +57.30682373046875 34.414215087890625 76.821968078613281 +54.393745422363281 32 84.106910705566406 +54.393745422363281 27.329744338989258 84.106910705566406 +57.507408142089844 27.819313049316406 76.6053466796875 +57.684379577636719 28.143291473388672 76.479019165039062 +57.755561828613281 28.525449752807617 76.4454345703125 +-34.9549560546875 13.490707397460938 18.001808166503906 +-35.116249084472656 -12.564321517944336 18.011754989624023 +-35.405059814453125 -10.521085739135742 18.051620483398438 +-35.622817993164062 -8.4573488235473633 18.100996017456055 +-35.938854217529297 -2.9209175109863281 18.204202651977539 +-35.844734191894531 -5.3018879890441895 18.169376373291016 +-35.977474212646484 -0.53356623649597168 18.219537734985352 +-35.966587066650391 1.618476390838623 18.215152740478516 +-35.911941528320312 3.7682209014892578 18.193878173828125 +-35.808559417724609 5.9533171653747559 18.156938552856445 +-35.491828918457031 9.7716169357299805 18.069252014160156 +-35.651840209960938 8.1280059814453125 18.108875274658203 +-35.290451049804688 11.403753280639648 18.032369613647461 +-55.864982604980469 -14.244834899902344 4.3644118309020996 +-54.462471008300781 -17.755165100097656 3.0565366744995117 +-54.818603515625 -17.94352912902832 3.3886284828186035 +-56.626029968261719 -15.95280647277832 5.0740923881530762 +-56.585136413574219 -16.471908569335938 5.0359563827514648 +-56.173324584960938 -14.552809715270996 4.6519408226013184 +-55.1982421875 -17.999443054199219 3.7426614761352539 +-55.575538635253906 -17.919099807739258 4.094489574432373 +-55.924766540527344 -17.707971572875977 4.4201545715332031 +-56.222137451171875 -17.380449295043945 4.6974596977233887 +-56.447372436523438 -16.958850860595703 4.907494068145752 +-56.567268371582031 -15.436921119689941 5.0192937850952148 +-56.412864685058594 -14.959407806396484 4.8753066062927246 +-54.409530639648438 16.04719352722168 7.4509906768798828 +-54.350776672363281 16.563079833984375 7.3961920738220215 +-54.196365356445312 17.040592193603516 7.2522048950195312 +-53.956832885742188 17.44719123840332 7.028839111328125 +-53.648490905761719 17.755165100097656 6.7413101196289062 +-53.292366027832031 17.94352912902832 6.4092183113098145 +-55.324134826660156 12.75 8.3038663864135742 +-50.570335388183594 12.75 3.8708794116973877 +-55.324134826660156 19.25 8.3038663864135742 +-50.570335388183594 19.25 3.8708794116973877 +-41.743515014648438 12.75 22.867301940917969 +-36.779350280761719 12.75 18.701873779296875 +-36.757293701171875 12.75 18.683547973632812 +-36.757293701171875 19.25 18.683547973632812 +-36.779350280761719 19.25 18.701873779296875 +-41.743515014648438 19.25 22.867301940917969 +-36.757297515869141 11.250000953674316 18.683549880981445 +-36.779350280761719 11.25 18.701873779296875 +-36.757297515869141 4.7500004768371582 18.683549880981445 +-36.779350280761719 4.7500004768371582 18.701873779296875 +-36.757297515869141 3.2500004768371582 18.683549880981445 +-36.779350280761719 3.2500004768371582 18.701873779296875 +-36.757297515869141 -3.2499995231628418 18.683549880981445 +-36.779350280761719 -3.2499995231628418 18.701873779296875 +-36.757297515869141 -4.7499995231628418 18.683549880981445 +-36.779350280761719 -4.7499995231628418 18.701873779296875 +-36.757297515869141 -11.249999046325684 18.683549880981445 +-36.779350280761719 -11.249999046325684 18.701873779296875 +-36.757297515869141 -12.749999046325684 18.683549880981445 +-36.779350280761719 -12.75 18.701873779296875 +-36.779350280761719 -19.25 18.701873779296875 +-36.757297515869141 -19.25 18.683549880981445 +-41.743515014648438 -19.25 22.867301940917969 +-41.743515014648438 11.250000953674316 22.867301940917969 +-41.743515014648438 -12.749999046325684 22.867301940917969 +-41.743515014648438 -11.249999046325684 22.867301940917969 +-41.743515014648438 -4.7499995231628418 22.867301940917969 +-41.743515014648438 -3.2499995231628418 22.867301940917969 +-41.743515014648438 3.2500004768371582 22.867301940917969 +-41.743515014648438 4.7500004768371582 22.867301940917969 +-52.245979309082031 -17.755165100097656 5.4334349632263184 +-52.602104187011719 -17.94352912902832 5.7655272483825684 +-52.98175048828125 -17.999443054199219 6.1195602416992188 +-53.359046936035156 -17.919099807739258 6.4713883399963379 +-53.708274841308594 -17.707971572875977 6.797053337097168 +-54.005638122558594 -17.380449295043945 7.0743570327758789 +-54.230880737304688 -16.958850860595703 7.2843923568725586 +-54.368644714355469 -16.471908569335938 7.4128546714782715 +-54.409530639648438 -15.95280647277832 7.4509906768798828 +-54.350776672363281 -15.436921119689941 7.3961920738220215 +-54.196365356445312 -14.959407806396484 7.2522048950195312 +-53.956832885742188 -14.552809715270996 7.028839111328125 +-52.245979309082031 6.2448348999023438 5.4334349632263184 +-52.602104187011719 6.0564718246459961 5.7655272483825684 +-52.98175048828125 6.0005569458007812 6.1195602416992188 +-53.359046936035156 6.0809006690979004 6.4713883399963379 +-53.708274841308594 6.2920279502868652 6.797053337097168 +-54.005638122558594 6.6195507049560547 7.0743570327758789 +-54.230880737304688 7.0411491394042969 7.2843923568725586 +-54.368644714355469 7.5280909538269043 7.4128546714782715 +-54.409530639648438 8.0471935272216797 7.4509906768798828 +-54.350776672363281 8.5630788803100586 7.3961920738220215 +-54.196365356445312 9.0405921936035156 7.2522048950195312 +-53.956832885742188 9.4471902847290039 7.028839111328125 +-53.648490905761719 9.7551651000976562 6.7413101196289062 +-53.292366027832031 9.9435281753540039 6.4092183113098145 +-52.9127197265625 9.9994430541992188 6.0551853179931641 +-52.535423278808594 9.9190988540649414 5.7033572196960449 +-52.186195373535156 9.7079715728759766 5.3776912689208984 +-51.888832092285156 9.3804492950439453 5.1003875732421875 +-51.663589477539062 8.9588508605957031 4.8903532028198242 +-51.525825500488281 8.4719085693359375 4.7618908882141113 +-51.484931945800781 7.9528069496154785 4.7237534523010254 +-51.543693542480469 7.4369211196899414 4.7785534858703613 +-51.698104858398438 6.9594078063964844 4.9225406646728516 +-51.937637329101562 6.5528097152709961 5.1459064483642578 +-52.245979309082031 -9.7551651000976562 5.4334349632263184 +-52.602104187011719 -9.9435281753540039 5.7655272483825684 +-52.98175048828125 -9.9994430541992188 6.1195602416992188 +-53.359046936035156 -9.9190988540649414 6.4713883399963379 +-53.708274841308594 -9.7079715728759766 6.797053337097168 +-54.005638122558594 -9.3804492950439453 7.0743570327758789 +-54.230880737304688 -8.9588508605957031 7.2843923568725586 +-54.368644714355469 -8.4719085693359375 7.4128546714782715 +-54.409530639648438 -7.9528069496154785 7.4509906768798828 +-54.350776672363281 -7.4369211196899414 7.3961920738220215 +-54.196365356445312 -6.9594078063964844 7.2522048950195312 +-53.956832885742188 -6.5528097152709961 7.028839111328125 +-53.648490905761719 -6.2448348999023438 6.7413101196289062 +-53.292366027832031 -6.0564718246459961 6.4092183113098145 +-52.9127197265625 -6.0005569458007812 6.0551853179931641 +-52.535423278808594 -6.0809006690979004 5.7033572196960449 +-52.186195373535156 -6.2920279502868652 5.3776912689208984 +-51.888832092285156 -6.6195507049560547 5.1003875732421875 +-51.663589477539062 -7.0411491394042969 4.8903532028198242 +-51.525825500488281 -7.5280909538269043 4.7618908882141113 +-51.484931945800781 -8.0471935272216797 4.7237534523010254 +-51.543693542480469 -8.5630788803100586 4.7785534858703613 +-51.698104858398438 -9.0405921936035156 4.9225406646728516 +-51.937637329101562 -9.4471902847290039 5.1459064483642578 +-52.245979309082031 -1.7551651000976562 5.4334349632263184 +-52.602104187011719 -1.9435282945632935 5.7655272483825684 +-52.98175048828125 -1.9994431734085083 6.1195602416992188 +-53.359046936035156 -1.9190992116928101 6.4713883399963379 +-53.708274841308594 -1.7079719305038452 6.797053337097168 +-54.005638122558594 -1.3804491758346558 7.0743570327758789 +-54.230880737304688 -0.95885109901428223 7.2843923568725586 +-54.368644714355469 -0.47190886735916138 7.4128546714782715 +-54.409530639648438 0.047193169593811035 7.4509906768798828 +-54.350776672363281 0.56307905912399292 7.3961920738220215 +-54.196365356445312 1.0405920743942261 7.2522048950195312 +-53.956832885742188 1.4471904039382935 7.028839111328125 +-53.648490905761719 1.7551651000976562 6.7413101196289062 +-53.292366027832031 1.9435282945632935 6.4092183113098145 +-52.9127197265625 1.9994431734085083 6.0551853179931641 +-52.535423278808594 1.9190992116928101 5.7033572196960449 +-52.186195373535156 1.7079719305038452 5.3776912689208984 +-51.888832092285156 1.3804491758346558 5.1003875732421875 +-51.663589477539062 0.95885109901428223 4.8903532028198242 +-51.525825500488281 0.47190886735916138 4.7618908882141113 +-51.484931945800781 -0.047193169593811035 4.7237534523010254 +-51.543693542480469 -0.56307905912399292 4.7785534858703613 +-51.698104858398438 -1.0405920743942261 4.9225406646728516 +-51.937637329101562 -1.4471904039382935 5.1459064483642578 +-55.324134826660156 -19.25 8.3038663864135742 +-55.324134826660156 -12.749999046325684 8.3038663864135742 +-55.324134826660156 -11.249999046325684 8.3038663864135742 +-50.570335388183594 -11.249999046325684 3.8708794116973877 +-55.324134826660156 -4.7499995231628418 8.3038663864135742 +-50.570335388183594 -4.7499995231628418 3.8708794116973877 +-55.324134826660156 4.7500004768371582 8.3038663864135742 +-50.570335388183594 4.7500004768371582 3.8708794116973877 +-55.324134826660156 11.250000953674316 8.3038663864135742 +-50.570335388183594 11.250000953674316 3.8708794116973877 +-55.324134826660156 -3.2499995231628418 8.3038663864135742 +-50.570335388183594 -3.2499995231628418 3.8708794116973877 +-55.324134826660156 3.2500004768371582 8.3038663864135742 +-50.570335388183594 3.2500004768371582 3.8708794116973877 +54.561210632324219 32 84.306480407714844 +54.561210632324219 27.316091537475586 84.306480407714844 +59.023063659667969 27.245063781738281 83.614967346191406 +58.855140686035156 27.220464706420898 84.373291015625 +58.709556579589844 27.20634651184082 83.559196472167969 +58.547500610351562 27.182525634765625 84.288505554199219 +58.705459594726562 27.198905944824219 84.742828369140625 +58.318092346191406 27.161706924438477 84.999580383300781 +58.428375244140625 28.472723007202148 77.358428955078125 +58.353050231933594 28.08903694152832 77.383209228515625 +58.16021728515625 27.764249801635742 77.487274169921875 +57.879478454589844 27.548213958740234 77.654670715332031 +3 3 4 5 +3 5 4 6 +3 5 6 7 +3 7 6 8 +3 7 8 9 +3 9 8 10 +3 9 10 11 +3 11 10 12 +3 11 12 13 +3 13 12 14 +3 15 16 17 +3 17 16 18 +3 17 18 19 +3 17 19 20 +3 20 19 21 +3 20 21 22 +3 22 21 23 +3 22 23 24 +3 2 25 24 +3 24 25 26 +3 24 26 22 +3 27 28 25 +3 50 49 56 +3 49 57 56 +3 49 48 57 +3 48 58 57 +3 48 59 58 +3 48 47 59 +3 47 60 59 +3 47 46 60 +3 39 43 63 +3 43 64 63 +3 43 44 64 +3 44 65 64 +3 44 66 65 +3 42 41 67 +3 41 68 67 +3 41 69 68 +3 41 40 69 +3 40 70 69 +3 54 53 71 +3 71 53 72 +3 52 72 53 +3 72 52 73 +3 51 73 52 +3 73 51 55 +3 46 45 61 +3 45 62 61 +3 44 42 66 +3 66 42 67 +3 74 75 76 +3 76 75 77 +3 76 77 78 +3 78 77 79 +3 78 79 80 +3 80 79 81 +3 80 81 82 +3 82 81 83 +3 82 83 84 +3 85 86 87 +3 87 86 88 +3 87 88 89 +3 89 88 90 +3 89 90 91 +3 91 90 92 +3 91 92 93 +3 93 92 94 +3 93 94 95 +3 96 97 98 +3 98 97 99 +3 98 99 100 +3 100 99 101 +3 100 101 102 +3 142 134 135 +3 142 135 136 +3 142 136 137 +3 142 137 138 +3 142 138 139 +3 142 139 143 +3 140 144 141 +3 141 144 145 +3 141 145 146 +3 147 143 146 +3 143 141 146 +3 143 147 142 +3 142 147 148 +3 142 148 149 +3 144 140 149 +3 140 142 149 +3 30 31 119 +3 31 117 119 +3 31 116 117 +3 29 30 108 +3 30 120 108 +3 30 118 120 +3 25 148 27 +3 148 147 27 +3 146 145 150 +3 145 151 150 +3 152 153 154 +3 153 155 154 +3 156 157 158 +3 157 159 158 +3 160 161 162 +3 161 163 162 +3 113 112 37 +3 112 38 37 +3 112 114 38 +3 110 111 36 +3 111 37 36 +3 111 113 37 +3 34 109 33 +3 109 36 33 +3 109 110 36 +3 35 164 0 +3 35 165 164 +3 35 162 165 +3 35 160 162 +3 35 158 160 +3 35 156 158 +3 35 154 156 +3 35 152 154 +3 35 150 152 +3 35 146 150 +3 35 147 146 +3 35 27 147 +3 35 38 27 +3 27 115 31 +3 27 114 115 +3 27 38 114 +3 116 31 115 +3 119 118 30 +3 32 29 108 +3 166 1 164 +3 1 0 164 +3 145 144 151 +3 144 167 151 +3 144 1 167 +3 2 148 25 +3 2 149 148 +3 2 144 149 +3 2 1 144 +3 168 1 166 +3 168 169 1 +3 168 161 169 +3 168 163 161 +3 170 1 169 +3 170 171 1 +3 170 157 171 +3 170 159 157 +3 172 1 171 +3 172 173 1 +3 172 153 173 +3 172 155 153 +3 1 173 167 +3 122 123 174 +3 123 175 174 +3 123 127 175 +3 127 176 175 +3 127 128 176 +3 128 177 176 +3 128 129 177 +3 129 178 177 +3 129 130 178 +3 130 179 178 +3 130 131 179 +3 131 180 179 +3 131 125 180 +3 125 181 180 +3 125 124 181 +3 124 182 181 +3 124 132 182 +3 132 183 182 +3 132 133 183 +3 133 184 183 +3 133 126 184 +3 126 185 184 +3 126 121 185 +3 258 259 168 +3 260 261 213 +3 260 213 214 +3 260 214 215 +3 260 215 216 +3 260 216 217 +3 260 217 218 +3 260 218 262 +3 261 263 229 +3 261 229 230 +3 261 230 231 +3 261 231 232 +3 261 232 233 +3 261 233 210 +3 261 210 211 +3 261 211 212 +3 261 212 213 +3 263 223 224 +3 263 224 225 +3 263 225 226 +3 263 226 227 +3 263 227 228 +3 263 228 229 +3 262 218 219 +3 262 219 220 +3 262 220 221 +3 262 221 222 +3 262 222 223 +3 262 223 263 +3 260 169 261 +3 261 169 161 +3 261 161 160 +3 158 263 160 +3 263 261 160 +3 263 158 262 +3 262 158 159 +3 262 159 170 +3 169 260 170 +3 260 262 170 +3 264 265 189 +3 264 189 190 +3 264 190 191 +3 264 191 192 +3 264 192 193 +3 264 193 194 +3 264 194 266 +3 265 267 205 +3 265 205 206 +3 265 206 207 +3 265 207 208 +3 265 208 209 +3 265 209 186 +3 265 186 187 +3 265 187 188 +3 265 188 189 +3 267 199 200 +3 267 200 201 +3 267 201 202 +3 267 202 203 +3 267 203 204 +3 267 204 205 +3 266 194 195 +3 266 195 196 +3 266 196 197 +3 266 197 198 +3 266 198 199 +3 266 199 267 +3 264 173 265 +3 265 173 153 +3 265 153 152 +3 150 267 152 +3 267 265 152 +3 267 150 266 +3 266 150 151 +3 266 151 167 +3 173 264 167 +3 264 266 167 +3 268 269 237 +3 268 237 238 +3 268 238 239 +3 268 239 240 +3 268 240 241 +3 268 241 242 +3 268 242 270 +3 269 271 253 +3 269 253 254 +3 269 254 255 +3 269 255 256 +3 269 256 257 +3 269 257 234 +3 269 234 235 +3 269 235 236 +3 269 236 237 +3 271 247 248 +3 271 248 249 +3 271 249 250 +3 271 250 251 +3 271 251 252 +3 271 252 253 +3 270 242 243 +3 270 243 244 +3 270 244 245 +3 270 245 246 +3 270 246 247 +3 270 247 271 +3 268 171 269 +3 269 171 157 +3 269 157 156 +3 154 271 156 +3 271 269 156 +3 271 154 270 +3 270 154 155 +3 270 155 172 +3 171 268 172 +3 268 270 172 +3 272 103 273 +3 273 103 104 +3 274 275 276 +3 275 277 276 +3 275 278 277 +3 278 279 277 +3 280 281 107 +3 281 106 107 +3 281 282 106 +3 282 105 106 +3 282 283 105 + diff --git a/STL_Extension/doc/STL_Extension/Doxyfile.in b/STL_Extension/doc/STL_Extension/Doxyfile.in index 312a81a0109..f9dec06ac54 100644 --- a/STL_Extension/doc/STL_Extension/Doxyfile.in +++ b/STL_Extension/doc/STL_Extension/Doxyfile.in @@ -6,4 +6,5 @@ INPUT += ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/value_type_traits.h INPUT += ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/functional.h INPUT += ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Triangulation_simplex_base_with_time_stamp.h INPUT += ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/bisect_failures.h +INPUT += ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Exception_ostream.h diff --git a/STL_Extension/include/CGAL/Exception_ostream.h b/STL_Extension/include/CGAL/Exception_ostream.h new file mode 100644 index 00000000000..f9784941378 --- /dev/null +++ b/STL_Extension/include/CGAL/Exception_ostream.h @@ -0,0 +1,72 @@ +// Copyright (c) 2025 GeometryFactory Sarl (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Laurent Rineau + +#ifndef CGAL_EXCEPTION_OSTREAM_H +#define CGAL_EXCEPTION_OSTREAM_H + +#include +#include +#include +#include + +namespace CGAL { + +/** + * \class Exception_basic_ostream + * \brief A std::basic_ostream that throws an exception with its buffer content when flushed. + * + * Usage: + * \code + * CGAL::Exception_basic_ostream os; + * os << "Error: " << value << std::endl; // throws std::runtime_error with the message + * \endcode + * + * \tparam CharT Character type (default: char) + * \tparam Traits Character traits (default: std::char_traits) + */ +template > +class Exception_basic_ostream : public std::basic_ostream { + class buffer_type : public std::basic_stringbuf { + public: + using int_type = typename Traits::int_type; + buffer_type() = default; + // When the buffer is flushed, throw an exception with the buffer content + int sync() override { + std::basic_string msg = this->str(); + this->str({}); // clear buffer + throw std::runtime_error(std::string(msg.begin(), msg.end())); + } + }; + buffer_type buffer_; +public: + Exception_basic_ostream() : std::basic_ostream(&buffer_) {} + // Disallow copy and move + Exception_basic_ostream(const Exception_basic_ostream&) = delete; + Exception_basic_ostream& operator=(const Exception_basic_ostream&) = delete; + Exception_basic_ostream(Exception_basic_ostream&&) = delete; + Exception_basic_ostream& operator=(Exception_basic_ostream&&) = delete; + ~Exception_basic_ostream() override = default; +}; + +/// /relates Exception_basic_ostream +using Exception_ostream = Exception_basic_ostream; + +/// /relates Exception_basic_ostream +using Exception_wostream = Exception_basic_ostream; + +inline Exception_ostream& exception_ostream() { + static Exception_ostream os; + return os; +} + +} // namespace CGAL + +#endif // CGAL_EXCEPTION_OSTREAM_H