From ef6c301d2180d37c55dc9fd9383e12ccebd009cb Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 1 Sep 2026 17:36:20 +0100 Subject: [PATCH 1/3] SMS: Document example for parallel simplification --- BGL/doc/BGL/BGL.txt | 8 ++++---- .../Surface_mesh_simplification.txt | 18 ++++++++++++++++++ .../Surface_mesh_simplification/examples.txt | 1 + 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/BGL/doc/BGL/BGL.txt b/BGL/doc/BGL/BGL.txt index fe5533696fe8..4bd8b93b287e 100644 --- a/BGL/doc/BGL/BGL.txt +++ b/BGL/doc/BGL/BGL.txt @@ -661,19 +661,19 @@ of the same concept. See `CGAL/boost/graph/graph_traits_inheritance_macros.h` fo For algorithms that operate locally, partitioning is often an easy way to parallelize the algorithm at little cost. The functions `CGAL::METIS::partition_graph()` and `CGAL::METIS::partition_dual_graph()` -provide wrappers to the graph partitioning library METIS \cgalCite{karypis1998fast}, -allowing to split triangular meshes that are models of the concept `FaceListGraph` +provide wrappers to the graph partitioning library thirdpartyMETIS , +enabling to split triangular meshes that are models of the concept `FaceListGraph` into a given number of subdomains. The following example shows how to read, partition, and write a mesh using -`partition_dual_graph()`. The class template `CGAL::Face_filtered_graph` +`CGAL::METIS::partition_dual_graph()`. The class template `CGAL::Face_filtered_graph` and the free function `copy_face_graph()` are used to create an independent mesh from one of the subdomains of the partition. Note that the copy is optional as writing can be done directly using `Face_filtered_graph`. \cgalExample{BGL_surface_mesh/surface_mesh_partition.cpp} -Using \ref BGLNamedParameters some of the many options of METIS can be customized, +Using \ref BGLNamedParameters some of the many options of \metis can be customized, as shown in \ref BGL_polyhedron_3/polyhedron_partition.cpp "this example". \section BGLGraphcut Graph Cut diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt index 0d0a4668829e..6b587056cb69 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt @@ -426,6 +426,24 @@ using behavior modifiers such as `Surface_mesh_simplification::Bounded_normal_ch Note that these policies depend on the third party \ref thirdpartyEigen library. + +\subsection Surface_mesh_simplificationExampleParallel Example Using Parallelism + +When using a local stop criterium like only collapsing small edges, a trivial parallelization is possible. +First the mesh must be partitioned with the help of the \thirdpartyMETIS library. +Then copies of the patches are generated, simplified independently, the result reassembled, +and a final pass done sequentially as the boundaries of the patches where not collapsed. + +A more elaborate version would also enable the usage of constrained property maps. +Instead of making copies of patches one might collapse in the input graph. +This needs taking care of possible race conditons. As the halfedge associated +to a vertex on the border of two neighboring patches might be modifed at the same time +by two threads, one would need a mutex or put constraints on all faces incident +to boundary vertices. + +\cgalExample{Surface_mesh_simplification/collapse_small_edges_in_parallel.cpp} + + \section SimplificationDesign Design and Implementation History The core of the package, as well as most of the simplification strategies, are the work of Fernando Cacciola, diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/examples.txt b/Surface_mesh_simplification/doc/Surface_mesh_simplification/examples.txt index 245e94654d23..8bbffc82bd34 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/examples.txt +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/examples.txt @@ -11,4 +11,5 @@ \example Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp \example Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp \example Surface_mesh_simplification/edge_collapse_garland_heckbert.cpp +\example Surface_mesh_simplification/collapse_small_edges_in_parallel.cpp */ From 14f92c42f5dff0ea1f1452f943a874a2b6e90d80 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 8 Oct 2026 10:39:47 +0200 Subject: [PATCH 2/3] Apply suggestion from @sloriot Co-authored-by: Sebastien Loriot --- BGL/doc/BGL/BGL.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BGL/doc/BGL/BGL.txt b/BGL/doc/BGL/BGL.txt index 4bd8b93b287e..812c87aae04d 100644 --- a/BGL/doc/BGL/BGL.txt +++ b/BGL/doc/BGL/BGL.txt @@ -661,7 +661,7 @@ of the same concept. See `CGAL/boost/graph/graph_traits_inheritance_macros.h` fo For algorithms that operate locally, partitioning is often an easy way to parallelize the algorithm at little cost. The functions `CGAL::METIS::partition_graph()` and `CGAL::METIS::partition_dual_graph()` -provide wrappers to the graph partitioning library thirdpartyMETIS , +provide wrappers to the graph partitioning library \thirdpartyMETIS , enabling to split triangular meshes that are models of the concept `FaceListGraph` into a given number of subdomains. From a4ffe946ae7f29edc9b1f1b0a11d2e95008adb16 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 9 Oct 2026 10:57:38 +0100 Subject: [PATCH 3/3] Fix links --- BGL/doc/BGL/BGL.txt | 2 +- .../Surface_mesh_simplification/Surface_mesh_simplification.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BGL/doc/BGL/BGL.txt b/BGL/doc/BGL/BGL.txt index 812c87aae04d..70223b70c5e4 100644 --- a/BGL/doc/BGL/BGL.txt +++ b/BGL/doc/BGL/BGL.txt @@ -661,7 +661,7 @@ of the same concept. See `CGAL/boost/graph/graph_traits_inheritance_macros.h` fo For algorithms that operate locally, partitioning is often an easy way to parallelize the algorithm at little cost. The functions `CGAL::METIS::partition_graph()` and `CGAL::METIS::partition_dual_graph()` -provide wrappers to the graph partitioning library \thirdpartyMETIS , +provide wrappers to the graph partitioning library \ref thirdpartyMETIS , enabling to split triangular meshes that are models of the concept `FaceListGraph` into a given number of subdomains. diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt index 6b587056cb69..51aa9a4ae534 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt @@ -430,7 +430,7 @@ Note that these policies depend on the third party \ref thirdpartyEigen library. \subsection Surface_mesh_simplificationExampleParallel Example Using Parallelism When using a local stop criterium like only collapsing small edges, a trivial parallelization is possible. -First the mesh must be partitioned with the help of the \thirdpartyMETIS library. +First the mesh must be partitioned with the help of the \ref thirdpartyMETIS library. Then copies of the patches are generated, simplified independently, the result reassembled, and a final pass done sequentially as the boundaries of the patches where not collapsed.