]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove std::bind from source
authorDaniel Arndt <arndtd@ornl.gov>
Sat, 21 Sep 2019 06:49:43 +0000 (00:49 -0600)
committerDaniel Arndt <arndtd@ornl.gov>
Sat, 21 Sep 2019 06:52:58 +0000 (00:52 -0600)
19 files changed:
source/base/quadrature_lib.cc
source/distributed/cell_weights.cc
source/distributed/solution_transfer.cc
source/dofs/dof_tools_constraints.cc
source/fe/fe.cc
source/fe/fe_values.cc
source/grid/grid_in.cc
source/grid/tria.cc
source/grid/tria_objects.cc
source/lac/sparsity_pattern.cc
source/multigrid/mg_transfer_block.cc
source/multigrid/mg_transfer_component.cc
source/numerics/data_out.cc
source/numerics/data_out_faces.cc
source/numerics/data_out_rotation.cc
source/numerics/derivative_approximation.cc
source/numerics/point_value_history.cc
source/numerics/time_dependent.cc
source/particles/particle_handler.cc

index a30e74661934ae47c00f18c73e5681ff21c458b4..bf302152770848f46d67053f1e0313f4a35602d6 100644 (file)
@@ -774,10 +774,9 @@ QSorted<dim>::QSorted(const Quadrature<dim> &quad)
 
   std::sort(permutation.begin(),
             permutation.end(),
-            std::bind(&QSorted<dim>::compare_weights,
-                      std::ref(*this),
-                      std::placeholders::_1,
-                      std::placeholders::_2));
+            [this](const unsigned int x, const unsigned int y) {
+              return this->compare_weights(x, y);
+            });
 
   // At this point, the variable is_tensor_product_flag is set
   // to the respective value of the given Quadrature in the base
index cbd8891be26368ca7417cd6cca8ac77aa06abb0f..0e92fa111c99d03a226e3faf3d04341fffc234b4 100644 (file)
@@ -40,10 +40,11 @@ namespace parallel
         // Add callback function to the cell_weight signal and store its
         // connection.
         tria_listener = triangulation->signals.cell_weight.connect(
-          std::bind(&CellWeights<dim, spacedim>::weight_callback,
-                    std::ref(*this),
-                    std::placeholders::_1,
-                    std::placeholders::_2));
+          [this](
+            const typename Triangulation<dim, spacedim>::cell_iterator &cell_,
+            const typename Triangulation<dim, spacedim>::CellStatus status) {
+            return this->weight_callback(cell_, status);
+          });
       }
     else
       Assert(
index 222884d101f31a3c4e6417e1adec7f76db449e09..fb45681fb8cdc80eb4253dc1ab14a178fddd620e 100644 (file)
@@ -156,11 +156,11 @@ namespace parallel
       Assert(tria != nullptr, ExcInternalError());
 
       handle = tria->register_data_attach(
-        std::bind(
-          &SolutionTransfer<dim, VectorType, DoFHandlerType>::pack_callback,
-          this,
-          std::placeholders::_1,
-          std::placeholders::_2),
+        [this](
+          const typename Triangulation<dim, DoFHandlerType::space_dimension>::
+            cell_iterator &cell_,
+          const typename Triangulation<dim, DoFHandlerType::space_dimension>::
+            CellStatus status) { return this->pack_callback(cell_, status); },
         /*returns_variable_size_data=*/DoFHandlerType::is_hp_dof_handler);
     }
 
@@ -262,14 +262,15 @@ namespace parallel
 
       tria->notify_ready_to_unpack(
         handle,
-        std::bind(
-          &SolutionTransfer<dim, VectorType, DoFHandlerType>::unpack_callback,
-          this,
-          std::placeholders::_1,
-          std::placeholders::_2,
-          std::placeholders::_3,
-          std::ref(all_out)));
-
+        [this, &all_out](
+          const typename Triangulation<dim, DoFHandlerType::space_dimension>::
+            cell_iterator &cell_,
+          const typename Triangulation<dim, DoFHandlerType::space_dimension>::
+            CellStatus status,
+          const boost::iterator_range<std::vector<char>::const_iterator>
+            &data_range) {
+          this->unpack_callback(cell_, status, data_range, all_out);
+        });
 
       for (typename std::vector<VectorType *>::iterator it = all_out.begin();
            it != all_out.end();
index c4a250a4288ec2977b3b3e3be620e1aeee7a95df..b9ab377ea2e47f77765ca774084005f594f4f027 100644 (file)
@@ -2819,25 +2819,38 @@ namespace DoFTools
 #endif
           }
 
-        WorkStream::run(coarse_grid.begin_active(),
-                        coarse_grid.end(),
-                        std::bind(&compute_intergrid_weights_3<dim, spacedim>,
-                                  std::placeholders::_1,
-                                  std::placeholders::_2,
-                                  std::placeholders::_3,
-                                  coarse_component,
-                                  std::cref(coarse_grid.get_fe()),
-                                  std::cref(coarse_to_fine_grid_map),
-                                  std::cref(parameter_dofs)),
-                        std::bind(&copy_intergrid_weights_3<dim, spacedim>,
-                                  std::placeholders::_1,
-                                  coarse_component,
-                                  std::cref(coarse_grid.get_fe()),
-                                  std::cref(weight_mapping),
-                                  is_called_in_parallel,
-                                  std::ref(weights)),
-                        scratch,
-                        copy_data);
+        WorkStream::run(
+          coarse_grid.begin_active(),
+          coarse_grid.end(),
+          [coarse_component,
+           &coarse_grid,
+           &coarse_to_fine_grid_map,
+           &parameter_dofs](const typename dealii::DoFHandler<dim, spacedim>::
+                              active_cell_iterator &            cell,
+                            const Assembler::Scratch &          scratch_data,
+                            Assembler::CopyData<dim, spacedim> &copy_data) {
+            compute_intergrid_weights_3<dim, spacedim>(cell,
+                                                       scratch_data,
+                                                       copy_data,
+                                                       coarse_component,
+                                                       coarse_grid.get_fe(),
+                                                       coarse_to_fine_grid_map,
+                                                       parameter_dofs);
+          },
+          [coarse_component,
+           &coarse_grid,
+           &weight_mapping,
+           is_called_in_parallel,
+           &weights](const Assembler::CopyData<dim, spacedim> &copy_data) {
+            copy_intergrid_weights_3<dim, spacedim>(copy_data,
+                                                    coarse_component,
+                                                    coarse_grid.get_fe(),
+                                                    weight_mapping,
+                                                    is_called_in_parallel,
+                                                    weights);
+          },
+          scratch,
+          copy_data);
 
 #ifdef DEAL_II_WITH_MPI
         for (std::size_t i = 0;
@@ -3308,9 +3321,9 @@ namespace DoFTools
     const types::global_dof_index n_global_parm_dofs =
       std::count_if(weight_mapping.begin(),
                     weight_mapping.end(),
-                    std::bind(std::not_equal_to<types::global_dof_index>(),
-                              std::placeholders::_1,
-                              numbers::invalid_dof_index));
+                    [](const types::global_dof_index dof) {
+                      return dof != numbers::invalid_dof_index;
+                    });
 
     // first construct the inverse mapping of weight_mapping
     std::vector<types::global_dof_index> inverse_weight_mapping(
index adee8fbea5f67ec1b47e69b34b4ae4a57f0f7e6f..24734dae81539ef1470b69f588e1a1a264776ac8 100644 (file)
@@ -83,10 +83,9 @@ FiniteElement<dim, spacedim>::FiniteElement(
   , n_nonzero_components_table(compute_n_nonzero_components(nonzero_components))
   , cached_primitivity(std::find_if(n_nonzero_components_table.begin(),
                                     n_nonzero_components_table.end(),
-                                    std::bind(std::not_equal_to<unsigned int>(),
-                                              std::placeholders::_1,
-                                              1U)) ==
-                       n_nonzero_components_table.end())
+                                    [](const unsigned int n_components) {
+                                      return n_components != 1U;
+                                    }) == n_nonzero_components_table.end())
 {
   Assert(restriction_is_additive_flags.size() == this->dofs_per_cell,
          ExcDimensionMismatch(restriction_is_additive_flags.size(),
index 92e6ec1de3370c114702b6db9b3ec848cb95c74c..4208da636891f6db413c2775ef6513b8884b4615 100644 (file)
@@ -4303,13 +4303,11 @@ FEValuesBase<dim, spacedim>::maybe_invalidate_previous_present_cell(
           // triangulations
           invalidate_present_cell();
           tria_listener_refinement =
-            cell->get_triangulation().signals.any_change.connect(std::bind(
-              &FEValuesBase<dim, spacedim>::invalidate_present_cell,
-              std::ref(static_cast<FEValuesBase<dim, spacedim> &>(*this))));
+            cell->get_triangulation().signals.any_change.connect(
+              [this]() { this->invalidate_present_cell(); });
           tria_listener_mesh_transform =
-            cell->get_triangulation().signals.mesh_movement.connect(std::bind(
-              &FEValuesBase<dim, spacedim>::invalidate_present_cell,
-              std::ref(static_cast<FEValuesBase<dim, spacedim> &>(*this))));
+            cell->get_triangulation().signals.mesh_movement.connect(
+              [this]() { this->invalidate_present_cell(); });
         }
     }
   else
@@ -4318,13 +4316,11 @@ FEValuesBase<dim, spacedim>::maybe_invalidate_previous_present_cell(
       // at least subscribe to the triangulation to get notified of
       // changes
       tria_listener_refinement =
-        cell->get_triangulation().signals.post_refinement.connect(std::bind(
-          &FEValuesBase<dim, spacedim>::invalidate_present_cell,
-          std::ref(static_cast<FEValuesBase<dim, spacedim> &>(*this))));
+        cell->get_triangulation().signals.post_refinement.connect(
+          [this]() { this->invalidate_present_cell(); });
       tria_listener_mesh_transform =
-        cell->get_triangulation().signals.mesh_movement.connect(std::bind(
-          &FEValuesBase<dim, spacedim>::invalidate_present_cell,
-          std::ref(static_cast<FEValuesBase<dim, spacedim> &>(*this))));
+        cell->get_triangulation().signals.mesh_movement.connect(
+          [this]() { this->invalidate_present_cell(); });
     }
 }
 
index b8cdce11b145392359c5e2e2faab8ce517b95692..95d144eb4fc8dc1ab9f2c4602e06132787d0087b 100644 (file)
@@ -3155,11 +3155,9 @@ GridIn<dim, spacedim>::skip_empty_lines(std::istream &in)
       // consists only of spaces, and
       // if not put the whole thing
       // back and return
-      if (std::find_if(line.begin(),
-                       line.end(),
-                       std::bind(std::not_equal_to<char>(),
-                                 std::placeholders::_1,
-                                 ' ')) != line.end())
+      if (std::find_if(line.begin(), line.end(), [](const char c) {
+            return c != ' ';
+          }) != line.end())
         {
           in.putback('\n');
           for (int i = line.length() - 1; i >= 0; --i)
index a95f5c52e8e2a6e41686e8a3e1a49a22e2f34466..da64da1b3af2a2000dfee88ba7b35f880a060289 100644 (file)
@@ -4737,10 +4737,10 @@ namespace internal
 
             // count number of used cells
             // on the next higher level
-            const unsigned int used_cells = std::count_if(
-              triangulation.levels[level + 1]->cells.used.begin(),
-              triangulation.levels[level + 1]->cells.used.end(),
-              std::bind(std::equal_to<bool>(), std::placeholders::_1, true));
+            const unsigned int used_cells =
+              std::count(triangulation.levels[level + 1]->cells.used.begin(),
+                         triangulation.levels[level + 1]->cells.used.end(),
+                         true);
 
             // reserve space for the used_cells cells already existing
             // on the next higher level as well as for the
@@ -4760,11 +4760,9 @@ namespace internal
 
         // add to needed vertices how many
         // vertices are already in use
-        needed_vertices += std::count_if(triangulation.vertices_used.begin(),
-                                         triangulation.vertices_used.end(),
-                                         std::bind(std::equal_to<bool>(),
-                                                   std::placeholders::_1,
-                                                   true));
+        needed_vertices += std::count(triangulation.vertices_used.begin(),
+                                      triangulation.vertices_used.end(),
+                                      true);
         // if we need more vertices: create them, if not: leave the
         // array as is, since shrinking is not really possible because
         // some of the vertices at the end may be in use
@@ -5046,10 +5044,10 @@ namespace internal
 
 
             // count number of used cells on the next higher level
-            const unsigned int used_cells = std::count_if(
-              triangulation.levels[level + 1]->cells.used.begin(),
-              triangulation.levels[level + 1]->cells.used.end(),
-              std::bind(std::equal_to<bool>(), std::placeholders::_1, true));
+            const unsigned int used_cells =
+              std::count(triangulation.levels[level + 1]->cells.used.begin(),
+                         triangulation.levels[level + 1]->cells.used.end(),
+                         true);
 
 
             // reserve space for the used_cells cells already existing
@@ -5085,11 +5083,9 @@ namespace internal
         triangulation.faces->lines.reserve_space(n_lines_in_pairs, 0);
 
         // add to needed vertices how many vertices are already in use
-        needed_vertices += std::count_if(triangulation.vertices_used.begin(),
-                                         triangulation.vertices_used.end(),
-                                         std::bind(std::equal_to<bool>(),
-                                                   std::placeholders::_1,
-                                                   true));
+        needed_vertices += std::count(triangulation.vertices_used.begin(),
+                                      triangulation.vertices_used.end(),
+                                      true);
         // if we need more vertices: create them, if not: leave the
         // array as is, since shrinking is not really possible because
         // some of the vertices at the end may be in use
@@ -5452,10 +5448,10 @@ namespace internal
 
 
             // count number of used cells on the next higher level
-            const unsigned int used_cells = std::count_if(
-              triangulation.levels[level + 1]->cells.used.begin(),
-              triangulation.levels[level + 1]->cells.used.end(),
-              std::bind(std::equal_to<bool>(), std::placeholders::_1, true));
+            const unsigned int used_cells =
+              std::count(triangulation.levels[level + 1]->cells.used.begin(),
+                         triangulation.levels[level + 1]->cells.used.end(),
+                         true);
 
 
             // reserve space for the used_cells cells already existing
@@ -5539,11 +5535,9 @@ namespace internal
 
 
         // add to needed vertices how many vertices are already in use
-        needed_vertices += std::count_if(triangulation.vertices_used.begin(),
-                                         triangulation.vertices_used.end(),
-                                         std::bind(std::equal_to<bool>(),
-                                                   std::placeholders::_1,
-                                                   true));
+        needed_vertices += std::count(triangulation.vertices_used.begin(),
+                                      triangulation.vertices_used.end(),
+                                      true);
         // if we need more vertices: create them, if not: leave the
         // array as is, since shrinking is not really possible because
         // some of the vertices at the end may be in use
@@ -13184,11 +13178,7 @@ template <int dim, int spacedim>
 unsigned int
 Triangulation<dim, spacedim>::n_used_vertices() const
 {
-  return std::count_if(vertices_used.begin(),
-                       vertices_used.end(),
-                       std::bind(std::equal_to<bool>(),
-                                 std::placeholders::_1,
-                                 true));
+  return std::count(vertices_used.begin(), vertices_used.end(), true);
 }
 
 
index 34a64e0baf1c135f4c6163bf41e5a383587e9fac..6e583bf96769daf38d1aab120e7a357ed444e40f 100644 (file)
@@ -170,11 +170,7 @@ namespace internal
     TriaObjectsHex::reserve_space(const unsigned int new_hexes)
     {
       const unsigned int new_size =
-        new_hexes + std::count_if(used.begin(),
-                                  used.end(),
-                                  std::bind(std::equal_to<bool>(),
-                                            std::placeholders::_1,
-                                            true));
+        new_hexes + std::count(used.begin(), used.end(), true);
 
       // see above...
       if (new_size > cells.size())
index e573a1fb2aa5053fe9ab5dfd9e5a67cfb7c60a4c..9c3185dc74df37310625ee3f699cf34029e2d586 100644 (file)
@@ -352,9 +352,7 @@ SparsityPattern::compress()
   const std::size_t nonzero_elements =
     std::count_if(&colnums[rowstart[0]],
                   &colnums[rowstart[rows]],
-                  std::bind(std::not_equal_to<size_type>(),
-                            std::placeholders::_1,
-                            invalid_entry));
+                  [](const size_type col) { return col != invalid_entry; });
   // now allocate the respective memory
   std::unique_ptr<size_type[]> new_colnums(new size_type[nonzero_elements]);
 
index 02b305460e0c23137e02f2c5784679be6f2ca32a..72ac874f7286635c12bd91e14e183162099c8f5a 100644 (file)
@@ -544,9 +544,9 @@ MGTransferBlockSelect<number>::build_matrices(
       const types::global_dof_index n_active_dofs =
         std::count_if(temp_copy_indices.begin(),
                       temp_copy_indices.end(),
-                      std::bind(std::not_equal_to<types::global_dof_index>(),
-                                std::placeholders::_1,
-                                numbers::invalid_dof_index));
+                      [](const types::global_dof_index index) {
+                        return index != numbers::invalid_dof_index;
+                      });
       copy_indices[selected_block][level].resize(n_active_dofs);
       types::global_dof_index counter = 0;
       for (types::global_dof_index i = 0; i < temp_copy_indices.size(); ++i)
@@ -623,12 +623,12 @@ MGTransferBlock<number>::build_matrices(const DoFHandler<dim, spacedim> &dof,
       for (unsigned int block = 0; block < n_blocks; ++block)
         if (selected[block])
           {
-            const types::global_dof_index n_active_dofs = std::count_if(
-              temp_copy_indices[block].begin(),
-              temp_copy_indices[block].end(),
-              std::bind(std::not_equal_to<types::global_dof_index>(),
-                        std::placeholders::_1,
-                        numbers::invalid_dof_index));
+            const types::global_dof_index n_active_dofs =
+              std::count_if(temp_copy_indices[block].begin(),
+                            temp_copy_indices[block].end(),
+                            [](const types::global_dof_index index) {
+                              return index != numbers::invalid_dof_index;
+                            });
             copy_indices[block][level].resize(n_active_dofs);
             types::global_dof_index counter = 0;
             for (types::global_dof_index i = 0;
index fa61143924a6a5ae8ab49abd78a6c00220cebbc6..69d149d844e0d8b5058004cea3cb2b1be8bc3e85 100644 (file)
@@ -683,9 +683,9 @@ MGTransferSelect<number>::build_matrices(
       const types::global_dof_index n_active_dofs =
         std::count_if(temp_copy_indices.begin(),
                       temp_copy_indices.end(),
-                      std::bind(std::not_equal_to<types::global_dof_index>(),
-                                std::placeholders::_1,
-                                numbers::invalid_dof_index));
+                      [](const types::global_dof_index index) {
+                        return index != numbers::invalid_dof_index;
+                      });
       copy_to_and_from_indices[level].resize(n_active_dofs);
       types::global_dof_index counter = 0;
       for (types::global_dof_index i = 0; i < temp_copy_indices.size(); ++i)
index a76ae281cfbe7ff8065ed6f19364c5812deb4822..2feb97861fe424dd8bf4c60349b697e9dd67888a 100644 (file)
@@ -812,15 +812,19 @@ DataOut<dim, DoFHandlerType>::build_patches(
     WorkStream::run(
       all_cells.data(),
       all_cells.data() + all_cells.size(),
-      std::bind(&DataOut<dim, DoFHandlerType>::build_one_patch,
-                this,
-                std::placeholders::_1,
-                std::placeholders::_2,
-                /* no std::placeholders::_3, since this function doesn't
-                   actually need a copy data object -- it just writes everything
-                   right into the output array */
-                n_subdivisions,
-                curved_cell_region),
+      [this, n_subdivisions, curved_cell_region](
+        const std::pair<cell_iterator, unsigned int> *cell_and_index,
+        internal::DataOutImplementation::ParallelData<
+          DoFHandlerType::dimension,
+          DoFHandlerType::space_dimension> &scratch_data,
+        // this function doesn't actually need a copy data object -- it just
+        // writes everything right into the output array
+        int) {
+        this->build_one_patch(cell_and_index,
+                              scratch_data,
+                              n_subdivisions,
+                              curved_cell_region);
+      },
       // no copy-local-to-global function needed here
       std::function<void(const int)>(),
       thread_data,
index 69bab0830565acaaf0ee51be3bdbed1e016d8c75..473b7af5d38b8acc6cb663228a2a4811648c9a1f 100644 (file)
@@ -396,19 +396,21 @@ DataOutFaces<dim, DoFHandlerType>::build_patches(
     n_datasets, Utilities::fixed_power<dimension - 1>(n_subdivisions + 1));
 
   // now build the patches in parallel
-  WorkStream::run(all_faces.data(),
-                  all_faces.data() + all_faces.size(),
-                  std::bind(&DataOutFaces<dim, DoFHandlerType>::build_one_patch,
-                            this,
-                            std::placeholders::_1,
-                            std::placeholders::_2,
-                            std::placeholders::_3),
-                  std::bind(&internal::DataOutFacesImplementation::
-                              append_patch_to_list<dim, space_dimension>,
-                            std::placeholders::_1,
-                            std::ref(this->patches)),
-                  thread_data,
-                  sample_patch);
+  WorkStream::run(
+    all_faces.data(),
+    all_faces.data() + all_faces.size(),
+    [this](const FaceDescriptor *cell_and_face,
+           internal::DataOutFacesImplementation::ParallelData<dimension,
+                                                              dimension> &data,
+           DataOutBase::Patch<dimension - 1, space_dimension> &patch) {
+      this->build_one_patch(cell_and_face, data, patch);
+    },
+    [this](const DataOutBase::Patch<dim - 1, space_dimension> &patch) {
+      internal::DataOutFacesImplementation::
+        append_patch_to_list<dim, space_dimension>(patch, this->patches);
+    },
+    thread_data,
+    sample_patch);
 }
 
 
index 7819ad0ac37d93f646e28f7cc8c4ac01e16eeea5..c366af22896a94f30fcaaa3e5480962099014a14 100644 (file)
@@ -535,15 +535,18 @@ DataOutRotation<dim, DoFHandlerType>::build_patches(
   WorkStream::run(
     all_cells.data(),
     all_cells.data() + all_cells.size(),
-    std::bind(&DataOutRotation<dim, DoFHandlerType>::build_one_patch,
-              this,
-              std::placeholders::_1,
-              std::placeholders::_2,
-              std::placeholders::_3),
-    std::bind(&internal::DataOutRotationImplementation ::
-                append_patch_to_list<dim, space_dimension>,
-              std::placeholders::_1,
-              std::ref(this->patches)),
+    [this](const cell_iterator *cell,
+           internal::DataOutRotationImplementation::
+             ParallelData<dimension, space_dimension> &data,
+           std::vector<DataOutBase::Patch<dimension + 1, space_dimension + 1>>
+             &my_patches) { this->build_one_patch(cell, data, my_patches); },
+    [this](
+      const std::vector<DataOutBase::Patch<dimension + 1, space_dimension + 1>>
+        &new_patches) {
+      internal::DataOutRotationImplementation ::
+        append_patch_to_list<dimension, space_dimension>(new_patches,
+                                                         this->patches);
+    },
     thread_data,
     new_patches);
 }
index 042512a15afd4f82e29dc3706daac62b9929ee70..8c1928e07276aca1115d78ecdcb1a456ab219868 100644 (file)
@@ -1002,19 +1002,17 @@ namespace DerivativeApproximation
       WorkStream::run(
         begin,
         end,
-        static_cast<std::function<void(SynchronousIterators<Iterators> const &,
-                                       Assembler::Scratch const &,
-                                       Assembler::CopyData &)>>(
-          std::bind(&approximate<DerivativeDescription,
-                                 dim,
-                                 DoFHandlerType,
-                                 InputVector,
-                                 spacedim>,
-                    std::placeholders::_1,
-                    std::cref(mapping),
-                    std::cref(dof_handler),
-                    std::cref(solution),
-                    component)),
+        [&mapping, &dof_handler, &solution, component](
+          SynchronousIterators<Iterators> const &cell,
+          Assembler::Scratch const &,
+          Assembler::CopyData &) {
+          approximate<DerivativeDescription,
+                      dim,
+                      DoFHandlerType,
+                      InputVector,
+                      spacedim>(
+            cell, mapping, dof_handler, solution, component);
+        },
         std::function<void(internal::Assembler::CopyData const &)>(),
         internal::Assembler::Scratch(),
         internal::Assembler::CopyData());
index 58c7d7a822003369700d6eb16cd422a06307779f..89445ff029d153143adb54aaa682ab05684c86bd 100644 (file)
@@ -96,7 +96,7 @@ PointValueHistory<dim>::PointValueHistory(
   indep_names = std::vector<std::string>();
 
   tria_listener = dof_handler.get_triangulation().signals.any_change.connect(
-    std::bind(&PointValueHistory<dim>::tria_change_listener, std::ref(*this)));
+    [this]() { this->tria_change_listener(); });
 }
 
 
@@ -128,8 +128,7 @@ PointValueHistory<dim>::PointValueHistory(
     {
       tria_listener =
         dof_handler->get_triangulation().signals.any_change.connect(
-          std::bind(&PointValueHistory<dim>::tria_change_listener,
-                    std::ref(*this)));
+          [this]() { this->tria_change_listener(); });
     }
 }
 
@@ -162,8 +161,7 @@ PointValueHistory<dim>::operator=(const PointValueHistory &point_value_history)
     {
       tria_listener =
         dof_handler->get_triangulation().signals.any_change.connect(
-          std::bind(&PointValueHistory<dim>::tria_change_listener,
-                    std::ref(*this)));
+          [this]() { this->tria_change_listener(); });
     }
 
   return *this;
index 80a45331083976e2e734551c02bf2f35abbe5478..7860c418c0a7abf5182624e25a500f0b5f011d15 100644 (file)
@@ -169,33 +169,33 @@ TimeDependent::delete_timestep(const unsigned int position)
 void
 TimeDependent::solve_primal_problem()
 {
-  do_loop(std::bind(&TimeStepBase::init_for_primal_problem,
-                    std::placeholders::_1),
-          std::bind(&TimeStepBase::solve_primal_problem, std::placeholders::_1),
-          timestepping_data_primal,
-          forward);
+  do_loop(
+    [](TimeStepBase *const time_step) { time_step->init_for_primal_problem(); },
+    [](TimeStepBase *const time_step) { time_step->solve_primal_problem(); },
+    timestepping_data_primal,
+    forward);
 }
 
 
 void
 TimeDependent::solve_dual_problem()
 {
-  do_loop(std::bind(&TimeStepBase::init_for_dual_problem,
-                    std::placeholders::_1),
-          std::bind(&TimeStepBase::solve_dual_problem, std::placeholders::_1),
-          timestepping_data_dual,
-          backward);
+  do_loop(
+    [](TimeStepBase *const time_step) { time_step->init_for_dual_problem(); },
+    [](TimeStepBase *const time_step) { time_step->init_for_dual_problem(); },
+    timestepping_data_dual,
+    backward);
 }
 
 
 void
 TimeDependent::postprocess()
 {
-  do_loop(std::bind(&TimeStepBase::init_for_postprocessing,
-                    std::placeholders::_1),
-          std::bind(&TimeStepBase::postprocess_timestep, std::placeholders::_1),
-          timestepping_data_postprocess,
-          forward);
+  do_loop(
+    [](TimeStepBase *const time_step) { time_step->init_for_postprocessing(); },
+    [](TimeStepBase *const time_step) { time_step->postprocess_timestep(); },
+    timestepping_data_postprocess,
+    forward);
 }
 
 
@@ -227,13 +227,13 @@ TimeDependent::start_sweep(const unsigned int s)
 void
 TimeDependent::end_sweep()
 {
-  void (TimeDependent::*p)(const unsigned int, const unsigned int) =
-    &TimeDependent::end_sweep;
-  parallel::apply_to_subranges(
-    0U,
-    timesteps.size(),
-    std::bind(p, this, std::placeholders::_1, std::placeholders::_2),
-    1);
+  parallel::apply_to_subranges(0U,
+                               timesteps.size(),
+                               [this](const unsigned int begin,
+                                      const unsigned int end) {
+                                 this->end_sweep(begin, end);
+                               },
+                               1);
 }
 
 
index 491f34e79d32aa5d29d5928352213206989918f8..95af0a13192a893c4e8f269b3e3df592cc391171 100644 (file)
@@ -654,14 +654,17 @@ namespace Particles
           for (unsigned int i = 0; i < n_neighbor_cells; ++i)
             neighbor_permutation[i] = i;
 
+          const auto cell_centers =
+            vertex_to_cell_centers[closest_vertex_index];
           std::sort(neighbor_permutation.begin(),
                     neighbor_permutation.end(),
-                    std::bind(&compare_particle_association<spacedim>,
-                              std::placeholders::_1,
-                              std::placeholders::_2,
-                              std::cref(vertex_to_particle),
-                              std::cref(
-                                vertex_to_cell_centers[closest_vertex_index])));
+                    [&vertex_to_particle, &cell_centers](const unsigned int a,
+                                                         const unsigned int b) {
+                      return compare_particle_association(a,
+                                                          b,
+                                                          vertex_to_particle,
+                                                          cell_centers);
+                    });
 
           // Search all of the cells adjacent to the closest vertex of the
           // previous cell Most likely we will find the particle in them.
@@ -1078,14 +1081,13 @@ namespace Particles
 
     if (global_max_particles_per_cell > 0)
       {
-        const std::function<std::vector<char>(
-          const typename Triangulation<dim, spacedim>::cell_iterator &,
-          const typename Triangulation<dim, spacedim>::CellStatus)>
-          callback_function =
-            std::bind(&ParticleHandler<dim, spacedim>::store_particles,
-                      std::cref(*this),
-                      std::placeholders::_1,
-                      std::placeholders::_2);
+        const auto callback_function =
+          [this](const typename Triangulation<dim, spacedim>::cell_iterator
+                   &cell_iterator,
+                 const typename Triangulation<dim, spacedim>::CellStatus
+                   cell_status) {
+            return this->store_particles(cell_iterator, cell_status);
+          };
 
         handle = non_const_triangulation->register_data_attach(
           callback_function, /*returns_variable_size_data=*/true);
@@ -1114,14 +1116,13 @@ namespace Particles
     // data correctly. Only do this if something was actually stored.
     if (serialization && (global_max_particles_per_cell > 0))
       {
-        const std::function<std::vector<char>(
-          const typename Triangulation<dim, spacedim>::cell_iterator &,
-          const typename Triangulation<dim, spacedim>::CellStatus)>
-          callback_function =
-            std::bind(&ParticleHandler<dim, spacedim>::store_particles,
-                      std::cref(*this),
-                      std::placeholders::_1,
-                      std::placeholders::_2);
+        const auto callback_function =
+          [this](const typename Triangulation<dim, spacedim>::cell_iterator
+                   &cell_iterator,
+                 const typename Triangulation<dim, spacedim>::CellStatus
+                   cell_status) {
+            return this->store_particles(cell_iterator, cell_status);
+          };
 
         handle = non_const_triangulation->register_data_attach(
           callback_function, /*returns_variable_size_data=*/true);
@@ -1130,16 +1131,15 @@ namespace Particles
     // Check if something was stored and load it
     if (handle != numbers::invalid_unsigned_int)
       {
-        const std::function<void(
-          const typename Triangulation<dim, spacedim>::cell_iterator &,
-          const typename Triangulation<dim, spacedim>::CellStatus,
-          const boost::iterator_range<std::vector<char>::const_iterator> &)>
-          callback_function =
-            std::bind(&ParticleHandler<dim, spacedim>::load_particles,
-                      std::ref(*this),
-                      std::placeholders::_1,
-                      std::placeholders::_2,
-                      std::placeholders::_3);
+        const auto callback_function =
+          [this](
+            const typename Triangulation<dim, spacedim>::cell_iterator
+              &cell_iterator,
+            const typename Triangulation<dim, spacedim>::CellStatus cell_status,
+            const boost::iterator_range<std::vector<char>::const_iterator>
+              &range_iterator) {
+            this->load_particles(cell_iterator, cell_status, range_iterator);
+          };
 
         non_const_triangulation->notify_ready_to_unpack(handle,
                                                         callback_function);

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.