]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove std::bind from include (apart from documentation) 8832/head
authorDaniel Arndt <arndtd@ornl.gov>
Sun, 22 Sep 2019 01:05:12 +0000 (21:05 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Mon, 23 Sep 2019 00:53:21 +0000 (20:53 -0400)
16 files changed:
include/deal.II/base/parallel.h
include/deal.II/base/quadrature_point_data.h
include/deal.II/base/time_stepping.templates.h
include/deal.II/base/work_stream.h
include/deal.II/distributed/cell_data_transfer.templates.h
include/deal.II/lac/chunk_sparse_matrix.templates.h
include/deal.II/lac/precondition.h
include/deal.II/lac/relaxation_block.templates.h
include/deal.II/lac/solver.h
include/deal.II/lac/sparse_matrix.templates.h
include/deal.II/matrix_free/dof_info.templates.h
include/deal.II/matrix_free/matrix_free.templates.h
include/deal.II/meshworker/loop.h
include/deal.II/meshworker/mesh_loop.h
include/deal.II/numerics/error_estimator.templates.h
include/deal.II/numerics/matrix_creator.templates.h

index 6d06ddf929b68a1961334650fbac523c352e1a14..f68b6a9db4fb872702ba430373f116df3d8a3b9a 100644 (file)
@@ -463,13 +463,13 @@ namespace parallel
     ff(begin, end);
 #  endif
 #else
-    internal::parallel_for(
-      begin,
-      end,
-      std::bind(&internal::apply_to_subranges<RangeType, Function>,
-                std::placeholders::_1,
-                std::cref(f)),
-      grainsize);
+    internal::parallel_for(begin,
+                           end,
+                           [&f](const tbb::blocked_range<RangeType> &range) {
+                             internal::apply_to_subranges<RangeType, Function>(
+                               range, f);
+                           },
+                           grainsize);
 #endif
   }
 
index ab9467e5792e6674dc0e5bcfd5d54546fb5d98df..106dbd468d29f90020e8e4205cf5939dc2bdffff 100644 (file)
@@ -939,11 +939,11 @@ namespace parallel
       data_storage  = &data_storage_;
 
       handle = triangulation->register_data_attach(
-        std::bind(
-          &ContinuousQuadratureDataTransfer<dim, DataType>::pack_function,
-          this,
-          std::placeholders::_1,
-          std::placeholders::_2),
+        [this](
+          const typename parallel::distributed::Triangulation<
+            dim>::cell_iterator &cell,
+          const typename parallel::distributed::Triangulation<dim>::CellStatus
+            status) { return this->pack_function(cell, status); },
         /*returns_variable_size_data=*/true);
     }
 
@@ -955,12 +955,13 @@ namespace parallel
     {
       triangulation->notify_ready_to_unpack(
         handle,
-        std::bind(
-          &ContinuousQuadratureDataTransfer<dim, DataType>::unpack_function,
-          this,
-          std::placeholders::_1,
-          std::placeholders::_2,
-          std::placeholders::_3));
+        [this](
+          const typename parallel::distributed::Triangulation<
+            dim>::cell_iterator &cell,
+          const typename parallel::distributed::Triangulation<dim>::CellStatus
+            status,
+          const boost::iterator_range<std::vector<char>::const_iterator>
+            &data_range) { this->unpack_function(cell, status, data_range); });
 
       // invalidate the pointers
       data_storage  = nullptr;
index b1f31024c3605d7dd93afdd088f764f53466e968..285b9cc0d70182ba4a31aaa1287eb00bef8c1a0e 100644 (file)
@@ -375,18 +375,16 @@ namespace TimeStepping
         // Solve the nonlinear system using Newton's method
         const double new_t       = t + this->c[i] * delta_t;
         const double new_delta_t = this->a[i][i] * delta_t;
+        VectorType & f_stage     = f_stages[i];
         newton_solve(
-          std::bind(&ImplicitRungeKutta<VectorType>::compute_residual,
-                    this,
-                    f,
-                    new_t,
-                    new_delta_t,
-                    std::cref(old_y),
-                    std::placeholders::_1,
-                    std::ref(f_stages[i]),
-                    std::placeholders::_2),
-          std::bind(
-            id_minus_tau_J_inverse, new_t, new_delta_t, std::placeholders::_1),
+          [this, &f, new_t, new_delta_t, &old_y, &f_stage](
+            const VectorType &y, VectorType &residual) {
+            this->compute_residual(
+              f, new_t, new_delta_t, old_y, y, f_stage, residual);
+          },
+          [&id_minus_tau_J_inverse, new_t, new_delta_t](const VectorType &y) {
+            return id_minus_tau_J_inverse(new_t, new_delta_t, y);
+          },
           y);
       }
   }
index 86a025ba0d44c976bbd354747f1eafb477414c7c..1c7470f6c8bb51f5fdb8c1ad0c839b0ffe9f6d26 100644 (file)
@@ -1225,9 +1225,11 @@ namespace WorkStream
               parallel::internal::parallel_for(
                 colored_iterators[color].begin(),
                 colored_iterators[color].end(),
-                std::bind(&WorkerAndCopier::operator(),
-                          std::ref(worker_and_copier),
-                          std::placeholders::_1),
+                [&worker_and_copier](
+                  const tbb::blocked_range<
+                    typename std::vector<Iterator>::const_iterator> &range) {
+                  worker_and_copier(range);
+                },
                 chunk_size);
             }
       }
