Merged in changes from master
authorDmitriy Morozov <morozov@cs.duke.edu>
Thu, 13 Sep 2007 04:43:33 -0400
changeset 28 b2cb83a28329
parent 27 b0d6c9162de3 (current diff)
parent 26 04d667548959 (diff)
child 29 25bed9659e0f
Merged in changes from master
--- a/README	Thu Sep 13 04:42:39 2007 -0400
+++ b/README	Thu Sep 13 04:43:33 2007 -0400
@@ -5,11 +5,11 @@
   boost -       great set of C++ libraries
   Doxygen -     for building documentation
   libcwd -      for debugging only (is not needed by default)
-  synaps -      for solving polynomial (for kinetic kernel), which in turn requires GMP
+  synaps -      for solving polynomials (for kinetic kernel), which in turn requires GMP
 
 Configuration
   The path to CGAL's Makefile is expected to be set in $CGAL_MAKEFILE, the rest
-  is just usual CMake configuration
+  is just the usual CMake configuration
 
 Building
   To build examples, create a directory build (to keep everything in one place),
--- a/examples/alphashapes/CMakeLists.txt	Thu Sep 13 04:42:39 2007 -0400
+++ b/examples/alphashapes/CMakeLists.txt	Thu Sep 13 04:43:33 2007 -0400
@@ -4,5 +4,5 @@
 							 
 foreach 					(t ${targets})
 	add_executable			(${t} ${t}.cpp ${external_sources})
-	target_link_libraries	(${t} ${libraries} ${cgal_libraries})
+	target_link_libraries	(${t} ${cgal_libraries})
 endforeach 					(t ${targets})
--- a/examples/alphashapes/alphashapes3d.cpp	Thu Sep 13 04:42:39 2007 -0400
+++ b/examples/alphashapes/alphashapes3d.cpp	Thu Sep 13 04:43:33 2007 -0400
@@ -32,7 +32,16 @@
 	for (AlphaSimplex3DVector::const_iterator cur = alpha_ordering.begin(); cur != alpha_ordering.end(); ++cur)
 		af.append(*cur);
 	af.fill_simplex_index_map();
+	std::cout << "Filled simplex-index map" << std::endl;
 	af.pair_simplices(af.begin(), af.end());
 	std::cout << "Simplices paired" << std::endl;
+
+	for (AlphaFiltration::Index i = af.begin(); i != af.end(); ++i)
+		if (i->is_paired())
+		{
+			if (i->sign())
+				std::cout << i->dimension() << " " << i->value() << " " << i->pair()->value() << std::endl;
+		} //else std::cout << i->value() << std::endl;
+
 }
 
--- a/examples/grid/grid2Dvineyard.hpp	Thu Sep 13 04:42:39 2007 -0400
+++ b/examples/grid/grid2Dvineyard.hpp	Thu Sep 13 04:43:33 2007 -0400
@@ -108,25 +108,25 @@
 			VertexIndex vv(&vertices_[grid()->seq(x,y+1)]);
 			VertexIndex vd(&vertices_[grid()->seq(x+1,y+1)]);
 
-			Simplex sh(v);
+			Simplex sh(2, v);
 			sh.add(vh);	filtration_->append(sh);		// Horizontal edge
 			sh.add(vd);	filtration_->append(sh);		// "Horizontal" triangle
 			
-			Simplex sv(v);
+			Simplex sv(2, v);
 			sv.add(vv);	filtration_->append(sv);		// Vertical edge
 			sv.add(vd);	filtration_->append(sv);		// "Vertical" triangle
 			
-			Simplex sd(v);
+			Simplex sd(2, v);
 			sd.add(vd); filtration_->append(sd);		// Diagonal edge
 
 			if (y == grid()->ysize() - 2)
 			{
-				Simplex s(vv); 
+				Simplex s(1, vv); 
 				s.add(vd); filtration_->append(s);		// Top edge
 			}
 			if (x == grid()->xsize() - 2)
 			{
-				Simplex s(vh); 
+				Simplex s(1, vh); 
 				s.add(vd); filtration_->append(s);		// Right edge
 			}
 		}
