From: bangerth Date: Wed, 17 Dec 2008 01:29:22 +0000 (+0000) Subject: Properly guard a mutable variable in the MappingQEulerian class. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d21eb5da6eaf6c62391dc3529d65d02d107ca8e2;p=dealii-svn.git Properly guard a mutable variable in the MappingQEulerian class. git-svn-id: https://svn.dealii.org/trunk@17962 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/fe/mapping_q_eulerian.h b/deal.II/deal.II/include/fe/mapping_q_eulerian.h index 83a0563262..c5517c31f6 100644 --- a/deal.II/deal.II/include/fe/mapping_q_eulerian.h +++ b/deal.II/deal.II/include/fe/mapping_q_eulerian.h @@ -15,6 +15,7 @@ #define __deal2__mapping_q_eulerian_h #include +#include #include #include #include @@ -203,6 +204,12 @@ class MappingQEulerian : public MappingQ */ mutable FEValues 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 diff --git a/deal.II/deal.II/source/fe/mapping_q_eulerian.cc b/deal.II/deal.II/source/fe/mapping_q_eulerian.cc index 4526338402..f12842a2cf 100644 --- a/deal.II/deal.II/source/fe/mapping_q_eulerian.cc +++ b/deal.II/deal.II/source/fe/mapping_q_eulerian.cc @@ -157,9 +157,13 @@ compute_mapping_support_points std::vector > shift_vector(n_support_pts,Vector(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); diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index d2d4b0fee1..3481b17471 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -598,6 +598,13 @@ inconvenience this causes.

deal.II

    +
  1. +

    + New: The MappingQEulerian function was not thread-safe. This is now fixed. +
    + (WB 2008/12/16) +

    +
  2. New: The functions FETools::lexicographic_to_hierarchic_numbering and