From 89634b39573a0e2cdec79b1a19580234d735dd7c Mon Sep 17 00:00:00 2001 From: anne-glerum Date: Sun, 2 Jun 2024 23:04:44 +0200 Subject: [PATCH] Optimize loop over stress field indices --- source/material_model/rheology/visco_plastic.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/material_model/rheology/visco_plastic.cc b/source/material_model/rheology/visco_plastic.cc index ed705b39117..9c51a3b40ab 100644 --- a/source/material_model/rheology/visco_plastic.cc +++ b/source/material_model/rheology/visco_plastic.cc @@ -534,8 +534,8 @@ namespace aspect // Set a mask (false) for the 2*n_independent_components fields representing the viscoelastic // stress tensor components so that they are excluded from the volume fraction computation. const std::vector &stress_field_indices = this->introspection().get_indices_for_fields_of_type(CompositionalFieldDescription::stress); - for (auto it = stress_field_indices.begin(); it != stress_field_indices.end(); ++it) - composition_mask.set(*it, false); + for (unsigned int field_index: stress_field_indices) + composition_mask.set(field_index, false); } return composition_mask;