getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] r4574 - in /trunk/getfem/src: ./ getfem/ gmm/


From: logari81
Subject: [Getfem-commits] r4574 - in /trunk/getfem/src: ./ getfem/ gmm/
Date: Mon, 31 Mar 2014 21:55:16 -0000

Author: logari81
Date: Mon Mar 31 23:55:15 2014
New Revision: 4574

URL: http://svn.gna.org/viewcvs/getfem?rev=4574&view=rev
Log:
further work on supporting the --enable-openmp confgure option

Modified:
    trunk/getfem/src/getfem/dal_singleton.h
    trunk/getfem/src/getfem/dal_static_stored_objects.h
    trunk/getfem/src/getfem/getfem_mesh_region.h
    trunk/getfem/src/getfem/getfem_omp.h
    trunk/getfem/src/getfem_omp.cc
    trunk/getfem/src/gmm/gmm_std.h

Modified: trunk/getfem/src/getfem/dal_singleton.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/dal_singleton.h?rev=4574&r1=4573&r2=4574&view=diff
==============================================================================
--- trunk/getfem/src/getfem/dal_singleton.h     (original)
+++ trunk/getfem/src/getfem/dal_singleton.h     Mon Mar 31 23:55:15 2014
@@ -48,7 +48,7 @@
 #include "getfem_omp.h"
 #include "dal_shared_ptr.h"
 
-#ifdef GETFEM_HAVE_BOOST
+#ifdef GETFEM_HAVE_OPENMP
 #include <boost/atomic/atomic.hpp>
 typedef  boost::atomic_bool atomic_bool;
 #else

Modified: trunk/getfem/src/getfem/dal_static_stored_objects.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/dal_static_stored_objects.h?rev=4574&r1=4573&r2=4574&view=diff
==============================================================================
--- trunk/getfem/src/getfem/dal_static_stored_objects.h (original)
+++ trunk/getfem/src/getfem/dal_static_stored_objects.h Mon Mar 31 23:55:15 2014
@@ -78,12 +78,17 @@
 #include "getfem/getfem_arch_config.h"
 #ifdef GETFEM_HAVE_BOOST
 #include <boost/intrusive_ptr.hpp>
+#else
+# include <getfem_boost/intrusive_ptr.hpp>
+#endif
+
+#ifdef GETFEM_HAVE_OPENMP
 #include <boost/atomic.hpp>
 typedef boost::atomic<int> atomic_int;
 #else
-# include <getfem_boost/intrusive_ptr.hpp>
 typedef int atomic_int;
 #endif
+
 #include <memory>
 
 
@@ -195,7 +200,7 @@
   }
 
 
-#ifdef GETFEM_HAVE_BOOST
+#ifdef GETFEM_HAVE_OPENMP
   inline void intrusive_ptr_add_ref(const static_stored_object * x)
   {
     x->pointer_ref_count_.fetch_add(1, boost::memory_order_relaxed);

Modified: trunk/getfem/src/getfem/getfem_mesh_region.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_mesh_region.h?rev=4574&r1=4573&r2=4574&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_mesh_region.h        (original)
+++ trunk/getfem/src/getfem/getfem_mesh_region.h        Mon Mar 31 23:55:15 2014
@@ -38,7 +38,6 @@
 #ifndef GETFEM_MESH_REGION
 #define GETFEM_MESH_REGION
 
-#include <map>
 #include <bitset>
 #include <iostream>
 #include "dal_bit_vector.h"
@@ -46,9 +45,15 @@
 #include "bgeot_convex_structure.h"
 #include "getfem_config.h"
 
+#if __cplusplus > 199711L
+#include <unordered_map>
+#elif defined(GETFEM_HAVE_BOOST) && BOOST_VERSION >= 103600
+#include <boost/unordered_map.hpp>
+#else
+#include <map>
+#endif
 
 #ifdef GETFEM_HAVE_BOOST
-#include <boost/unordered_map.hpp>
 #include <boost/shared_ptr.hpp>
 #endif
 
@@ -63,7 +68,9 @@
   public:
     typedef std::bitset<MAX_FACES_PER_CV+1> face_bitset;
 
-#ifdef GETFEM_HAVE_BOOST
+#if __cplusplus > 199711L
+    typedef std::unordered_map<size_type,face_bitset> map_t;
+#elif defined(GETFEM_HAVE_BOOST) && BOOST_VERSION >= 103600
     typedef boost::unordered_map<size_type,face_bitset> map_t;
 #else
     typedef std::map<size_type,face_bitset> map_t;
@@ -150,13 +157,13 @@
     }
     /** return the intersection of two mesh regions */
     static mesh_region intersection(const mesh_region& a, 
-      const mesh_region& b); 
+                                    const mesh_region& b); 
     /** return the union of two mesh_regions */
     static mesh_region merge(const mesh_region &a, 
-      const mesh_region &b);
+                             const mesh_region &b);
     /** remove the second region from the first one */
     static mesh_region substract(const mesh_region &a, 
-      const mesh_region &b);
+                                 const mesh_region &b);
     size_type id() const { return id_; }
 
     size_type get_type() const { return type_; }

