Added Poincare sphere example dev
authorDmitriy Morozov <morozov@cs.duke.edu>
Wed, 26 Mar 2008 05:53:03 -0400
branchdev
changeset 53 cef300f2c62e
parent 52 08074dfb2a6a
child 54 8f88bd32153a
Added Poincare sphere example
examples/CMakeLists.txt
examples/fitness/CMakeLists.txt
examples/poincare/CMakeLists.txt
examples/poincare/poincare-filtration.txt
examples/poincare/poincare.cpp
examples/poincare/poincare.dat
--- a/examples/CMakeLists.txt	Wed Mar 26 05:52:39 2008 -0400
+++ b/examples/CMakeLists.txt	Wed Mar 26 05:53:03 2008 -0400
@@ -1,6 +1,10 @@
+find_library                (boost_program_options_LIBRARY      NAME boost_program_options
+                                                                PATHS ${Boost_LIBRARY_DIR})
+
 add_subdirectory			(alphashapes)
 add_subdirectory			(ar-vineyard)
 add_subdirectory			(cech-complex)
 add_subdirectory			(fitness)
 add_subdirectory			(grid)
 add_subdirectory			(triangle)
+add_subdirectory			(poincare)
--- a/examples/fitness/CMakeLists.txt	Wed Mar 26 05:52:39 2008 -0400
+++ b/examples/fitness/CMakeLists.txt	Wed Mar 26 05:53:03 2008 -0400
@@ -2,9 +2,6 @@
 							 avida-distance
                              avida-landscape)
 	
-find_library                (boost_program_options_LIBRARY      NAME boost_program_options
-                                                                PATHS ${Boost_LIBRARY_DIR})
-
 foreach 					(t ${targets})
 	add_executable			(${t} ${t}.cpp)
 	target_link_libraries	(${t} ${libraries} ${boost_program_options_LIBRARY})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/poincare/CMakeLists.txt	Wed Mar 26 05:53:03 2008 -0400
