From: Wolfgang Bangerth Date: Fri, 5 Jun 2020 00:12:47 +0000 (-0600) Subject: Next step in fixing AffineConstraints. X-Git-Tag: v9.3.0-rc1~1457^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b94b653a9899088dd6ebde8626c633c5b4d8025e;p=dealii.git Next step in fixing AffineConstraints. --- diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index cf5815045f..5c439dadaa 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -2754,11 +2754,12 @@ namespace internal { public: /** - * Constructor. Grabs the scratch data object on the current thread and - * marks it as used. + * Constructor. Takes the scratch data object for the current + * thread out of the provided object and marks it as used. */ - ScratchDataAccessor() - : my_scratch_data(&AffineConstraintsData::scratch_data.get()) + ScratchDataAccessor( + Threads::ThreadLocalStorage> &tls_scratch_data) + : my_scratch_data(&tls_scratch_data.get()) { Assert( my_scratch_data->in_use == false, @@ -2796,7 +2797,6 @@ namespace internal ScratchData *my_scratch_data; }; - private: /** * The actual data object that contains a scratch data for each thread. */ @@ -3560,8 +3560,9 @@ AffineConstraints::distribute_local_to_global( const size_type n_local_dofs = local_dof_indices.size(); - typename internal::AffineConstraints::AffineConstraintsData< - number>::ScratchDataAccessor scratch_data; + typename internal::AffineConstraints::AffineConstraintsData:: + ScratchDataAccessor scratch_data( + internal::AffineConstraints::AffineConstraintsData::scratch_data); internal::AffineConstraints::GlobalRowsFromLocal &global_rows = scratch_data->global_rows; @@ -3711,8 +3712,9 @@ AffineConstraints::distribute_local_to_global( } Assert(sorted == true, ExcMatrixNotClosed()); - typename internal::AffineConstraints::AffineConstraintsData< - number>::ScratchDataAccessor scratch_data; + typename internal::AffineConstraints::AffineConstraintsData:: + ScratchDataAccessor scratch_data( + internal::AffineConstraints::AffineConstraintsData::scratch_data); const size_type n_local_dofs = local_dof_indices.size(); internal::AffineConstraints::GlobalRowsFromLocal &global_rows = @@ -3848,7 +3850,9 @@ AffineConstraints::distribute_local_to_global( const size_type n_local_col_dofs = col_indices.size(); typename internal::AffineConstraints::AffineConstraintsData< - typename MatrixType::value_type>::ScratchDataAccessor scratch_data; + typename MatrixType::value_type>::ScratchDataAccessor + scratch_data( + internal::AffineConstraints::AffineConstraintsData::scratch_data); internal::AffineConstraints::GlobalRowsFromLocal &global_rows = scratch_data->global_rows; @@ -3907,8 +3911,9 @@ AffineConstraints::add_entries_local_to_global( ExcNotQuadratic()); const size_type n_local_dofs = local_dof_indices.size(); - typename internal::AffineConstraints::AffineConstraintsData< - number>::ScratchDataAccessor scratch_data; + typename internal::AffineConstraints::AffineConstraintsData:: + ScratchDataAccessor scratch_data( + internal::AffineConstraints::AffineConstraintsData::scratch_data); const bool dof_mask_is_active = (dof_mask.n_rows() == n_local_dofs); if (dof_mask_is_active == true) @@ -4063,8 +4068,9 @@ AffineConstraints::add_entries_local_to_global( const size_type n_local_dofs = local_dof_indices.size(); const size_type num_blocks = sparsity_pattern.n_block_rows(); - typename internal::AffineConstraints::AffineConstraintsData< - number>::ScratchDataAccessor scratch_data; + typename internal::AffineConstraints::AffineConstraintsData:: + ScratchDataAccessor scratch_data( + internal::AffineConstraints::AffineConstraintsData::scratch_data); const bool dof_mask_is_active = (dof_mask.n_rows() == n_local_dofs); if (dof_mask_is_active == true)