StaticPersistence::pair_simplices() has an option to not display progress (LSVineyard uses it during consistency checking) dev
authorDmitriy Morozov <dmitriy@mrzv.org>
Tue, 02 Feb 2010 23:43:46 -0800
branchdev
changeset 193 7198c9bf279d
parent 192 19d35448c7c7
child 194 6c2a98fb8990
StaticPersistence::pair_simplices() has an option to not display progress (LSVineyard uses it during consistency checking)
bindings/python/static-persistence.cpp
include/topology/lsvineyard.hpp
include/topology/static-persistence.h
include/topology/static-persistence.hpp
--- a/bindings/python/static-persistence.cpp	Tue Jan 26 11:14:50 2010 -0800
+++ b/bindings/python/static-persistence.cpp	Tue Feb 02 23:43:46 2010 -0800
@@ -19,6 +19,8 @@
     return p;
 }
 
+void                                    pair_simplices(dp::SPersistence& sp)                { sp.pair_simplices(false); }
+
 unsigned                                distance(dp::SPersistence& sp, 
                                                  const dp::SPersistenceIndex& i)            { return sp.iterator_to(i) - sp.begin(); }
 
@@ -41,7 +43,7 @@
     bp::class_<dp::SPersistence>("StaticPersistence", bp::no_init)
         .def("__init__",        bp::make_constructor(&init_from_filtration))
         
-        .def("pair_simplices",  (void (dp::SPersistence::*)())  &dp::SPersistence::pair_simplices)
+        .def("pair_simplices",  &pair_simplices)
         .def("__call__",        &distance)
         .def("make_simplex_map",&dp::SPersistence::make_simplex_map<dp::PythonFiltration>)
 
--- a/include/topology/lsvineyard.hpp	Tue Jan 26 11:14:50 2010 -0800
+++ b/include/topology/lsvineyard.hpp	Tue Feb 02 23:43:46 2010 -0800
@@ -164,6 +164,7 @@
 {
     rLog(rlLSVineyardDebug, "Entered swap");
     VertexIndex ao = kinetic_map_[a], bo = kinetic_map_[b];
+    rLog(rlLSVineyardDebug, "Vertices: %d %d compare %d", ao->vertex(), bo->vertex(), vcmp_(ao->vertex(), bo->vertex()));
     AssertMsg(vcmp_(ao->vertex(), bo->vertex()), "In swap(a,b), a must precede b");
     transpose_vertices(ao);
     // AssertMsg(vcmp_(bo->vertex(), ao->vertex()), "In swap(a,b), b must precede a after the transposition");
@@ -265,7 +266,7 @@
 {
     rLog(rlLSVineyardDebug, "Verifying pairing");
     StaticPersistence<> p(filtration());
-    p.pair_simplices();
+    p.pair_simplices(false);
     iterator                        i     = persistence().begin();
     StaticPersistence<>::iterator   ip    = p.begin();
     StaticPersistence<>::SimplexMap<LSFiltration>       m = p.make_simplex_map(filtration());
--- a/include/topology/static-persistence.h	Tue Jan 26 11:14:50 2010 -0800
+++ b/include/topology/static-persistence.h	Tue Feb 02 23:43:46 2010 -0800
@@ -90,7 +90,7 @@
         
         // Function: pair_simplices()                                        
         // Compute persistence of the filtration
-        void                            pair_simplices()                                        { pair_simplices<PairVisitor>(begin(), end(), false, PairVisitor(size())); }
+        void                            pair_simplices(bool progress = true);
 
         // Functions: Accessors
         //   begin() -              returns OrderIndex of the first element
@@ -148,6 +148,14 @@
             mutable boost::progress_display     
                                         show_progress;
         };
+        
+        struct                          PairVisitorNoProgress
+        {
+                                        PairVisitorNoProgress()                                 {}
+            void                        init(iterator i) const                                  {}
+            void                        update(iterator j, iterator i) const                    {}
+            void                        finished(iterator j) const                              {}
+        };
 
         const Order&                    order() const                                           { return order_; }
         Order&                          order()                                                 { return order_; }
--- a/include/topology/static-persistence.hpp	Tue Jan 26 11:14:50 2010 -0800
+++ b/include/topology/static-persistence.hpp	Tue Feb 02 23:43:46 2010 -0800
@@ -40,6 +40,17 @@
         set_pair(ocur,   ocur);
     }
 }
+                    
+template<class D, class CT, class OT, class E, class Cmp>
+void 
+StaticPersistence<D, CT, OT, E, Cmp>::
+pair_simplices(bool progress)
+{ 
+    if (progress) 
+        pair_simplices<PairVisitor>(begin(), end(), false, PairVisitor(size())); 
+    else
+        pair_simplices<PairVisitorNoProgress>(begin(), end(), false, PairVisitorNoProgress());
+}
 
 template<class D, class CT, class OT, class E, class Cmp>
 template<class Visitor>