]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Avoid usage of deprecated methods and classes in source/base
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 13 Dec 2012 17:59:20 +0000 (17:59 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 13 Dec 2012 17:59:20 +0000 (17:59 +0000)
    ThreadMutex -> Mutex
    Implement vector::scale in operator*=
    Drop deprecated attribute for Logstream::push/pop for now

git-svn-id: https://svn.dealii.org/branches/branch_deprecated@27807 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/logstream.h
deal.II/include/deal.II/lac/vector.h
deal.II/include/deal.II/lac/vector.templates.h
deal.II/source/base/function_derivative.cc
deal.II/source/base/logstream.cc
deal.II/source/base/polynomial.cc
deal.II/source/base/polynomials_raviart_thomas.cc
deal.II/source/base/subscriptor.cc
deal.II/source/base/thread_management.cc
deal.II/source/base/timer.cc

index 83a98105fd90aa708753eeee51d8cce9a488f8f5..cb50979e3807875c1617432f729060d9f16054d9 100644 (file)
@@ -216,14 +216,14 @@ public:
    * colon and there is a double
    * colon after the last prefix.
    */
-  void push (const std::string &text) DEAL_II_DEPRECATED;
+  void push (const std::string &text);
 
   /**
    * @deprecated Use Prefix instead
    *
    * Remove the last prefix.
    */
-  void pop () DEAL_II_DEPRECATED;
+  void pop ();
 
   /**
    * Maximum number of levels to be
index bba0d255442aa758ee1ae04d5d86aed497937f8a..92d57362a63847b802e70391a703f8f4b9820141 100644 (file)
@@ -800,7 +800,10 @@ public:
    * <tt>operator *=</tt> and
    * <tt>operator /=</tt> instead.
    */
-  void scale (const Number factor) DEAL_II_DEPRECATED;
+  void scale (const Number factor) DEAL_II_DEPRECATED
+  {
+    this->operator *= (factor);
+  }
 
 
   /**
@@ -1265,19 +1268,6 @@ Number &Vector<Number>::operator[] (const unsigned int i)
 
 
 
-template <typename Number>
-inline
-Vector<Number> &Vector<Number>::operator *= (const Number factor)
-{
-
-  Assert (numbers::is_finite(factor),ExcNumberNotFinite());
-
-  scale (factor);
-  return *this;
-}
-
-
-
 template <typename Number>
 inline
 Vector<Number> &
index 1c1943a7de270507283ba3382cc9c31b4a1d904a..9587ea7fb353181a51687ec6f7b166a10a5819a6 100644 (file)
@@ -431,7 +431,7 @@ Vector<std::complex<float> >::operator = (const std::complex<float> s)
 
 template <typename Number>
 void
-Vector<Number>::scale (const Number factor)
+Vector<Number> &Vector<Number>::operator *= (const Number factor)
 {
   Assert (numbers::is_finite(factor),ExcNumberNotFinite());
 
@@ -442,6 +442,8 @@ Vector<Number>::scale (const Number factor)
                        val,
                        (factor*boost::lambda::_1),
                        internal::Vector::minimum_parallel_grain_size);
+
+  return *this;
 }
 
 
index 09b8bfd80e036e26eb9a4bca667c6fcff9971c0b..cfa5c9f20a96fe0d5e93a110a0be457cfc664b39 100644 (file)
@@ -130,7 +130,7 @@ FunctionDerivative<dim>::vector_value (
       result.add(-8., aux);
       f.vector_value(p+incr[0], aux);
       result.add(8., aux);
-      result.scale(1./(12*h));
+      result/=(12.*h);
       return;
     default:
       Assert(false, ExcInvalidFormula());
index 8fb571cb3d0987ca5fd4b8b87565555a7d3d35dd..67852cb616da770751d39d8ee068e75322565e39 100644 (file)
@@ -35,8 +35,8 @@ DEAL_II_NAMESPACE_OPEN
 
 namespace
 {
-  Threads::ThreadMutex log_lock;
-  Threads::ThreadMutex write_lock;
+  Threads::Mutex log_lock;
+  Threads::Mutex write_lock;
 }
 
 
@@ -151,7 +151,7 @@ LogStream::~LogStream()
 void
 LogStream::test_mode(bool on)
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   if (on)
     {
       double_threshold = 1.e-10;
@@ -180,7 +180,7 @@ LogStream::operator<< (std::ostream& (*p) (std::ostream &))
   std::ostream & (* const p_endl) (std::ostream &) = &std::endl;
   if (p == p_endl)
     {
-      Threads::ThreadMutex::ScopedLock lock(write_lock);
+      Threads::Mutex::ScopedLock lock(write_lock);
       print_line_head();
       std::ostringstream &stream = get_stream();
       if (prefixes.size() <= std_depth)
@@ -200,7 +200,7 @@ std::ostringstream &
 LogStream::get_stream()
 {
 //TODO: use a ThreadLocalStorage object here
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   const unsigned int id = Threads::this_thread_id();
 
   // if necessary allocate a stream object
@@ -217,7 +217,7 @@ LogStream::get_stream()
 void
 LogStream::attach(std::ostream &o)
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   file = &o;
   o.setf(std::ios::showpoint | std::ios::left);
   o << dealjobid();
@@ -226,14 +226,14 @@ LogStream::attach(std::ostream &o)
 
 void LogStream::detach ()
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   file = 0;
 }
 
 
 void LogStream::log_cerr ()
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   if (old_cerr == 0)
     {
       old_cerr = std::cerr.rdbuf(file->rdbuf());
@@ -278,7 +278,7 @@ LogStream::get_prefix() const
 void
 LogStream::push (const std::string &text)
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   std::string pre=prefixes.top();
   pre += text;
   pre += std::string(":");
@@ -288,7 +288,7 @@ LogStream::push (const std::string &text)
 
 void LogStream::pop ()
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   if (prefixes.size() > 1)
     prefixes.pop();
 }
@@ -297,7 +297,7 @@ void LogStream::pop ()
 unsigned int
 LogStream::depth_console (const unsigned int n)
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   const unsigned int h = std_depth;
   std_depth = n;
   return h;
@@ -307,7 +307,7 @@ LogStream::depth_console (const unsigned int n)
 unsigned int
 LogStream::depth_file (const unsigned int n)
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   const unsigned int h = file_depth;
   file_depth = n;
   return h;
@@ -317,7 +317,7 @@ LogStream::depth_file (const unsigned int n)
 void
 LogStream::threshold_double (const double t)
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   double_threshold = t;
 }
 
@@ -325,7 +325,7 @@ LogStream::threshold_double (const double t)
 void
 LogStream::threshold_float (const float t)
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   float_threshold = t;
 }
 
@@ -333,7 +333,7 @@ LogStream::threshold_float (const float t)
 bool
 LogStream::log_execution_time (const bool flag)
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   const bool h = print_utime;
   print_utime = flag;
   return h;
@@ -343,7 +343,7 @@ LogStream::log_execution_time (const bool flag)
 bool
 LogStream::log_time_differences (const bool flag)
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   const bool h = diff_utime;
   diff_utime = flag;
   return h;
@@ -353,7 +353,7 @@ LogStream::log_time_differences (const bool flag)
 bool
 LogStream::log_thread_id (const bool flag)
 {
-  Threads::ThreadMutex::ScopedLock lock(log_lock);
+  Threads::Mutex::ScopedLock lock(log_lock);
   const bool h = print_thread_id;
   print_thread_id = flag;
   return h;
index 7f1a627bcbe5495e870a7112c462f9d64d7d5320..0664ce5e2ac7c648211a2675fa76b188456bfbaf 100644 (file)
@@ -34,7 +34,7 @@ DEAL_II_NAMESPACE_OPEN
 // more fine-grained solution
 namespace
 {
-  Threads::ThreadMutex coefficients_lock;
+  Threads::Mutex coefficients_lock;
 }
 
 
@@ -888,7 +888,7 @@ namespace Polynomials
     // operation of this function;
     // for this, acquire the lock
     // until we quit this function
-    Threads::ThreadMutex::ScopedLock lock(coefficients_lock);
+    Threads::Mutex::ScopedLock lock(coefficients_lock);
 
     // The first 2 coefficients are hard-coded
     if (k==0)
@@ -1021,7 +1021,7 @@ namespace Polynomials
     // then get a pointer to the array
     // of coefficients. do that in a MT
     // safe way
-    Threads::ThreadMutex::ScopedLock lock (coefficients_lock);
+    Threads::Mutex::ScopedLock lock (coefficients_lock);
     return *shifted_coefficients[k];
   }
 
@@ -1153,7 +1153,7 @@ namespace Polynomials
     // of this function
     // for this, acquire the lock
     // until we quit this function
-    Threads::ThreadMutex::ScopedLock lock(coefficients_lock);
+    Threads::Mutex::ScopedLock lock(coefficients_lock);
 
     // The first 2 coefficients
     // are hard-coded
@@ -1288,7 +1288,7 @@ namespace Polynomials
     // then get a pointer to the array
     // of coefficients. do that in a MT
     // safe way
-    Threads::ThreadMutex::ScopedLock lock (coefficients_lock);
+    Threads::Mutex::ScopedLock lock (coefficients_lock);
     return *recursive_coefficients[k];
   }
 
index aa0ee7137f61d5d5fc76b06b7a29eae8a18a4c01..367b2443e16f9af05ac5cd414db5f3d4729e53c0 100644 (file)
@@ -78,8 +78,8 @@ PolynomialsRaviartThomas<dim>::compute (const Point<dim>            &unit_point,
   // deal.II/create_mass_matrix_05)
   // will start to produce random
   // results in multithread mode
-  static Threads::ThreadMutex mutex;
-  Threads::ThreadMutex::ScopedLock lock(mutex);
+  static Threads::Mutex mutex;
+  Threads::Mutex::ScopedLock lock(mutex);
 
   static std::vector<double> p_values;
   static std::vector<Tensor<1,dim> > p_grads;
index 6d0bd775deffbf180bfb460284dbed4a68995b67..bb4638541a3c64514e30e51cb0e64a646da41aee 100644 (file)
@@ -34,7 +34,7 @@ namespace
 // operates on a per-object base (in which case we would have to
 // include the huge <thread_management.h> file into the
 // <subscriptor.h> file).
-  Threads::ThreadMutex subscription_lock;
+  Threads::Mutex subscription_lock;
 }
 
 
@@ -144,7 +144,7 @@ void Subscriptor::do_subscribe (const char *id) const
 #ifdef DEBUG
   if (object_info == 0)
     object_info = &typeid(*this);
-  Threads::ThreadMutex::ScopedLock lock (subscription_lock);
+  Threads::Mutex::ScopedLock lock (subscription_lock);
   ++counter;
 
 #ifndef DEAL_II_USE_MT
@@ -171,7 +171,7 @@ void Subscriptor::do_unsubscribe (const char *id) const
   if (counter == 0)
     return;
 
-  Threads::ThreadMutex::ScopedLock lock (subscription_lock);
+  Threads::Mutex::ScopedLock lock (subscription_lock);
   --counter;
 
 #ifndef DEAL_II_USE_MT
index de0ff51ff295ae6822496e5c2eddd3fb69dce008..da4db796a264b61bb7d9646bd396c9b406cc9f95 100644 (file)
@@ -34,12 +34,12 @@ namespace Threads
     // counter and access mutex for the
     // number of threads
     volatile unsigned int n_existing_threads_counter = 1;
-    ThreadMutex  n_existing_threads_mutex;
+    Mutex  n_existing_threads_mutex;
 
 
     void register_thread ()
     {
-      ThreadMutex::ScopedLock lock (n_existing_threads_mutex);
+      Mutex::ScopedLock lock (n_existing_threads_mutex);
       ++n_existing_threads_counter;
     }
 
@@ -47,7 +47,7 @@ namespace Threads
 
     void deregister_thread ()
     {
-      ThreadMutex::ScopedLock lock (n_existing_threads_mutex);
+      Mutex::ScopedLock lock (n_existing_threads_mutex);
       --n_existing_threads_counter;
       Assert (n_existing_threads_counter >= 1,
               ExcInternalError());
@@ -127,7 +127,7 @@ namespace Threads
 
   unsigned int n_existing_threads ()
   {
-    ThreadMutex::ScopedLock lock (internal::n_existing_threads_mutex);
+    Mutex::ScopedLock lock (internal::n_existing_threads_mutex);
     return internal::n_existing_threads_counter;
   }
 
index ca6aca302ecb9b3d289b19c7de98a549c0470bfe..633b1a32d75afb8f404d469ca228ca1474edd715 100644 (file)
@@ -337,7 +337,7 @@ TimerOutput::~TimerOutput()
 void
 TimerOutput::enter_subsection (const std::string &section_name)
 {
-  Threads::ThreadMutex::ScopedLock lock (mutex);
+  Threads::Mutex::ScopedLock lock (mutex);
 
   Assert (section_name.empty() == false,
           ExcMessage ("Section string is empty."));
@@ -369,7 +369,7 @@ TimerOutput::leave_subsection (const std::string &section_name)
   Assert (!active_sections.empty(),
           ExcMessage("Cannot exit any section because none has been entered!"));
 
-  Threads::ThreadMutex::ScopedLock lock (mutex);
+  Threads::Mutex::ScopedLock lock (mutex);
 
   if (section_name != "")
     {

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.