@@ -1283,12 +1285,14 @@ namespace WorkStream
     // forward to the other function
     run(begin,
         end,
-        std::bind(worker,
-                  std::ref(main_object),
-                  std::placeholders::_1,
-                  std::placeholders::_2,
-                  std::placeholders::_3),
-        std::bind(copier, std::ref(main_object), std::placeholders::_1),
+        [&main_object, worker](const Iterator &iterator,
+                               ScratchData &   scratch_data,
+                               CopyData &      copy_data) {
+          (main_object.*worker)(iterator, scratch_data, copy_data);
+        },
+        [&main_object, copier](const CopyData &copy_data) {
+          (main_object.*copier)(copy_data);
+        },
         sample_scratch_data,
         sample_copy_data,
         queue_length,
@@ -1314,12 +1318,14 @@ namespace WorkStream
     // forward to the other function
     run(begin,
         end,
-        std::bind(worker,
-                  std::ref(main_object),
-                  std::placeholders::_1,
-                  std::placeholders::_2,
-                  std::placeholders::_3),
-        std::bind(copier, std::ref(main_object), std::placeholders::_1),
+        [&main_object, worker](const Iterator &iterator,
+                               ScratchData &   scratch_data,
+                               CopyData &      copy_data) {
+          (main_object.*worker)(iterator, scratch_data, copy_data);
+        },
+        [&main_object, copier](const CopyData &copy_data) {
+          (main_object.*copier)(copy_data);
+        },
         sample_scratch_data,
         sample_copy_data,
         queue_length,
index ed4e233e0c1622dc8fa822a5e415bf1be6a8dc32..a05a1d64d46116945f738e42cac9e44d1176da26 100644 (file)
@@ -143,10 +143,12 @@ namespace parallel
       Assert(tria != nullptr, ExcInternalError());
 
       handle = tria->register_data_attach(
-        std::bind(&CellDataTransfer<dim, spacedim, VectorType>::pack_callback,
-                  this,
-                  std::placeholders::_1,
-                  std::placeholders::_2),
+        [this](const typename parallel::distributed::
+                 Triangulation<dim, spacedim>::cell_iterator &cell,
+               const typename parallel::distributed::
+                 Triangulation<dim, spacedim>::CellStatus status) {
+          return this->pack_callback(cell, status);
+        },
         /*returns_variable_size_data=*/transfer_variable_size_data);
     }
 
@@ -215,12 +217,15 @@ namespace parallel
 
       tria->notify_ready_to_unpack(
         handle,
-        std::bind(&CellDataTransfer<dim, spacedim, VectorType>::unpack_callback,
-                  this,
-                  std::placeholders::_1,
-                  std::placeholders::_2,
-                  std::placeholders::_3,
-                  std::ref(all_out)));
+        [this, &all_out](
+          const typename parallel::distributed::Triangulation<dim, spacedim>::
+            cell_iterator &cell,
+          const typename parallel::distributed::Triangulation<dim, spacedim>::
+            CellStatus status,
+          const boost::iterator_range<std::vector<char>::const_iterator>
+            &data_range) {
+          this->unpack_callback(cell, status, data_range, all_out);
+        });
 
       dealii::internal::parallel::distributed::CellDataTransferImplementation::
         post_unpack_action(all_out);
index 4fb16052efc35955926f48c54ebaa5fa71d2bdca..0c5929a59bb98303bfd95cf2231caa1141345ab0 100644 (file)
@@ -396,11 +396,11 @@ ChunkSparseMatrix<number>::operator=(const double d)
     parallel::apply_to_subranges(
       0U,
       matrix_size,
-      std::bind(&internal::ChunkSparseMatrixImplementation::
-                  template zero_subrange<number>,
-                std::placeholders::_1,
-                std::placeholders::_2,
-                val.get()),
+      [this](const unsigned int begin, const unsigned int end) {
+        internal::ChunkSparseMatrixImplementation::zero_subrange(begin,
+                                                                 end,
+                                                                 val.get());
+      },
       grain_size);
   else if (matrix_size > 0)
     std::memset(val.get(), 0, matrix_size * sizeof(number));
@@ -507,9 +507,7 @@ ChunkSparseMatrix<number>::n_actually_nonzero_elements() const
   return std::count_if(val.get(),
                        val.get() + cols->sparsity_pattern.n_nonzero_elements() *
                                      chunk_size * chunk_size,
-                       std::bind(std::not_equal_to<double>(),
-                                 std::placeholders::_1,
-                                 0));
+                       [](const double element) { return element != 0.; });
 }
 
 
@@ -707,16 +705,18 @@ ChunkSparseMatrix<number>::vmult_add(OutVector &dst, const InVector &src) const
   parallel::apply_to_subranges(
     0U,
     cols->sparsity_pattern.n_rows(),
-    std::bind(&internal::ChunkSparseMatrixImplementation::
-                vmult_add_on_subrange<number, InVector, OutVector>,
-              std::cref(*cols),
-              std::placeholders::_1,
-              std::placeholders::_2,
-              val.get(),
-              cols->sparsity_pattern.rowstart.get(),
-              cols->sparsity_pattern.colnums.get(),
-              std::cref(src),
-              std::ref(dst)),
+    [this, &src, &dst](const unsigned int begin_row,
+                       const unsigned int end_row) {
+      internal::ChunkSparseMatrixImplementation::vmult_add_on_subrange(
+        *cols,
+        begin_row,
+        end_row,
+        val.get(),
+        cols->sparsity_pattern.rowstart.get(),
+        cols->sparsity_pattern.colnums.get(),
+        src,
+        dst);
+    },
     internal::SparseMatrixImplementation::minimum_parallel_grain_size /
         cols->chunk_size +
       1);
index 01cbd8001b782893e59752f2f59c7bce1f48a162..45119c847385034206d75f1b8d6489f03eb69a8a 100644 (file)
@@ -2267,10 +2267,10 @@ PreconditionChebyshev<MatrixType, VectorType, PreconditionerType>::
       internal::PreconditionChebyshevImplementation::EigenvalueTracker
                            eigenvalue_tracker;
       SolverCG<VectorType> solver(control);
-      solver.connect_eigenvalues_slot(std::bind(
-        &internal::PreconditionChebyshevImplementation::EigenvalueTracker::slot,
-        &eigenvalue_tracker,
-        std::placeholders::_1));
+      solver.connect_eigenvalues_slot(
+        [&eigenvalue_tracker](const std::vector<double> &eigenvalues) {
+          eigenvalue_tracker.slot(eigenvalues);
+        });
 
       // set an initial guess which is close to the constant vector but where
       // one entry is different to trigger high frequencies
index ea8e13934bf0dfc60ea2ba1093f76f0f346e4b38..988bf5d73a7961504b0c6a9da755a580ba45705f 100644 (file)
@@ -100,15 +100,13 @@ RelaxationBlock<MatrixType, InverseNumberType, VectorType>::invert_diagblocks()
   else
     {
       // compute blocks in parallel
-      parallel::apply_to_subranges(
-        0,
-        this->additional_data->block_list.n_rows(),
-        std::bind(&RelaxationBlock<MatrixType, InverseNumberType, VectorType>::
-                    block_kernel,
-                  this,
-                  std::placeholders::_1,
-                  std::placeholders::_2),
-        16);
+      parallel::apply_to_subranges(0,
+                                   this->additional_data->block_list.n_rows(),
+                                   [this](const size_type block_begin,
+                                          const size_type block_end) {
+                                     this->block_kernel(block_begin, block_end);
+                                   },
+                                   16);
     }
   this->inverses_computed(true);
 }
index 242c78cdedc5311aeb55fb8e7de3917c062c34a8..438959d2362290df4f99feda968c393cd0f7422d 100644 (file)
@@ -523,10 +523,11 @@ inline SolverBase<VectorType>::SolverBase(
   // only takes two arguments, the iteration and the check_value, and so
   // we simply ignore the third argument that is passed in whenever the
   // signal is executed
-  connect(std::bind(&SolverControl::check,
-                    std::ref(solver_control),
-                    std::placeholders::_1,
-                    std::placeholders::_2));
+  connect([&solver_control](const unsigned int iteration,
+                            const double       check_value,
+                            const VectorType &) {
+    return solver_control.check(iteration, check_value);
+  });
 }
 
 
@@ -540,10 +541,11 @@ inline SolverBase<VectorType>::SolverBase(SolverControl &solver_control)
   // only takes two arguments, the iteration and the check_value, and so
   // we simply ignore the third argument that is passed in whenever the
   // signal is executed
-  connect(std::bind(&SolverControl::check,
-                    std::ref(solver_control),
-                    std::placeholders::_1,
-                    std::placeholders::_2));
+  connect([&solver_control](const unsigned int iteration,
+                            const double       check_value,
+                            const VectorType &) {
+    return solver_control.check(iteration, check_value);
+  });
 }
 
 
index 46f7e7898e889ea82130e2cc1132854a35b5b1d1..429a51660aec7e4557075150b971c90a9600e11c 100644 (file)
@@ -212,11 +212,11 @@ SparseMatrix<number>::operator=(const double d)
     parallel::apply_to_subranges(
       0U,
       matrix_size,
-      std::bind(
-        &internal::SparseMatrixImplementation::template zero_subrange<number>,
-        std::placeholders::_1,
-        std::placeholders::_2,
-        val.get()),
+      [this](const size_type begin, const size_type end) {
+        internal::SparseMatrixImplementation::zero_subrange(begin,
+                                                            end,
+                                                            val.get());
+      },
       grain_size);
   else if (matrix_size > 0)
     {
@@ -778,16 +778,17 @@ SparseMatrix<number>::vmult(OutVector &dst, const InVector &src) const
   parallel::apply_to_subranges(
     0U,
     m(),
-    std::bind(&internal::SparseMatrixImplementation::
-                vmult_on_subrange<number, InVector, OutVector>,
-              std::placeholders::_1,
-              std::placeholders::_2,
-              val.get(),
-              cols->rowstart.get(),
-              cols->colnums.get(),
-              std::cref(src),
-              std::ref(dst),
-              false),
+    [this, &src, &dst](const size_type begin_row, const size_type end_row) {
+      internal::SparseMatrixImplementation::vmult_on_subrange(
+        begin_row,
+        end_row,
+        val.get(),
+        cols->rowstart.get(),
+        cols->colnums.get(),
+        src,
+        dst,
+        false);
+    },
     internal::SparseMatrixImplementation::minimum_parallel_grain_size);
 }
 
@@ -835,16 +836,17 @@ SparseMatrix<number>::vmult_add(OutVector &dst, const InVector &src) const
   parallel::apply_to_subranges(
     0U,
     m(),
-    std::bind(&internal::SparseMatrixImplementation::
-                vmult_on_subrange<number, InVector, OutVector>,
-              std::placeholders::_1,
-              std::placeholders::_2,
-              val.get(),
-              cols->rowstart.get(),
-              cols->colnums.get(),
-              std::cref(src),
-              std::ref(dst),
-              true),
+    [this, &src, &dst](const size_type begin_row, const size_type end_row) {
+      internal::SparseMatrixImplementation::vmult_on_subrange(
+        begin_row,
+        end_row,
+        val.get(),
+        cols->rowstart.get(),
+        cols->colnums.get(),
+        src,
+        dst,
+        true);
+    },
     internal::SparseMatrixImplementation::minimum_parallel_grain_size);
 }
 
@@ -922,14 +924,15 @@ SparseMatrix<number>::matrix_norm_square(const Vector<somenumber> &v) const
   Assert(n() == v.size(), ExcDimensionMismatch(n(), v.size()));
 
   return parallel::accumulate_from_subranges<somenumber>(
-    std::bind(&internal::SparseMatrixImplementation::
-                matrix_norm_sqr_on_subrange<number, Vector<somenumber>>,
-              std::placeholders::_1,
-              std::placeholders::_2,
-              val.get(),
-              cols->rowstart.get(),
-              cols->colnums.get(),
-              std::cref(v)),
+    [this, &v](const size_type begin_row, const size_type end_row) {
+      return internal::SparseMatrixImplementation::matrix_norm_sqr_on_subrange(
+        begin_row,
+        end_row,
+        val.get(),
+        cols->rowstart.get(),
+        cols->colnums.get(),
+        v);
+    },
     0,
     m(),
     internal::SparseMatrixImplementation::minimum_parallel_grain_size);
@@ -989,15 +992,16 @@ SparseMatrix<number>::matrix_scalar_product(const Vector<somenumber> &u,
   Assert(n() == v.size(), ExcDimensionMismatch(n(), v.size()));
 
   return parallel::accumulate_from_subranges<somenumber>(
-    std::bind(&internal::SparseMatrixImplementation::
-                matrix_scalar_product_on_subrange<number, Vector<somenumber>>,
-              std::placeholders::_1,
-              std::placeholders::_2,
-              val.get(),
-              cols->rowstart.get(),
-              cols->colnums.get(),
-              std::cref(u),
-              std::cref(v)),
+    [this, &u, &v](const size_type begin_row, const size_type end_row) {
+      return internal::SparseMatrixImplementation::
+        matrix_scalar_product_on_subrange(begin_row,
+                                          end_row,
+                                          val.get(),
+                                          cols->rowstart.get(),
+                                          cols->colnums.get(),
+                                          u,
+                                          v);
+    },
     0,
     m(),
     internal::SparseMatrixImplementation::minimum_parallel_grain_size);
@@ -1337,18 +1341,17 @@ SparseMatrix<number>::residual(Vector<somenumber> &      dst,
   Assert(&u != &dst, ExcSourceEqualsDestination());
 
   return std::sqrt(parallel::accumulate_from_subranges<somenumber>(
-    std::bind(&internal::SparseMatrixImplementation::residual_sqr_on_subrange<
-                number,
-                Vector<somenumber>,
-                Vector<somenumber>>,
-              std::placeholders::_1,
-              std::placeholders::_2,
-              val.get(),
-              cols->rowstart.get(),
-              cols->colnums.get(),
-              std::cref(u),
-              std::cref(b),
-              std::ref(dst)),
+    [this, &u, &b, &dst](const size_type begin_row, const size_type end_row) {
+      return internal::SparseMatrixImplementation::residual_sqr_on_subrange(
+        begin_row,
+        end_row,
+        val.get(),
+        cols->rowstart.get(),
+        cols->colnums.get(),
+        u,
+        b,
+        dst);
+    },
     0,
     m(),
     internal::SparseMatrixImplementation::minimum_parallel_grain_size));
index de4bbf4e3cad623ae9c26057244d79a4a850f6e2..dff2d5b367a5a3294e0b91b89b029db559ed12ae 100644 (file)
@@ -1571,12 +1571,13 @@ namespace internal
         n_rows / internal::bucket_size_threading + 1);
       parallel::apply_to_subranges(0,
                                    task_info.n_active_cells,
-                                   std::bind(&internal::compute_row_lengths,
-                                             std::placeholders::_1,
-                                             std::placeholders::_2,
-                                             std::cref(*this),
-                                             std::ref(mutexes),
-                                             std::ref(row_lengths)),
+                                   [this,
+                                    &mutexes,
+                                    &row_lengths](const unsigned int begin,
+                                                  const unsigned int end) {
+                                     internal::compute_row_lengths(
+                                       begin, end, *this, mutexes, row_lengths);
+                                   },
                                    20);
 
       // disregard dofs that only sit on a single cell because they cannot
@@ -1591,16 +1592,15 @@ namespace internal
       SparsityPattern connectivity_dof(n_rows,
                                        task_info.n_active_cells,
                                        row_lengths);
-      parallel::apply_to_subranges(0,
-                                   task_info.n_active_cells,
-                                   std::bind(&internal::fill_connectivity_dofs,
-                                             std::placeholders::_1,
-                                             std::placeholders::_2,
-                                             std::cref(*this),
-                                             std::cref(row_lengths),
-                                             std::ref(mutexes),
-                                             std::ref(connectivity_dof)),
-                                   20);
+      parallel::apply_to_subranges(
+        0,
+        task_info.n_active_cells,
+        [this, &row_lengths, &mutexes, &connectivity_dof](
+          const unsigned int begin, const unsigned int end) {
+          internal::fill_connectivity_dofs(
+            begin, end, *this, row_lengths, mutexes, connectivity_dof);
+        },
+        20);
       connectivity_dof.compress();
 
 
@@ -1612,16 +1612,19 @@ namespace internal
       // create a connectivity list between cells. The connectivity graph
       // should apply the renumbering, i.e., the entry for cell j is the entry
       // for cell renumbering[j] in the original ordering.
-      parallel::apply_to_subranges(0,
-                                   task_info.n_active_cells,
-                                   std::bind(&internal::fill_connectivity,
-                                             std::placeholders::_1,
-                                             std::placeholders::_2,
-                                             std::cref(*this),
-                                             std::cref(reverse_numbering),
-                                             std::cref(connectivity_dof),
-                                             std::ref(connectivity)),
-                                   20);
+      parallel::apply_to_subranges(
+        0,
+        task_info.n_active_cells,
+        [this, &reverse_numbering, &connectivity_dof, &connectivity](
+          const unsigned int begin, const unsigned int end) {
+          internal::fill_connectivity(begin,
+                                      end,
+                                      *this,
+                                      reverse_numbering,
+                                      connectivity_dof,
+                                      connectivity);
+        },
+        20);
     }
 
 
index c7fb9ce1da64d4f081d730b59c67383c7f4b404e..23a95f10833c24969d6ba8f4d4ca2c2e1ceb1103 100644 (file)
@@ -1872,14 +1872,13 @@ MatrixFree<dim, Number, VectorizedArrayType>::make_connectivity_graph_faces(
   tbb::concurrent_unordered_map<std::pair<unsigned int, unsigned int>,
                                 unsigned int>
     map;
-  parallel::apply_to_subranges(0,
-                               cell_level_index.size(),
-                               std::bind(&internal::fill_index_subrange,
-                                         std::placeholders::_1,
-                                         std::placeholders::_2,
-                                         std::cref(cell_level_index),
-                                         std::ref(map)),
-                               50);
+  parallel::apply_to_subranges(
+    0,
+    cell_level_index.size(),
+    [this, &map](const unsigned int begin, const unsigned int end) {
+      internal::fill_index_subrange(begin, end, cell_level_index, map);
+    },
+    50);
 
   // step 2: Make a list for all blocks with other blocks that write to the
   // cell (due to the faces that are associated to it)
@@ -1892,13 +1891,11 @@ MatrixFree<dim, Number, VectorizedArrayType>::make_connectivity_graph_faces(
   parallel::apply_to_subranges(
     0,
     task_info.n_active_cells,
-    std::bind(&internal::fill_connectivity_subrange<dim>,
-              std::placeholders::_1,
-              std::placeholders::_2,
-              std::cref(tria),
-              std::cref(cell_level_index),
-              std::cref(map),
-              std::ref(connectivity_direct)),
+    [this, &tria, &map, &connectivity_direct](const unsigned int begin,
+                                              const unsigned int end) {
+      internal::fill_connectivity_subrange<dim>(
+        begin, end, tria, cell_level_index, map, connectivity_direct);
+    },
     20);
   connectivity_direct.symmetrize();
 
@@ -1907,11 +1904,13 @@ MatrixFree<dim, Number, VectorizedArrayType>::make_connectivity_graph_faces(
   parallel::apply_to_subranges(
     0,
     task_info.n_active_cells,
-    std::bind(&internal::fill_connectivity_indirect_subrange,
-              std::placeholders::_1,
-              std::placeholders::_2,
-              std::cref(connectivity_direct),
-              std::ref(connectivity)),
+    [&connectivity_direct, &connectivity](const unsigned int begin,
+                                          const unsigned int end) {
+      internal::fill_connectivity_indirect_subrange(begin,
+                                                    end,
+                                                    connectivity_direct,
+                                                    connectivity);
+    },
     20);
 #endif
 }
index 426abcf69a4aafd1457b31150e712682d0f8cec1..bf07441355583c51af1d6cc6794aa151f5b39b2c 100644 (file)
@@ -471,17 +471,19 @@ namespace MeshWorker
     WorkStream::run(
       begin,
       end,
-      std::bind(&cell_action<INFOBOX, DOFINFO, dim, spacedim, ITERATOR>,
-                std::placeholders::_1,
-                std::placeholders::_3,
-                std::placeholders::_2,
-                cell_worker,
-                boundary_worker,
-                face_worker,
-                lctrl),
-      std::bind(&dealii::internal::assemble<dim, DOFINFO, ASSEMBLER>,
-                std::placeholders::_1,
-                &assembler),
+      [&cell_worker, &boundary_worker, &face_worker, &lctrl](
+        ITERATOR cell, INFOBOX &info, DoFInfoBox<dim, DOFINFO> &dof_info) {
+        cell_action<INFOBOX, DOFINFO, dim, spacedim, ITERATOR>(cell,
+                                                               dof_info,
+                                                               info,
+                                                               cell_worker,
+                                                               boundary_worker,
+                                                               face_worker,
+                                                               lctrl);
+      },
+      [&assembler](const MeshWorker::DoFInfoBox<dim, DOFINFO> &dinfo) {
+        dealii::internal::assemble<dim, DOFINFO, ASSEMBLER>(dinfo, &assembler);
+      },
       info,
       dof_info);
   }
@@ -516,22 +518,28 @@ namespace MeshWorker
                        IntegrationInfo<dim, spacedim> &)>
       face_worker;
     if (integrator.use_cell)
