From 6cf515e51a8a6f4e8014b51d8c0ff4cbd7dce931 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 5 Oct 2017 14:54:37 -0500 Subject: [PATCH] simplify code --- .../deal.II/numerics/vector_tools.templates.h | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index e15e17fb70..f1c62f9b98 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -248,10 +248,10 @@ namespace VectorTools // Internal implementation of interpolate that takes a generic functor - // function such that function(cell).second is of type - // Function* and - // function(cell).first is a boolean indicating whether the current - // cell should be processed + // function such that function(cell) is of type + // Function* + // + // A given cell is skipped if function(cell) == nullptr template n_components, + Assert(n_components == function(cell)->n_components, ExcDimensionMismatch(dof_handler.get_fe().n_components(), - function(cell).second->n_components)); - function(cell).second->vector_value_list(generalized_support_points, - function_values); + function(cell)->n_components)); + function(cell)->vector_value_list(generalized_support_points, + function_values); { // Before we can average, we have to transform all function values @@ -506,9 +508,9 @@ namespace VectorTools // internal implementation const auto function_map = [&function]( const typename DoFHandlerType::active_cell_iterator &) - -> std::pair *> + -> const Function * { - return std::make_pair(true, &function); + return &function; }; interpolate(mapping, dof_handler, function_map, vec, component_mask); @@ -617,11 +619,13 @@ namespace VectorTools // internal implementation const auto function_map = [&functions]( const typename DoFHandlerType::active_cell_iterator &cell) - -> std::pair *> + -> const Function * { const auto function = functions.find(cell->material_id()); - bool update = function != functions.end(); - return std::make_pair(update, function->second); + if (function != functions.end()) + return function->second; + else + return nullptr; }; interpolate(mapping, dof_handler, function_map, vec, component_mask); -- 2.39.5