From c3391cbb5b554163ebd3ce71e743c61562207c8d Mon Sep 17 00:00:00 2001
From: Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
Date: Thu, 27 May 2021 15:49:47 +0200
Subject: [PATCH] Update script; cleanup parallel-arrangement-bench.

---
 run-gis-test.sh                    | 19 +++++++++----------
 src/CMakeLists.txt                 |  2 +-
 src/Partial_hds.h                  |  2 ++
 src/SHds.h                         | 23 +++++++++++++++--------
 src/parallel-arrangement-bench.cpp | 13 +++++--------
 5 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/run-gis-test.sh b/run-gis-test.sh
index 078644b..7eb8dbc 100755
--- a/run-gis-test.sh
+++ b/run-gis-test.sh
@@ -6,25 +6,25 @@
 #     REPEAT is the number of runs to do for each file; computation time will be
 #            the average of these runs. 1 by default.
 REPEAT=1 # Number of runs; computation time will be the average
-PROG="./src/builds/release/parallel-arrangement-bench" # Executable name
+PROG="./builds/release/parallel-arrangement-bench" # Executable name
 
-if (( $# > 1 ))
+if (( $# > 0 ))
+then
    REPEAT=${1}
 fi   
 
 # Test function: 1st parameter: directory that contains segment files;  2nd parameter: options
 function test {
-echo "######################################## ${2} ###############################" >> times.dat
-echo "######################################## ${2} ################################" >> detailed-times.dat
-echo "######################################## ${2} ###############################" >> nbcells.dat
+echo "######################################## ${REPEAT} ${2} ###############################" >> times.dat
+echo "######################################## ${REPEAT} ${2} ################################" >> detailed-times.dat
+echo "######################################## ${REPEAT} ${2} ###############################" >> nbcells.dat
 
 for file in "${1}/"*.txt
 do
     ${PROG} -t1 "${file}" -cgal -repeat ${REPEAT}
-    # echo -n "${file} - " >> times.dat
     for i in 1 2 4 8 16 32
     do
-        ${PROG} -t1 "${file}" -nbs $((i)) -nbt ${i} -repeat ${REPEAT} ${2}
+        ${PROG} -t1 "${file}" -nbs $((i)) -nbt $((i)) -repeat ${REPEAT} ${2}
     done
     echo "" >> times.dat
     echo "" >> detailed-times.dat
@@ -36,8 +36,7 @@ echo "##########################################################################
 echo "################################################################################" >> nbcells.dat
 
 echo "#GlobalTimes CGAL 1 2 4 8 16 32" >> times.dat
-echo "#DetailedTimes LoadAndDispatch ComputeLocals ComputeLCC" >> detailed-times.dat
-echo "#NbCells HalfEdges Vertices Edges FiniteFaces Faces CriticalSegments" >> nbcells.dat
+echo "#DetailedTimes LoadAndDispatch ComputeLocals ComputeFaces" >> detailed-times.dat
+echo "#NbCells HalfEdges Vertices Edges FiniteFaces Faces ExternalHalfedges" >> nbcells.dat
 
-gunzip ./data/countries/*.gzip 
 test ./data/countries "-crop"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c5e7047..e9acb5f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -36,7 +36,7 @@ endif()
 # add_definitions("-pg")
 # SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
 # add_definitions("-D_GLIBCXX_DEBUG")
-add_definitions("-g") # for vtune (perf evaluator)
+# add_definitions("-g") # for vtune (perf evaluator)
 
 # ##########################################################
 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/")
diff --git a/src/Partial_hds.h b/src/Partial_hds.h
index 8f7c667..4f54aaa 100644
--- a/src/Partial_hds.h
+++ b/src/Partial_hds.h
@@ -97,6 +97,8 @@ public:
   { return hds().number_of_halfedges()-number_of_externals(); }
   std::size_t number_of_input_segments() const
   { return m_nb_input_segments; }
+  std::size_t number_of_vertices() const
+  { return hds().number_of_vertices(); }
 
   void clear()
   {
diff --git a/src/SHds.h b/src/SHds.h
index 90229ca..9499dfa 100644
--- a/src/SHds.h
+++ b/src/SHds.h
@@ -53,7 +53,6 @@ public:
     m_xmin(0), m_ymin(0), m_xmax(0), m_ymax(0),
     m_nb_strips(0),
     m_number_segments(0),
-    m_number_of_halfedges(0),
     m_nb_finite_faces(0)
   { init_all_marks(); }
 
@@ -80,7 +79,6 @@ public:
     m_xmin(0), m_ymin(0), m_xmax(0), m_ymax(0),
     m_nb_strips(nb_strips),
     m_number_segments(0),
-    m_number_of_halfedges(0),
     m_nb_finite_faces(0)
   {
     init_all_marks();
@@ -258,7 +256,7 @@ public:
   void clear()
   {
     m_xmin=m_ymin=m_xmax=m_ymax=0;
-    m_nb_strips=m_number_segments=m_number_of_halfedges=0;
+    m_nb_strips=m_number_segments=0;
     for (auto it=m_tab_partial_hds.begin(),
          itend=m_tab_partial_hds.end(); it!=itend; ++it)
     { delete *it; *it=nullptr; }
@@ -553,7 +551,7 @@ public:
   {
     std::size_t res=0;
     for (std::size_t i=0; i<number_of_strips(); ++i)
-    { res+=Partial_hds(i).number_of_non_externals(); }
+    { res+=partial_hds(i).number_of_non_externals(); }
     return res;
   }
 
@@ -565,6 +563,17 @@ public:
     return res;
   }
 
+  std::size_t number_of_vertices() const
+  {
+    std::size_t res=0;
+    for (std::size_t i=0; i<number_of_strips(); ++i)
+    { res+=m_tab_partial_hds[i]->number_of_vertices(); }
+    return res;
+  }
+
+  std::size_t number_of_edges() const
+  { return number_of_non_external_halfedges()/2; }
+
   /** Count the number of used marks.
    * @return the number of used marks.
    */
@@ -810,7 +819,7 @@ public:
     mnb_times_reserved_marks[amark]=0;
   }
 
-  // Build the faces of the given lcc (and the father/son relations between holes)
+  // Build the faces of the given shds (and the father/son relations between holes)
   // Return the number of finite faces.
   std::size_t build_faces_array()
   {
@@ -832,7 +841,7 @@ public:
       for (auto it=hds(i).vertices().begin(),
            itend=hds(i).vertices().end(); it!=itend; ++it)
       {
-        if (!Partial_hds(i).is_external(it->first_halfedge()) &&
+        if (!partial_hds(i).is_external(it->first_halfedge()) &&
             !is_marked(it->first_halfedge(), treated))
         { // first_halfedge belongs necessarily to one infinite face.
           firsthalfedge=it->first_halfedge();
@@ -1019,7 +1028,6 @@ public:
   {
     m_xmin=m_ymin=m_xmax=m_ymax=0.;
     m_number_segments=0;
-    m_number_of_halfedges=0;
     m_tab_partial_hds.clear();
 
     std::size_t i=0;
@@ -1163,7 +1171,6 @@ protected:
   double m_xmin, m_ymin, m_xmax, m_ymax;
   std::size_t m_nb_strips;
   std::size_t m_number_segments;
-  std::size_t m_number_of_halfedges;
   std::size_t m_nb_finite_faces;
 
   std::vector<Partial_hds*>     m_tab_partial_hds;
diff --git a/src/parallel-arrangement-bench.cpp b/src/parallel-arrangement-bench.cpp
index 164746b..3fd7a0d 100644
--- a/src/parallel-arrangement-bench.cpp
+++ b/src/parallel-arrangement-bench.cpp
@@ -41,7 +41,6 @@
 #include "Segment_readers.h"
 #include "My_visitor.h"
 #include "SHds.h"
-#include "SHds_to_lcc.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
@@ -260,14 +259,12 @@ int main(int argc, char** argv)
       SHds shds(filename, nbstrips, nbthreads, optimized_strips, times, crop);
       if (i==0)
       {
-        LCC_2 lcc;
-        std::size_t finite_faces=shds_to_lcc(shds, lcc); // TODO NO MORE NEED !!
-         std::vector<unsigned int> nbcells=lcc.count_all_cells();
-
         fcells<<shds.number_of_halfedges()<<'\t'
-             <<nbcells[0]<<'\t'<<nbcells[1]<<'\t'
-            <<finite_faces<<'\t'<<nbcells[2]
-            <<'\t'<<shds.number_of_external_halfedges()<<std::endl;
+              <<shds.number_of_vertices()<<'\t'
+              <<shds.number_of_edges()<<'\t'
+              <<shds.number_of_finite_faces()<<'\t'
+              <<shds.number_of_faces()<<'\t'
+              <<shds.number_of_external_halfedges()<<std::endl;
       }
     }
 
-- 
GitLab