/**
* 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
* 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:
/**
// ---------------------------------------------------------------------
//
-// 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.
//
}
}
+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
+ }
+}
+