--- a/CMakeLists.txt Thu Sep 13 10:31:39 2007 -0400
+++ b/CMakeLists.txt Fri Sep 14 05:51:51 2007 -0400
@@ -11,9 +11,6 @@
find_library (dsrpdb_LIBRARY NAMES dsrpdb)
find_path (dsrpdb_INCLUDE_DIR dsrpdb/Protein.h)
-set (libraries ${libraries}
- ${dsrpdb_LIBRARY})
-
#CGAL
execute_process (COMMAND ${CMAKE_MAKE_PROGRAM} -f ${CMAKE_CURRENT_SOURCE_DIR}/FindCGAL.Makefile libpaths
OUTPUT_VARIABLE cgal_libpaths)
@@ -46,12 +43,6 @@
# Debugging
if (debug)
-# find_library (cwd_LIBRARY NAMES cwd)
-# find_path (cwd_INCLUDE_DIR libcwd/debug.h)
-# set (cwd_INCLUDE_DIR ${cwd_INCLUDE_DIR}/libcwd)
-# add_definitions (-DCWDEBUG -g)
-# set (external_sources ${CMAKE_CURRENT_SOURCE_DIR}/src/debug.cpp)
-# set (libraries ${libraries} ${cwd_LIBRARY})
add_definitions (-g)
else (debug)
add_definitions (-DNDEBUG)
@@ -95,6 +86,6 @@
# DEPENDS Doxyfile)
endif (DOXYGEN_FOUND)
-# Set external sources
+# Process subdirectories
add_subdirectory (examples)
add_subdirectory (tests)
--- a/examples/alphashapes/CMakeLists.txt Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/alphashapes/CMakeLists.txt Fri Sep 14 05:51:51 2007 -0400
@@ -3,6 +3,6 @@
alpharadius)
foreach (t ${targets})
- add_executable (${t} ${t}.cpp ${external_sources})
- target_link_libraries (${t} ${cgal_libraries})
+ add_executable (${t} ${t}.cpp)
+ target_link_libraries (${t} ${libraries} ${cgal_libraries})
endforeach (t ${targets})
--- a/examples/alphashapes/alpharadius.cpp Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/alphashapes/alpharadius.cpp Fri Sep 14 05:51:51 2007 -0400
@@ -1,5 +1,4 @@
-#include <utilities/sys.h>
-#include <utilities/debug.h>
+#include <utilities/log.h>
#include "alphashapes3d.h"
#include <topology/filtration.h>
@@ -48,11 +47,12 @@
int main(int argc, char** argv)
{
-#ifdef CWDEBUG
- Debug(dc::filtration.on());
- //Debug(dc::cycle.on());
+#ifdef LOGGING
+ rlog::RLogInit(argc, argv);
- dionysus::debug::init();
+ stdoutLog.subscribeTo( RLOG_CHANNEL("error") );
+ stdoutLog.subscribeTo( RLOG_CHANNEL("topology/filtration") );
+ //stdoutLog.subscribeTo( RLOG_CHANNEL("topology/cycle") );
#endif
std::istream& in = std::cin;
--- a/examples/alphashapes/alphashapes3d.cpp Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/alphashapes/alphashapes3d.cpp Fri Sep 14 05:51:51 2007 -0400
@@ -1,5 +1,4 @@
-#include <utilities/sys.h>
-#include <utilities/debug.h>
+#include <utilities/log.h>
#include "alphashapes3d.h"
#include <topology/filtration.h>
@@ -11,6 +10,16 @@
int main(int argc, char** argv)
{
+#ifdef LOGGING
+ rlog::RLogInit(argc, argv);
+
+ stdoutLog.subscribeTo( RLOG_CHANNEL("error") );
+ stdoutLog.subscribeTo( RLOG_CHANNEL("topology/filtration") );
+ //stdoutLog.subscribeTo( RLOG_CHANNEL("topology/cycle") );
+#endif
+
+ SetFrequency(GetCounter("filtration/pair"), 10000);
+
// Read in the point set and compute its Delaunay triangulation
std::istream& in = std::cin;
double x,y,z;
--- a/examples/ar-vineyard/CMakeLists.txt Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/ar-vineyard/CMakeLists.txt Fri Sep 14 05:51:51 2007 -0400
@@ -2,6 +2,6 @@
ar-vineyard)
foreach (t ${targets})
- add_executable (${t} ${t}.cpp ${external_sources})
+ add_executable (${t} ${t}.cpp)
target_link_libraries (${t} ${libraries} ${cgal_libraries})
endforeach (t)
--- a/examples/ar-vineyard/ar-vineyard.cpp Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/ar-vineyard/ar-vineyard.cpp Fri Sep 14 05:51:51 2007 -0400
@@ -1,5 +1,4 @@
-#include <utilities/sys.h>
-#include <utilities/debug.h>
+#include <utilities/log.h>
#include "ar-vineyard.h"
@@ -9,14 +8,15 @@
int main(int argc, char** argv)
{
-#ifdef CWDEBUG
- Debug(dc::filtration.off());
- Debug(dc::cycle.off());
- Debug(dc::vineyard.off());
- Debug(dc::transpositions.off());
- Debug(dc::lsfiltration.off());
+#ifdef LOGGING
+ rlog::RLogInit(argc, argv);
- dionysus::debug::init();
+ stdoutLog.subscribeTo( RLOG_CHANNEL("error") );
+ //stdoutLog.subscribeTo( RLOG_CHANNEL("topology/filtration") );
+ //stdoutLog.subscribeTo( RLOG_CHANNEL("topology/cycle") );
+ //stdoutLog.subscribeTo( RLOG_CHANNEL("topology/vineyard") );
+ //stdoutLog.subscribeTo( RLOG_CHANNEL("topology/filtration/transpositions") );
+ //stdoutLog.subscribeTo( RLOG_CHANNEL("topology/lowerstar") );
#endif
// Read command-line arguments
--- a/examples/ar-vineyard/ar-vineyard.h Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/ar-vineyard/ar-vineyard.h Fri Sep 14 05:51:51 2007 -0400
@@ -6,9 +6,6 @@
#ifndef __AR_VINEYARD_H__
#define __AR_VINEYARD_H__
-#include "utilities/sys.h"
-#include "utilities/debug.h"
-
#include "topology/conesimplex.h"
#include "topology/filtration.h"
--- a/examples/ar-vineyard/ar-vineyard.hpp Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/ar-vineyard/ar-vineyard.hpp Fri Sep 14 05:51:51 2007 -0400
@@ -1,3 +1,5 @@
+#include <utilities/log.h>
+
/* Implementation */
ARVineyard::
--- a/examples/cech-complex/CMakeLists.txt Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/cech-complex/CMakeLists.txt Fri Sep 14 05:51:51 2007 -0400
@@ -2,6 +2,6 @@
cech-complex)
foreach (t ${targets})
- add_executable (${t} ${t}.cpp ${external_sources})
- target_link_libraries (${t} ${libraries} ${cgal_libraries})
+ add_executable (${t} ${t}.cpp)
+ target_link_libraries (${t} ${libraries})
endforeach (t ${targets})
--- a/examples/cech-complex/cech-complex.cpp Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/cech-complex/cech-complex.cpp Fri Sep 14 05:51:51 2007 -0400
@@ -1,5 +1,4 @@
-#include <utilities/sys.h>
-#include <utilities/debug.h>
+#include <utilities/log.h>
#include <topology/simplex.h>
#include <topology/filtration.h>
--- a/examples/grid/CMakeLists.txt Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/grid/CMakeLists.txt Fri Sep 14 05:51:51 2007 -0400
@@ -4,6 +4,6 @@
combustion-vineyard)
foreach (t ${targets})
- add_executable (${t} ${t}.cpp ${external_sources})
- target_link_libraries (${t} ${libraries} ${cgal_libraries})
+ add_executable (${t} ${t}.cpp)
+ target_link_libraries (${t} ${libraries} ${cgal_libraries} ${dsrpdb_LIBRARY})
endforeach (t ${targets})
--- a/examples/grid/combustion-vineyard.cpp Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/grid/combustion-vineyard.cpp Fri Sep 14 05:51:51 2007 -0400
@@ -3,8 +3,7 @@
* Department of Computer Science, Duke University, 2005
*/
-#include <utilities/sys.h>
-#include <utilities/debug.h>
+#include <utilities/log.h>
#include <iostream>
#include <fstream>
--- a/examples/grid/grid2Dvineyard.h Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/grid/grid2Dvineyard.h Fri Sep 14 05:51:51 2007 -0400
@@ -6,9 +6,6 @@
#ifndef __GRID2DVINEYARD_H__
#define __GRID2DVINEYARD_H__
-#include "utilities/sys.h"
-#include "utilities/debug.h"
-
#include "grid2D.h"
#include "topology/lowerstarfiltration.h"
--- a/examples/grid/grid2Dvineyard.hpp Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/grid/grid2Dvineyard.hpp Fri Sep 14 05:51:51 2007 -0400
@@ -1,3 +1,5 @@
+#include <utilities/log.h>
+
/* Implementation */
Grid2DVineyard::
--- a/examples/grid/pdbdistance-vineyard.cpp Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/grid/pdbdistance-vineyard.cpp Fri Sep 14 05:51:51 2007 -0400
@@ -1,6 +1,5 @@
//#include <boost/archive/binary_oarchive.hpp>
-#include "utilities/sys.h"
-#include "utilities/debug.h"
+#include "utilities/log.h"
#include "pdbdistance.h"
#include "grid2Dvineyard.h"
@@ -18,14 +17,13 @@
int main(int argc, char** argv)
{
-#ifdef CWDEBUG
- Debug(dc::filtration.off());
- Debug(dc::cycle.off());
- Debug(dc::vineyard.off());
- Debug(dc::transpositions.off());
- Debug(dc::lsfiltration.off());
+#ifdef LOGGING
+ rlog::RLogInit(argc, argv);
- dionysus::debug::init();
+ stdoutLog.subscribeTo( RLOG_CHANNEL("topology/filtration") );
+ stdoutLog.subscribeTo( RLOG_CHANNEL("topology/cycle") );
+ stdoutLog.subscribeTo( RLOG_CHANNEL("topology/vineyard") );
+ stdoutLog.subscribeTo( RLOG_CHANNEL("topology/lowerstar") );
#endif
if (argc < 5)
--- a/examples/triangle/CMakeLists.txt Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/triangle/CMakeLists.txt Fri Sep 14 05:51:51 2007 -0400
@@ -2,6 +2,6 @@
triangle)
foreach (t ${targets})
- add_executable (${t} ${t}.cpp ${external_sources})
+ add_executable (${t} ${t}.cpp)
target_link_libraries (${t} ${libraries})
endforeach (t ${targets})
--- a/examples/triangle/triangle.cpp Thu Sep 13 10:31:39 2007 -0400
+++ b/examples/triangle/triangle.cpp Fri Sep 14 05:51:51 2007 -0400
@@ -1,3 +1,5 @@
+#include <utilities/log.h>
+
#include "topology/filtration.h"
#include "topology/simplex.h"
#include <vector>
@@ -24,15 +26,14 @@
f.append(Simplex(bg, bg + 3, 5)); // ABC
}
-int main()
+int main(int argc, char** argv)
{
-#ifdef CWDEBUG
- dionysus::debug::init();
+#ifdef LOGGING
+ rlog::RLogInit(argc, argv);
- Debug(dc::filtration.on());
- Debug(dc::cycle.off());
- Debug(dc::vineyard.on());
- Debug(dc::transpositions.on());
+ stdoutLog.subscribeTo(RLOG_CHANNEL("topology/filtration"));
+ //stdoutLog.subscribeTo(RLOG_CHANNEL("topology/cycle"));
+ stdoutLog.subscribeTo(RLOG_CHANNEL("topology/vineyard"));
#endif
Evaluator<Simplex> e;
--- a/include/topology/cycle.h Thu Sep 13 10:31:39 2007 -0400
+++ b/include/topology/cycle.h Fri Sep 14 05:51:51 2007 -0400
@@ -6,9 +6,6 @@
#ifndef __CYCLE_H__
#define __CYCLE_H__
-#include "utilities/sys.h"
-#include "utilities/debug.h"
-
#include "utilities/types.h"
#include "utilities/circular_list.h"
#include <list>
--- a/include/topology/cycle.hpp Thu Sep 13 10:31:39 2007 -0400
+++ b/include/topology/cycle.hpp Fri Sep 14 05:51:51 2007 -0400
@@ -6,9 +6,15 @@
#include <boost/serialization/binary_object.hpp>
#include <boost/utility.hpp>
+#include "utilities/log.h"
+
using boost::serialization::make_nvp;
using boost::serialization::make_binary_object;
+#ifdef LOGGING
+static rlog::RLogChannel* rlCycle = DEF_CHANNEL( "topology/cycle", rlog::Log_Debug);
+#endif // LOGGING
+
template<class I, class OrderCmp, class ConsistencyCmp>
Cycle<I,OrderCmp,ConsistencyCmp>::
Cycle(): sz(0)
@@ -80,7 +86,7 @@
AssertMsg(!empty(), "Cycle must not be empty for get_second()");
if (size() < 2) return begin(); // Indicates that there is no second.
- Dout(dc::cycle, "Looking for second");
+ rLog(rlCycle, "Looking for second");
AssertMsg(size() >= 2, "Cycle must have at least two elements for get_second()");
iterator min = begin();
iterator second = ++begin();
@@ -98,7 +104,7 @@
}
}
- Dout(dc::cycle, "Looked up: " << **second);
+ rLog(rlCycle, "Looked up: %s", tostring(**second).c_str());
return second;
}
@@ -143,7 +149,7 @@
for (iterator cur = begin(); cur != end(); ++cur)
while ((cur != end()) && ((*cur == j) || (cmp(*cur, j) && cmp(i, *cur))))
{
- Dout(dc::cycle, "Iteration of the erase while loop");
+ rLog(rlCycle, "Iteration of the erase while loop");
cur = erase(cur);
}
}
@@ -173,7 +179,7 @@
Cycle<I, OrderCmp, ConsistencyCmp>::
add(const Self& c, const ConsistencyCmp& cmp)
{
- Dout(dc::cycle, "Adding cycles: " << *this << " + " << c);
+ rLog(rlCycle, "Adding cycles: %s + %s", tostring(*this).c_str(), tostring(c).c_str());
iterator cur1 = begin();
const_iterator cur2 = c.begin();
@@ -184,33 +190,33 @@
{
while (cur2 != c.end())
push_back(*cur2++);
- Dout(dc::cycle, "After addition: " << *this);
+ rLog(rlCycle, "After addition: %s", tostring(*this).c_str());
return *this;
}
// mod 2
int res = cmp.compare(*cur1, *cur2);
- Dout(dc::cycle, "Comparison result: " << res);
+ rLog(rlCycle, "Comparison result: %i", res);
if (res == 0) // *cur1 == *cur2
{
- Dout(dc::cycle, "Equality");
+ rLog(rlCycle, "Equality");
cur1 = erase(cur1); // erase cur1 --- as a result cur1 will be pointing at old_cur1++
--sz;
++cur2;
} else if (res < 0) // *cur1 < *cur2
{
- Dout(dc::cycle, "Less than");
+ rLog(rlCycle, "Less than");
cur1++;
} else if (res > 0) // *cur1 > *cur2
{
- Dout(dc::cycle, "Greater than");
+ rLog(rlCycle, "Greater than");
insert(cur1, *cur2);
++cur2;
++sz;
}
}
- Dout(dc::cycle, "After addition: " << *this);
+ rLog(rlCycle, "After addition: %s", tostring(*this).c_str());
return *this;
}
--- a/include/topology/filtration.h Thu Sep 13 10:31:39 2007 -0400
+++ b/include/topology/filtration.h Fri Sep 14 05:51:51 2007 -0400
@@ -6,8 +6,7 @@
#ifndef __FILTRATION_H__
#define __FILTRATION_H__
-#include "utilities/sys.h"
-#include "utilities/debug.h"
+#include "utilities/log.h"
#include "filtrationcontainer.h"
#include "filtrationsimplex.h"
@@ -92,8 +91,8 @@
std::ostream& operator<<(std::ostream& out) const;
- protected:
- /// \name Comparator accessors (protected)
+ public: // doesn't really need to be public, except for assertions
+ /// \name Comparator accessors
/// @{
const ConsistencyComparator& get_consistency_cmp() const { return consistency_cmp; }
const CyclesComparator& get_cycles_cmp() const { return cycles_cmp; }
--- a/include/topology/filtration.hpp Thu Sep 13 10:31:39 2007 -0400
+++ b/include/topology/filtration.hpp Fri Sep 14 05:51:51 2007 -0400
@@ -11,13 +11,18 @@
using boost::serialization::make_nvp;
/* Filtration Public */
-
+
+#ifdef LOGGING
+static rlog::RLogChannel* rlFiltration = DEF_CHANNEL("topology/filtration", rlog::Log_Debug);
+static rlog::RLogChannel* rlFiltrationTranspositions = DEF_CHANNEL("topology/filtration/transpositions", rlog::Log_Debug);
+#endif // LOGGING
+
+#ifdef COUNTERS
static Counter* cFiltrationPair = GetCounter("filtration/pair");
static Counter* cFiltrationPairBoundaries = GetCounter("filtration/pair/boundaries");
static Counter* cFiltrationPairCycleLength = GetCounter("filtration/pair/cyclelength");
static Counter* cFiltrationTransposition = GetCounter("filtration/transposition");
static Counter* cFiltrationTranspositionDiffDim = GetCounter("filtration/transposition/diffdim");
-static Counter* cFiltrationTranspositionCase1 = GetCounter("filtration/transposition/case/1");
static Counter* cFiltrationTranspositionCase12 = GetCounter("filtration/transposition/case/1/2");
static Counter* cFiltrationTranspositionCase112 = GetCounter("filtration/transposition/case/1/1/2");
static Counter* cFiltrationTranspositionCase111 = GetCounter("filtration/transposition/case/1/1/1");
@@ -27,6 +32,7 @@
static Counter* cFiltrationTranspositionCase32 = GetCounter("filtration/transposition/case/3/2");
static Counter* cFiltrationTranspositionCase31 = GetCounter("filtration/transposition/case/3/1");
static Counter* cFiltrationTranspositionCase4 = GetCounter("filtration/transposition/case/4");
+#endif // COUNTERS
template<class S, class FS, class V>
@@ -39,17 +45,13 @@
Filtration<S, FS, V>::
pair_simplices(Index bg, Index end)
{
- int i = 0;
- Dout(dc::filtration, "Entered: compute_pairing");
+ rLog(rlFiltration, "Entered: compute_pairing");
for (Index j = bg; j != end; ++j)
{
- if (i++ % 10000 == 0)
- std::cout << i << " simplices processed" << std::endl;
-
- Dout(dc::filtration|flush_cf|continued_cf, *j << ": ");
+ rLog(rlFiltration, "Simplex %s", tostring(*j).c_str());
init_cycle_trail(j);
Cycle& bdry = j->cycle();
- Dout(dc::finish, bdry);
+ rLog(rlFiltration, " has boundary: %s", tostring(bdry).c_str());
CountNum(cFiltrationPairBoundaries, j->dimension());
Count(cFiltrationPair);
@@ -57,28 +59,31 @@
while(!bdry.empty())
{
Index i = bdry.top(cycles_cmp);
- Dout(dc::filtration, *i << ": " << *(i->pair()));
- AssertMsg(!cycles_cmp(i, j), "Simplices in the cycle must precede current simplex: " <<
- "(" << *i << " in cycle of " << *j << ")");
+ rLog(rlFiltration, "%s: %s", tostring(*i).c_str(), tostring(*(i->pair())).c_str());
+ AssertMsg(!cycles_cmp(i, j),
+ "Simplices in the cycle must precede current simplex: (%s in cycle of %s)",
+ tostring(*i).c_str(), tostring(*j).c_str());
// i is not paired, so we pair j with i
if (i->pair() == i)
{
- Dout(dc::filtration, "Pairing " << *i << " and " << *j << " with cycle " << j->cycle());
+ rLog(rlFiltration, "Pairing %s and %s with cycle %s",
+ tostring(*i).c_str(), tostring(*j).c_str(),
+ tostring(j->cycle()).c_str());
i->set_pair(j);
j->set_pair(i);
CountNum(cFiltrationPairCycleLength, j->cycle().size());
break;
}
- // continue searching --- change the Dout to the continued mode with newlines FIXME
- Dout(dc::filtration, " Adding: [" << bdry << "] + ");
- Dout(dc::filtration, " [" << i->pair()->cycle() << "]");
+ rLog(rlFiltration, " Adding: [%s] + [%s]",
+ 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());
- Dout(dc::filtration, "After addition: " << bdry);
+ rLog(rlFiltration, "After addition: %s", tostring(bdry).c_str());
}
- Dout(dc::filtration, "Finished with " << *j << ": " << *(j->pair()));
+ rLog(rlFiltration, "Finished with %s: %s",
+ tostring(*j).c_str(), tostring(*(j->pair())).c_str());
}
paired = true;
}
@@ -195,7 +200,7 @@
if (i_prev->dimension() != i->dimension())
{
swap(i_prev, i);
- Dout(dc::transpositions, "Different dimension");
+ rLog(rlFiltrationTranspositions, "Different dimension");
Count(cFiltrationTranspositionDiffDim);
return false;
}
@@ -203,13 +208,13 @@
bool si = i_prev->sign(), sii = i->sign();
if (si && sii)
{
- Dout(dc::transpositions, "Trail prev: " << i_prev->trail());
+ rLog(rlFiltrationTranspositions, "Trail prev: %s", tostring(i_prev->trail()).c_str());
// Case 1
TrailIterator i_in_i_prev = std::find(i_prev->trail().begin(), i_prev->trail().end(), i);
if (i_in_i_prev != i_prev->trail().end())
{
- Dout(dc::transpositions, "Case 1, U[i,i+1] = 1");
+ rLog(rlFiltrationTranspositions, "Case 1, U[i,i+1] = 1");
i_prev->trail().erase(i_in_i_prev);
}
@@ -220,8 +225,8 @@
if (l == i)
{
swap(i_prev, i);
- Dout(dc::transpositions, "Case 1.2 --- unpaired");
- Dout(dc::transpositions, *i_prev);
+ rLog(rlFiltrationTranspositions, "Case 1.2 --- unpaired");
+ rLog(rlFiltrationTranspositions, "%s", tostring(*i_prev).c_str());
Count(cFiltrationTranspositionCase12);
return false;
} else if (k == i_prev)
@@ -230,8 +235,8 @@
{
// Case 1.2
swap(i_prev, i);
- Dout(dc::transpositions, "Case 1.2 --- unpaired");
- Dout(dc::transpositions, *i_prev);
+ rLog(rlFiltrationTranspositions, "Case 1.2 --- unpaired");
+ rLog(rlFiltrationTranspositions, tostring(*i_prev).c_str());
Count(cFiltrationTranspositionCase12);
return false;
} else
@@ -239,14 +244,14 @@
// Case 1.1.2 --- special version (plain swap, but pairing switches)
swap(i_prev, i);
pairing_switch(i_prev, i);
- Dout(dc::transpositions, "Case 1.1.2 --- unpaired");
- Dout(dc::transpositions, *i_prev);
+ rLog(rlFiltrationTranspositions, "Case 1.1.2 --- unpaired");
+ rLog(rlFiltrationTranspositions, tostring(*i_prev).c_str());
Count(cFiltrationTranspositionCase112);
return true;
}
}
- Dout(dc::transpositions, "l cycle: " << l->cycle());
+ rLog(rlFiltrationTranspositions, "l cycle: %s", tostring(l->cycle()).c_str());
if (std::find(l->cycle().begin(), l->cycle().end(), i_prev) == l->cycle().end())
{
// Case 1.2
@@ -260,7 +265,7 @@
}
}
swap(i_prev, i);
- Dout(dc::transpositions, "Case 1.2");
+ rLog(rlFiltrationTranspositions, "Case 1.2");
Count(cFiltrationTranspositionCase12);
return false;
} else
@@ -272,7 +277,7 @@
swap(i_prev, i);
l->cycle().add(k->cycle(), Filtration::get_consistency_cmp()); // Add column k to l
k->trail().add(l->trail(), Filtration::get_consistency_cmp()); // Add row l to k
- Dout(dc::transpositions, "Case 1.1.1");
+ rLog(rlFiltrationTranspositions, "Case 1.1.1");
Count(cFiltrationTranspositionCase111);
return false;
} else
@@ -282,7 +287,7 @@
k->cycle().add(l->cycle(), Filtration::get_consistency_cmp()); // Add column l to k
l->trail().add(k->trail(), Filtration::get_consistency_cmp()); // Add row k to l
pairing_switch(i_prev, i);
- Dout(dc::transpositions, "Case 1.1.2");
+ rLog(rlFiltrationTranspositions, "Case 1.1.2");
Count(cFiltrationTranspositionCase112);
return true;
}
@@ -294,7 +299,7 @@
{
// Case 2.2
swap(i_prev, i);
- Dout(dc::transpositions, "Case 2.2");
+ rLog(rlFiltrationTranspositions, "Case 2.2");
Count(cFiltrationTranspositionCase22);
return false;
} else
@@ -311,13 +316,13 @@
i_prev->cycle().add(i->cycle(), Filtration::get_consistency_cmp()); // Add column i to i_prev (after transposition)
i->trail().add(i_prev->trail(), Filtration::get_consistency_cmp()); // Add row i to i_prev
pairing_switch(i_prev, i);
- Dout(dc::transpositions, "Case 2.1.2");
+ rLog(rlFiltrationTranspositions, "Case 2.1.2");
Count(cFiltrationTranspositionCase212);
return true;
}
// Case 2.1.1
- Dout(dc::transpositions, "Case 2.1.1");
+ rLog(rlFiltrationTranspositions, "Case 2.1.1");
Count(cFiltrationTranspositionCase211);
return false;
}
@@ -328,7 +333,7 @@
{
// Case 3.2
swap(i_prev, i);
- Dout(dc::transpositions, "Case 3.2");
+ rLog(rlFiltrationTranspositions, "Case 3.2");
Count(cFiltrationTranspositionCase32);
return false;
} else
@@ -340,7 +345,7 @@
i_prev->cycle().add(i->cycle(), Filtration::get_consistency_cmp()); // Add column i_prev to i (after transposition)
i->trail().add(i_prev->trail(), Filtration::get_consistency_cmp()); // Add row i to i_prev
pairing_switch(i_prev, i);
- Dout(dc::transpositions, "Case 3.1");
+ rLog(rlFiltrationTranspositions, "Case 3.1");
Count(cFiltrationTranspositionCase31);
return true;
}
@@ -350,11 +355,11 @@
TrailIterator i_in_i_prev = std::find(i_prev->trail().begin(), i_prev->trail().end(), i);
if (i_in_i_prev != i_prev->trail().end())
{
- Dout(dc::transpositions, "Case 4, U[i,i+1] = 1");
+ rLog(rlFiltrationTranspositions, "Case 4, U[i,i+1] = 1");
i_prev->trail().erase(i_in_i_prev);
}
swap(i_prev, i);
- Dout(dc::transpositions, "Case 4");
+ rLog(rlFiltrationTranspositions, "Case 4");
Count(cFiltrationTranspositionCase4);
return false;
}
@@ -373,7 +378,8 @@
for (typename Simplex::Cycle::const_iterator cur = bdry.begin(); cur != bdry.end(); ++cur)
{
- Dout(dc::filtration, "Appending in init_cycle_trail(): " << *cur);
+ rLog(rlFiltrationTranspositions, "Appending in init_cycle_trail(): %s",
+ tostring(*cur).c_str());
AssertMsg(get_index(*cur) != end(), "Non-existent simplex in the cycle");
j->cycle().append(get_index(*cur), get_consistency_cmp());
}
@@ -421,7 +427,7 @@
SizeType sz = size();
ar << make_nvp("size", sz);
- Dout(dc::filtration, "Size: " << sz);
+ rLog(rlFiltration, "Size: %i", sz);
/* Record integer indices */
IndexIntMap index_map; SizeType i = 0;
@@ -437,7 +443,7 @@
//FiltrationSimplexSerialization simplex = FiltrationSimplexSerialization(*cur, index_map);
//ar << make_nvp("FiltrationSimplex", simplex);
}
- Dout(dc::filtration, count << " simplices serialized");
+ rLog(rlFiltration, "%i simplices serialized", count);
}
template<class S, class FS, class V>
@@ -446,16 +452,16 @@
Filtration<S, FS, V>::
load(Archive& ar, version_type )
{
- Dout(dc::filtration, "Starting to read filtration");
+ rLog(rlFiltration, "Starting to read filtration");
ar >> BOOST_SERIALIZATION_NVP(paired);
ar >> BOOST_SERIALIZATION_NVP(cycles_cmp);
ar >> BOOST_SERIALIZATION_NVP(trails_cmp);
ar >> BOOST_SERIALIZATION_NVP(consistency_cmp);
- Dout(dc::filtration, "In Filtration: first block read");
+ rLog(rlFiltration, "In Filtration: first block read");
SizeType sz;
ar >> make_nvp("size", sz);
- Dout(dc::filtration, "In Filtration: size read " << sz);
+ rLog(rlFiltration, "In Filtration: size read %i", sz);
IndexVector index_vector(sz);
for (SizeType i = 0; i < sz; ++i)
@@ -470,10 +476,10 @@
//FiltrationSimplexSerialization simplex;
//ar >> make_nvp("FiltrationSimplex", simplex);
count++;
- Dout(dc::filtration, "In Filtration: simplex read (" << count << ")");
+ rLog(rlFiltration, "In Filtration: simplex read (%i)", count);
//simplex.set_filtration_simplex(*index_vector[i], index_vector);
}
- Dout(dc::filtration, "In Filtration: simplices read");
+ rLog(rlFiltration, "In Filtration: simplices read");
}
template<class S, class FS, class V>
--- a/include/topology/filtrationsimplex.h Thu Sep 13 10:31:39 2007 -0400
+++ b/include/topology/filtrationsimplex.h Fri Sep 14 05:51:51 2007 -0400
@@ -6,9 +6,6 @@
#ifndef __FILTRATIONSIMPLEX_H__
#define __FILTRATIONSIMPLEX_H__
-#include "utilities/sys.h"
-#include "utilities/debug.h"
-
#include "filtrationcontainer.h"
#include "vineyard.h"
#include "utilities/types.h"
--- a/include/topology/lowerstarfiltration.h Thu Sep 13 10:31:39 2007 -0400
+++ b/include/topology/lowerstarfiltration.h Fri Sep 14 05:51:51 2007 -0400
@@ -6,8 +6,7 @@
#ifndef __LOWERSTARFILTRATION_H__
#define __LOWERSTARFILTRATION_H__
-#include "utilities/sys.h"
-#include "utilities/debug.h"
+#include "utilities/log.h"
#include "filtration.h"
#include "simplex.h"
--- a/include/topology/lowerstarfiltration.hpp Thu Sep 13 10:31:39 2007 -0400
+++ b/include/topology/lowerstarfiltration.hpp Fri Sep 14 05:51:51 2007 -0400
@@ -1,9 +1,15 @@
#include "utilities/counter.h"
/* Implementations */
-
+
+#ifdef LOGGING
+static rlog::RLogChannel* rlLowerStar = DEF_CHANNEL("lowerstar", rlog::Log_Debug);
+#endif // LOGGING
+
+#ifdef COUNTERS
static Counter* cLowerStarTransposition = GetCounter("lowerstar");
static Counter* cLowerStarChangedAttachment = GetCounter("lowerstar/ChangedAttachment");
+#endif // COUNTERS
template<class VI, class Smplx, class FltrSmplx, class Vnrd>
template<class VertexCmp>
@@ -65,8 +71,9 @@
transpose_vertices(const VertexOrderIndex& order)
{
Count(cLowerStarTransposition);
- Dout(dc::lsfiltration, "Transposing vertices (" << order->vertex_index << ", "
- << boost::next(order)->vertex_index << ")");
+ rLog(rlLowerStar, "Transposing vertices (%s, %s)",
+ tostring(order->vertex_index).c_str(),
+ tostring(boost::next(order)->vertex_index).c_str());
Index i = order->simplex_index;
Index i_prev = boost::prior(i);
@@ -86,17 +93,17 @@
result |= transpose(i_next_prev);
i_next_prev = boost::prior(i_next);
}
- Dout(dc::lsfiltration, "Done moving the vertex");
+ rLog(rlLowerStar, "Done moving the vertex");
// Second, move the simplices attached to it
- Dout(dc::lsfiltration, "Moving attached simplices");
+ rLog(rlLowerStar, "Moving attached simplices");
while (j != Parent::end() && j->get_attachment() == v_i_next)
{
- Dout(dc::lsfiltration, " Considering " << *j);
+ rLog(rlLowerStar, " Considering %s", tostring(*j).c_str());
if (nbghrs && j->contains(v_i)) // short circuit
{
Count(cLowerStarChangedAttachment);
- Dout(dc::lsfiltration, " Attachment changed for " << *j);
+ rLog(rlLowerStar, " Attachment changed for %s", tostring(*j).c_str());
j->set_attachment(v_i);
++j;
continue;
@@ -106,13 +113,14 @@
while ((--j_prev)->get_attachment() != v_i_next) // i.e., until we have reached v_i_next
// (and the simplices that follow it) again
{
- Dout(dc::lsfiltration, " Moving: " << *j_prev << ", " << *boost::next(j_prev));
+ rLog(rlLowerStar, " Moving: %s, %s",
+ tostring(*j_prev).c_str(), tostring(*boost::next(j_prev)).c_str());
AssertMsg(j_prev->get_attachment() == v_i, "Simplex preceding the one being moved must be attached to v_i");
result |= transpose(j_prev);
--j_prev;
}
}
- Dout(dc::lsfiltration, "Done moving attached simplices");
+ rLog(rlLowerStar, "Done moving attached simplices");
vertex_order.swap(order, boost::next(order));
return result;
@@ -125,14 +133,17 @@
{
Index j = boost::next(i);
- Dout(dc::lsfiltration, " Transposing (" << *i << ", " << *(i->pair()) << ") and ("
- << *j << ", " << *(j->pair()) << ")");
+ rLog(rlLowerStar, " Transposing (%s, %s) and (%s, %s)",
+ tostring(*i).c_str(), tostring(*(i->pair())).c_str(),
+ tostring(*j).c_str(), tostring(*(j->pair())).c_str());
assert_pairing(i);
assert_pairing(j);
bool res = Parent::transpose(i, false);
- Dout(dc::lsfiltration, " " << *j << ": " << *(j->pair()) << ", " << *i << ": " << *(i->pair()));
+ rLog(rlLowerStar, " %s: %s, %s: %s",
+ tostring(*j).c_str(), tostring(*(j->pair())).c_str(),
+ tostring(*i).c_str(), tostring(*(i->pair())).c_str());
assert_pairing(j);
assert_pairing(i);
@@ -151,10 +162,11 @@
{
if (i->pair() != i->cycle().top(Parent::get_cycles_cmp()))
{
- Dout(dc::lsfiltration, "i (negative): " << *i);
- Dout(dc::lsfiltration, "pair(i): " << *(i->pair()));
- Dout(dc::lsfiltration, "i->cycle().top(): " << *(i->cycle().top(Parent::get_cycles_cmp())));
- DoutFatal(dc::fatal, "Pairing not matching the matrix at " << *i);
+ rLog(rlLowerStar, "i (negative): %s", tostring(*i).c_str());
+ rLog(rlLowerStar, "pair(i): %s", tostring(*(i->pair())).c_str());
+ rLog(rlLowerStar, "i->cycle().top(): %s",
+ tostring(*(i->cycle().top(Parent::get_cycles_cmp()))).c_str());
+ AssertMsg(0, "Pairing not matching the matrix at %s", tostring(*i).c_str());
}
} else
{
@@ -162,11 +174,11 @@
{
if (i->pair()->cycle().top(Parent::get_cycles_cmp()) != i)
{
- Dout(dc::lsfiltration, "i (positive): " << *i);
- Dout(dc::lsfiltration, "pair(i): " << *(i->pair()));
- Dout(dc::lsfiltration, "pair(i)->cycle(): " << i->pair()->cycle());
- Dout(dc::lsfiltration, "pair->cycle().top(): " << *(i->pair()->cycle().top(Parent::get_cycles_cmp())));
- DoutFatal(dc::fatal, "Pairing not matching the matrix at " << *(i->pair()));
+ rLog(rlLowerStar, "i (positive): %s", tostring(*i).c_str());
+ rLog(rlLowerStar, "pair(i): %s", tostring(*(i->pair())).c_str());
+ rLog(rlLowerStar, "pair(i)->cycle(): %s", tostring(i->pair()->cycle()).c_str());
+ rLog(rlLowerStar, "pair->cycle().top(): %s", tostring(*(i->pair()->cycle().top(Parent::get_cycles_cmp()))).c_str());
+ AssertMsg(0, "Pairing not matching the matrix at %s", tostring(*(i->pair())).c_str());
}
}
}
--- a/include/topology/simplex.h Thu Sep 13 10:31:39 2007 -0400
+++ b/include/topology/simplex.h Fri Sep 14 05:51:51 2007 -0400
@@ -6,9 +6,6 @@
#ifndef __SIMPLEX_H__
#define __SIMPLEX_H__
-#include "utilities/sys.h"
-#include "utilities/debug.h"
-
#include <vector>
#include <algorithm>
#include <list>
@@ -41,9 +38,9 @@
vertices_(s.vertices_) {}
template<class Iterator>
SimplexWithVertices(Iterator bg, Iterator end):
- vertices_(bg, end) {}
+ vertices_(bg, end) { std::sort(vertices_.begin(), vertices_.end()); }
SimplexWithVertices(const VertexContainer& v):
- vertices_(v) {}
+ vertices_(v) { std::sort(vertices_.begin(), vertices_.end()); }
SimplexWithVertices(Dimension d, Vertex v):
vertices_() { vertices_.reserve(d+1); add(v); }
SimplexWithVertices(Dimension d):
--- a/include/topology/vineyard.hpp Thu Sep 13 10:31:39 2007 -0400
+++ b/include/topology/vineyard.hpp Fri Sep 14 05:51:51 2007 -0400
@@ -3,6 +3,12 @@
#include <fstream>
#include <sstream>
+#include "utilities/log.h"
+
+#ifdef LOGGING
+static rlog::RLogChannel* rlVineyard = DEF_CHANNEL("topology/vineyard", rlog::Log_Debug);
+#endif // LOGGING
+
template<class FS>
void
Vineyard<FS>::
@@ -50,7 +56,7 @@
Vineyard<FS>::
start_vine(Index i)
{
- Dout(dc::vineyard, "Starting new vine");
+ rLog(rlVineyard, "Starting new vine");
AssertMsg(i->sign(), "Can only start vines for positive simplices");
Dimension dim = i->dimension();
@@ -65,7 +71,7 @@
Vineyard<FS>::
record_diagram(Index bg, Index end)
{
- Dout(dc::vineyard, "Entered: record_diagram()");
+ rLog(rlVineyard, "Entered: record_diagram()");
AssertMsg(evaluator != 0, "Cannot record diagram with a null evaluator");
for (Index i = bg; i != end; ++i)
@@ -104,7 +110,7 @@
Vineyard<FS>::
record_knee(Index i)
{
- Dout(dc::vineyard, "Entered record_knee()");
+ rLog(rlVineyard, "Entered record_knee()");
AssertMsg(evaluator != 0, "Cannot record knee with a null evaluator");
AssertMsg(i->vine() != 0, "Cannot add a knee to a null vine");
AssertMsg(i->sign(), "record_knee() must be called on a positive simplex");
@@ -113,23 +119,23 @@
i->vine()->add(evaluator->value(*i), Infinity, evaluator->time());
else
{
- Dout(dc::vineyard, "Creating knee");
+ rLog(rlVineyard, "Creating knee");
Knee k(evaluator->value(*i), evaluator->value(*(i->pair())), evaluator->time());
- Dout(dc::vineyard, "Knee created: " << k);
+ rLog(rlVineyard, "Knee created: %s", tostring(k).c_str());
if (!k.is_diagonal() || i->vine()->empty()) // non-diagonal k, or empty vine
{
- Dout(dc::vineyard, "Extending a vine");
+ rLog(rlVineyard, "Extending a vine");
i->vine()->add(k);
}
else if (i->vine()->back().is_diagonal()) // last knee is diagonal
{
AssertMsg(i->vine()->size() == 1, "Only first knee may be diagonal for a live vine");
- Dout(dc::vineyard, "Overwriting first diagonal knee");
+ rLog(rlVineyard, "Overwriting first diagonal knee");
i->vine()->back() = k;
} else // finish this vine
{
- Dout(dc::vineyard, "Finishing a vine");
+ rLog(rlVineyard, "Finishing a vine");
i->vine()->add(k);
start_vine(i);
i->vine()->add(k);
@@ -137,7 +143,7 @@
}
i->vine()->back().set_cycle(resolve_cycle(i));
- Dout(dc::vineyard, "Leaving record_knee()");
+ rLog(rlVineyard, "Leaving record_knee()");
}
template<class FS>
@@ -145,7 +151,7 @@
Vineyard<FS>::
resolve_cycle(Index i) const
{
- Dout(dc::vineyard, "Entered resolve_cycle");
+ rLog(rlVineyard, "Entered resolve_cycle");
const Cycle& cycle = i->cycle();
// Resolve simplices
--- a/include/utilities/counter.h Thu Sep 13 10:31:39 2007 -0400
+++ b/include/utilities/counter.h Fri Sep 14 05:51:51 2007 -0400
@@ -15,10 +15,10 @@
#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 SetFrequency(x, freq) do { x->frequency = freq; } while (0);
- #define SetTrigger(x, y) do { x->trigger = y; } while(0);
+ #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 SetFrequency(x, freq) do { x->frequency = freq; } while (0)
+ #define SetTrigger(x, y) do { x->trigger = y; } while(0)
#endif // COUNTERS
--- a/include/utilities/debug.h Thu Sep 13 10:31:39 2007 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-#ifndef DEBUG_H
-#define DEBUG_H
-
-#ifndef CWDEBUG
-
-#include <iostream> // std::cerr
-#include <cstdlib> // std::exit, EXIT_FAILURE
-#include <cassert>
-
-#define AllocTag1(p)
-#define AllocTag2(p, desc)
-#define AllocTag_dynamic_description(p, data)
-#define AllocTag(p, data)
-#define Debug(STATEMENT...)
-#define Dout(cntrl, data)
-#define DoutFatal(cntrl, data) LibcwDoutFatal(, , cntrl, data)
-#define ForAllDebugChannels(STATEMENT...)
-#define ForAllDebugObjects(STATEMENT...)
-#define LibcwDebug(dc_namespace, STATEMENT...)
-#define LibcwDout(dc_namespace, d, cntrl, data)
-#define LibcwDoutFatal(dc_namespace, d, cntrl, data) do { ::std::cerr << data << ::std::endl; ::std::exit(EXIT_FAILURE); } while(1)
-#define LibcwdForAllDebugChannels(dc_namespace, STATEMENT...)
-#define LibcwdForAllDebugObjects(dc_namespace, STATEMENT...)
-#define NEW(x) new x
-#define CWDEBUG_ALLOC 0
-#define CWDEBUG_MAGIC 0
-#define CWDEBUG_LOCATION 0
-#define CWDEBUG_LIBBFD 0
-#define CWDEBUG_DEBUG 0
-#define CWDEBUG_DEBUGOUTPUT 0
-#define CWDEBUG_DEBUGM 0
-#define CWDEBUG_DEBUGT 0
-#define CWDEBUG_MARKER 0
-#define AssertMsg(TEST,MSG)
-//#define AssertMsg(TEST,STRM,MSG)
-
-
-#else // CWDEBUG
-
-// This must be defined before <libcwd/debug.h> is included and must be the
-// name of the namespace containing your `dc' (Debug Channels) namespace
-// (see below). You can use any namespace(s) you like, except existing
-// namespaces (like ::, ::std and ::libcwd).
-#define DEBUGCHANNELS ::dionysus::debug::channels
-#include <libcwd/debug.h>
-
-namespace dionysus
-{
- namespace debug
- {
- void init(void); // Initialize debugging code from main().
- void init_thread(void); // Initialize debugging code from new threads.
-
- namespace channels // This is the DEBUGCHANNELS namespace, see above.
- {
- namespace dc // 'dc' is defined inside DEBUGCHANNELS.
- {
- using namespace libcwd::channels::dc;
- using libcwd::channel_ct;
-
- // Add the declaration of new debug channels here
- // and add their definition in a custom debug.cc file.
- extern channel_ct filtration;
- extern channel_ct transpositions;
- extern channel_ct vineyard;
- extern channel_ct cycle;
- extern channel_ct lsfiltration;
- extern channel_ct orderlist;
- } // namespace dc
- } // namespace DEBUGCHANNELS
- }
-}
-
-
-#define AssertMsg(TEST,MSG) \
- ( (TEST) ? (void)0 \
- : (std::cerr << __FILE__ ":" << __LINE__ \
- << ": Assertion failed " #TEST \
- << " - " << MSG << std::endl,abort()))
-/*
-#define AssertMsg(TEST,STRM,MSG) \
- ( (TEST) ? (void)0 \
- : (DoutFatal(STRM, __FILE__ "(" << __LINE__ \
- << "): Assertion failed " #TEST \
- << MSG << std::endl)))
-*/
-
-#endif // CWDEBUG
-
-#endif // DEBUG_H
--- a/include/utilities/log.h Thu Sep 13 10:31:39 2007 -0400
+++ b/include/utilities/log.h Fri Sep 14 05:51:51 2007 -0400
@@ -13,8 +13,12 @@
template<class T>
std::string tostring(const T& t) { std::ostringstream out; out << t; return out.str(); }
+#define AssertMsg(cond, message, ...) do { if (!(cond)) { rError(message, ##__VA_ARGS__); rAssertSilent(cond); } } while (0)
+
#else // LOGGING
+#include <unistd.h> // for STDOUT_FILENO and STDERR_FILENO
+
#define rDebug(...)
#define rInfo(...)
#define rWarning(...)
@@ -27,6 +31,33 @@
#define DEF_CHANNEL(...) 0
#define RLOG_CHANNEL(...) 0
+#define AssertMsg(cond, ...)
+
+// To avoid undefined errors for RLogChannel, we create a dummy namespace
+namespace rlog
+{
+ typedef void RLogChannel;
+
+ class StdioNode
+ {
+ public:
+ StdioNode(int,int) {}
+ void subscribeTo(RLogChannel*) {}
+
+ static const int OutputColor = 0;
+ static const int OutputChannel = 0;
+ };
+}
+
#endif // LOGGING
+static rlog::StdioNode stdoutLog(STDOUT_FILENO,
+ rlog::StdioNode::OutputColor +
+ rlog::StdioNode::OutputChannel);
+
+static rlog::StdioNode stderrLog(STDERR_FILENO,
+ rlog::StdioNode::OutputColor +
+ rlog::StdioNode::OutputChannel);
+
+
#endif //__LOG_H__
--- a/include/utilities/orderlist.h Thu Sep 13 10:31:39 2007 -0400
+++ b/include/utilities/orderlist.h Fri Sep 14 05:51:51 2007 -0400
@@ -12,15 +12,13 @@
#ifndef __ORDERLIST_H__
#define __ORDERLIST_H__
-#include "sys.h"
-#include "debug.h"
+#include "log.h"
#include <iterator>
#include <iostream>
#include <list>
#include "types.h"
-//#include "counter.h"
#include <boost/utility.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
--- a/include/utilities/orderlist.hpp Thu Sep 13 10:31:39 2007 -0400
+++ b/include/utilities/orderlist.hpp Fri Sep 14 05:51:51 2007 -0400
@@ -1,5 +1,9 @@
/* Implementations */
+#ifdef LOGGING
+static rlog::RLogChannel* rlOrderList = DEF_CHANNEL("utilities/orderlist", rlog::Log_Debug);
+#endif // LOGGING
+
template<class T>
void
OrderList<T>::
@@ -70,16 +74,16 @@
} while (inv_density * num_elements >= maximum);
++num_elements; // for the extra element inserted
- Dout(dc::orderlist, num_elements << ", " << lower << ", " << upper);
- Dout(dc::orderlist, "prev is at the end: " << (prev == Parent::end()));
- Dout(dc::orderlist, "next is at the end: " << (next == Parent::end()));
+ rLog(rlOrderList, "%i, %i, %i", num_elements, lower, upper);
+ rLog(rlOrderList, "prev is at the end: %i", (prev == Parent::end()));
+ rLog(rlOrderList, "next is at the end: %i", (next == Parent::end()));
// Reorder
AssertMsg((upper - lower + 1)/num_elements > 0, "Spacing between new tags must be non-zero");
for (unsigned int i = 0; i < num_elements; ++i)
{
(++prev)->tag = lower + i*((upper - lower + 1)/num_elements);
- Dout(dc::orderlist, prev->tag);
+ rLog(rlOrderList, "%i", prev->tag);
AssertMsg(prev->tag != 0 || prev == Parent::begin(), "Cannot assign 0 tag except at the beginning of OrderList");
}
--- a/include/utilities/sys.h Thu Sep 13 10:31:39 2007 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-// sys.h
-//
-// This header file is included at the top of every source file,
-// before any other header file.
-// It is intended to add defines that are needed globally and
-// to work around Operating System dependend incompatibilities.
-
-// EXAMPLE: If you use autoconf you can add the following here.
-// #ifdef HAVE_CONFIG_H
-// #include "config.h"
-// #endif
-
-// EXAMPLE: You could add stuff like this here too
-// (Otherwise add -DCWDEBUG to your CFLAGS).
-// #if defined(WANTSDEBUGGING) && defined(HAVE_LIBCWD_BLAHBLAH)
-// #define CWDEBUG
-// #endif
-
-// The following is the libcwd related mandatory part.
-// It must be included before any system header file is included!
-#ifdef CWDEBUG
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#include <libcwd/sys.h>
-#endif
--- a/src/debug.cpp Thu Sep 13 10:31:39 2007 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-#include "sys.h"
-#include "debug.h"
-
-#ifdef CWDEBUG
-
-namespace dionysus
-{
- namespace debug
- {
- namespace channels // DEBUGCHANNELS is set to this in debug.h
- {
- namespace dc
- {
- // Add new debug channels here.
- channel_ct filtration("FILTRATION");
- channel_ct transpositions("TRANSPOS");
- channel_ct vineyard("VINEYARD");
- channel_ct cycle("CYCLE");
- channel_ct lsfiltration("LSFILTRATION");
- channel_ct orderlist("ORDERLIST");
- }
- } // namespace DEBUGCHANNELS
-
- // Initialize debugging code from new threads.
- void init_thread(void)
- {
- // Everything below needs to be repeated at the start of every
- // thread function, because every thread starts in a completely
- // reset state with all debug channels off etc.
-
- #if LIBCWD_THREAD_SAFE // For the non-threaded case this is set by the rcfile.
- // Turn on all debug channels by default.
- ForAllDebugChannels(while(!debugChannel.is_on()) debugChannel.on());
- // Turn off specific debug channels.
- Debug(dc::bfd.off());
- Debug(dc::malloc.off());
- #endif
-
- // Turn on debug output.
- // Only turn on debug output when the environment variable SUPPRESS_DEBUG_OUTPUT is not set.
- Debug(if (getenv("SUPPRESS_DEBUG_OUTPUT") == NULL) libcw_do.on());
- #if LIBCWD_THREAD_SAFE
- Debug(libcw_do.set_ostream(&std::cout, &cout_mutex));
-
- // Set the thread id in the margin.
- char margin[12];
- sprintf(margin, "%-10lu ", pthread_self());
- Debug(libcw_do.margin().assign(margin, 11));
- #else
- Debug(libcw_do.set_ostream(&std::cout));
- #endif
-
- // Write a list of all existing debug channels to the default debug device.
- Debug(list_channels_on(libcw_do));
- }
-
- // Initialize debugging code from main().
- void init(void)
- {
- // You want this, unless you mix streams output with C output.
- // Read http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#8 for an explanation.
- // We can't use it, because other code uses printf to write to the console.
- //std::ios::sync_with_stdio(false);
-
- // This will warn you when you are using header files that do not belong to the
- // shared libcwd object that you linked with.
- Debug(check_configuration());
-
- #if CWDEBUG_ALLOC
- // Remove all current (pre- main) allocations from the Allocated Memory Overview.
- libcwd::make_all_allocations_invisible_except(NULL);
- #endif
-
- //Debug(read_rcfile());
-
- init_thread();
- }
- } // namespace debug
-} // namespace dionysus
-
-#endif // CWDEBUG
--- a/tests/utilities/CMakeLists.txt Thu Sep 13 10:31:39 2007 -0400
+++ b/tests/utilities/CMakeLists.txt Fri Sep 14 05:51:51 2007 -0400
@@ -4,6 +4,6 @@
test-counters)
foreach (t ${targets})
- add_executable (${t} ${t}.cpp ${external_sources})
+ add_executable (${t} ${t}.cpp)
target_link_libraries (${t} ${libraries})
endforeach (t ${targets})
--- a/tests/utilities/test-counters.cpp Thu Sep 13 10:31:39 2007 -0400
+++ b/tests/utilities/test-counters.cpp Fri Sep 14 05:51:51 2007 -0400
@@ -17,12 +17,12 @@
Count(cTestElaborate);
Count(cTestBasic);
Count(cTestBasic);
- CountNum(cTestBasic, 25)
- CountNum(cTestBasic, 132)
- CountNum(cTestBasic, 25)
- CountNum(cTestBasic, 121)
- CountNum(cTestBasic, 132)
- CountNum(cTestBasic, 25)
+ CountNum(cTestBasic, 25);
+ CountNum(cTestBasic, 132);
+ CountNum(cTestBasic, 25);
+ CountNum(cTestBasic, 121);
+ CountNum(cTestBasic, 132);
+ CountNum(cTestBasic, 25);
SetTrigger(cTestBasic, &rootCounter);
Count(cTestBasic);