From 63997c94e9d1cefbfe12f7d567ef9596af55678c Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 15 Dec 2020 15:00:37 +0100 Subject: [PATCH] Clean up std::map usage in interpolate_boundary_values --- .../vector_tools_boundary.templates.h | 40 ++++++++----------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/include/deal.II/numerics/vector_tools_boundary.templates.h b/include/deal.II/numerics/vector_tools_boundary.templates.h index cacf289443..30168150f3 100644 --- a/include/deal.II/numerics/vector_tools_boundary.templates.h +++ b/include/deal.II/numerics/vector_tools_boundary.templates.h @@ -417,8 +417,7 @@ namespace VectorTools const ComponentMask & component_mask) { std::map *> - function_map; - function_map[boundary_component] = &boundary_function; + function_map = {{boundary_component, &boundary_function}}; interpolate_boundary_values( mapping, dof, function_map, boundary_values, component_mask); } @@ -451,8 +450,7 @@ namespace VectorTools const ComponentMask & component_mask) { std::map *> - function_map; - function_map[boundary_component] = &boundary_function; + function_map = {{boundary_component, &boundary_function}}; interpolate_boundary_values( mapping, dof, function_map, boundary_values, component_mask); } @@ -514,16 +512,14 @@ namespace VectorTools std::map boundary_values; interpolate_boundary_values( mapping, dof, function_map, boundary_values, component_mask_); - typename std::map::const_iterator - boundary_value = boundary_values.begin(); - for (; boundary_value != boundary_values.end(); ++boundary_value) + for (const auto &boundary_value : boundary_values) { - if (constraints.can_store_line(boundary_value->first) && - !constraints.is_constrained(boundary_value->first)) + if (constraints.can_store_line(boundary_value.first) && + !constraints.is_constrained(boundary_value.first)) { - constraints.add_line(boundary_value->first); - constraints.set_inhomogeneity(boundary_value->first, - boundary_value->second); + constraints.add_line(boundary_value.first); + constraints.set_inhomogeneity(boundary_value.first, + boundary_value.second); } } } @@ -541,8 +537,7 @@ namespace VectorTools const ComponentMask & component_mask) { std::map *> - function_map; - function_map[boundary_component] = &boundary_function; + function_map = {{boundary_component, &boundary_function}}; interpolate_boundary_values( mapping, dof, function_map, constraints, component_mask); } @@ -562,16 +557,14 @@ namespace VectorTools std::map boundary_values; interpolate_boundary_values( mapping, dof, function_map, boundary_values, component_mask_); - typename std::map::const_iterator - boundary_value = boundary_values.begin(); - for (; boundary_value != boundary_values.end(); ++boundary_value) + for (const auto &boundary_value : boundary_values) { - if (constraints.can_store_line(boundary_value->first) && - !constraints.is_constrained(boundary_value->first)) + if (constraints.can_store_line(boundary_value.first) && + !constraints.is_constrained(boundary_value.first)) { - constraints.add_line(boundary_value->first); - constraints.set_inhomogeneity(boundary_value->first, - boundary_value->second); + constraints.add_line(boundary_value.first); + constraints.set_inhomogeneity(boundary_value.first, + boundary_value.second); } } } @@ -589,8 +582,7 @@ namespace VectorTools const ComponentMask & component_mask) { std::map *> - function_map; - function_map[boundary_component] = &boundary_function; + function_map = {{boundary_component, &boundary_function}}; interpolate_boundary_values( mapping, dof, function_map, constraints, component_mask); } -- 2.39.5