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
// 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(
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);
}
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();
#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(©_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,
+ ¶meter_dofs](const typename dealii::DoFHandler<dim, spacedim>::
+ active_cell_iterator & cell,
+ const Assembler::Scratch & scratch_data,
+ Assembler::CopyData<dim, spacedim> ©_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> ©_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;
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(
, 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(),
// 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
// 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(); });
}
}
// 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)
// 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
// 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
// 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
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
// 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
// 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
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);
}
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())
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]);
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)
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;
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)
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,
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);
}
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);
}
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());
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(); });
}
{
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(); });
}
}
{
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;
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);
}
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);
}
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.
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);
// 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);
// 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);