]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move an implementation to a source file. 5926/head
authorDavid Wells <wellsd2@rpi.edu>
Mon, 19 Feb 2018 00:20:17 +0000 (19:20 -0500)
committerDavid Wells <wellsd2@rpi.edu>
Mon, 19 Feb 2018 03:37:59 +0000 (22:37 -0500)
include/deal.II/base/parallel.h
source/base/parallel.cc

index ad3e37e36cf8f3836114968f06c6fa32c1560ee9..b3db498933e08c8513a7194a3a0fcfce30d495ed 100644 (file)
@@ -703,25 +703,14 @@ namespace parallel
       /**
        * Constructor.
        */
-      TBBPartitioner()
-#ifdef DEAL_II_WITH_THREADS
-        :
-        my_partitioner(std::make_shared<tbb::affinity_partitioner>()),
-        in_use(false)
-#endif
-      {}
+      TBBPartitioner();
 
 #ifdef DEAL_II_WITH_THREADS
       /**
        * Destructor. Check that the object is not in use any more, i.e., all
        * loops have been completed.
        */
-      ~TBBPartitioner()
-      {
-        AssertNothrow(in_use == false,
-                      ExcInternalError("A vector partitioner goes out of scope, but "
-                                       "it appears to be still in use."));
-      }
+      ~TBBPartitioner();
 
       /**
        * Return an affinity partitioner. In case the partitioner owned by the
@@ -730,29 +719,14 @@ namespace parallel
        * again, return it by the release_one_partitioner() call.
        */
       std::shared_ptr<tbb::affinity_partitioner>
-      acquire_one_partitioner()
-      {
-        dealii::Threads::Mutex::ScopedLock lock(mutex);
-        if (in_use)
-          return std::make_shared<tbb::affinity_partitioner>();
-
-        in_use = true;
-        return my_partitioner;
-      }
+      acquire_one_partitioner();
 
       /**
        * After using the partitioner in a tbb loop through
        * acquire_one_partitioner(), this call makes the partitioner available
        * again.
        */
-      void release_one_partitioner(std::shared_ptr<tbb::affinity_partitioner> &p)
-      {
-        if (p.get() == my_partitioner.get())
-          {
-            dealii::Threads::Mutex::ScopedLock lock(mutex);
-            in_use = false;
-          }
-      }
+      void release_one_partitioner(std::shared_ptr<tbb::affinity_partitioner> &p);
 
     private:
       /**
index 476b6f02afaa079fe53e45811e4e1418dcdf438d..1a72567154f90953e17c2339b8a9174e789399c6 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2009 - 2016 by the deal.II authors
+// Copyright (C) 2009 - 2018 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -49,6 +49,56 @@ namespace internal
   }
 }
 
+namespace parallel
+{
+  namespace internal
+  {
+#ifdef DEAL_II_WITH_THREADS
+    TBBPartitioner::TBBPartitioner()
+      :
+      my_partitioner(std::make_shared<tbb::affinity_partitioner>()),
+      in_use(false)
+    {}
+
+
+
+    TBBPartitioner::~TBBPartitioner()
+    {
+      AssertNothrow(in_use == false,
+                    ExcInternalError("A vector partitioner goes out of scope, but "
+                                     "it appears to be still in use."));
+    }
+
+
+
+    std::shared_ptr<tbb::affinity_partitioner>
+    TBBPartitioner::acquire_one_partitioner()
+    {
+      dealii::Threads::Mutex::ScopedLock lock(mutex);
+      if (in_use)
+        return std::make_shared<tbb::affinity_partitioner>();
+
+      in_use = true;
+      return my_partitioner;
+    }
+
+
+
+    void
+    TBBPartitioner::release_one_partitioner(std::shared_ptr<tbb::affinity_partitioner> &p)
+    {
+      if (p.get() == my_partitioner.get())
+        {
+          dealii::Threads::Mutex::ScopedLock lock(mutex);
+          in_use = false;
+        }
+    }
+#else
+    TBBPartitioner::TBBPartitioner() = default;
+#endif
+  }
+}
+
 
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.