@@ -0,0 +1,7 @@
+set							(targets						
+							 poincare)
+							 
+foreach 					(t ${targets})
+	add_executable			(${t} ${t}.cpp)
+	target_link_libraries	(${t} ${libraries} ${boost_program_options_LIBRARY})
+endforeach 					(t ${targets})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/poincare/poincare-filtration.txt	Wed Mar 26 05:53:03 2008 -0400
@@ -0,0 +1,392 @@
+9
+2
+2 9
+4
+4 9
+2 4
+2 4 9
+1
+1 9
+1 4
+1 4 9
+1 2
+1 2 9
+1 2 4
+1 2 4 9
+15
+2 15
+4 15
+2 4 15
+1 15
+1 4 15
+1 2 15
+1 2 4 15
+14
+2 14
+6
+6 14
+2 6
+2 6 14
+1 14
+1 6
+1 6 14
+1 2 14
+1 2 6
+1 2 6 14
+6 15
+2 6 15
+1 6 15
+1 2 6 15
+9 14
+2 9 14
+1 9 14
+1 2 9 14
+12
+3
+3 12
+4 12
+3 4
+3 4 12
+1 12
+1 4 12
+1 3
+1 3 12
+1 3 4
+1 3 4 12
+3 15
+3 4 15
+1 3 15
+1 3 4 15
+10
+3 10
+7
+7 10
+3 7
+3 7 10
+1 10
+1 7
+1 7 10
+1 3 10
+1 3 7
+1 3 7 10
+7 12
+3 7 12
+1 7 12
+1 3 7 12
+10 15
+3 10 15
+1 10 15
+1 3 10 15
+9 12
+4 9 12
+1 9 12
+1 4 9 12
+13
+5
+5 13
+6 13
+5 6
+5 6 13
+1 13
+1 6 13
+1 5
+1 5 13
+1 5 6
+1 5 6 13
+5 14
+5 6 14
+1 5 14
+1 5 6 14
+11
+5 11
+8
+8 11
+5 8
+5 8 11
+1 11
+1 8
+1 8 11
+1 5 11
+1 5 8
+1 5 8 11
+8 13
+5 8 13
+1 8 13
+1 5 8 13
+11 14
+5 11 14
+1 11 14
+1 5 11 14
+13 15
+6 13 15
+1 13 15
+1 6 13 15
+8 10
+7 8
+7 8 10
+1 8 10
+1 7 8
+1 7 8 10
+7 11
+7 8 11
+1 7 11
+1 7 8 11
+11 12
+7 11 12
+1 11 12
+1 7 11 12
+10 13
+8 10 13
+1 10 13
+1 8 10 13
+9 11
+9 11 12
+1 9 11
+1 9 11 12
+9 11 14
+1 9 11 14
+10 13 15
+1 10 13 15
+5 10
+3 5
+3 5 10
+2 10
+2 5
+2 5 10
+2 3
+2 3 10
+2 3 5
+2 3 5 10
+3 11
+3 5 11
+2 11
+2 5 11
+2 3 11
+2 3 5 11
+2 7
+2 7 10
+2 3 7
+2 3 7 10
+3 13
+7 13
+3 7 13
+2 13
+2 7 13
+2 3 13
+2 3 7 13
+11 13
+3 11 13
+2 11 13
+2 3 11 13
+4 13
+9 13
+4 9 13
+2 9 13
+2 4 13
+2 4 9 13
+4 11
+4 11 13
+2 4 11
+2 4 11 13
+11 15
+4 11 15
+2 11 15
+2 4 11 15
+2 8
+2 8 11
+2 5 8
+2 5 8 11
+5 12
+8 12
+5 8 12
+2 12
+2 8 12
+2 5 12
+2 5 8 12
+10 12
+5 10 12
+2 10 12
+2 5 10 12
+6 12
+6 10
+6 10 12
+2 6 12
+2 6 10
+2 6 10 12
+10 14
+6 10 14
+2 10 14
+2 6 10 14
+12 15
+6 12 15
+2 12 15
+2 6 12 15
+7 9
+7 9 13
+2 7 9
+2 7 9 13
+7 14
+7 9 14
+2 7 14
+2 7 9 14
+7 10 14
+2 7 10 14
+8 15
+8 11 15
+2 8 15
+2 8 11 15
+8 12 15
+2 8 12 15
+4 14
+4 5
+4 5 14
+3 14
+3 5 14
+3 4 14
+3 4 5
+3 4 5 14
+5 15
+4 5 15
+3 5 15
+3 4 5 15
+12 14
+4 12 14
+3 12 14
+3 4 12 14
+5 10 15
+3 5 10 15
+3 11 14
+3 5 11 14
+12 13
+7 12 13
+3 12 13
+3 7 12 13
+13 14
+11 13 14
+3 13 14
+3 11 13 14
+12 13 14
+3 12 13 14
+5 7
+6 7
+5 6 7
+4 7
+4 6
+4 6 7
+4 5 7
+4 5 6
+4 5 6 7
+4 6 14
+4 5 6 14
+7 15
+5 7 15
+4 7 15
+4 5 7 15
+6 11
+6 7 11
+4 7 11
+4 6 11
+4 6 7 11
+10 11
+6 10 11
+4 10
+4 10 11
+4 6 10
+4 6 10 11
+4 10 14
+4 6 10 14
+7 11 15
+4 7 11 15
+8 9
+8 9 12
+4 8
+4 8 12
+4 8 9
+4 8 9 12
+8 9 13
+4 8 13
+4 8 9 13
+4 10 13
+4 8 10
+4 8 10 13
+8 14
+8 10 14
+4 8 14
+4 8 10 14
+8 12 14
+4 8 12 14
+10 11 13
+4 10 11 13
+6 7 13
+5 7 13
+5 6 7 13
+5 9
+5 9 13
+5 7 9
+5 7 9 13
+9 15
+7 9 15
+5 9 15
+5 7 9 15
+5 9 12
+5 8 9
+5 8 9 12
+5 8 9 13
+9 10
+9 10 12
+5 9 10
+5 9 10 12
+9 10 15
+5 9 10 15
+6 11 12
+6 7 12
+6 7 11 12
+6 12 13
+6 7 12 13
+10 11 12
+6 10 11 12
+12 13 15
+6 12 13 15
+7 8 14
+7 8 10 14
+7 8 15
+7 8 11 15
+14 15
+8 14 15
+7 14 15
+7 8 14 15
+9 14 15
+7 9 14 15
+12 14 15
+8 12 14 15
+9 10 11
+9 10 11 12
+16
+10 16
+11 16
+10 11 16
+9 16
+9 11 16
+9 10 16
+9 10 11 16
+15 16
+10 15 16
+9 15 16
+9 10 15 16
+14 16
+11 14 16
+9 14 16
+9 11 14 16
+14 15 16
+9 14 15 16
+13 16
+11 13 16
+10 13 16
+10 11 13 16
+13 15 16
+10 13 15 16
+13 14 16
+11 13 14 16
+13 14 15
+12 13 14 15
+13 14 15 16
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/poincare/poincare.cpp	Wed Mar 26 05:53:03 2008 -0400
@@ -0,0 +1,80 @@
+#include "topology/filtration.h"
+#include "topology/simplex.h"
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <boost/program_options.hpp>
+
+typedef 		SimplexWithValue<int> 			Simplex;
+typedef			Filtration<Simplex>				SimplexFiltration;
+
+namespace po = boost::program_options;
+
+int main(int argc, char** argv)
+{
+    std::string infilename;
+
+    // Parse program options
+    po::options_description hidden("Hidden options");
+    hidden.add_options()
+        ("input-file",  po::value<std::string>(&infilename),
+                        "Filtration filename");
+
+    po::options_description visible("Allowed options");
+    visible.add_options()
+        ("help,h",      "produce help message");
+    po::positional_options_description p;
+    p.add("input-file", 1);
+    
+    po::options_description all; all.add(visible).add(hidden);
+
+    po::variables_map vm;
+    po::store(po::command_line_parser(argc, argv).
+                  options(all).positional(p).run(), vm);
+    po::notify(vm);
+
+    if (vm.count("help") || !vm.count("input-file"))
+    { 
+        std::cout << "Usage: " << argv[0] << " [options] FILENAME" << std::endl;
+        std::cout << visible << std::endl; 
+        return 1; 
+    }
+
+
+	Evaluator<Simplex> e;
+	SimplexFiltration::Vineyard v(&e);
+	SimplexFiltration f(&v);
+
+    std::ifstream in(infilename.c_str());
+    unsigned int i = 0;
+    std::string s;
+    std::getline(in, s);
+    while(in)
+    {
+        std::istringstream linestream(s);
+        Simplex simplex(float(i++));
+        unsigned int vertex;
+        linestream >> vertex;
+        while(linestream)
+        {
+            simplex.add(vertex);
+            linestream >> vertex;
+        }
+        std::cout << simplex << std::endl;
+        f.append(simplex);
+        std::getline(in, s);
+    }
+	
+    f.fill_simplex_index_map();
+	f.pair_simplices();
+	v.start_vines(f.begin(), f.end());
+	
+	std::cout << "Filtration size: " << f.size() << std::endl;
+    for (SimplexFiltration::Index cur = f.begin(); cur != f.end(); ++cur)
+        if (cur->sign()) 
+            std::cout << cur->dimension() << " " 
+                      << cur->get_value() << " " 
+                      << cur->pair()->get_value() << std::endl;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/poincare/poincare.dat	Wed Mar 26 05:53:03 2008 -0400
@@ -0,0 +1,99 @@
+# 16 vertex triangulation of Poincare sphere
+# made by Bjo"rner and Lutz,
+# in "Simplicial manifolds, bistellar flips and a 16-vertex
+#     triangulation of the Poincar\'e homology 3-sphere",
+#     to appear in Experimental Mathematics.
+# This example has f = (1, 16, 106, 180, 90).
+#
+# Found on Masahiro Hachimori's page at
+# http://infoshako.sk.tsukuba.ac.jp/~hachi/math/library/poincare_eng.html
+1 2 4 9
+1 2 4 15
+1 2 6 14
+1 2 6 15
+1 2 9 14
+1 3 4 12
+1 3 4 15
+1 3 7 10
+1 3 7 12
+1 3 10 15
+1 4 9 12
+1 5 6 13
+1 5 6 14
+1 5 8 11
+1 5 8 13
+1 5 11 14
+1 6 13 15
+1 7 8 10
+1 7 8 11
+1 7 11 12
+1 8 10 13
+1 9 11 12
+1 9 11 14
+1 10 13 15
+2 3 5 10
+2 3 5 11
+2 3 7 10
+2 3 7 13
+2 3 11 13
+2 4 9 13
+2 4 11 13
+2 4 11 15
+2 5 8 11
+2 5 8 12
+2 5 10 12
+2 6 10 12
+2 6 10 14
+2 6 12 15
+2 7 9 13
+2 7 9 14
+2 7 10 14
+2 8 11 15
+2 8 12 15
+3 4 5 14
+3 4 5 15
+3 4 12 14
+3 5 10 15
+3 5 11 14
+3 7 12 13
+3 11 13 14
+3 12 13 14
+4 5 6 7
+4 5 6 14
+4 5 7 15
+4 6 7 11
+4 6 10 11
+4 6 10 14
+4 7 11 15
+4 8 9 12
+4 8 9 13
+4 8 10 13
+4 8 10 14
+4 8 12 14
+4 10 11 13
+5 6 7 13
+5 7 9 13
+5 7 9 15
+5 8 9 12
+5 8 9 13
+5 9 10 12
+5 9 10 15
+6 7 11 12
+6 7 12 13
+6 10 11 12
+6 12 13 15
+7 8 10 14
+7 8 11 15
+7 8 14 15
+7 9 14 15
+8 12 14 15
+9 10 11 12
+9 10 11 16
+9 10 15 16
+9 11 14 16
+9 14 15 16
+10 11 13 16
+10 13 15 16
+11 13 14 16
+12 13 14 15
+13 14 15 16