From 6ea846b20db8232b3fac60909eda8e1f8cf0ce79 Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 16 Mar 2001 09:39:20 +0000 Subject: [PATCH] Purge static non-const variables, or make them const to avoid ordering problems with read access in multithreaded applications. git-svn-id: https://svn.dealii.org/trunk@4233 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/fe/fe_values.cc | 2 +- deal.II/deal.II/source/fe/mapping_q.cc | 4 ++-- deal.II/deal.II/source/fe/mapping_q1.cc | 4 ++-- deal.II/deal.II/source/grid/grid_reordering.cc | 8 -------- deal.II/deal.II/source/grid/tria.all_dimensions.cc | 2 +- deal.II/deal.II/source/numerics/assembler.cc | 4 ++-- deal.II/deal.II/source/numerics/data_out.cc | 2 +- deal.II/deal.II/source/numerics/data_out_faces.cc | 2 +- deal.II/deal.II/source/numerics/data_out_rotation.cc | 2 +- deal.II/deal.II/source/numerics/data_out_stack.cc | 2 +- .../deal.II/source/numerics/derivative_approximation.cc | 2 +- deal.II/deal.II/source/numerics/error_estimator.cc | 2 +- deal.II/deal.II/source/numerics/matrices.cc | 2 +- deal.II/deal.II/source/numerics/vectors.cc | 2 +- 14 files changed, 16 insertions(+), 24 deletions(-) diff --git a/deal.II/deal.II/source/fe/fe_values.cc b/deal.II/deal.II/source/fe/fe_values.cc index 3618e5fddd..091f6ff4cd 100644 --- a/deal.II/deal.II/source/fe/fe_values.cc +++ b/deal.II/deal.II/source/fe/fe_values.cc @@ -33,7 +33,7 @@ using namespace std; // TODO: replace this by non-global object -static MappingQ1 mapping_q1; +static const MappingQ1 mapping_q1; template void diff --git a/deal.II/deal.II/source/fe/mapping_q.cc b/deal.II/deal.II/source/fe/mapping_q.cc index dbe72a4f6e..5a887dd409 100644 --- a/deal.II/deal.II/source/fe/mapping_q.cc +++ b/deal.II/deal.II/source/fe/mapping_q.cc @@ -933,7 +933,7 @@ MappingQ<3>::add_quad_support_points(const Triangulation<3>::cell_iterator &cell {2,10,6,11}, {8,7,11,3}}; - static StraightBoundary<3> straight_boundary; + static const StraightBoundary<3> straight_boundary; // used if face quad at boundary or // entirely in the interior of the // domain @@ -1047,7 +1047,7 @@ void MappingQ<3>::fill_quad_support_points_simple (const Triangulation<3>::cell_iterator &cell, std::vector > &a) const { - static StraightBoundary<3> straight_boundary; + static const StraightBoundary<3> straight_boundary; const Boundary<3> *boundary = 0; diff --git a/deal.II/deal.II/source/fe/mapping_q1.cc b/deal.II/deal.II/source/fe/mapping_q1.cc index c15c557305..e8449b1723 100644 --- a/deal.II/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/deal.II/source/fe/mapping_q1.cc @@ -947,8 +947,8 @@ MappingQ1::InternalData* MappingQ1::get_cell_data(const typename Triangulation::cell_iterator cell, const UpdateFlags update_flags) const { - static Point dummy_p; - static Quadrature dummy_quadrature(dummy_p); + static const Point dummy_p; + static const Quadrature dummy_quadrature(dummy_p); InternalData *mdata=dynamic_cast ( get_data(update_flags, dummy_quadrature)); diff --git a/deal.II/deal.II/source/grid/grid_reordering.cc b/deal.II/deal.II/source/grid/grid_reordering.cc index 04eeb04447..6286fef6b3 100644 --- a/deal.II/deal.II/source/grid/grid_reordering.cc +++ b/deal.II/deal.II/source/grid/grid_reordering.cc @@ -942,14 +942,6 @@ void GridReordering::find_reordering (typename std::vector // cell in the present // orientation is valid check_topmost_cell: - - static unsigned int max_size = 0; - if (rotation_states.size() > max_size) - { - max_size = rotation_states.size(); -// if (max_size % 10 == 0) -// cout << "New max size " << rotation_states.size() << endl; - }; const typename std::vector::iterator try_cell = cells.begin() + rotation_states.size()-1; diff --git a/deal.II/deal.II/source/grid/tria.all_dimensions.cc b/deal.II/deal.II/source/grid/tria.all_dimensions.cc index b44f8ad663..f46d0393bb 100644 --- a/deal.II/deal.II/source/grid/tria.all_dimensions.cc +++ b/deal.II/deal.II/source/grid/tria.all_dimensions.cc @@ -66,7 +66,7 @@ void CellData<3>::rotate (const unsigned int times) // list the 24 ways to rotate a // cell, by the ways by which the // vertices are then permuted - static unsigned int rotations[24][GeometryInfo<3>::vertices_per_cell] + static const unsigned int rotations[24][GeometryInfo<3>::vertices_per_cell] = { {0,1,2,3,4,5,6,7}, {1,5,6,2,0,4,7,3}, {5,4,7,6,1,0,3,2}, diff --git a/deal.II/deal.II/source/numerics/assembler.cc b/deal.II/deal.II/source/numerics/assembler.cc index 794690cbc5..11b48d2918 100644 --- a/deal.II/deal.II/source/numerics/assembler.cc +++ b/deal.II/deal.II/source/numerics/assembler.cc @@ -29,8 +29,8 @@ using namespace std; #endif - -static MappingQ1 mapping; +//TODO: purge this variable +static const MappingQ1 mapping; template Assembler::AssemblerData::AssemblerData (const DoFHandler &dof, diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index 7902c30df4..96942fdc64 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -25,7 +25,7 @@ #include //TODO: Do this more clever -static MappingQ1 mapping; +static const MappingQ1 mapping; #ifdef DEAL_II_USE_MT #include diff --git a/deal.II/deal.II/source/numerics/data_out_faces.cc b/deal.II/deal.II/source/numerics/data_out_faces.cc index f29a1f763d..83ec1fefd4 100644 --- a/deal.II/deal.II/source/numerics/data_out_faces.cc +++ b/deal.II/deal.II/source/numerics/data_out_faces.cc @@ -25,7 +25,7 @@ #include //TODO: Do this more clever -static MappingQ1 mapping; +static const MappingQ1 mapping; #ifdef DEAL_II_USE_MT #include diff --git a/deal.II/deal.II/source/numerics/data_out_rotation.cc b/deal.II/deal.II/source/numerics/data_out_rotation.cc index 9142d73b4a..d1476267e2 100644 --- a/deal.II/deal.II/source/numerics/data_out_rotation.cc +++ b/deal.II/deal.II/source/numerics/data_out_rotation.cc @@ -24,7 +24,7 @@ #include //TODO: Do this more clever -static MappingQ1 mapping; +static const MappingQ1 mapping; #ifdef DEAL_II_USE_MT #include diff --git a/deal.II/deal.II/source/numerics/data_out_stack.cc b/deal.II/deal.II/source/numerics/data_out_stack.cc index 6aeee12a0e..322f418c60 100644 --- a/deal.II/deal.II/source/numerics/data_out_stack.cc +++ b/deal.II/deal.II/source/numerics/data_out_stack.cc @@ -32,7 +32,7 @@ using namespace std; //TODO: Comment?? Use proper mapping! -static MappingQ1 mapping; +static const MappingQ1 mapping; template diff --git a/deal.II/deal.II/source/numerics/derivative_approximation.cc b/deal.II/deal.II/source/numerics/derivative_approximation.cc index 7f534b38e4..242ed0eb3a 100644 --- a/deal.II/deal.II/source/numerics/derivative_approximation.cc +++ b/deal.II/deal.II/source/numerics/derivative_approximation.cc @@ -28,7 +28,7 @@ //TODO: Comment? Use proper mapping! -static MappingQ1 mapping; +static const MappingQ1 mapping; template diff --git a/deal.II/deal.II/source/numerics/error_estimator.cc b/deal.II/deal.II/source/numerics/error_estimator.cc index d66742d6c1..705a915da8 100644 --- a/deal.II/deal.II/source/numerics/error_estimator.cc +++ b/deal.II/deal.II/source/numerics/error_estimator.cc @@ -40,7 +40,7 @@ using namespace std; //TODO: Comment?? Proper Mapping -static MappingQ1 mapping; +static const MappingQ1 mapping; diff --git a/deal.II/deal.II/source/numerics/matrices.cc b/deal.II/deal.II/source/numerics/matrices.cc index b6a0cee4b9..2a87dc2568 100644 --- a/deal.II/deal.II/source/numerics/matrices.cc +++ b/deal.II/deal.II/source/numerics/matrices.cc @@ -42,7 +42,7 @@ using namespace std; //TODO: Comment?? Use proper mapping! -static MappingQ1 mapping; +static const MappingQ1 mapping; diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index 98864bfb46..eae932880d 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -45,7 +45,7 @@ using namespace std; //TODO: Comment?? Use proper mapping! -static MappingQ1 mapping; +static const MappingQ1 mapping; -- 2.39.5