-      cell_worker = std::bind(&LocalIntegrator<dim, spacedim>::cell,
-                              &integrator,
-                              std::placeholders::_1,
-                              std::placeholders::_2);
+      cell_worker =
+        [&integrator](DoFInfo<dim, spacedim> &        dof_info,
+                      IntegrationInfo<dim, spacedim> &integration_info) {
+          integrator.cell(dof_info, integration_info);
+        };
     if (integrator.use_boundary)
-      boundary_worker = std::bind(&LocalIntegrator<dim, spacedim>::boundary,
-                                  &integrator,
-                                  std::placeholders::_1,
-                                  std::placeholders::_2);
+      boundary_worker =
+        [&integrator](DoFInfo<dim, spacedim> &        dof_info,
+                      IntegrationInfo<dim, spacedim> &integration_info) {
+          integrator.boundary(dof_info, integration_info);
+        };
     if (integrator.use_face)
-      face_worker = std::bind(&LocalIntegrator<dim, spacedim>::face,
-                              &integrator,
-                              std::placeholders::_1,
-                              std::placeholders::_2,
-                              std::placeholders::_3,
-                              std::placeholders::_4);
+      face_worker =
+        [&integrator](DoFInfo<dim, spacedim> &        dof_info_1,
+                      DoFInfo<dim, spacedim> &        dof_info_2,
+                      IntegrationInfo<dim, spacedim> &integration_info_1,
+                      IntegrationInfo<dim, spacedim> &integration_info_2) {
+          integrator.face(dof_info_1,
+                          dof_info_2,
+                          integration_info_1,
+                          integration_info_2);
+        };
 
     loop<dim, spacedim>(begin,
                         end,
index 6e03cf2a30c9658f8171c0e2df9e2782ece3b513..8c8d79f7cc8ae1aa07116688c44c0e59ba37aa2f 100644 (file)
@@ -698,36 +698,49 @@ namespace MeshWorker
       f_face_worker;
 
     if (cell_worker != nullptr)
-      f_cell_worker = std::bind(cell_worker,
-                                std::ref(main_class),
-                                std::placeholders::_1,
-                                std::placeholders::_2,
-                                std::placeholders::_3);
+      f_cell_worker = [&main_class,
+                       cell_worker](const CellIteratorType &cell_iterator,
+                                    ScratchData &           scratch_data,
+                                    CopyData &              copy_data) {
+        (main_class.*cell_worker)(cell_iterator, scratch_data, copy_data);
+      };
 
     if (boundary_worker != nullptr)
-      f_boundary_worker = std::bind(boundary_worker,
-                                    std::ref(main_class),
-                                    std::placeholders::_1,
-                                    std::placeholders::_2,
-                                    std::placeholders::_3,
-                                    std::placeholders::_4);
+      f_boundary_worker =
+        [&main_class, boundary_worker](const CellIteratorType &cell_iterator,
+                                       const unsigned int      face_no,
+                                       ScratchData &           scratch_data,
+                                       CopyData &              copy_data) {
+          (main_class.*
+           boundary_worker)(cell_iterator, face_no, scratch_data, copy_data);
+        };
 
     if (face_worker != nullptr)
-      f_face_worker = std::bind(face_worker,
-                                std::ref(main_class),
-                                std::placeholders::_1,
-                                std::placeholders::_2,
-                                std::placeholders::_3,
-                                std::placeholders::_4,
-                                std::placeholders::_5,
-                                std::placeholders::_6,
-                                std::placeholders::_7,
-                                std::placeholders::_8);
+      f_face_worker = [&main_class,
+                       face_worker](const CellIteratorType &cell_iterator_1,
+                                    const unsigned int      face_index_1,
+                                    const unsigned int      subface_index_1,
+                                    const CellIteratorType &cell_iterator_2,
+                                    const unsigned int      face_index_2,
+                                    const unsigned int      subface_index_2,
+                                    ScratchData &           scratch_data,
+                                    CopyData &              copy_data) {
+        (main_class.*face_worker)(cell_iterator_1,
+                                  face_index_1,
+                                  subface_index_1,
+                                  cell_iterator_2,
+                                  face_index_2,
+                                  subface_index_2,
+                                  scratch_data,
+                                  copy_data);
+      };
 
     mesh_loop(begin,
               end,
               f_cell_worker,
-              std::bind(copier, main_class, std::placeholders::_1),
+              [&main_class, copier](const CopyData &copy_data) {
+                (main_class.*copier)(copy_data);
+              },
               sample_scratch_data,
               sample_copy_data,
               flags,
index 9ad9583c419d57a4c09f18015eb8a29a99697d66..c7fd6940c972afcdd8f1c2c172e10c404c6b9dfd 100644 (file)
@@ -1307,15 +1307,21 @@ KellyErrorEstimator<dim, spacedim>::estimate(
     dof_handler.begin_active(),
     static_cast<typename DoFHandlerType::active_cell_iterator>(
       dof_handler.end()),
-    std::bind(&internal::estimate_one_cell<InputVector, DoFHandlerType>,
-              std::placeholders::_1,
-              std::placeholders::_2,
-              std::placeholders::_3,
-              std::ref(solutions),
-              strategy),
-    std::bind(&internal::copy_local_to_global<DoFHandlerType>,
-              std::placeholders::_1,
-              std::ref(face_integrals)),
+    [&solutions, strategy](
+      const typename DoFHandlerType::active_cell_iterator &cell,
+      internal::ParallelData<DoFHandlerType, typename InputVector::value_type>
+        &parallel_data,
+      std::map<typename DoFHandlerType::face_iterator, std::vector<double>>
+        &local_face_integrals) {
+      internal::estimate_one_cell(
+        cell, parallel_data, local_face_integrals, solutions, strategy);
+    },
+    [&face_integrals](
+      const std::map<typename DoFHandlerType::face_iterator,
+                     std::vector<double>> &local_face_integrals) {
+      internal::copy_local_to_global<DoFHandlerType>(local_face_integrals,
+                                                     face_integrals);
+    },
     parallel_data,
     sample_local_face_integrals);
 
index 1ae593cea3571370148bf8baedcb50ee317d1377..12fe44a90f052b6ee63b8d09496bcb689adefc31 100644 (file)
@@ -741,12 +741,10 @@ namespace MatrixCreator
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator,
         number>,
-      std::bind(
-        &MatrixCreator::internal::
-          copy_local_to_global<number, SparseMatrix<number>, Vector<number>>,
-        std::placeholders::_1,
-        &matrix,
-        static_cast<Vector<number> *>(nullptr)),
+      [&matrix](const internal::AssemblerData::CopyData<number> &data) {
+        MatrixCreator::internal::copy_local_to_global(
+          data, &matrix, static_cast<Vector<number> *>(nullptr));
+      },
       assembler_data,
       copy_data);
   }