Modified: trunk/getfem/src/getfem/getfem_omp.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_omp.h?rev=4574&r1=4573&r2=4574&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_omp.h        (original)
+++ trunk/getfem/src/getfem/getfem_omp.h        Mon Mar 31 23:55:15 2014
@@ -39,24 +39,18 @@
 #ifndef GETFEM_OMP
 #define GETFEM_OMP
 
-#ifdef _OPENMP
-#ifndef GETFEM_HAVE_BOOST
-#error OpenMP compilation relies on Boost \
-  threads. Please include Boost libraries with compiled \
-  Boost.thread library and define GETFEM_HAVE_BOOST macro
-#endif
-#endif
 #include <vector>
-#ifdef _OPENMP
+#include <algorithm>
+
+#ifdef GETFEM_HAVE_OPENMP
 #include <omp.h>
-#endif
-#include <algorithm>
-#ifdef GETFEM_HAVE_BOOST
 #include <boost/thread.hpp>
 #endif
+
 #ifdef _WIN32
 #include <mbctype.h>
 #endif
+
 #include <locale.h>
 #include <memory>
 #include "dal_shared_ptr.h"
@@ -74,7 +68,7 @@
 
   //declaring a thread lock, to protect multi-threaded accesses to
   //asserts, traces and warnings
-#ifdef GETFEM_HAVE_BOOST
+#ifdef GETFEM_HAVE_OPENMP
   class omp_guard: public boost::lock_guard<boost::mutex>
   {
   public:
@@ -88,7 +82,7 @@
 
 
 
-#ifdef _OPENMP 
+#ifdef GETFEM_HAVE_OPENMP      
   /**number of OpenMP threads*/
   inline size_t num_threads(){return omp_get_max_threads();}
   /**index of the current thread*/
@@ -221,7 +215,7 @@
   the effect of thread local storage for any type of objects
   and their initialization (it's more general and portable
   then using __declspec(thread))*/
-#ifdef _OPENMP
+#ifdef GETFEM_HAVE_OPENMP
 #define        DEFINE_STATIC_THREAD_LOCAL_INITIALIZED(Type,Var,initial) \
   static boost::thread_specific_ptr<Type> ptr_##Var; \
   if(!ptr_##Var.get()) {ptr_##Var.reset(new Type(initial));} \

Modified: trunk/getfem/src/getfem_omp.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_omp.cc?rev=4574&r1=4573&r2=4574&view=diff
==============================================================================
--- trunk/getfem/src/getfem_omp.cc      (original)
+++ trunk/getfem/src/getfem_omp.cc      Mon Mar 31 23:55:15 2014
@@ -4,7 +4,7 @@
 
 namespace getfem{ 
 
-#ifdef GETFEM_HAVE_BOOST
+#ifdef GETFEM_HAVE_OPENMP
   boost::mutex omp_guard::boost_mutex;
   omp_guard::omp_guard() : boost::lock_guard<boost::mutex>(boost_mutex) {}
 #endif

Modified: trunk/getfem/src/gmm/gmm_std.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/gmm/gmm_std.h?rev=4574&r1=4573&r2=4574&view=diff
==============================================================================
--- trunk/getfem/src/gmm/gmm_std.h      (original)
+++ trunk/getfem/src/gmm/gmm_std.h      Mon Mar 31 23:55:15 2014
@@ -129,7 +129,7 @@
 #include <locale.h>
 
 
-#ifdef _OPENMP 
+#ifdef GETFEM_HAVE_OPENMP      
 #include <omp.h>
        /**number of OpenMP threads*/
        inline size_t num_threads(){return omp_get_max_threads();}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]