From: Martin Kronbichler Date: Tue, 15 Dec 2020 14:00:37 +0000 (+0100) Subject: Clean up std::map usage in interpolate_boundary_values X-Git-Tag: v9.3.0-rc1~751^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11376%2Fhead;p=dealii.git Clean up std::map usage in interpolate_boundary_values --- 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); }