Small logging additions + maintain_lazy = false + eventqueue ar
authorDmitriy Morozov <morozov@cs.duke.edu>
Sun, 02 Mar 2008 16:11:05 -0500
branchar
changeset 83 cf653a5a2d4f
parent 82 167a93cca2e2
child 84 c711bb2916e4
Small logging additions + maintain_lazy = false + eventqueue - Filtration::transpose( ..., maintain_lazy = false ) - EventQueue inserts a new event after all the ones equal to it, not before
examples/ar-vineyard/ar-simplex3d.hpp
examples/ar-vineyard/ar-vineyard.hpp
include/topology/cycle.hpp
include/topology/filtration.h
include/topology/filtration.hpp
include/utilities/consistencylist.h
include/utilities/eventqueue.h
--- a/examples/ar-vineyard/ar-simplex3d.hpp	Sat Mar 01 04:48:49 2008 -0500
+++ b/examples/ar-vineyard/ar-simplex3d.hpp	Sun Mar 02 16:11:05 2008 -0500
@@ -214,6 +214,7 @@
 ARSimplex3D::
 operator<<(std::ostream& out) const
 {
+    out << this << ": ";
 	for (VertexSet::const_iterator cur = Parent::vertices().begin(); cur != Parent::vertices().end(); ++cur)
 		out << &(**cur) << ", ";
 	out << "value = " << value();
--- a/examples/ar-vineyard/ar-vineyard.hpp	Sat Mar 01 04:48:49 2008 -0500
+++ b/examples/ar-vineyard/ar-vineyard.hpp	Sun Mar 02 16:11:05 2008 -0500
@@ -6,7 +6,7 @@
 static rlog::RLogChannel* rlARVineyard =                        DEF_CHANNEL("ar/vineyard", rlog::Log_Debug);
 static rlog::RLogChannel* rlARVineyardComputing =               DEF_CHANNEL("ar/vineyard/computing", rlog::Log_Debug);
 static rlog::RLogChannel* rlARVineyardSwap =                    DEF_CHANNEL("ar/vineyard/swap", rlog::Log_Debug);
-static rlog::RLogChannel* rlARVineyardConeSimplexSwap =         DEF_CHANNEL("ar/vineyard/conesimplex/swap", rlog::Log_Debug);
+static rlog::RLogChannel* rlARVineyardThresholdSwap =           DEF_CHANNEL("ar/vineyard/threshold/swap", rlog::Log_Debug);
 #endif
 
 
@@ -20,8 +20,8 @@
 ARConeSimplex3D<Simulator_>::
 swap_thresholds(ThresholdListIterator i, Simulator* simulator)
 {
-    rLog(rlARVineyardConeSimplexSwap, "Transposing %s and %s", tostring(*i).c_str(),
-                                                               tostring(*boost::next(i)).c_str());
+    rLog(rlARVineyardThresholdSwap, "Transposing %s and %s", tostring(*i).c_str(),
+                                                             tostring(*boost::next(i)).c_str());
 	typename ThresholdList::iterator n = boost::next(i);
 	thresholds_.splice(i, thresholds_, n);
 	if (boost::next(i) == thresholds_.end())
@@ -135,9 +135,9 @@
 ARVineyard::
 swap(Index i, Simulator* simulator)
 {
-    rLog(rlARVineyardSwap, "Transposing %p and %p: %s and %s", 
-                            &(*i), &(*boost::next(i)),
-                            tostring(*i).c_str(), tostring(*boost::next(i)).c_str());
+    rLog(rlARVineyardSwap, "Transposing %p and %p:", &(*i), &(*boost::next(i)));
+    rLog(rlARVineyardSwap, "  %s and", tostring(*i).c_str());
+    rLog(rlARVineyardSwap, "  %s", tostring(*boost::next(i)).c_str());
 	filtration_->transpose(i);
 }
 
--- a/include/topology/cycle.hpp	Sat Mar 01 04:48:49 2008 -0500
+++ b/include/topology/cycle.hpp	Sun Mar 02 16:11:05 2008 -0500
@@ -166,7 +166,8 @@
 {
 	for (const_iterator cur = begin(); cur != end(); ++cur)
 	{
-		out << **cur << ", ";
+        if (cur != begin()) out << ", ";
+		out << **cur;
 	}
 	// out << "(last: " << *last << ")";  // For debugging only
 	return out;
--- a/include/topology/filtration.h	Sat Mar 01 04:48:49 2008 -0500
+++ b/include/topology/filtration.h	Sun Mar 02 16:11:05 2008 -0500
@@ -65,7 +65,7 @@
 		/// Computes RU decomposition of the simplices in [bg, end) range, assuming that everything before bg has been paired 
 		void 							pair_simplices(Index bg, Index end, bool store_trails = true);
 		void 							pair_simplices(bool store_trails = true)	{ pair_simplices(begin(), end(), store_trails); }
-		bool							transpose(Index i, bool maintain_lazy = true);
+		bool							transpose(Index i, bool maintain_lazy = false);
 		bool							is_paired() const;
 		Index							append(const Simplex& s);					///< Appends s to the filtration
 		Index							insert(Index prior, const Simplex& s);		///< Inserts s after prior
--- a/include/topology/filtration.hpp	Sat Mar 01 04:48:49 2008 -0500
+++ b/include/topology/filtration.hpp	Sun Mar 02 16:11:05 2008 -0500
@@ -116,6 +116,15 @@
 	
 	Index i_orig = i++;
 	
+    rLog(rlFiltrationTranspositions, "Transposing:");
+    rLog(rlFiltrationTranspositions, "  %s: (%s | %s)", 
+                                     tostring(*i_orig).c_str(), tostring(i_orig->cycle()).c_str(),
+                                                                tostring(i_orig->trail()).c_str());
+    rLog(rlFiltrationTranspositions, "    and");
+    rLog(rlFiltrationTranspositions, "  %s: (%s | %s)", 
+                                     tostring(*i).c_str(), tostring(i->cycle()).c_str(),
+                                                           tostring(i->trail()).c_str());
+
 	AssertMsg(i_orig->pair() != i, "Transposing simplices must not be paired");
 	bool result = transpose_simplices(i_orig, maintain_lazy);
 	AssertMsg(i_orig == boost::next(i), "Wrong indices after transposition");
--- a/include/utilities/consistencylist.h	Sat Mar 01 04:48:49 2008 -0500
+++ b/include/utilities/consistencylist.h	Sun Mar 02 16:11:05 2008 -0500
@@ -144,7 +144,7 @@
 	T 				data;
 	OrderType		consistency;
 
-	std::ostream& 		operator<<(std::ostream& out) const					{ return out << data << ": " << consistency; }
+	std::ostream& 		operator<<(std::ostream& out) const					{ return out << consistency << ": " << data; }
 };
 
 template<class T>
--- a/include/utilities/eventqueue.h	Sat Mar 01 04:48:49 2008 -0500
+++ b/include/utilities/eventqueue.h	Sun Mar 02 16:11:05 2008 -0500
@@ -57,7 +57,8 @@
 {
 	QueueRepresentation tmp;
 	tmp.splice(tmp.end(), queue_, i);
-	iterator pos = std::find_if(queue_.begin(), queue_.end(), std::not1(std::bind2nd(EventComparison(), *i)));
+	//iterator pos = std::find_if(queue_.begin(), queue_.end(), std::not1(std::bind2nd(EventComparison(), *i)));
+	iterator pos = std::find_if(queue_.begin(), queue_.end(), std::bind1st(EventComparison(), *i));
 	queue_.splice(pos, tmp);
 }