@@ -816,12 +814,12 @@ namespace MatrixCreator
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator,
         number>,
-      std::bind(
-        &MatrixCreator::internal::
-          copy_local_to_global<number, SparseMatrix<number>, Vector<number>>,
-        std::placeholders::_1,
-        &matrix,
-        &rhs_vector),
+      [&matrix,
+       &rhs_vector](const internal::AssemblerData::CopyData<number> &data) {
+        MatrixCreator::internal::copy_local_to_global(data,
+                                                      &matrix,
+                                                      &rhs_vector);
+      },
       assembler_data,
       copy_data);
   }
@@ -891,12 +889,10 @@ namespace MatrixCreator
         spacedim,
         typename hp::DoFHandler<dim, spacedim>::active_cell_iterator,
         number>,
-      std::bind(
-        &MatrixCreator::internal::
-          copy_local_to_global<number, SparseMatrix<number>, Vector<number>>,
-        std::placeholders::_1,
-        &matrix,
-        static_cast<Vector<number> *>(nullptr)),
+      [&matrix](const internal::AssemblerData::CopyData<number> &data) {
+        MatrixCreator::internal::copy_local_to_global(
+          data, &matrix, static_cast<Vector<number> *>(nullptr));
+      },
       assembler_data,
       copy_data);
   }
@@ -963,12 +959,12 @@ namespace MatrixCreator
         spacedim,
         typename hp::DoFHandler<dim, spacedim>::active_cell_iterator,
         number>,
-      std::bind(
-        &MatrixCreator::internal::
-          copy_local_to_global<number, SparseMatrix<number>, Vector<number>>,
-        std::placeholders::_1,
-        &matrix,
-        &rhs_vector),
+      [&matrix,
+       &rhs_vector](const internal::AssemblerData::CopyData<number> &data) {
+        MatrixCreator::internal::copy_local_to_global(data,
+                                                      &matrix,
+                                                      &rhs_vector);
+      },
       assembler_data,
       copy_data);
   }
@@ -1405,31 +1401,30 @@ namespace MatrixCreator
     WorkStream::run(
       dof.begin_active(),
       dof.end(),
-      static_cast<std::function<
-        void(typename DoFHandler<dim, spacedim>::active_cell_iterator const &,
-             MatrixCreator::internal::AssemblerBoundary::Scratch const &,
-             MatrixCreator::internal::AssemblerBoundary::
-               CopyData<DoFHandler<dim, spacedim>, number> &)>>(
-        std::bind(
-          &internal::create_boundary_mass_matrix_1<dim, spacedim, number>,
-          std::placeholders::_1,
-          std::placeholders::_2,
-          std::placeholders::_3,
-          std::cref(mapping),
-          std::cref(fe),
-          std::cref(q),
-          std::cref(boundary_functions),
-          coefficient,
-          std::cref(component_mapping))),
-      static_cast<std::function<void(
-        MatrixCreator::internal::AssemblerBoundary ::
-          CopyData<DoFHandler<dim, spacedim>, number> const &)>>(
-        std::bind(&internal::copy_boundary_mass_matrix_1<dim, spacedim, number>,
-                  std::placeholders::_1,
-                  std::cref(boundary_functions),
-                  std::cref(dof_to_boundary_mapping),
-                  std::ref(matrix),
-                  std::ref(rhs_vector))),
+      [&mapping, &fe, &q, &boundary_functions, coefficient, &component_mapping](
+        typename DoFHandler<dim, spacedim>::active_cell_iterator const &cell,
+        MatrixCreator::internal::AssemblerBoundary::Scratch const &scratch_data,
+        MatrixCreator::internal::AssemblerBoundary::
+          CopyData<DoFHandler<dim, spacedim>, number> &copy_data) {
+        internal::create_boundary_mass_matrix_1(cell,
+                                                scratch_data,
+                                                copy_data,
+                                                mapping,
+                                                fe,
+                                                q,
+                                                boundary_functions,
+                                                coefficient,
+                                                component_mapping);
+      },
+      [&boundary_functions, &dof_to_boundary_mapping, &matrix, &rhs_vector](
+        MatrixCreator::internal::AssemblerBoundary::
+          CopyData<DoFHandler<dim, spacedim>, number> const &copy_data) {
+        internal::copy_boundary_mass_matrix_1(copy_data,
+                                              boundary_functions,
+                                              dof_to_boundary_mapping,
+                                              matrix,
+                                              rhs_vector);
+      },
       scratch,
       copy_data);
   }
