← Back to team overview

dolfin team mailing list archive

[Fwd: [Branch ~dolfin-core/dolfin/main] Rev 4496: Apply patch for buggy unordered_set on Mac OS X from Harish]

 

I suggest that we use Boost for unordered set/maps in place of
std::tr1::foo, rather than the ugly work around for crappy operating
systems. I did change to boost, but this broke the buildbot. I've used
unordered set/map now also in the SCOCTH interface because they're
faster than set/map.

Garth

-------- Original Message --------
Subject: [Branch ~dolfin-core/dolfin/main] Rev 4496: Apply patch for
buggy	unordered_set on Mac OS X from Harish
Date: Fri, 12 Feb 2010 16:22:22 -0000
From: noreply@xxxxxxxxxxxxx
Reply-To: noreply@xxxxxxxxxxxxx
To: Garth Wells <gnw20@xxxxxxxxx>

------------------------------------------------------------
revno: 4496
committer: Anders Logg <logg@xxxxxxxxx>
branch nick: dolfin-dev
timestamp: Fri 2010-02-12 17:19:43 +0100
message:
  Apply patch for buggy unordered_set on Mac OS X from Harish
modified:
  SConstruct
  dolfin/fem/DofMapBuilder.h


--
lp:dolfin
https://code.launchpad.net/~dolfin-core/dolfin/main

Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
To unsubscribe from this branch go to
https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription.

=== modified file 'SConstruct'
--- SConstruct	2010-02-04 00:03:02 +0000
+++ SConstruct	2010-02-12 16:19:43 +0000
@@ -106,6 +106,7 @@
     BoolVariable("enableLapack", "Compile with support for LAPACK", "yes"),
     BoolVariable("enablePython", "Compile the Python wrappers", "yes"),
     BoolVariable("enablePydolfin", "Compile the Python wrappers of DOLFIN *deprecated*", "yes"),
+    BoolVariable("enableHashset", "Force the use of gcc's deprecated hash_set extension", "no"),
     # some of the above may need extra options (like petscDir), should we
     # try to get that from pkg-config?
     # It may be neccessary to specify the installation path to the above packages.
@@ -299,6 +300,17 @@
     # try to use g++ as default:
     env["CXX"] = "g++"
 
+  if env['enableHashset']:
+    if configure.checkCxxHeader('ext/hash_set'):
+      env.Append(CPPDEFINES=["HAVE_HASH_SET"])  
+  else:
+    if configure.checkCxxHeader('unordered_set'):
+      env.Append(CPPDEFINES=["HAVE_UNORDERED_SET"])
+    elif configure.checkCxxHeader('tr1/unordered_set'):
+      env.Append(CPPDEFINES=["HAVE_TR1_UNORDERED_SET"])
+    elif configure.checkCxxHeader('ext/hash_set'):
+      env.Append(CPPDEFINES=["HAVE_HASH_SET"])
+
   # process list of packages to be included in allowed Dependencies.
   # Do we need this any more? I think we rather pick up (external) packages from
   # the scons.cfg files. Actually, I doubt usePackages is ever used?

=== modified file 'dolfin/fem/DofMapBuilder.h'
--- dolfin/fem/DofMapBuilder.h	2010-02-05 17:04:45 +0000
+++ dolfin/fem/DofMapBuilder.h	2010-02-12 16:19:43 +0000
@@ -10,9 +10,19 @@
 #define __DOF_MAP_BUILDER_H
 
 #include <set>
+//#include <boost/unordered_set.hpp>
+//#include <tr1/unordered_set>
+#ifdef HAVE_TR1_UNORDERED_SET
 #include <tr1/unordered_set>
-//#include <boost/unordered_set.hpp>
-
+#else 
+#ifdef HAVE_UNORDERED_SET
+#include <unordered_set>
+#else
+#ifdef HAVE_HASH_SET
+#include <ext/hash_set>
+#endif
+#endif
+#endif
 #include <dolfin/common/Set.h>
 
 namespace dolfin
@@ -32,8 +42,22 @@
     //typedef std::set<dolfin::uint>::const_iterator set_iterator;
     //typedef Set<dolfin::uint> set;
     //typedef Set<dolfin::uint>::const_iterator set_iterator;
+    #ifdef HAVE_TR1_UNORDERED_SET
     typedef std::tr1::unordered_set<dolfin::uint> set;
     typedef std::tr1::unordered_set<dolfin::uint>::const_iterator set_iterator;
+    #else
+    #ifdef HAVE_UNORDERED_SET
+    typedef std::unordered_set<dolfin::uint> set;
+    typedef std::unordered_set<dolfin::uint>::const_iterator set_iterator;
+    #else
+    #ifdef HAVE_HASH_SET
+    typedef __gnu_cxx::hash_set<dolfin::uint> set;
+    typedef __gnu_cxx::hash_set<dolfin::uint>::const_iterator set_iterator;
+    #endif
+    #endif
+    #endif
+    //typedef std::tr1::unordered_set<dolfin::uint> set;
+    //typedef std::tr1::unordered_set<dolfin::uint>::const_iterator set_iterator;
     //typedef boost::unordered_set<dolfin::uint> set;
     //typedef boost::unordered_set<dolfin::uint>::const_iterator set_iterator;
 



Follow ups