]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Revert "Fix compiling with THREADS=ON"
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 28 Sep 2018 23:35:16 +0000 (01:35 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 28 Sep 2018 23:35:16 +0000 (01:35 +0200)
This reverts commit 49e7b20b064893627a5b403449fdc29edf1cd3d8.

29 files changed:
include/deal.II/base/timer.h
include/deal.II/fe/fe_tools.templates.h
include/deal.II/lac/block_matrix_base.h
include/deal.II/lac/la_parallel_vector.templates.h
include/deal.II/lac/precondition.h
include/deal.II/lac/swappable_vector.templates.h
include/deal.II/lac/tensor_product_matrix.h
include/deal.II/lac/vector_memory.templates.h
include/deal.II/matrix_free/dof_info.templates.h
source/base/flow_function.cc
source/base/function_cspline.cc
source/base/function_parser.cc
source/base/index_set.cc
source/base/logstream.cc
source/base/polynomial.cc
source/base/polynomials_abf.cc
source/base/polynomials_bdm.cc
source/base/polynomials_raviart_thomas.cc
source/base/polynomials_rt_bubbles.cc
source/base/timer.cc
source/fe/fe_dgq.cc
source/fe/fe_nedelec.cc
source/fe/fe_poly_tensor.cc
source/fe/fe_q_base.cc
source/fe/fe_system.cc
source/fe/mapping_fe_field.cc
source/fe/mapping_q_eulerian.cc
source/lac/lapack_full_matrix.cc
source/lac/scalapack.cc

index 1fad47765fea02ca885ea7cce93fee33a6f5f2f9..1acb5750d246ad5d196e17c021cde1a4e79a4441 100644 (file)
@@ -910,9 +910,7 @@ private:
    * A lock that makes sure that this class gives reasonable results even when
    * used with several threads.
    */
-#ifdef DEAL_II_WITH_THREADS
   Threads::Mutex mutex;
-#endif
 };
 
 
index 9721e875194794f0966a993a76f388c61ce07f18..c741bc0c245c36e98688607c082b0c3a0eb4e24d 100644 (file)
@@ -1281,9 +1281,7 @@ namespace FETools
       // they're in an anonymous namespace) in order to make icc happy
       // (which otherwise reports a multiply defined symbol when linking
       // libraries for more than one space dimension together
-#ifdef DEAL_II_WITH_THREADS
       static Threads::Mutex fe_name_map_lock;
-#endif
 
       // This is the map used by FETools::get_fe_by_name and
       // FETools::add_fe_name. It is only accessed by functions in this
@@ -2406,15 +2404,13 @@ namespace FETools
       "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"));
     if (name_end < name.size())
       name.erase(name_end);
-      // first make sure that no other
-      // thread intercepts the
-      // operation of this function;
-      // for this, acquire the lock
-      // until we quit this function
-#ifdef DEAL_II_WITH_THREADS
+    // first make sure that no other
+    // thread intercepts the
+    // operation of this function;
+    // for this, acquire the lock
+    // until we quit this function
     std::lock_guard<std::mutex> lock(
       internal::FEToolsAddFENameHelper::fe_name_map_lock);