@@ -1879,32 +1874,36 @@ namespace MatrixCreator
     WorkStream::run(
       dof.begin_active(),
       dof.end(),
-      static_cast<std::function<void(
-        typename hp::DoFHandler<dim, spacedim>::active_cell_iterator const &,
-        MatrixCreator::internal::AssemblerBoundary::Scratch const &,
-        MatrixCreator::internal::AssemblerBoundary::
-          CopyData<hp::DoFHandler<dim, spacedim>, number> &)>>(
-        std::bind(
-          &internal::create_hp_boundary_mass_matrix_1<dim, spacedim, number>,
-          std::placeholders::_1,
-          std::placeholders::_2,
-          std::placeholders::_3,
-          std::cref(mapping),
-          std::cref(fe_collection),
-          std::cref(q),
-          std::cref(boundary_functions),
-          coefficient,
-          std::cref(component_mapping))),
-      static_cast<std::function<void(
+      [&mapping,
+       &fe_collection,
+       &q,
+       &boundary_functions,
+       coefficient,
+       &component_mapping](
+        typename hp::DoFHandler<dim, spacedim>::active_cell_iterator const
+          &                                                        cell,
+        MatrixCreator::internal::AssemblerBoundary::Scratch const &scratch_data,
+        MatrixCreator::internal::AssemblerBoundary ::
+          CopyData<hp::DoFHandler<dim, spacedim>, number> &copy_data) {
+        internal::create_hp_boundary_mass_matrix_1(cell,
+                                                   scratch_data,
+                                                   copy_data,
+                                                   mapping,
+                                                   fe_collection,
+                                                   q,
+                                                   boundary_functions,
+                                                   coefficient,
+                                                   component_mapping);
+      },
+      [&boundary_functions, &dof_to_boundary_mapping, &matrix, &rhs_vector](
         MatrixCreator::internal::AssemblerBoundary ::
-          CopyData<hp::DoFHandler<dim, spacedim>, number> const &)>>(
-        std::bind(
-          &internal::copy_hp_boundary_mass_matrix_1<dim, spacedim, number>,
-          std::placeholders::_1,
-          std::cref(boundary_functions),
-          std::cref(dof_to_boundary_mapping),
-          std::ref(matrix),
-          std::ref(rhs_vector))),
+          CopyData<hp::DoFHandler<dim, spacedim>, number> const &copy_data) {
+        internal::copy_hp_boundary_mass_matrix_1(copy_data,
+                                                 boundary_functions,
+                                                 dof_to_boundary_mapping,
+                                                 matrix,
+                                                 rhs_vector);
+      },
       scratch,
       copy_data);
   }
@@ -1980,12 +1979,10 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator>,
-      std::bind(
-        &MatrixCreator::internal::
-          copy_local_to_global<double, SparseMatrix<double>, Vector<double>>,
-        std::placeholders::_1,
-        &matrix,
-        static_cast<Vector<double> *>(nullptr)),
+      [&matrix](const internal::AssemblerData::CopyData<double> &data) {
+        MatrixCreator::internal::copy_local_to_global(
+          data, &matrix, static_cast<Vector<double> *>(nullptr));
+      },
       assembler_data,
       copy_data);
   }
@@ -2054,12 +2051,12 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator>,
-      std::bind(
-        &MatrixCreator::internal::
-          copy_local_to_global<double, SparseMatrix<double>, Vector<double>>,
-        std::placeholders::_1,
-        &matrix,
-        &rhs_vector),
+      [&matrix,
+       &rhs_vector](const internal::AssemblerData::CopyData<double> &data) {
+        MatrixCreator::internal::copy_local_to_global(data,
+                                                      &matrix,
+                                                      &rhs_vector);
+      },
       assembler_data,
       copy_data);
   }
@@ -2128,12 +2125,10 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename hp::DoFHandler<dim, spacedim>::active_cell_iterator>,
-      std::bind(
-        &MatrixCreator::internal::
-          copy_local_to_global<double, SparseMatrix<double>, Vector<double>>,
-        std::placeholders::_1,
-        &matrix,
-        static_cast<Vector<double> *>(nullptr)),
+      [&matrix](const internal::AssemblerData::CopyData<double> &data) {
+        MatrixCreator::internal::copy_local_to_global(
+          data, &matrix, static_cast<Vector<double> *>(nullptr));
+      },
       assembler_data,
       copy_data);
   }
@@ -2200,12 +2195,12 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename hp::DoFHandler<dim, spacedim>::active_cell_iterator>,
-      std::bind(
-        &MatrixCreator::internal::
-          copy_local_to_global<double, SparseMatrix<double>, Vector<double>>,
-        std::placeholders::_1,
-        &matrix,
-        &rhs_vector),
+      [&matrix,
+       &rhs_vector](const internal::AssemblerData::CopyData<double> &data) {
+        MatrixCreator::internal::copy_local_to_global(data,
+                                                      &matrix,
+                                                      &rhs_vector);
+      },
       assembler_data,
       copy_data);
   }

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.