--- a/include/topology/filtration.hpp	Thu Sep 13 04:42:39 2007 -0400
+++ b/include/topology/filtration.hpp	Thu Sep 13 04:43:33 2007 -0400
@@ -22,9 +22,13 @@
 Filtration<S, FS, V>::
 pair_simplices(Index bg, Index end)
 {
+	int i = 0;
 	Dout(dc::filtration, "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 << ": ");
 		init_cycle_trail(j); 
 		Cycle& bdry = j->cycle();
--- a/include/topology/lowerstarfiltration.hpp	Thu Sep 13 04:42:39 2007 -0400
+++ b/include/topology/lowerstarfiltration.hpp	Thu Sep 13 04:43:33 2007 -0400
@@ -17,7 +17,7 @@
 
 	// Record vertex order
 	for(typename VertexIndexList::const_iterator cur = tmp_list.begin(); cur != tmp_list.end(); ++cur)
-		(*cur)->set_order(vertex_order.push_back(VertexDescriptor(*cur, Parent::append(Simplex(*cur)))));
+		(*cur)->set_order(vertex_order.push_back(VertexDescriptor(*cur, Parent::append(Simplex(0, *cur)))));
 }
 
 template<class VI, class Smplx, class FltrSmplx, class Vnrd>
--- a/include/topology/simplex.h	Thu Sep 13 04:42:39 2007 -0400
+++ b/include/topology/simplex.h	Thu Sep 13 04:43:33 2007 -0400
@@ -1,6 +1,6 @@
 /*
  * Author: Dmitriy Morozov
- * Department of Computer Science, Duke University, 2005 -- 2006
+ * Department of Computer Science, Duke University, 2005 -- 2007
  */
 
 #ifndef __SIMPLEX_H__
@@ -9,7 +9,8 @@
 #include "utilities/sys.h"
 #include "utilities/debug.h"
 
-#include <set>
+#include <vector>
+#include <algorithm>
 #include <list>
 #include <iostream>
 
@@ -30,7 +31,7 @@
 		typedef		V																Vertex;
 		typedef		SimplexWithVertices<Vertex>										Self;
 	
-		typedef		std::set<Vertex>												VertexContainer;
+		typedef		std::vector<Vertex>												VertexContainer;
 		typedef		std::list<Self>													Cycle;
 		
 		/// \name Constructors 
@@ -43,8 +44,10 @@
 			vertices_(bg, end)														{}
 		SimplexWithVertices(const VertexContainer& v):	
 			vertices_(v)															{}
-		SimplexWithVertices(Vertex v):	
-			vertices_()																{ vertices_.insert(v); }
+		SimplexWithVertices(Dimension d, Vertex v):	
+			vertices_()																{ vertices_.reserve(d+1); add(v); }
+		SimplexWithVertices(Dimension d): 
+			vertices_(d+1)															{}
 		/// @}
 		
 		/// \name Core 
@@ -55,9 +58,9 @@
 		
 		/// \name Vertex manipulation
 		/// @{
-		bool					contains(const Vertex& v) const						{ return (vertices_.find(v) != vertices_.end()); }
+		bool					contains(const Vertex& v) const;
 		const VertexContainer&	vertices() const									{ return vertices_; }
-		void					add(const Vertex& v) 								{ vertices_.insert(v); }
+		void					add(const Vertex& v);
 		/// @}
 
 		/// \name Assignment and comparison
@@ -147,8 +150,8 @@
 			Parent(bg, end)															{}
 		SimplexWithAttachment(const Parent& s):
 			Parent(s)																{}
-		SimplexWithAttachment(VertexIndex vi):
-			Parent(vi), attachment(vi)												{}
+		SimplexWithAttachment(Dimension d, VertexIndex vi):
+			Parent(d, vi), attachment(vi)											{}
 		/// @}
 
 		void 					set_attachment(VertexIndex v)						{ attachment = v; }
--- a/include/topology/simplex.hpp	Thu Sep 13 04:42:39 2007 -0400
+++ b/include/topology/simplex.hpp	Thu Sep 13 04:43:33 2007 -0400
@@ -16,15 +16,30 @@
 
 	for (typename VertexContainer::const_iterator cur = vertices_.begin(); cur != vertices_.end(); ++cur)
 	{
-		bdry.push_back(*this);
+		bdry.push_back(Self(dimension() - 1));
 		Self& s = bdry.back();
-		s.vertices_.erase(*cur);
+		std::remove_copy(vertices_.begin(), vertices_.end(), s.vertices_.begin(), *cur);
 	}
 
 	return bdry;
 }
 
 template<class V>
+bool
+SimplexWithVertices<V>::
+contains(const Vertex& v) const
+{ 
+	typename VertexContainer::const_iterator location = std::lower_bound(vertices_.begin(), vertices_.end(), v); 
+	return ((location == vertices_.end()) || (*location == v)); 
+}
+		
+template<class V>
+void
+SimplexWithVertices<V>::
+add(const Vertex& v)
+{ vertices_.push_back(v); std::sort(vertices_.begin(), vertices_.end()); }
+
+template<class V>
 std::ostream&			
 SimplexWithVertices<V>::
 operator<<(std::ostream& out) const
--- a/include/utilities/types.h	Thu Sep 13 04:42:39 2007 -0400
+++ b/include/utilities/types.h	Thu Sep 13 04:43:33 2007 -0400
@@ -5,7 +5,7 @@
 
 /* Types */
 typedef 	bool					Sign;
-typedef		short int				Dimension;
+typedef		unsigned short int		Dimension;
 const 		Sign	 				POS = true;
 const 		Sign					NEG = false;
 typedef		double					RealType;