From a92d9e277cdde0c46dd38873899d184a1cc98633 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 2 Mar 2020 16:34:06 +0100 Subject: [PATCH] WIP: Make more Teams `const` --- dash/include/dash/TeamSpec.h | 6 +++--- dash/include/dash/algorithm/Transform.h | 2 +- dash/include/dash/pattern/LoadBalancePattern.h | 6 +++--- dash/include/dash/util/TeamLocality.h | 8 ++++---- dash/src/util/TeamLocality.cc | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dash/include/dash/TeamSpec.h b/dash/include/dash/TeamSpec.h index fd39e5036..61fe602c6 100644 --- a/dash/include/dash/TeamSpec.h +++ b/dash/include/dash/TeamSpec.h @@ -48,7 +48,7 @@ class TeamSpec : * dimension. */ TeamSpec( - Team & team = dash::Team::All()) + const Team & team = dash::Team::All()) : _is_linear(true), _myid(team.myid()) { @@ -88,7 +88,7 @@ class TeamSpec : TeamSpec( const self_t & other, const DistributionSpec & distribution, - Team & team = dash::Team::All()) + const Team & team = dash::Team::All()) : CartesianIndexSpace( other.extents()), _myid(team.myid()) @@ -142,7 +142,7 @@ class TeamSpec : */ TeamSpec( const DistributionSpec & distribution, - Team & team = dash::Team::All()) + const Team & team = dash::Team::All()) : _myid(team.myid()) { DASH_LOG_TRACE_VAR("TeamSpec(dist, t)", team.is_null()); diff --git a/dash/include/dash/algorithm/Transform.h b/dash/include/dash/algorithm/Transform.h index dc42706c5..b562d1258 100644 --- a/dash/include/dash/algorithm/Transform.h +++ b/dash/include/dash/algorithm/Transform.h @@ -325,7 +325,7 @@ GlobOutputIt transform( } #endif // Resolve teams from global iterators: - dash::Team & team_in_a = pattern_in_a.team(); + const dash::Team & team_in_a = pattern_in_a.team(); DASH_ASSERT_MSG( team_in_a == pattern_in_b.team(), "dash::transform: Different teams in input ranges"); diff --git a/dash/include/dash/pattern/LoadBalancePattern.h b/dash/include/dash/pattern/LoadBalancePattern.h index 9654ebb9e..def706931 100644 --- a/dash/include/dash/pattern/LoadBalancePattern.h +++ b/dash/include/dash/pattern/LoadBalancePattern.h @@ -997,7 +997,7 @@ class LoadBalancePattern< * The Team containing the units to which this pattern's elements are * mapped. */ - inline dash::Team & team() const + inline const dash::Team & team() const { return *_team; } @@ -1292,11 +1292,11 @@ class LoadBalancePattern< /// Distribution types of all dimensions. DistributionSpec_t _distspec; /// Team containing the units to which the patterns element are mapped - dash::Team * _team = nullptr; + const dash::Team * _team = nullptr; /// The active unit's id. team_unit_t _myid; /// Cartesian arrangement of units within the team - TeamSpec_t _teamspec; + const TeamSpec_t _teamspec; /// Total amount of units to which this pattern's elements are mapped SizeType _nunits = 0; /// Actual number of local elements of the active unit. diff --git a/dash/include/dash/util/TeamLocality.h b/dash/include/dash/util/TeamLocality.h index f12a1f469..9cb92ec6e 100644 --- a/dash/include/dash/util/TeamLocality.h +++ b/dash/include/dash/util/TeamLocality.h @@ -72,7 +72,7 @@ class TeamLocality * locality domain of a specified team. */ TeamLocality( - dash::Team & team, + const dash::Team & team, Scope_t scope = Scope_t::Global, std::string domain_tag = "."); @@ -81,7 +81,7 @@ class TeamLocality * a specified team and locality domain. */ TeamLocality( - dash::Team & team, + const dash::Team & team, LocalityDomain_t & domain); /** @@ -190,7 +190,7 @@ class TeamLocality return _domain.num_cores(); } - inline dash::Team & team() const + inline const dash::Team & team() const { return (nullptr == _team) ? dash::Team::Null() : *_team; } @@ -235,7 +235,7 @@ class TeamLocality } private: - dash::Team * _team = nullptr; + const dash::Team * _team = nullptr; /// Parent scope of the team locality domain hierarchy. Scope_t _scope = Scope_t::Undefined; /// Locality domain of the team. diff --git a/dash/src/util/TeamLocality.cc b/dash/src/util/TeamLocality.cc index 6444172e7..44dba5978 100644 --- a/dash/src/util/TeamLocality.cc +++ b/dash/src/util/TeamLocality.cc @@ -14,7 +14,7 @@ dash::util::TeamLocality::TeamLocality( - dash::Team & team, + const dash::Team & team, dash::util::Locality::Scope scope, std::string domain_tag) : _team(&team), @@ -44,7 +44,7 @@ dash::util::TeamLocality::TeamLocality( } dash::util::TeamLocality::TeamLocality( - dash::Team & team, + const dash::Team & team, dash::util::LocalityDomain & domain) : _team(&team), _scope(domain.scope()),