-#endif
 
     Assert(
       internal::FEToolsAddFENameHelper::fe_name_map[dim][spacedim].find(name) ==
@@ -2570,10 +2566,8 @@ namespace FETools
           {
             // Make sure no other thread
             // is just adding an element
-#ifdef DEAL_II_WITH_THREADS
             std::lock_guard<std::mutex> lock(
               internal::FEToolsAddFENameHelper::fe_name_map_lock);
-#endif
             AssertThrow(fe_name_map.find(name_part) != fe_name_map.end(),
                         FETools::ExcInvalidFEName(name));
 
index 955d43d69c9dc3173f55fb1b75939331a6ebb75d..13c9b4a335cf688e6f7f33e5ea80d69c8da85bd2 100644 (file)
@@ -1724,9 +1724,7 @@ BlockMatrixBase<MatrixType>::set(const size_type  row,
 
   // lock access to the temporary data structure to
   // allow multiple threads to call this function concurrently
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(temporary_data.mutex);
-#  endif
 
   // Resize scratch arrays
   if (temporary_data.column_indices.size() < this->n_block_cols())
@@ -1982,10 +1980,8 @@ BlockMatrixBase<MatrixType>::add(const size_type  row,
       return;
     }
 
-    // Lock scratch arrays, then resize them
-#  ifdef DEAL_II_WITH_THREADS
+  // Lock scratch arrays, then resize them
   std::lock_guard<std::mutex> lock(temporary_data.mutex);
-#  endif
 
   if (temporary_data.column_indices.size() < this->n_block_cols())
     {
index 7a63627e51c5323d7a23e4d657a5cdb150adb057..f008b8ce53e3cab666b3899d0047bb534f9d8d3e 100644 (file)
@@ -875,9 +875,7 @@ namespace LinearAlgebra
 
 #ifdef DEAL_II_WITH_MPI
       // make this function thread safe
-#  ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(mutex);
-#  endif
 
       // allocate import_data in case it is not set up yet
       if (import_data == nullptr && partitioner->n_import_indices() > 0)
@@ -930,9 +928,7 @@ namespace LinearAlgebra
       // compress_requests.size() == 0
 
       // make this function thread safe
-#  ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(mutex);
-#  endif
 
       Assert(partitioner->n_import_indices() == 0 || import_data != nullptr,
              ExcNotInitialized());
@@ -978,10 +974,8 @@ namespace LinearAlgebra
           partitioner->n_import_indices() == 0)
         return;
 
-        // make this function thread safe
-#  ifdef DEAL_II_WITH_THREADS
+      // make this function thread safe
       std::lock_guard<std::mutex> lock(mutex);
-#  endif
 
       // allocate import_data in case it is not set up yet
       if (import_data == nullptr && partitioner->n_import_indices() > 0)
@@ -1039,9 +1033,7 @@ namespace LinearAlgebra
       if (update_ghost_values_requests.size() > 0)
         {
           // make this function thread safe
-#  ifdef DEAL_II_WITH_THREADS
           std::lock_guard<std::mutex> lock(mutex);
-#  endif
 
           partitioner->export_to_ghosted_array_finish(
             ArrayView<Number>(data.values.get() + partitioner->local_size(),
index 595f2aa3054b035cb28cc6f3b13c6dc996a48eab..45bdb20c1353fb2c8f0121c6e09250e0d745a344 100644 (file)
@@ -2308,9 +2308,7 @@ PreconditionChebyshev<MatrixType, VectorType, PreconditionerType>::vmult(
   VectorType &      dst,
   const VectorType &src) const
 {
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
   if (eigenvalues_are_initialized == false)
     estimate_eigenvalues(src);
 
@@ -2336,9 +2334,7 @@ PreconditionChebyshev<MatrixType, VectorType, PreconditionerType>::Tvmult(
   VectorType &      dst,
   const VectorType &src) const
 {
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
   if (eigenvalues_are_initialized == false)
     estimate_eigenvalues(src);
 
@@ -2364,9 +2360,7 @@ PreconditionChebyshev<MatrixType, VectorType, PreconditionerType>::step(
   VectorType &      dst,
   const VectorType &src) const
 {
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
   if (eigenvalues_are_initialized == false)
     estimate_eigenvalues(src);
 
@@ -2393,9 +2387,7 @@ PreconditionChebyshev<MatrixType, VectorType, PreconditionerType>::Tstep(
   VectorType &      dst,
   const VectorType &src) const
 {
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
   if (eigenvalues_are_initialized == false)
     estimate_eigenvalues(src);
 
index 64b98682d24c63925f6224e33d1501260d5ccc87..54963f8920f59fc6ca782ee29027c0c93daa0278 100644 (file)
@@ -75,12 +75,10 @@ SwappableVector<number>::operator=(const SwappableVector<number> &v)
   if (filename != "")
     kill_file();
 
-    // if in MT mode, block all other
-    // operations. if not in MT mode,
-    // this is a no-op
-#ifdef DEAL_II_WITH_THREADS
+  // if in MT mode, block all other
+  // operations. if not in MT mode,
+  // this is a no-op
   std::lock_guard<std::mutex> lock(this->lock);
-#endif
 
   Vector<number>::operator=(v);
   data_is_preloaded       = false;
@@ -109,9 +107,7 @@ SwappableVector<number>::swap_out(const std::string &name)
   // if in MT mode, block all other
   // operations. if not in MT mode,
   // this is a no-op
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(this->lock);
-#endif
 
   //  check that we have not called
   //  @p alert without the respective
@@ -135,9 +131,7 @@ SwappableVector<number>::reload()
   // possibly existing @p alert
   // calls. if not in MT mode, this
   // is a no-op
-#ifdef DEAL_II_WITH_THREADS
   lock.lock();
-#endif
 
   // if data was already preloaded,
   // then there is no more need to
@@ -153,12 +147,10 @@ SwappableVector<number>::reload()
       // needed
       data_is_preloaded = false;
 
-// release lock. the lock is
-// also released in the other
-// branch of the if-clause
-#ifdef DEAL_II_WITH_THREADS
+      // release lock. the lock is
+      // also released in the other
+      // branch of the if-clause
       lock.unlock();
-#endif
     }
 }
 
@@ -233,9 +225,7 @@ SwappableVector<number>::kill_file()
   // (there should be none, but who
   // knows). if not in MT mode,
   // this is a no-op
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(this->lock);
-#endif
 
   // this is too bad: someone
   // requested the vector in advance,
index 6d86f64dbd51b31a051124c865848adb02ee756e..53fcb039f15e3212af85f599da3fc2142e6d1d2a 100644 (file)
@@ -477,10 +477,8 @@ TensorProductMatrixSymmetricSumBase<dim, Number, size>::vmult(
 {
   AssertDimension(dst_view.size(), this->m());
   AssertDimension(src_view.size(), this->n());
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(this->mutex);
-#  endif
-  const unsigned int n =
+  const unsigned int          n =
     Utilities::fixed_power<dim>(size > 0 ? size : eigenvalues[0].size());
   tmp_array.resize_fast(n * 2);
   constexpr int kernel_size = size > 0 ? size : 0;
@@ -547,10 +545,8 @@ TensorProductMatrixSymmetricSumBase<dim, Number, size>::apply_inverse(
 {
   AssertDimension(dst_view.size(), this->n());
   AssertDimension(src_view.size(), this->m());
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(this->mutex);
-#  endif
-  const unsigned int n = size > 0 ? size : eigenvalues[0].size();
+  const unsigned int          n = size > 0 ? size : eigenvalues[0].size();
   tmp_array.resize_fast(Utilities::fixed_power<dim>(n));
   constexpr int kernel_size = size > 0 ? size : 0;
   internal::EvaluatorTensorProduct<internal::evaluate_general,
index e111d568cd126406840c4025d22cbdb409a58a32..20412b74805905a560dec84bc99ac1ebf0e37607 100644 (file)
@@ -81,9 +81,7 @@ inline GrowingVectorMemory<VectorType>::GrowingVectorMemory(
   , current_alloc(0)
   , log_statistics(log_statistics)
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
   pool.initialize(initial_size);
 }
 
@@ -108,9 +106,7 @@ template <typename VectorType>
 inline VectorType *
 GrowingVectorMemory<VectorType>::alloc()
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   ++total_alloc;
   ++current_alloc;
@@ -140,9 +136,7 @@ template <typename VectorType>
 inline void
 GrowingVectorMemory<VectorType>::free(const VectorType *const v)
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   for (typename std::vector<entry_type>::iterator i = pool.data->begin();
        i != pool.data->end();
@@ -164,9 +158,7 @@ template <typename VectorType>
 inline void
 GrowingVectorMemory<VectorType>::release_unused_memory()
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   if (pool.data != nullptr)
     pool.data->clear();
@@ -178,9 +170,7 @@ template <typename VectorType>
 inline std::size_t
 GrowingVectorMemory<VectorType>::memory_consumption() const
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   std::size_t                                            result = sizeof(*this);
   const typename std::vector<entry_type>::const_iterator end = pool.data->end();
index 349aade88653ba5d54a4016c61b82359af3d02df..a3400b2b506a01db4bf42de0ba140dce3bc52b1b 100644 (file)
@@ -1286,15 +1286,11 @@ namespace internal
       static constexpr unsigned int bucket_size_threading = 256;
 
       void
-      compute_row_lengths(const unsigned int begin,
-                          const unsigned int end,
-                          const DoFInfo &    dof_info,
-#ifdef DEAL_II_WITH_THREADS
+      compute_row_lengths(const unsigned int           begin,
+                          const unsigned int           end,
+                          const DoFInfo &              dof_info,
                           std::vector<Threads::Mutex> &mutexes,
-#else
-                          std::vector<Threads::Mutex> &,
-#endif
-                          std::vector<unsigned int> &row_lengths)
+                          std::vector<unsigned int> &  row_lengths)
       {
         std::vector<unsigned int> scratch;
         const unsigned int n_components = dof_info.start_components.back();
@@ -1317,11 +1313,8 @@ namespace internal
                 // that are within the range of one lock at once
                 const unsigned int next_bucket =
                   (*it / bucket_size_threading + 1) * bucket_size_threading;
-#ifdef DEAL_II_WITH_THREADS
                 std::lock_guard<std::mutex> lock(
                   mutexes[*it / bucket_size_threading]);
-#endif
-
                 for (; it != end_unique && *it < next_bucket; ++it)
                   {
                     AssertIndexRange(*it, row_lengths.size());
@@ -1336,12 +1329,8 @@ namespace internal
                              const unsigned int               end,
                              const DoFInfo &                  dof_info,
                              const std::vector<unsigned int> &row_lengths,
-#ifdef DEAL_II_WITH_THREADS
-                             std::vector<Threads::Mutex> &mutexes,
-#else
-                             std::vector<Threads::Mutex> &,
-#endif
-                             dealii::SparsityPattern &connectivity_dof)
+                             std::vector<Threads::Mutex> &    mutexes,
+                             dealii::SparsityPattern &        connectivity_dof)
       {
         std::vector<unsigned int> scratch;
         const unsigned int n_components = dof_info.start_components.back();
@@ -1362,10 +1351,8 @@ namespace internal
               {
                 const unsigned int next_bucket =
                   (*it / bucket_size_threading + 1) * bucket_size_threading;
-#ifdef DEAL_II_WITH_THREADS
                 std::lock_guard<std::mutex> lock(
                   mutexes[*it / bucket_size_threading]);
-#endif
                 for (; it != end_unique && *it < next_bucket; ++it)
                   if (row_lengths[*it] > 0)
                     connectivity_dof.add(*it, block);
index 8bf63deeefd2f6e0634ece9d96dfac59d876ae29..8dae6dc072a8039c632e50998775a9f136bd0a0d 100644 (file)
@@ -57,9 +57,7 @@ namespace Functions
 
     // guard access to the aux_*
     // variables in multithread mode
-#ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(mutex);
-#endif
 
     for (unsigned int d = 0; d < dim + 1; ++d)
       aux_values[d].resize(n_points);
@@ -89,9 +87,7 @@ namespace Functions
 
     // guard access to the aux_*
     // variables in multithread mode
-#ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(mutex);
-#endif
 
     for (unsigned int d = 0; d < dim + 1; ++d)
       aux_values[d].resize(n_points);
@@ -114,9 +110,7 @@ namespace Functions
 
     // guard access to the aux_*
     // variables in multithread mode
-#ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(mutex);
-#endif
 
     for (unsigned int d = 0; d < dim + 1; ++d)
       aux_values[d].resize(n_points);
@@ -138,9 +132,7 @@ namespace Functions
 
     // guard access to the aux_*
     // variables in multithread mode
-#ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(mutex);
-#endif
 
     for (unsigned int d = 0; d < dim + 1; ++d)
       aux_gradients[d].resize(n_points);
@@ -168,9 +160,7 @@ namespace Functions
 
     // guard access to the aux_*
     // variables in multithread mode
-#ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(mutex);
-#endif
 
     for (unsigned int d = 0; d < dim + 1; ++d)
       aux_values[d].resize(n_points);
index 46c83e8b82e5accef72304a7180490473173e981..cdc9972c4942514f319cc93be2099f377c75d164 100644 (file)
@@ -73,9 +73,7 @@ namespace Functions
     // GSL functions may modify gsl_interp_accel *acc object (last argument).
     // This can only work in multithreaded applications if we lock the data
     // structures via a mutex.
-#  ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(acc_mutex);
-#  endif
 
     const double x = p[0];
     Assert(x >= interpolation_points.front() &&
@@ -96,9 +94,7 @@ namespace Functions
     // GSL functions may modify gsl_interp_accel *acc object (last argument).
     // This can only work in multithreaded applications if we lock the data
     // structures via a mutex.
-#  ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(acc_mutex);
-#  endif
 
     const double x = p[0];
     Assert(x >= interpolation_points.front() &&
@@ -122,9 +118,7 @@ namespace Functions
     // GSL functions may modify gsl_interp_accel *acc object (last argument).
     // This can only work in multithreaded applications if we lock the data
     // structures via a mutex.
-#  ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(acc_mutex);
-#  endif
 
     const double x = p[0];
     Assert(x >= interpolation_points.front() &&
index 3d27017dd0e2b851727ec9876343cfdd011ac376..769c681851adb60cd2adad0491c7c0a709f6dbdd 100644 (file)
@@ -241,10 +241,8 @@ namespace internal
   double
   mu_rand_seed(double seed)
   {
-#  ifdef DEAL_II_WITH_THREADS
     static Threads::Mutex       rand_mutex;
     std::lock_guard<std::mutex> lock(rand_mutex);
-#  endif
 
     static boost::random::uniform_real_distribution<> uniform_distribution(0,
                                                                            1);
@@ -263,10 +261,8 @@ namespace internal
   double
   mu_rand()
   {
-#  ifdef DEAL_II_WITH_THREADS
-    static Threads::Mutex       rand_mutex;
-    std::lock_guard<std::mutex> lock(rand_mutex);
-#  endif
+    static Threads::Mutex                             rand_mutex;
+    std::lock_guard<std::mutex>                       lock(rand_mutex);
     static boost::random::uniform_real_distribution<> uniform_distribution(0,
                                                                            1);
     static boost::random::mt19937                     rng(
index 7b69d4f06e3977ea486fa0e155766021403d9dec..5a491e5f7aa60dff4ef971755ffaeb5bcbdda8cd 100644 (file)
@@ -129,9 +129,7 @@ IndexSet::do_compress() const
   // via a mutex, so that users can call 'const' functions from threads
   // in parallel (and these 'const' functions can then call compress()
   // which itself calls the current function)
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(compress_mutex);
-#endif
 
   // see if any of the contiguous ranges can be merged. do not use
   // std::vector::erase in-place as it is quadratic in the number of
index 976c99064f9005bc0365430c437983bd144de7b9..c1c97a33798ca7324794d12384ab219e501ff84a 100644 (file)
@@ -27,10 +27,8 @@ DEAL_II_NAMESPACE_OPEN
 
 namespace
 {
-#ifdef DEAL_II_WITH_THREADS
   Threads::Mutex log_lock;
   Threads::Mutex write_lock;
-#endif
 } // namespace
 
 
@@ -193,9 +191,7 @@ LogStream::operator<<(std::ostream &(*p)(std::ostream &))
 
   if (query_streambuf.flushed())
     {
-#ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(write_lock);
-#endif
 
       // Print the line head in case of a previous newline:
       if (at_newline)
@@ -222,9 +218,7 @@ LogStream::attach(std::ostream &                o,
                   const bool                    print_job_id,
                   const std::ios_base::fmtflags flags)
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(log_lock);
-#endif
   file = &o;
   o.setf(flags);
   if (print_job_id)
@@ -235,9 +229,7 @@ LogStream::attach(std::ostream &                o,
 void
 LogStream::detach()
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(log_lock);
-#endif
   file = nullptr;
 }
 
@@ -355,11 +347,9 @@ LogStream::width(const std::streamsize wide)
 unsigned int
 LogStream::depth_console(const unsigned int n)
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(log_lock);
-#endif
-  const unsigned int h = std_depth;
-  std_depth            = n;
+  const unsigned int          h = std_depth;
+  std_depth                     = n;
   return h;
 }
 
@@ -368,11 +358,9 @@ LogStream::depth_console(const unsigned int n)
 unsigned int
 LogStream::depth_file(const unsigned int n)
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(log_lock);
-#endif
-  const unsigned int h = file_depth;
-  file_depth           = n;
+  const unsigned int          h = file_depth;
+  file_depth                    = n;
   return h;
 }
 
@@ -381,11 +369,9 @@ LogStream::depth_file(const unsigned int n)
 bool
 LogStream::log_thread_id(const bool flag)
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(log_lock);
-#endif
-  const bool h    = print_thread_id;
-  print_thread_id = flag;
+  const bool                  h = print_thread_id;
+  print_thread_id               = flag;
   return h;
 }
 
index 2bc3f1d25adb3cbfd5785531f1a2008d6999eaf0..141d55dd6c14a534617a553026b90c4d1448a2e3 100644 (file)
@@ -38,10 +38,8 @@ DEAL_II_NAMESPACE_OPEN
 // more fine-grained solution
 namespace
 {
-#ifdef DEAL_II_WITH_THREADS
   Threads::Mutex coefficients_lock;
-#endif
-} // namespace
+}
 
 
 
@@ -1008,9 +1006,7 @@ namespace Polynomials
     // of this function
     // for this, acquire the lock
     // until we quit this function
-#ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(coefficients_lock);
-#endif
 
     // The first 2 coefficients
     // are hard-coded
@@ -1070,13 +1066,9 @@ namespace Polynomials
           }
         else if (k == 2)
           {
-#ifdef DEAL_II_WITH_THREADS
             coefficients_lock.unlock();
-#endif
             compute_coefficients(1);
-#ifdef DEAL_II_WITH_THREADS
             coefficients_lock.lock();
-#endif
 
             std::vector<double> c2(3);
 
@@ -1099,13 +1091,9 @@ namespace Polynomials
             // allow the called
             // function to acquire it
             // itself
-#ifdef DEAL_II_WITH_THREADS
             coefficients_lock.unlock();
-#endif
             compute_coefficients(k - 1);
-#ifdef DEAL_II_WITH_THREADS
             coefficients_lock.lock();
-#endif
 
             std::vector<double> ck(k + 1);
 
@@ -1152,9 +1140,7 @@ namespace Polynomials
     // then get a pointer to the array
     // of coefficients. do that in a MT
     // safe way
-#ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(coefficients_lock);
-#endif
     return *recursive_coefficients[k];
   }
 
index bf698b1ea49fd055641d4410761067de65a1d399..b8ca149a93f0c3f4056f217f9dd0aece411c9733 100644 (file)
@@ -86,9 +86,7 @@ PolynomialsABF<dim>::compute(
   // using a mutex to make sure they
   // are not used by multiple threads
   // at once
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   p_values.resize((values.size() == 0) ? 0 : n_sub);
   p_grads.resize((grads.size() == 0) ? 0 : n_sub);
index 860b8536586b72215d0f832fdaff07c35756856a..51491c0a0b4e3a86183f4f6d567aa938e8b4055d 100644 (file)
@@ -85,9 +85,7 @@ PolynomialsBDM<dim>::compute(
   // are not used by multiple threads
   // at once
   {
-#ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(mutex);
-#endif
 
     p_values.resize((values.size() == 0) ? 0 : n_sub);
     p_grads.resize((grads.size() == 0) ? 0 : n_sub);
index 9505832a048e5bb1be2bb06ef6b5b4b7191fa19e..8bf74e98817e4d30026fda9b631eff3bfe922c46 100644 (file)
@@ -80,23 +80,21 @@ PolynomialsRaviartThomas<dim>::compute(
   Assert(fourth_derivatives.size() == n_pols || fourth_derivatives.size() == 0,
          ExcDimensionMismatch(fourth_derivatives.size(), n_pols));
 
-// have a few scratch
-// arrays. because we don't want to
-// re-allocate them every time this
-// function is called, we make them
-// static. however, in return we
-// have to ensure that the calls to
-// the use of these variables is
-// locked with a mutex. if the
-// mutex is removed, several tests
-// (notably
-// deal.II/create_mass_matrix_05)
-// will start to produce random
-// results in multithread mode
-#ifdef DEAL_II_WITH_THREADS
+  // have a few scratch
+  // arrays. because we don't want to
+  // re-allocate them every time this
+  // function is called, we make them
+  // static. however, in return we
+  // have to ensure that the calls to
+  // the use of these variables is
+  // locked with a mutex. if the
+  // mutex is removed, several tests
+  // (notably
+  // deal.II/create_mass_matrix_05)
+  // will start to produce random
+  // results in multithread mode
   static Threads::Mutex       mutex;
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   static std::vector<double>         p_values;
   static std::vector<Tensor<1, dim>> p_grads;
index 8cc0447c6ff640056115e9e43937e2be532dca0a..117d244723462c7738e2a9d7a50b17cc9b8c49ac 100644 (file)
@@ -73,10 +73,8 @@ PolynomialsRT_Bubbles<dim>::compute(
   // using a mutex to make sure they are not used by multiple threads
   // at once
   {
-#ifdef DEAL_II_WITH_THREADS
     static Threads::Mutex       mutex;
     std::lock_guard<std::mutex> lock(mutex);
-#endif
 
     static std::vector<Tensor<1, dim>> p_values;
     static std::vector<Tensor<2, dim>> p_grads;
index 433bcb132c1e05008d582946f36cd1aa6ad60aea..e2a1fba761ffbff27fb9f8f07f2384673a996354 100644 (file)
@@ -412,9 +412,7 @@ TimerOutput::~TimerOutput()
 void
 TimerOutput::enter_subsection(const std::string &section_name)
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   Assert(section_name.empty() == false, ExcMessage("Section string is empty."));
 
@@ -459,9 +457,7 @@ TimerOutput::leave_subsection(const std::string &section_name)
   Assert(!active_sections.empty(),
          ExcMessage("Cannot exit any section because none has been entered!"));
 
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   if (section_name != "")
     {
@@ -877,9 +873,7 @@ TimerOutput::enable_output()
 void
 TimerOutput::reset()
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
   sections.clear();
   active_sections.clear();
   timer_all.restart();
index a923c88fbf6ee683531c25f6a20539401e9d1f55..439fb5d7b5a783aa3c7de0f1bdbfa736b7e0056b 100644 (file)
@@ -408,9 +408,7 @@ FE_DGQ<dim, spacedim>::get_prolongation_matrix(
   // initialization upon first request
   if (this->prolongation[refinement_case - 1][child].n() == 0)
     {
-#ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(this->mutex);
-#endif
 
       // if matrix got updated while waiting for the lock
       if (this->prolongation[refinement_case - 1][child].n() ==
@@ -490,9 +488,7 @@ FE_DGQ<dim, spacedim>::get_restriction_matrix(
   // initialization upon first request
   if (this->restriction[refinement_case - 1][child].n() == 0)
     {
-#ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(this->mutex);
-#endif
 
       // if matrix got updated while waiting for the lock...
       if (this->restriction[refinement_case - 1][child].n() ==
index 367cd35799962886e63e93424fd570444da1e34c..51f5fe7515b7f0484f2117821d73c78218fffa51 100644 (file)
@@ -2985,9 +2985,7 @@ FE_Nedelec<dim>::get_prolongation_matrix(
   // initialization upon first request
   if (this->prolongation[refinement_case - 1][child].n() == 0)
     {
-#ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(this->mutex);
-#endif
 
       // if matrix got updated while waiting for the lock
       if (this->prolongation[refinement_case - 1][child].n() ==
@@ -3049,9 +3047,7 @@ FE_Nedelec<dim>::get_restriction_matrix(
   // initialization upon first request
   if (this->restriction[refinement_case - 1][child].n() == 0)
     {
-#ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(this->mutex);
-#endif
 
       // if matrix got updated while waiting for the lock...
       if (this->restriction[refinement_case - 1][child].n() ==
index f68b05c36c431eba509a2fa9f5c1ca9280c5a7ea..2dc68bc749b933fb966a3400e0926f47b5df838f 100644 (file)
@@ -201,9 +201,7 @@ FE_PolyTensor<PolynomialType, dim, spacedim>::shape_value_component(
   Assert(i < this->dofs_per_cell, ExcIndexRange(i, 0, this->dofs_per_cell));
   Assert(component < dim, ExcIndexRange(component, 0, dim));
 
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(cache_mutex);
-#endif
 
   if (cached_point != p || cached_values.size() == 0)
     {
@@ -249,9 +247,7 @@ FE_PolyTensor<PolynomialType, dim, spacedim>::shape_grad_component(
   Assert(i < this->dofs_per_cell, ExcIndexRange(i, 0, this->dofs_per_cell));
   Assert(component < dim, ExcIndexRange(component, 0, dim));
 
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(cache_mutex);
-#endif
 
   if (cached_point != p || cached_grads.size() == 0)
     {
@@ -298,9 +294,7 @@ FE_PolyTensor<PolynomialType, dim, spacedim>::shape_grad_grad_component(
   Assert(i < this->dofs_per_cell, ExcIndexRange(i, 0, this->dofs_per_cell));
   Assert(component < dim, ExcIndexRange(component, 0, dim));
 
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(cache_mutex);
-#endif
 
   if (cached_point != p || cached_grad_grads.size() == 0)
     {
index 09a7b01f1f9eb8278f8a305ddcf65f843a7a43a9..fd4f429c2293f5f9beb6006e1c53567e456a54d4 100644 (file)
@@ -1232,9 +1232,7 @@ FE_Q_Base<PolynomialType, dim, spacedim>::get_prolongation_matrix(
   // initialization upon first request
   if (this->prolongation[refinement_case - 1][child].n() == 0)
     {
-#ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(this->mutex);
-#endif
 
       // if matrix got updated while waiting for the lock
       if (this->prolongation[refinement_case - 1][child].n() ==
@@ -1436,9 +1434,7 @@ FE_Q_Base<PolynomialType, dim, spacedim>::get_restriction_matrix(
   // initialization upon first request
   if (this->restriction[refinement_case - 1][child].n() == 0)
     {
-#ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(this->mutex);
-#endif
 
       // if matrix got updated while waiting for the lock...
       if (this->restriction[refinement_case - 1][child].n() ==
index a10d8c14b010f6a3e8383bc115369a648ff46312..89f88c634fa55463f410f1f920554d02e8c29e38 100644 (file)
@@ -718,9 +718,7 @@ FESystem<dim, spacedim>::get_restriction_matrix(
   // initialization upon first request
   if (this->restriction[refinement_case - 1][child].n() == 0)
     {
-#ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(this->mutex);
-#endif
 
       // check if updated while waiting for lock
       if (this->restriction[refinement_case - 1][child].n() ==
@@ -817,9 +815,7 @@ FESystem<dim, spacedim>::get_prolongation_matrix(
   // restriction matrix
   if (this->prolongation[refinement_case - 1][child].n() == 0)
     {
-#ifdef DEAL_II_WITH_THREADS
       std::lock_guard<std::mutex> lock(this->mutex);
-#endif
 
       if (this->prolongation[refinement_case - 1][child].n() ==
           this->dofs_per_cell)
index 879388ff8d7ab2c0fc179b8db0c5c6ca61ad4743..5289c9d1e7ce1bc0a17758f10a57fb3bfea5be35 100644 (file)
@@ -321,9 +321,7 @@ MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::get_vertices(
       euler_dof_handler->get_fe().n_components()));
 
   {
-#ifdef DEAL_II_WITH_THREADS
     std::lock_guard<std::mutex> lock(fe_values_mutex);
-#endif
     fe_values.reinit(dof_cell);
     fe_values.get_function_values(*euler_vector, values);
   }
index 530c0c84320be77f4e5f6944543f0ab189815aab..e4bd088f83cc364baf0c53bf14825b0c28e7db28 100644 (file)
@@ -221,9 +221,7 @@ MappingQEulerian<dim, VectorType, spacedim>::MappingQEulerianGeneric::
   // fill shift vector for each support point using an fe_values object. make
   // sure that the fe_values variable isn't used simultaneously from different
   // threads
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(fe_values_mutex);
-#endif
   fe_values.reinit(dof_cell);
   if (mg_vector)
     {
index 40393811b469288a2181cf500f735419fbee04c8..e075424f7975f6b562f4bff2f6d8503dfaee485e 100644 (file)
@@ -670,9 +670,7 @@ LAPACKFullMatrix<number>::vmult(Vector<number> &      w,
         }
       case svd:
         {
-#ifdef DEAL_II_WITH_THREADS
           std::lock_guard<std::mutex> lock(mutex);
-#endif
           AssertDimension(v.size(), this->n());
           AssertDimension(w.size(), this->m());
           // Compute V^T v
@@ -707,9 +705,7 @@ LAPACKFullMatrix<number>::vmult(Vector<number> &      w,
         }
       case inverse_svd:
         {
-#ifdef DEAL_II_WITH_THREADS
           std::lock_guard<std::mutex> lock(mutex);
-#endif
           AssertDimension(w.size(), this->n());
           AssertDimension(v.size(), this->m());
           // Compute U^T v
@@ -809,9 +805,7 @@ LAPACKFullMatrix<number>::Tvmult(Vector<number> &      w,
         }
       case svd:
         {
-#ifdef DEAL_II_WITH_THREADS
           std::lock_guard<std::mutex> lock(mutex);
-#endif
           AssertDimension(w.size(), this->n());
           AssertDimension(v.size(), this->m());
 
@@ -847,9 +841,7 @@ LAPACKFullMatrix<number>::Tvmult(Vector<number> &      w,
         }
       case inverse_svd:
         {
-#ifdef DEAL_II_WITH_THREADS
           std::lock_guard<std::mutex> lock(mutex);
-#endif
           AssertDimension(v.size(), this->n());
           AssertDimension(w.size(), this->m());
 
@@ -1004,9 +996,7 @@ LAPACKFullMatrix<number>::Tmmult(LAPACKFullMatrix<number> &      C,
   // https://stackoverflow.com/questions/3548069/multiplying-three-matrices-in-blas-with-the-middle-one-being-diagonal
   // http://mathforum.org/kb/message.jspa?messageID=3546564
 
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
   // First, get V*B into "work" array
   work.resize(kk * nn);
   // following http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=768#p2577
@@ -1379,9 +1369,7 @@ template <typename number>
 number
 LAPACKFullMatrix<number>::norm(const char type) const
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   Assert(state == LAPACKSupport::matrix ||
            state == LAPACKSupport::inverse_matrix,
@@ -1459,9 +1447,7 @@ template <typename number>
 number
 LAPACKFullMatrix<number>::reciprocal_condition_number(const number a_norm) const
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
   Assert(state == cholesky, ExcState(state));
   number rcond = 0.;
 
@@ -1494,9 +1480,7 @@ template <typename number>
 number
 LAPACKFullMatrix<number>::reciprocal_condition_number() const
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
   Assert(property == upper_triangular || property == lower_triangular,
          ExcProperty(property));
   number rcond = 0.;
index 57c96e37e6d6b8f158c1f51529d032db767bd782..8067646a20bef2bf9254932b7612ff8ebd25845f 100644 (file)
@@ -1388,9 +1388,7 @@ ScaLAPACKMatrix<NumberType>::eigenpairs_symmetric(
   Assert(property == LAPACKSupport::symmetric,
          ExcMessage("Matrix has to be symmetric for this operation."));
 
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
 
   const bool use_values = (std::isnan(eigenvalue_limits.first) ||
                            std::isnan(eigenvalue_limits.second)) ?
@@ -1721,9 +1719,7 @@ ScaLAPACKMatrix<NumberType>::eigenpairs_symmetric_MRRR(
   Assert(property == LAPACKSupport::symmetric,
          ExcMessage("Matrix has to be symmetric for this operation."));
 
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
 
   const bool use_values = (std::isnan(eigenvalue_limits.first) ||
                            std::isnan(eigenvalue_limits.second)) ?
@@ -1960,9 +1956,7 @@ ScaLAPACKMatrix<NumberType>::compute_SVD(ScaLAPACKMatrix<NumberType> *U,
              ExcDimensionMismatch(grid->blacs_context,
                                   VT->grid->blacs_context));
     }
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
 
   std::vector<NumberType> sv(std::min(n_rows, n_columns));
 
@@ -2077,9 +2071,7 @@ ScaLAPACKMatrix<NumberType>::least_squares(ScaLAPACKMatrix<NumberType> &B,
          ExcMessage(
            "Use identical block-cyclic distribution for matrices A and B"));
 
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
 
   if (grid->mpi_process_is_active)
     {
@@ -2231,10 +2223,8 @@ ScaLAPACKMatrix<NumberType>::reciprocal_condition_number(
   Assert(state == LAPACKSupport::cholesky,
          ExcMessage(
            "Matrix has to be in Cholesky state before calling this function."));
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
-  NumberType rcond = 0.;
+  NumberType                  rcond = 0.;
 
   if (grid->mpi_process_is_active)
     {
@@ -2336,10 +2326,8 @@ ScaLAPACKMatrix<NumberType>::norm_general(const char type) const
   Assert(state == LAPACKSupport::matrix ||
            state == LAPACKSupport::inverse_matrix,
          ExcMessage("norms can be called in matrix state only."));
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
-  NumberType res = 0.;
+  NumberType                  res = 0.;
 
   if (grid->mpi_process_is_active)
     {
@@ -2399,10 +2387,8 @@ ScaLAPACKMatrix<NumberType>::norm_symmetric(const char type) const
          ExcMessage("norms can be called in matrix state only."));
   Assert(property == LAPACKSupport::symmetric,
          ExcMessage("Matrix has to be symmetric for this operation."));
-#  ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#  endif
-  NumberType res = 0.;
+  NumberType                  res = 0.;
 
   if (grid->mpi_process_is_active)
     {

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.