]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Properly guard a mutable variable in the MappingQEulerian class.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 17 Dec 2008 01:29:22 +0000 (01:29 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 17 Dec 2008 01:29:22 +0000 (01:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@17962 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/fe/mapping_q_eulerian.h
deal.II/deal.II/source/fe/mapping_q_eulerian.cc
deal.II/doc/news/changes.h

index 83a05632629dc00384ad58ad68f2a763f9e3adb4..c5517c31f6d29ebfa5ac65529c67718fef9a8846 100644 (file)
@@ -15,6 +15,7 @@
 #define __deal2__mapping_q_eulerian_h
 
 #include <base/smartpointer.h>
+#include <base/thread_management.h>
 #include <grid/tria_iterator.h>
 #include <dofs/dof_handler.h>
 #include <dofs/dof_accessor.h>
@@ -203,6 +204,12 @@ class MappingQEulerian : public MappingQ<dim, spacedim>
                                       */
     mutable FEValues<dim> fe_values;
 
+                                    /**
+                                     * A variable to guard access to
+                                     * the fe_values variable.
+                                     */
+    mutable Threads::ThreadMutex fe_values_mutex;
+    
                                      /**
                                       * Compute the positions of the
                                       * support points in the current
index 4526338402175bd7026c2a5e3841996f83b9cd00..f12842a2cfdab404a4ab5484ebc1655f78bcf095 100644 (file)
@@ -157,9 +157,13 @@ compute_mapping_support_points
 
   std::vector<Vector<double> > shift_vector(n_support_pts,Vector<double>(n_components));
 
-                                  // fill shift vector for each support
-                                  // point using an fe_values object.
-
+                                  // fill shift vector for each
+                                  // support point using an fe_values
+                                  // object. make sure that the
+                                  // fe_values variable isn't used
+                                  // simulatenously from different
+                                  // threads
+  Threads::ThreadMutex::ScopedLock lock(fe_values_mutex);
   fe_values.reinit(dof_cell);
   fe_values.get_function_values(euler_vector,shift_vector);
 
index d2d4b0fee1d2bbd91cd4f0a45b0cd19e3b4246d7..3481b17471bb58330c35b51531a0a659f5e50b72 100644 (file)
@@ -598,6 +598,13 @@ inconvenience this causes.
 <h3>deal.II</h3>
 
 <ol>
+  <li>
+  <p>
+  New: The MappingQEulerian function was not thread-safe. This is now fixed.
+  <br>
+  (WB 2008/12/16)
+  </p>
+
   <li>
   <p>
   New: The functions FETools::lexicographic_to_hierarchic_numbering and

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.