Added counter of total trail and cycle lengths. Added CountBy.
authorDmitriy Morozov <morozov@cs.duke.edu>
Thu, 20 Sep 2007 07:31:40 -0400
changeset 37 addeb7563cb2
parent 36 fd55f095302f
child 38 aee8f549d324
Added counter of total trail and cycle lengths. Added CountBy.
examples/alphashapes/alphashapes3d.cpp
include/topology/filtration.hpp
include/utilities/counter.h
--- a/examples/alphashapes/alphashapes3d.cpp	Tue Sep 18 05:45:19 2007 -0400
+++ b/examples/alphashapes/alphashapes3d.cpp	Thu Sep 20 07:31:40 2007 -0400
@@ -14,7 +14,7 @@
 	rlog::RLogInit(argc, argv);
 
 	stdoutLog.subscribeTo( RLOG_CHANNEL("error") );
-	stdoutLog.subscribeTo( RLOG_CHANNEL("topology/filtration") );
+	//stdoutLog.subscribeTo( RLOG_CHANNEL("topology/filtration") );
 	//stdoutLog.subscribeTo( RLOG_CHANNEL("topology/cycle") );
 #endif
 
--- a/include/topology/filtration.hpp	Tue Sep 18 05:45:19 2007 -0400
+++ b/include/topology/filtration.hpp	Thu Sep 20 07:31:40 2007 -0400
@@ -21,6 +21,7 @@
 static Counter*  cFiltrationPair =		 			GetCounter("filtration/pair");
 static Counter*  cFiltrationPairBoundaries = 		GetCounter("filtration/pair/boundaries");
 static Counter*  cFiltrationPairCycleLength = 		GetCounter("filtration/pair/cyclelength");
+static Counter*  cFiltrationPairTrailLength = 		GetCounter("filtration/pair/traillength");
 static Counter*  cFiltrationTransposition = 		GetCounter("filtration/transposition");
 static Counter*  cFiltrationTranspositionDiffDim = 	GetCounter("filtration/transposition/diffdim");
 static Counter*  cFiltrationTranspositionCase12 = 	GetCounter("filtration/transposition/case/1/2");
@@ -73,6 +74,7 @@
 				i->set_pair(j);
 				j->set_pair(i);
 				CountNum(cFiltrationPairCycleLength, j->cycle().size());
+				CountBy(cFiltrationPairCycleLength, j->cycle().size());
 				break;
 			}
 
@@ -80,6 +82,7 @@
 							   tostring(bdry).c_str(), tostring(i->pair()->cycle()).c_str());
 			bdry.add(i->pair()->cycle(), get_consistency_cmp());
 			i->pair()->trail().append(j, get_consistency_cmp());
+			Count(cFiltrationPairTrailLength);
 			rLog(rlFiltration, "After addition: %s", tostring(bdry).c_str());
 		}
 		rLog(rlFiltration, "Finished with %s: %s", 
--- a/include/utilities/counter.h	Tue Sep 18 05:45:19 2007 -0400
+++ b/include/utilities/counter.h	Thu Sep 20 07:31:40 2007 -0400
@@ -11,12 +11,14 @@
 	#define 	GetCounter(path) 		0
 	#define 	Count(x)
 	#define		CountNum(x,y)
+	#define		CountBy(x,y)
 	#define		SetFrequency(x, freq)
 	#define		SetTrigger(x, y)
 #else // COUNTERS
 	#define 	GetCounter(path) 			get_counter(path)
 	#define 	Count(x) 					do { x->count++; if ((x->count % x->frequency == 0)) x->trigger->print(); } while (0)
 	#define 	CountNum(x,y) 				do { x->subcount[y]++; } while (0)
+	#define 	CountBy(x,y) 				do { x->count += y; } while (0)
 	#define		SetFrequency(x, freq)		do { x->frequency = freq; } while (0)
 	#define		SetTrigger(x, y)			do { x->trigger = y; } while(0)
 #endif // COUNTERS