author Dmitriy Morozov Tue, 05 Jan 2010 11:02:07 -0800 branch dev 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 file | annotate | diff | comparison | revisions include/utilities/property-maps.h file | annotate | diff | comparison | revisions
--- 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
-
+

list = []
@@ -73,7 +77,8 @@

-    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"