Threads::Task<> rhs_task =
Threads::new_task(&Solver<dim>::assemble_rhs, *this, linear_system.rhs);
- WorkStream::run(
- dof_handler.begin_active(),
- dof_handler.end(),
+ auto worker =
[this](const typename DoFHandler<dim>::active_cell_iterator &cell,
AssemblyScratchData &scratch_data,
AssemblyCopyData & copy_data) {
this->local_assemble_matrix(cell, scratch_data, copy_data);
- },
- [this, &linear_system](const AssemblyCopyData ©_data) {
- this->copy_local_to_global(copy_data, linear_system);
- },
- AssemblyScratchData(*fe, *quadrature),
- AssemblyCopyData());
+ };
+
+ auto copier = [this, &linear_system](const AssemblyCopyData ©_data) {
+ this->copy_local_to_global(copy_data, linear_system);
+ };
+
+ WorkStream::run(dof_handler.begin_active(),
+ dof_handler.end(),
+ worker,
+ copier,
+ AssemblyScratchData(*fe, *quadrature),
+ AssemblyCopyData());
linear_system.hanging_node_constraints.condense(linear_system.matrix);
// The syntax above using lambda functions requires
Threads::Task<> rhs_task =
Threads::new_task(&Solver<dim>::assemble_rhs, *this, linear_system.rhs);
- WorkStream::run(
- dof_handler.begin_active(),
- dof_handler.end(),
+ auto worker =
[this](const typename DoFHandler<dim>::active_cell_iterator &cell,
AssemblyScratchData &scratch_data,
AssemblyCopyData & copy_data) {
this->local_assemble_matrix(cell, scratch_data, copy_data);
- },
- [this, &linear_system](const AssemblyCopyData ©_data) {
- this->copy_local_to_global(copy_data, linear_system);
- },
- AssemblyScratchData(*fe, *quadrature),
- AssemblyCopyData());
+ };
+
+ auto copier = [this, &linear_system](const AssemblyCopyData ©_data) {
+ this->copy_local_to_global(copy_data, linear_system);
+ };
+
+ WorkStream::run(dof_handler.begin_active(),
+ dof_handler.end(),
+ worker,
+ copier,
+ AssemblyScratchData(*fe, *quadrature),
+ AssemblyCopyData());
linear_system.hanging_node_constraints.condense(linear_system.matrix);
std::map<types::global_dof_index, double> boundary_value_map;
++face_no)
face_integrals[cell->face(face_no)] = -1e20;
+ auto worker = [this,
+ &error_indicators,
+ &face_integrals](const active_cell_iterator & cell,
+ WeightedResidualScratchData &scratch_data,
+ WeightedResidualCopyData & copy_data) {
+ this->estimate_on_one_cell(
+ cell, scratch_data, copy_data, error_indicators, face_integrals);
+ };
+
+ auto copier = std::function<void(const WeightedResidualCopyData &)>();
+
// Then hand it all off to WorkStream::run() to compute the
// estimators for all cells in parallel:
WorkStream::run(
DualSolver<dim>::dof_handler.begin_active(),
DualSolver<dim>::dof_handler.end(),
- [this,
- &error_indicators,
- &face_integrals](const active_cell_iterator & cell,
- WeightedResidualScratchData &scratch_data,
- WeightedResidualCopyData & copy_data) {
- this->estimate_on_one_cell(
- cell, scratch_data, copy_data, error_indicators, face_integrals);
- },
- std::function<void(const WeightedResidualCopyData &)>(),
+ worker,
+ copier,
WeightedResidualScratchData(*DualSolver<dim>::fe,
*DualSolver<dim>::quadrature,
*DualSolver<dim>::face_quadrature,
using CellFilter =
FilteredIterator<typename DoFHandler<2>::active_cell_iterator>;
- WorkStream::run(
- CellFilter(IteratorFilters::LocallyOwnedCell(),
- stokes_dof_handler.begin_active()),
- CellFilter(IteratorFilters::LocallyOwnedCell(), stokes_dof_handler.end()),
+ auto worker =
[this](const typename DoFHandler<dim>::active_cell_iterator &cell,
Assembly::Scratch::StokesPreconditioner<dim> & scratch,
Assembly::CopyData::StokesPreconditioner<dim> & data) {
this->local_assemble_stokes_preconditioner(cell, scratch, data);
- },
+ };
+
+ auto copier =
[this](const Assembly::CopyData::StokesPreconditioner<dim> &data) {
this->copy_local_to_global_stokes_preconditioner(data);
- },
- Assembly::Scratch::StokesPreconditioner<dim>(stokes_fe,
- quadrature_formula,
- mapping,
- update_JxW_values |
- update_values |
- update_gradients),
- Assembly::CopyData::StokesPreconditioner<dim>(stokes_fe));
+ };
+
+ WorkStream::run(CellFilter(IteratorFilters::LocallyOwnedCell(),
+ stokes_dof_handler.begin_active()),
+ CellFilter(IteratorFilters::LocallyOwnedCell(),
+ stokes_dof_handler.end()),
+ worker,
+ copier,
+ Assembly::Scratch::StokesPreconditioner<dim>(
+ stokes_fe,
+ quadrature_formula,
+ mapping,
+ update_JxW_values | update_values | update_gradients),
+ Assembly::CopyData::StokesPreconditioner<dim>(stokes_fe));
stokes_preconditioner_matrix.compress(VectorOperation::add);
}
using CellFilter =
FilteredIterator<typename DoFHandler<2>::active_cell_iterator>;
- WorkStream::run(
- CellFilter(IteratorFilters::LocallyOwnedCell(),
- temperature_dof_handler.begin_active()),
- CellFilter(IteratorFilters::LocallyOwnedCell(),
- temperature_dof_handler.end()),
- [this, global_T_range, maximal_velocity, global_entropy_variation](
- const typename DoFHandler<dim>::active_cell_iterator &cell,
- Assembly::Scratch::TemperatureRHS<dim> & scratch,
- Assembly::CopyData::TemperatureRHS<dim> & data) {
+ auto worker =
+ [=](const typename DoFHandler<dim>::active_cell_iterator &cell,
+ Assembly::Scratch::TemperatureRHS<dim> & scratch,
+ Assembly::CopyData::TemperatureRHS<dim> & data) {
this->local_assemble_temperature_rhs(global_T_range,
maximal_velocity,
global_entropy_variation,
cell,
scratch,
data);
- },
- [this](const Assembly::CopyData::TemperatureRHS<dim> &data) {
- this->copy_local_to_global_temperature_rhs(data);
- },
- Assembly::Scratch::TemperatureRHS<dim>(
- temperature_fe, stokes_fe, mapping, quadrature_formula),
- Assembly::CopyData::TemperatureRHS<dim>(temperature_fe));
+ };
+
+ auto copier = [=](const Assembly::CopyData::TemperatureRHS<dim> &data) {
+ this->copy_local_to_global_temperature_rhs(data);
+ };
+
+ WorkStream::run(CellFilter(IteratorFilters::LocallyOwnedCell(),
+ temperature_dof_handler.begin_active()),
+ CellFilter(IteratorFilters::LocallyOwnedCell(),
+ temperature_dof_handler.end()),
+ worker,
+ copier,
+ Assembly::Scratch::TemperatureRHS<dim>(
+ temperature_fe, stokes_fe, mapping, quadrature_formula),
+ Assembly::CopyData::TemperatureRHS<dim>(temperature_fe));
temperature_rhs.compress(VectorOperation::add);
}