Check Boost version in include/utilities/property-maps.h + minor changes to cocycle.py dev
authorDmitriy Morozov <dmitriy@mrzv.org>
Tue, 05 Jan 2010 11:02:07 -0800
branchdev
changeset 186 6d81d6ae7a3b
parent 185 7241b887eabb
child 187 25e468323d77
Check Boost version in include/utilities/property-maps.h + minor changes to cocycle.py
examples/cohomology/cocycle.py
include/utilities/property-maps.h
--- a/examples/cohomology/cocycle.py	Thu Dec 31 11:28:49 2009 -0800
+++ b/examples/cohomology/cocycle.py	Tue Jan 05 11:02:07 2010 -0800
@@ -6,7 +6,7 @@
 from    sys             import argv, exit
 import  os.path
 
-def smooth(boundary_list, cocycle_list, vertices):
+def smooth(boundary_list, cocycle_list):
     dimension = max((max(d[1], d[2]) for d in boundary_list))
     dimension += 1
 
@@ -45,11 +45,15 @@
     if not (sum((D*v)**2) < tol and sum((D.T*v)**2) < tol):
         print "Expected a harmonic cocycle:", sum((D*v)**2), sum((D.T*v)**2) 
 
+    return solution[0]        
+
+
+def vertex_values(solution, vertices):
     values = [None]*len(vertices)
     for i,v in vertices:
-        values[v] = solution[0][i]
+        values[v] = solution[i]
     return values
-
+    
 
 def read_list_file(filename):
     list = []
@@ -73,7 +77,8 @@
     cocycle_list = read_list_file(cocycle_filename)
     vertexmap_list = read_list_file(vertexmap_filename)
 
-    values = smooth(boundary_list, cocycle_list, vertexmap_list)
+    solution = smooth(boundary_list, cocycle_list)
+    values = vertex_values(solution, vertexmap_list)
 
     outfn = os.path.splitext(cocycle_filename)[0] + '.val'
     with open(outfn, 'w') as f:
--- a/include/utilities/property-maps.h	Thu Dec 31 11:28:49 2009 -0800
+++ b/include/utilities/property-maps.h	Tue Jan 05 11:02:07 2010 -0800
@@ -1,7 +1,13 @@
 #ifndef __PROPERTY_MAPS_H__
 #define __PROPERTY_MAPS_H__
 
+#include <boost/version.hpp>
+#if BOOST_VERSION >= 104000
 #include <boost/property_map/property_map.hpp>
+#else
+#include <boost/property_map.hpp>
+#endif
+
 #include <boost/iterator/iterator_traits.hpp>
 #include <algorithm>
 #include "utilities/log.h"