From aa12a2b816aeec018230cb2ac1704a3464a5c283 Mon Sep 17 00:00:00 2001 From: Alex Lindsay Date: Wed, 8 Feb 2017 12:21:27 -0600 Subject: [PATCH] Convert to range based for loops (#8444) --- framework/include/base/MooseObjectWarehouseBase.h | 13 +++++++------ framework/include/base/SubProblem.h | 4 +++- .../include/materials/MaterialPropertyInterface.h | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/framework/include/base/MooseObjectWarehouseBase.h b/framework/include/base/MooseObjectWarehouseBase.h index ab63d0998014..064f50f7b4f5 100644 --- a/framework/include/base/MooseObjectWarehouseBase.h +++ b/framework/include/base/MooseObjectWarehouseBase.h @@ -530,11 +530,8 @@ void MooseObjectWarehouseBase::updateBoundaryMatPropDependency(std::set & needed_mat_props, THREAD_ID tid/* = 0*/) const { if (hasActiveBoundaryObjects(tid)) - { - typename std::map>>::const_iterator it; - for (it = _active_boundary_objects[tid].begin(); it != _active_boundary_objects[tid].end(); ++it) - updateMatPropDependencyHelper(needed_mat_props, it->second); - } + for (auto & active_bnd_object : _active_boundary_objects[tid]) + updateMatPropDependencyHelper(needed_mat_props, active_bnd_object.second); } @@ -551,9 +548,13 @@ template void MooseObjectWarehouseBase::updateMatPropDependencyHelper(std::set & needed_mat_props, const std::vector> & objects) { +<<<<<<< HEAD for (typename std::vector> ::const_iterator it = objects.begin(); it != objects.end(); ++it) +======= + for (auto & object : objects) +>>>>>>> 5225638... Convert to range based for loops (#8444) { - const std::set & mp_deps = (*it)->getMatPropDependencies(); + const std::set & mp_deps = object->getMatPropDependencies(); needed_mat_props.insert(mp_deps.begin(), mp_deps.end()); } } diff --git a/framework/include/base/SubProblem.h b/framework/include/base/SubProblem.h index c0ec581f3671..4dae22416a4e 100644 --- a/framework/include/base/SubProblem.h +++ b/framework/include/base/SubProblem.h @@ -400,8 +400,10 @@ class SubProblem : public Problem /* This needs to remain for threading purposes */ std::vector _has_active_elemental_moose_variables; - std::vector > _active_material_property_ids; + /// Set of material property ids that determine whether materials get reinited + std::vector> _active_material_property_ids; + /// True if _active_material_property_ids is not empty std::vector _has_active_material_property_ids; /// nonlocal coupling requirement flag diff --git a/framework/include/materials/MaterialPropertyInterface.h b/framework/include/materials/MaterialPropertyInterface.h index da5d919db307..7573673e8dda 100644 --- a/framework/include/materials/MaterialPropertyInterface.h +++ b/framework/include/materials/MaterialPropertyInterface.h @@ -251,6 +251,7 @@ class MaterialPropertyInterface */ void addMatPropDependency(unsigned int mat_prop_id) { _material_property_dependencies.insert(mat_prop_id); } + /// The set of material properties (as given by their IDs) that _this_ object depends on std::set _material_property_dependencies; private: