DASH  0.3.0
dash::DynamicPattern< 1, Arrangement, IndexType > Class Template Reference

Irregular dynamic pattern. More...

#include <DynamicPattern.h>

Classes

struct  local_coords_t
 
struct  local_index_t
 

Public Types

typedef pattern_partitioning_properties< pattern_partitioning_tag::minimal, pattern_partitioning_tag::rectangular, pattern_partitioning_tag::balanced, pattern_partitioning_tag::unbalanced, pattern_partitioning_tag::dynamicpartitioning_properties
 Satisfiable properties in pattern property category Partitioning: More...
 
typedef pattern_mapping_properties< pattern_mapping_tag::unbalancedmapping_properties
 Satisfiable properties in pattern property category Mapping: More...
 
typedef pattern_layout_properties< pattern_layout_tag::blocked, pattern_layout_tag::linearlayout_properties
 Satisfiable properties in pattern property category Layout: More...
 
typedef IndexType index_type
 
typedef SizeType size_type
 
typedef ViewSpec_t viewspec_type
 

Public Member Functions

template<typename ... Args>
 DynamicPattern (SizeType arg, Args &&... args)
 Constructor, initializes a pattern from an argument list consisting of the pattern size (extent, number of elements) followed by an optional distribution type. More...
 
 DynamicPattern (const SizeSpec_t &sizespec, const DistributionSpec_t &distspec, const TeamSpec_t &teamspec, Team &team=dash::Team::All())
 Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec, TeamSpec and Team. More...
 
 DynamicPattern (const SizeSpec_t &sizespec, const DistributionSpec_t &distspec, Team &team=dash::Team::All())
 Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec and Team. More...
 
template<typename ... Args>
 DynamicPattern (const std::vector< size_type > &local_sizes, SizeType arg, Args &&... args)
 Constructor, initializes a pattern from an argument list consisting of the pattern size (extent, number of elements) followed by an optional distribution type. More...
 
 DynamicPattern (const std::vector< size_type > &local_sizes, const TeamSpec_t &teamspec, dash::Team &team=dash::Team::All())
 Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec, TeamSpec and a Team. More...
 
 DynamicPattern (const std::vector< size_type > &local_sizes, Team &team=dash::Team::All())
 Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec, TeamSpec and a Team. More...
 
 DynamicPattern (const self_t &other)
 Copy constructor. More...
 
 DynamicPattern (self_t &other)
 Copy constructor using non-const lvalue reference parameter. More...
 
bool operator== (const self_t &other) const
 Equality comparison operator. More...
 
bool operator!= (const self_t &other) const
 Inquality comparison operator. More...
 
self_t & operator= (const self_t &other)=default
 Assignment operator. More...
 
IndexType lbegin () const
 Resolves the global index of the first local element in the pattern. More...
 
IndexType lend () const
 Resolves the global index past the last local element in the pattern. More...
 
void local_resize (team_unit_t unit, size_type local_size)
 resize / balance More...
 
void local_resize (size_type local_size)
 Update the number of local elements of the active unit. More...
 
void balance ()
 Balance the number of local elements across all units in the pattern's associated team. More...
 
team_unit_t unit_at (const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
 unit_at More...
 
team_unit_t unit_at (const std::array< IndexType, NumDimensions > &g_coords) const
 Convert given coordinate in pattern to its assigned unit id. More...
 
team_unit_t unit_at (IndexType global_pos, const ViewSpec_t &viewspec) const
 Convert given global linear index to its assigned unit id. More...
 
team_unit_t unit_at (IndexType g_index) const
 Convert given global linear index to its assigned unit id. More...
 
IndexType extent (dim_t dim) const
 extent More...
 
IndexType local_extent (dim_t dim) const
 The actual number of elements in this pattern that are local to the calling unit in the given dimension. More...
 
std::array< SizeType, NumDimensions > local_extents (team_unit_t unit) const
 The actual number of elements in this pattern that are local to the given unit, by dimension. More...
 
IndexType local_at (const std::array< IndexType, NumDimensions > &local_coords, const ViewSpec_t &viewspec) const
 local More...
 
IndexType local_at (const std::array< IndexType, NumDimensions > &local_coords) const
 Convert given local coordinates to linear local offset (index). More...
 
local_coords_t local (const std::array< IndexType, NumDimensions > &g_coords) const
 Converts global coordinates to their associated unit and its respective local coordinates. More...
 
local_index_t local (IndexType g_index) const
 Converts global index to its associated unit and respective local index. More...
 
std::array< IndexType, NumDimensions > local_coords (const std::array< IndexType, NumDimensions > &g_coords) const
 Converts global coordinates to their associated unit's respective local coordinates. More...
 
local_index_t local_index (const std::array< IndexType, NumDimensions > &g_coords) const
 Converts global coordinates to their associated unit and their respective local index. More...
 
std::array< IndexType, NumDimensions > global (team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
 global More...
 
std::array< IndexType, NumDimensions > global (const std::array< IndexType, NumDimensions > &l_coords) const
 Converts local coordinates of active unit to global coordinates. More...
 
IndexType global (team_unit_t unit, IndexType l_index) const
 Resolve an element's linear global index from the given unit's local index of that element. More...
 
IndexType global (IndexType l_index) const
 Resolve an element's linear global index from the calling unit's local index of that element. More...
 
IndexType global_index (team_unit_t unit, const std::array< IndexType, NumDimensions > &l_coords) const
 Resolve an element's linear global index from a given unit's local coordinates of that element. More...
 
IndexType at (const std::array< IndexType, NumDimensions > &g_coords) const
 at More...
 
IndexType at (const std::array< IndexType, NumDimensions > &g_coords, const ViewSpec_t &viewspec) const
 Global coordinates and viewspec to local index. More...
 
template<typename ... Values>
IndexType at (IndexType value, Values ... values) const
 Global coordinates to local index. More...
 
bool has_local_elements (dim_t dim, IndexType dim_offset, team_unit_t unit, const ViewSpec_t &viewspec) const
 is_local More...
 
bool is_local (IndexType index, team_unit_t unit) const
 Whether the given global index is local to the specified unit. More...
 
bool is_local (IndexType index) const
 Whether the given global index is local to the unit that created this pattern instance. More...
 
const BlockSpec_tblockspec () const
 block More...
 
index_type block_at (const std::array< index_type, NumDimensions > &g_coords) const
 Index of block at given global coordinates. More...
 
ViewSpec_t block (index_type g_block_index) const
 View spec (offset and extents) of block at global linear block index in cartesian element space. More...
 
ViewSpec_t local_block (index_type l_block_index) const
 View spec (offset and extents) of block at local linear block index in global cartesian element space. More...
 
ViewSpec_t local_block_local (index_type l_block_index) const
 View spec (offset and extents) of block at local linear block index in local cartesian element space. More...
 
SizeType blocksize (dim_t dimension) const
 Maximum number of elements in a single block in the given dimension. More...
 
SizeType max_blocksize () const
 Maximum number of elements in a single block in all dimensions. More...
 
SizeType local_capacity (team_unit_t unit=UNDEFINED_TEAM_UNIT_ID) const
 Maximum number of elements assigned to a single unit in total, equivalent to the local capacity of every unit in this pattern. More...
 
SizeType local_size (team_unit_t unit=UNDEFINED_TEAM_UNIT_ID) const
 The actual number of elements in this pattern that are local to the calling unit in total. More...
 
IndexType num_units () const
 The number of units to which this pattern's elements are mapped. More...
 
IndexType capacity () const
 The maximum number of elements arranged in this pattern. More...
 
IndexType size () const
 The number of elements arranged in this pattern. More...
 
dash::Teamteam () const
 The Team containing the units to which this pattern's elements are mapped. More...
 
const DistributionSpec_tdistspec () const
 Distribution specification of this pattern. More...
 
SizeSpec_t sizespec () const
 Size specification of the index space mapped by this pattern. More...
 
const std::array< SizeType, NumDimensions > & extents () const
 Size specification of the index space mapped by this pattern. More...
 
const TeamSpec_tteamspec () const
 Cartesian arrangement of the Team containing the units to which this pattern's elements are mapped. More...
 
std::array< IndexType, NumDimensions > coords (IndexType index) const
 Convert given global linear offset (index) to global cartesian coordinates. More...
 
std::array< IndexType, NumDimensions > coords (IndexType index, const ViewSpec_t &viewspec) const
 Convert given global linear offset (index) to global cartesian coordinates using viewspec. More...
 

Static Public Member Functions

static constexpr MemArrange memory_order ()
 Memory order followed by the pattern. More...
 
static constexpr dim_t ndim ()
 Number of dimensions of the cartesian space partitioned by the pattern. More...
 

Static Public Attributes

static constexpr char const * PatternName = "DynamicPattern1D"
 

Detailed Description

template<MemArrange Arrangement, typename IndexType>
class dash::DynamicPattern< 1, Arrangement, IndexType >

Irregular dynamic pattern.

Specialization for 1-dimensional data.

Implemented concept:
Pattern Concept

Definition at line 46 of file DynamicPattern.h.

Member Typedef Documentation

◆ layout_properties

template<MemArrange Arrangement, typename IndexType >
typedef pattern_layout_properties< pattern_layout_tag::blocked, pattern_layout_tag::linear > dash::DynamicPattern< 1, Arrangement, IndexType >::layout_properties

Satisfiable properties in pattern property category Layout:

Definition at line 81 of file DynamicPattern.h.

◆ mapping_properties

template<MemArrange Arrangement, typename IndexType >
typedef pattern_mapping_properties< pattern_mapping_tag::unbalanced > dash::DynamicPattern< 1, Arrangement, IndexType >::mapping_properties

Satisfiable properties in pattern property category Mapping:

Definition at line 73 of file DynamicPattern.h.

◆ partitioning_properties

Satisfiable properties in pattern property category Partitioning:

Definition at line 68 of file DynamicPattern.h.

Constructor & Destructor Documentation

◆ DynamicPattern() [1/8]

template<MemArrange Arrangement, typename IndexType >
template<typename ... Args>
dash::DynamicPattern< 1, Arrangement, IndexType >::DynamicPattern ( SizeType  arg,
Args &&...  args 
)
inline

Constructor, initializes a pattern from an argument list consisting of the pattern size (extent, number of elements) followed by an optional distribution type.

Parameters
argArgument list consisting of the pattern size (extent, number of elements) in every dimension followed by optional distribution types.
argsArgument list consisting of the pattern size (extent, number of elements) in every dimension followed by optional distribution types.

Definition at line 128 of file DynamicPattern.h.

137  : DynamicPattern(PatternArguments_t(arg, args...))
138 
139  {
140  DASH_LOG_TRACE("DynamicPattern()", "Constructor with argument list");
141  DASH_ASSERT_EQ(
142  _local_sizes.size(), _nunits,
143  "Number of given local sizes " << _local_sizes.size() << " " <<
144  "does not match number of units" << _nunits);
145  initialize_local_range();
146  DASH_LOG_TRACE("DynamicPattern()", "DynamicPattern initialized");
147  }
DynamicPattern(SizeType arg, Args &&... args)
Constructor, initializes a pattern from an argument list consisting of the pattern size (extent...

◆ DynamicPattern() [2/8]

template<MemArrange Arrangement, typename IndexType >
dash::DynamicPattern< 1, Arrangement, IndexType >::DynamicPattern ( const SizeSpec_t sizespec,
const DistributionSpec_t distspec,
const TeamSpec_t teamspec,
Team team = dash::Team::All() 
)
inline

Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec, TeamSpec and Team.

Parameters
sizespecSize spec of the pattern.
distspecDistribution spec.
teamspecCartesian arrangement of units within the team
teamTeam containing units to which this pattern maps its elements.

Definition at line 154 of file DynamicPattern.h.

163  : _size(sizespec.size()),
164  _local_sizes(initialize_local_sizes(
165  _size,
166  distspec,
167  team)),
168  _block_offsets(initialize_block_offsets(
169  _local_sizes)),
170  _memory_layout(std::array<SizeType, 1> { _size }),
171  _blockspec(initialize_blockspec(
172  _size,
173  _local_sizes)),
174  _distspec(DistributionSpec_t()),
175  _team(&team),
176  _myid(_team->myid()),
177  _teamspec(
178  teamspec,
179  _distspec,
180  *_team),
181  _nunits(_team->size()),
182  _blocksize(initialize_blocksize(
183  _size,
184  _distspec,
185  _nunits)),
186  _nblocks(_nunits),
187  _local_size(
188  initialize_local_extent(_team->myid())),
189  _local_memory_layout(std::array<SizeType, 1> { _local_size }),
190  _local_capacity(initialize_local_capacity())
191  {
192  DASH_LOG_TRACE("DynamicPattern()", "(sizespec, dist, team)");
193  DASH_ASSERT_EQ(
194  _local_sizes.size(), _nunits,
195  "Number of given local sizes " << _local_sizes.size() << " " <<
196  "does not match number of units" << _nunits);
197  initialize_local_range();
198  DASH_LOG_TRACE("DynamicPattern()", "DynamicPattern initialized");
199  }
SizeSpec_t sizespec() const
Size specification of the index space mapped by this pattern.
const DistributionSpec_t & distspec() const
Distribution specification of this pattern.
size_t size() const
The number of units in this team.
Definition: Team.h:498
dash::Team & team() const
The Team containing the units to which this pattern&#39;s elements are mapped.
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:164
const TeamSpec_t & teamspec() const
Cartesian arrangement of the Team containing the units to which this pattern&#39;s elements are mapped...

◆ DynamicPattern() [3/8]

template<MemArrange Arrangement, typename IndexType >
dash::DynamicPattern< 1, Arrangement, IndexType >::DynamicPattern ( const SizeSpec_t sizespec,
const DistributionSpec_t distspec,
Team team = dash::Team::All() 
)
inline

Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec and Team.

Parameters
sizespecSize spec of the pattern.
distspecDistribution spec.
teamTeam containing units to which this pattern maps its elements.

Definition at line 206 of file DynamicPattern.h.

213  : _size(sizespec.size()),
214  _local_sizes(initialize_local_sizes(
215  _size,
216  distspec,
217  team)),
218  _block_offsets(initialize_block_offsets(
219  _local_sizes)),
220  _memory_layout(std::array<SizeType, 1> { _size }),
221  _blockspec(initialize_blockspec(
222  _size,
223  _local_sizes)),
224  _distspec(DistributionSpec_t()),
225  _team(&team),
226  _myid(_team->myid()),
227  _teamspec(_distspec, *_team),
228  _nunits(_team->size()),
229  _blocksize(initialize_blocksize(
230  _size,
231  _distspec,
232  _nunits)),
233  _nblocks(_nunits),
234  _local_size(
235  initialize_local_extent(_team->myid())),
236  _local_memory_layout(std::array<SizeType, 1> { _local_size }),
237  _local_capacity(initialize_local_capacity())
238  {
239  DASH_LOG_TRACE("DynamicPattern()", "(sizespec, dist, team)");
240  DASH_ASSERT_EQ(
241  _local_sizes.size(), _nunits,
242  "Number of given local sizes " << _local_sizes.size() << " " <<
243  "does not match number of units" << _nunits);
244  initialize_local_range();
245  DASH_LOG_TRACE("DynamicPattern()", "DynamicPattern initialized");
246  }
SizeSpec_t sizespec() const
Size specification of the index space mapped by this pattern.
const DistributionSpec_t & distspec() const
Distribution specification of this pattern.
size_t size() const
The number of units in this team.
Definition: Team.h:498
dash::Team & team() const
The Team containing the units to which this pattern&#39;s elements are mapped.
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:164

◆ DynamicPattern() [4/8]

template<MemArrange Arrangement, typename IndexType >
template<typename ... Args>
dash::DynamicPattern< 1, Arrangement, IndexType >::DynamicPattern ( const std::vector< size_type > &  local_sizes,
SizeType  arg,
Args &&...  args 
)
inline

Constructor, initializes a pattern from an argument list consisting of the pattern size (extent, number of elements) followed by an optional distribution type.

Parameters
local_sizesNumber of local elements for every unit in the active team.
argArgument list consisting of the pattern size (extent, number of elements) in every dimension followed by optional distribution types.
argsArgument list consisting of the pattern size (extent, number of elements) in every dimension followed by optional distribution types.

Definition at line 255 of file DynamicPattern.h.

266  : DynamicPattern(local_sizes, PatternArguments_t(arg, args...))
267  {
268  DASH_LOG_TRACE("DynamicPattern()", "Constructor with argument list");
269  DASH_ASSERT_EQ(
270  _local_sizes.size(), _nunits,
271  "Number of given local sizes " << _local_sizes.size() << " " <<
272  "does not match number of units" << _nunits);
273  initialize_local_range();
274  DASH_LOG_TRACE("DynamicPattern()", "DynamicPattern initialized");
275  }
DynamicPattern(SizeType arg, Args &&... args)
Constructor, initializes a pattern from an argument list consisting of the pattern size (extent...

◆ DynamicPattern() [5/8]

template<MemArrange Arrangement, typename IndexType >
dash::DynamicPattern< 1, Arrangement, IndexType >::DynamicPattern ( const std::vector< size_type > &  local_sizes,
const TeamSpec_t teamspec,
dash::Team team = dash::Team::All() 
)
inline

Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec, TeamSpec and a Team.

Parameters
local_sizesNumber of local elements for every unit in the active team.
teamspecCartesian arrangement of units within the team
teamTeam containing units to which this pattern maps its elements

Definition at line 282 of file DynamicPattern.h.

289  : _size(initialize_size(
290  local_sizes)),
291  _local_sizes(local_sizes),
292  _block_offsets(initialize_block_offsets(
293  _local_sizes)),
294  _memory_layout(std::array<SizeType, 1> { _size }),
295  _blockspec(initialize_blockspec(
296  _size,
297  _local_sizes)),
298  _distspec(DistributionSpec_t()),
299  _team(&team),
300  _myid(_team->myid()),
301  _teamspec(
302  teamspec,
303  _distspec,
304  *_team),
305  _nunits(_team->size()),
306  _blocksize(initialize_blocksize(
307  _size,
308  _distspec,
309  _nunits)),
310  _nblocks(_nunits),
311  _local_size(
312  initialize_local_extent(_team->myid())),
313  _local_memory_layout(std::array<SizeType, 1> { _local_size }),
314  _local_capacity(initialize_local_capacity())
315  {
316  DASH_LOG_TRACE("DynamicPattern()", "(sizespec, dist, teamspec, team)");
317  DASH_ASSERT_EQ(
318  _local_sizes.size(), _nunits,
319  "Number of given local sizes " << _local_sizes.size() << " " <<
320  "does not match number of units" << _nunits);
321  initialize_local_range();
322  DASH_LOG_TRACE("DynamicPattern()", "DynamicPattern initialized");
323  }
size_t size() const
The number of units in this team.
Definition: Team.h:498
const TeamSpec_t & teamspec() const
Cartesian arrangement of the Team containing the units to which this pattern&#39;s elements are mapped...

◆ DynamicPattern() [6/8]

template<MemArrange Arrangement, typename IndexType >
dash::DynamicPattern< 1, Arrangement, IndexType >::DynamicPattern ( const std::vector< size_type > &  local_sizes,
Team team = dash::Team::All() 
)
inline

Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec, TeamSpec and a Team.

Parameters
local_sizesNumber of local elements for every unit in the active team.
teamTeam containing units to which this pattern maps its elements

Definition at line 330 of file DynamicPattern.h.

335  : _size(initialize_size(
336  local_sizes)),
337  _local_sizes(local_sizes),
338  _block_offsets(initialize_block_offsets(
339  _local_sizes)),
340  _memory_layout(std::array<SizeType, 1> { _size }),
341  _blockspec(initialize_blockspec(
342  _size,
343  _local_sizes)),
344  _distspec(DistributionSpec_t()),
345  _team(&team),
346  _myid(_team->myid()),
347  _teamspec(_distspec, *_team),
348  _nunits(_team->size()),
349  _blocksize(initialize_blocksize(
350  _size,
351  _distspec,
352  _nunits)),
353  _nblocks(_nunits),
354  _local_size(
355  initialize_local_extent(_team->myid())),
356  _local_memory_layout(std::array<SizeType, 1> { _local_size }),
357  _local_capacity(initialize_local_capacity())
358  {
359  DASH_LOG_TRACE("DynamicPattern()", "(sizespec, dist, team)");
360  DASH_ASSERT_EQ(
361  _local_sizes.size(), _nunits,
362  "Number of given local sizes " << _local_sizes.size() << " " <<
363  "does not match number of units" << _nunits);
364  initialize_local_range();
365  DASH_LOG_TRACE("DynamicPattern()", "DynamicPattern initialized");
366  }
size_t size() const
The number of units in this team.
Definition: Team.h:498
dash::Team & team() const
The Team containing the units to which this pattern&#39;s elements are mapped.

◆ DynamicPattern() [7/8]

template<MemArrange Arrangement, typename IndexType >
dash::DynamicPattern< 1, Arrangement, IndexType >::DynamicPattern ( const self_t &  other)
inline

Copy constructor.

Definition at line 371 of file DynamicPattern.h.

372  : _size(other._size),
373  _local_sizes(other._local_sizes),
374  _block_offsets(other._block_offsets),
375  _memory_layout(other._memory_layout),
376  _blockspec(other._blockspec),
377  _distspec(other._distspec),
378  _team(other._team),
379  _myid(other._myid),
380  _teamspec(other._teamspec),
381  _nunits(other._nunits),
382  _blocksize(other._blocksize),
383  _nblocks(other._nblocks),
384  _local_size(other._local_size),
385  _local_memory_layout(other._local_memory_layout),
386  _local_capacity(other._local_capacity),
387  _lbegin(other._lbegin),
388  _lend(other._lend)
389  {
390  // No need to copy _arguments as it is just used to
391  // initialize other members.
392  DASH_LOG_TRACE("DynamicPattern(other)", "DynamicPattern copied");
393  }

◆ DynamicPattern() [8/8]

template<MemArrange Arrangement, typename IndexType >
dash::DynamicPattern< 1, Arrangement, IndexType >::DynamicPattern ( self_t &  other)
inline

Copy constructor using non-const lvalue reference parameter.

Introduced so variadic constructor is not a better match for copy-construction.

Definition at line 401 of file DynamicPattern.h.

402  : DynamicPattern(static_cast<const self_t &>(other))
403  { }
DynamicPattern(SizeType arg, Args &&... args)
Constructor, initializes a pattern from an argument list consisting of the pattern size (extent...

Member Function Documentation

◆ at() [1/3]

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::at ( const std::array< IndexType, NumDimensions > &  g_coords) const
inline

at

Global coordinates to local index.

Convert given global coordinates in pattern to their respective linear local index.

See also
Pattern Concept

Definition at line 882 of file DynamicPattern.h.

884  {
885  return local_coords(g_coords)[0];
886  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &g_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.

◆ at() [2/3]

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::at ( const std::array< IndexType, NumDimensions > &  g_coords,
const ViewSpec_t viewspec 
) const
inline

Global coordinates and viewspec to local index.

Convert given global coordinate in pattern to its linear local index.

See also
Pattern Concept

Definition at line 895 of file DynamicPattern.h.

898  {
899  auto vs_coords = g_coords;
900  vs_coords[0] += viewspec.offset(0);
901  return local_coords(vs_coords)[0];
902  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &g_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.

◆ at() [3/3]

template<MemArrange Arrangement, typename IndexType >
template<typename ... Values>
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::at ( IndexType  value,
Values ...  values 
) const
inline

Global coordinates to local index.

Convert given coordinate in pattern to its linear local index.

See also
Pattern Concept

Definition at line 912 of file DynamicPattern.h.

913  {
914  static_assert(
915  sizeof...(values) == NumDimensions-1,
916  "Wrong parameter number");
917  std::array<IndexType, NumDimensions> inputindex = {
918  value, (IndexType)values...
919  };
920  return at(inputindex);
921  }
IndexType at(const std::array< IndexType, NumDimensions > &g_coords) const
at

◆ balance()

template<MemArrange Arrangement, typename IndexType >
void dash::DynamicPattern< 1, Arrangement, IndexType >::balance ( )
inline

Balance the number of local elements across all units in the pattern's associated team.

Definition at line 487 of file DynamicPattern.h.

488  {
489  }

◆ block()

template<MemArrange Arrangement, typename IndexType >
ViewSpec_t dash::DynamicPattern< 1, Arrangement, IndexType >::block ( index_type  g_block_index) const
inline

View spec (offset and extents) of block at global linear block index in cartesian element space.

Definition at line 1029 of file DynamicPattern.h.

1031  {
1032  DASH_LOG_DEBUG_VAR("DynamicPattern<1>.block >", g_block_index);
1033  index_type offset = _block_offsets[g_block_index];
1034  auto block_size = _local_sizes[g_block_index];
1035  std::array<index_type, NumDimensions> offsets = { offset };
1036  std::array<size_type, NumDimensions> extents = { block_size };
1037  ViewSpec_t block_vs(offsets, extents);
1038  DASH_LOG_DEBUG_VAR("DynamicPattern<1>.block >", block_vs);
1039  return block_vs;
1040  }
const std::array< SizeType, NumDimensions > & extents() const
Size specification of the index space mapped by this pattern.

◆ block_at()

template<MemArrange Arrangement, typename IndexType >
index_type dash::DynamicPattern< 1, Arrangement, IndexType >::block_at ( const std::array< index_type, NumDimensions > &  g_coords) const
inline

Index of block at given global coordinates.

See also
Pattern Concept
Parameters
g_coordsGlobal coordinates of element

Definition at line 1009 of file DynamicPattern.h.

1012  {
1013  DASH_LOG_TRACE_VAR("DynamicPattern.block_at()", g_coords);
1014  auto g_coord = g_coords[0];
1015  for (index_type block_idx = 0; block_idx < _nunits - 1; ++block_idx) {
1016  if (_block_offsets[block_idx+1] >= g_coord) {
1017  DASH_LOG_TRACE_VAR("DynamicPattern.block_at >", block_idx);
1018  return block_idx;
1019  }
1020  }
1021  DASH_LOG_TRACE_VAR("DynamicPattern.block_at >", _nunits-1);
1022  return _nunits-1;
1023  }

◆ blocksize()

template<MemArrange Arrangement, typename IndexType >
SizeType dash::DynamicPattern< 1, Arrangement, IndexType >::blocksize ( dim_t  dimension) const
inline

Maximum number of elements in a single block in the given dimension.

Returns
The blocksize in the given dimension
See also
Pattern Concept
Parameters
dimensionThe dimension in the pattern

Definition at line 1085 of file DynamicPattern.h.

1088  {
1089  return _blocksize;
1090  }

◆ blockspec()

template<MemArrange Arrangement, typename IndexType >
const BlockSpec_t& dash::DynamicPattern< 1, Arrangement, IndexType >::blockspec ( ) const
inline

block

Cartesian arrangement of pattern blocks.

Definition at line 999 of file DynamicPattern.h.

1000  {
1001  return _blockspec;
1002  }

◆ capacity()

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::capacity ( ) const
inline

The maximum number of elements arranged in this pattern.

See also
Pattern Concept

Definition at line 1148 of file DynamicPattern.h.

1149  {
1150  return _size;
1151  }

◆ coords() [1/2]

template<MemArrange Arrangement, typename IndexType >
std::array<IndexType, NumDimensions> dash::DynamicPattern< 1, Arrangement, IndexType >::coords ( IndexType  index) const
inline

Convert given global linear offset (index) to global cartesian coordinates.

See also
Pattern Concept

Definition at line 1217 of file DynamicPattern.h.

1219  {
1220  return std::array<IndexType, 1> { index };
1221  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60

◆ coords() [2/2]

template<MemArrange Arrangement, typename IndexType >
std::array<IndexType, NumDimensions> dash::DynamicPattern< 1, Arrangement, IndexType >::coords ( IndexType  index,
const ViewSpec_t viewspec 
) const
inline

Convert given global linear offset (index) to global cartesian coordinates using viewspec.

See also
Pattern Concept

Definition at line 1229 of file DynamicPattern.h.

1232  {
1233  return std::array<IndexType, 1> { index + viewspec.offset(0) };
1234  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60

◆ distspec()

template<MemArrange Arrangement, typename IndexType >
const DistributionSpec_t& dash::DynamicPattern< 1, Arrangement, IndexType >::distspec ( ) const
inline

Distribution specification of this pattern.

Definition at line 1175 of file DynamicPattern.h.

1176  {
1177  return _distspec;
1178  }

◆ extent()

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::extent ( dim_t  dim) const
inline

extent

The number of elements in this pattern in the given dimension.

See also
blocksize()
local_size()
local_extent()
Pattern Concept

Definition at line 592 of file DynamicPattern.h.

593  {
594  DASH_ASSERT_EQ(
595  0, dim,
596  "Wrong dimension for Pattern::local_extent. " <<
597  "Expected dimension = 0, got " << dim);
598  return _size;
599  }

◆ extents()

template<MemArrange Arrangement, typename IndexType >
const std::array<SizeType, NumDimensions>& dash::DynamicPattern< 1, Arrangement, IndexType >::extents ( ) const
inline

Size specification of the index space mapped by this pattern.

See also
Pattern Concept

Definition at line 1195 of file DynamicPattern.h.

1196  {
1197  return std::array<SizeType, 1> { _size };
1198  }

◆ global() [1/4]

template<MemArrange Arrangement, typename IndexType >
std::array<IndexType, NumDimensions> dash::DynamicPattern< 1, Arrangement, IndexType >::global ( team_unit_t  unit,
const std::array< IndexType, NumDimensions > &  local_coords 
) const
inline

global

Converts local coordinates of a given unit to global coordinates.

See also
Pattern Concept

Definition at line 798 of file DynamicPattern.h.

801  {
802  DASH_LOG_DEBUG_VAR("DynamicPattern.global()", unit);
803  DASH_LOG_DEBUG_VAR("DynamicPattern.global()", local_coords);
804  DASH_LOG_TRACE_VAR("DynamicPattern.global", _nunits);
805  if (_nunits < 2) {
806  return local_coords;
807  }
808  // Initialize global index with element phase (= local coords):
809  index_type glob_index = _block_offsets[unit] + local_coords[0];
810  DASH_LOG_TRACE_VAR("DynamicPattern.global >", glob_index);
811  return std::array<IndexType, 1> { glob_index };
812  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &g_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.

◆ global() [2/4]

template<MemArrange Arrangement, typename IndexType >
std::array<IndexType, NumDimensions> dash::DynamicPattern< 1, Arrangement, IndexType >::global ( const std::array< IndexType, NumDimensions > &  l_coords) const
inline

Converts local coordinates of active unit to global coordinates.

See also
Pattern Concept

Definition at line 819 of file DynamicPattern.h.

References dash::global().

821  {
822  return global(_team->myid(), l_coords);
823  }
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global

◆ global() [3/4]

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::global ( team_unit_t  unit,
IndexType  l_index 
) const
inline

Resolve an element's linear global index from the given unit's local index of that element.

See also
at Inverse of local()
Pattern Concept

Definition at line 833 of file DynamicPattern.h.

836  {
837  return global(unit, std::array<IndexType, 1> { l_index })[0];
838  }
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global

◆ global() [4/4]

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::global ( IndexType  l_index) const
inline

Resolve an element's linear global index from the calling unit's local index of that element.

See also
at Inverse of local()
Pattern Concept

Definition at line 848 of file DynamicPattern.h.

References dash::global().

850  {
851  return global(_team->myid(), std::array<IndexType, 1> { l_index })[0];
852  }
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global

◆ global_index()

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::global_index ( team_unit_t  unit,
const std::array< IndexType, NumDimensions > &  l_coords 
) const
inline

Resolve an element's linear global index from a given unit's local coordinates of that element.

See also
at
Pattern Concept

Definition at line 862 of file DynamicPattern.h.

865  {
866  auto g_index = global(unit, l_coords[0]);
867  return g_index;
868  }
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global

◆ has_local_elements()

template<MemArrange Arrangement, typename IndexType >
bool dash::DynamicPattern< 1, Arrangement, IndexType >::has_local_elements ( dim_t  dim,
IndexType  dim_offset,
team_unit_t  unit,
const ViewSpec_t viewspec 
) const
inline

is_local

Whether there are local elements in a dimension at a given offset, e.g. in a specific row or column.

See also
Pattern Concept
Parameters
dimDimension to check
dim_offsetOffset in dimension
unitDART id of the unit
viewspecViewspec to apply

Definition at line 933 of file DynamicPattern.h.

942  {
943  DASH_ASSERT_EQ(
944  0, dim,
945  "Wrong dimension for Pattern::has_local_elements. " <<
946  "Expected dimension = 0, got " << dim);
947  DASH_LOG_TRACE_VAR("DynamicPattern.has_local_elements()", dim_offset);
948  DASH_LOG_TRACE_VAR("DynamicPattern.has_local_elements()", unit);
949  DASH_LOG_TRACE_VAR("DynamicPattern.has_local_elements()", viewspec);
950  DASH_THROW(
952  "DynamicPattern.has_local_elements is not implemented");
953  }

◆ is_local() [1/2]

template<MemArrange Arrangement, typename IndexType >
bool dash::DynamicPattern< 1, Arrangement, IndexType >::is_local ( IndexType  index,
team_unit_t  unit 
) const
inline

Whether the given global index is local to the specified unit.

See also
Pattern Concept

Definition at line 960 of file DynamicPattern.h.

963  {
964  DASH_LOG_TRACE_VAR("DynamicPattern.is_local()", index);
965  DASH_LOG_TRACE_VAR("DynamicPattern.is_local()", unit);
966  bool is_loc = index >= _block_offsets[unit] &&
967  (unit == _nunits-1 ||
968  index < _block_offsets[unit+1]);
969  DASH_LOG_TRACE_VAR("DynamicPattern.is_local >", is_loc);
970  return is_loc;
971  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60

◆ is_local() [2/2]

template<MemArrange Arrangement, typename IndexType >
bool dash::DynamicPattern< 1, Arrangement, IndexType >::is_local ( IndexType  index) const
inline

Whether the given global index is local to the unit that created this pattern instance.

See also
Pattern Concept

Definition at line 979 of file DynamicPattern.h.

981  {
982  auto unit = team().myid();
983  DASH_LOG_TRACE_VAR("DynamicPattern.is_local()", index);
984  DASH_LOG_TRACE_VAR("DynamicPattern.is_local", unit);
985  bool is_loc = index >= _block_offsets[unit] &&
986  (unit == _nunits-1 ||
987  index < _block_offsets[unit+1]);
988  DASH_LOG_TRACE_VAR("DynamicPattern.is_local >", is_loc);
989  return is_loc;
990  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
dash::Team & team() const
The Team containing the units to which this pattern&#39;s elements are mapped.

◆ lbegin()

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::lbegin ( ) const
inline

Resolves the global index of the first local element in the pattern.

See also
Pattern Concept

Definition at line 448 of file DynamicPattern.h.

449  {
450  return _lbegin;
451  }

◆ lend()

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::lend ( ) const
inline

Resolves the global index past the last local element in the pattern.

See also
Pattern Concept

Definition at line 458 of file DynamicPattern.h.

459  {
460  return _lend;
461  }

◆ local() [1/2]

template<MemArrange Arrangement, typename IndexType >
local_coords_t dash::DynamicPattern< 1, Arrangement, IndexType >::local ( const std::array< IndexType, NumDimensions > &  g_coords) const
inline

Converts global coordinates to their associated unit and its respective local coordinates.

NOTE: Same as local_index.

See also
Pattern Concept

Definition at line 679 of file DynamicPattern.h.

681  {
682  DASH_LOG_TRACE_VAR("DynamicPattern.local()", g_coords);
683  IndexType g_index = g_coords[0];
684  local_index_t l_index;
685  for (auto unit_idx = _nunits-1; unit_idx >= 0; --unit_idx) {
686  index_type block_offset = _block_offsets[unit_idx];
687  if (block_offset <= g_index) {
688  l_index.unit = unit_idx;
689  l_index.index = g_index - block_offset;
690  DASH_LOG_TRACE_VAR("DynamicPattern.local >", l_index.unit);
691  DASH_LOG_TRACE_VAR("DynamicPattern.local >", l_index.index);
692  return l_index;
693  }
694  }
695  DASH_THROW(
697  "DynamicPattern.local: global coord " << g_index << " is out of bounds");
698  }

◆ local() [2/2]

template<MemArrange Arrangement, typename IndexType >
local_index_t dash::DynamicPattern< 1, Arrangement, IndexType >::local ( IndexType  g_index) const
inline

Converts global index to its associated unit and respective local index.

NOTE: Same as local_index.

See also
Pattern Concept

Definition at line 707 of file DynamicPattern.h.

709  {
710  DASH_LOG_TRACE_VAR("DynamicPattern.local()", g_index);
711  DASH_LOG_TRACE_VAR("DynamicPattern.local", _block_offsets.size());
712  DASH_ASSERT_GT(_nunits, 0,
713  "team size is 0");
714  DASH_ASSERT_GE(_block_offsets.size(), _nunits,
715  "missing block offsets");
716  local_index_t l_index;
717  index_type unit_idx = static_cast<index_type>(_nunits-1);
718  for (; unit_idx >= 0; --unit_idx) {
719  DASH_LOG_TRACE_VAR("DynamicPattern.local", unit_idx);
720  index_type block_offset = _block_offsets[unit_idx];
721  DASH_LOG_TRACE_VAR("DynamicPattern.local", block_offset);
722  if (block_offset <= g_index) {
723  l_index.unit = unit_idx;
724  l_index.index = g_index - block_offset;
725  DASH_LOG_TRACE_VAR("DynamicPattern.local >", l_index.unit);
726  DASH_LOG_TRACE_VAR("DynamicPattern.local >", l_index.index);
727  return l_index;
728  }
729  }
730  DASH_THROW(
732  "DynamicPattern.local: global index " << g_index << " is out of bounds");
733  }

◆ local_at() [1/2]

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::local_at ( const std::array< IndexType, NumDimensions > &  local_coords,
const ViewSpec_t viewspec 
) const
inline

local

Convert given local coordinates and viewspec to linear local offset (index).

See also
Pattern Concept
Parameters
local_coordsPoint in local memory
viewspecView specification (offsets) to apply on coords

Definition at line 650 of file DynamicPattern.h.

655  {
656  return local_coords[0] + viewspec.offset(0);
657  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &g_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.

◆ local_at() [2/2]

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::local_at ( const std::array< IndexType, NumDimensions > &  local_coords) const
inline

Convert given local coordinates to linear local offset (index).

See also
Pattern Concept
Parameters
local_coordsPoint in local memory

Definition at line 664 of file DynamicPattern.h.

667  {
668  return local_coords[0];
669  }
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &g_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.

◆ local_block()

template<MemArrange Arrangement, typename IndexType >
ViewSpec_t dash::DynamicPattern< 1, Arrangement, IndexType >::local_block ( index_type  l_block_index) const
inline

View spec (offset and extents) of block at local linear block index in global cartesian element space.

Definition at line 1046 of file DynamicPattern.h.

1048  {
1049  DASH_LOG_DEBUG_VAR("DynamicPattern<1>.local_block()", l_block_index);
1050  DASH_ASSERT_EQ(
1051  0, l_block_index,
1052  "DynamicPattern always assigns exactly 1 block to a single unit");
1053  index_type block_offset = _block_offsets[_team->myid()];
1054  size_type block_size = _local_sizes[_team->myid()];
1055  std::array<index_type, NumDimensions> offsets = { block_offset };
1056  std::array<size_type, NumDimensions> extents = { block_size };
1057  ViewSpec_t block_vs(offsets, extents);
1058  DASH_LOG_DEBUG_VAR("DynamicPattern<1>.local_block >", block_vs);
1059  return block_vs;
1060  }
const std::array< SizeType, NumDimensions > & extents() const
Size specification of the index space mapped by this pattern.

◆ local_block_local()

template<MemArrange Arrangement, typename IndexType >
ViewSpec_t dash::DynamicPattern< 1, Arrangement, IndexType >::local_block_local ( index_type  l_block_index) const
inline

View spec (offset and extents) of block at local linear block index in local cartesian element space.

Definition at line 1066 of file DynamicPattern.h.

1068  {
1069  DASH_LOG_DEBUG_VAR("DynamicPattern<1>.local_block_local >", l_block_index);
1070  size_type block_size = _local_sizes[_team->myid()];
1071  std::array<index_type, NumDimensions> offsets = { 0 };
1072  std::array<size_type, NumDimensions> extents = { block_size };
1073  ViewSpec_t block_vs(offsets, extents);
1074  DASH_LOG_DEBUG_VAR("DynamicPattern<1>.local_block_local >", block_vs);
1075  return block_vs;
1076  }
const std::array< SizeType, NumDimensions > & extents() const
Size specification of the index space mapped by this pattern.

◆ local_capacity()

template<MemArrange Arrangement, typename IndexType >
SizeType dash::DynamicPattern< 1, Arrangement, IndexType >::local_capacity ( team_unit_t  unit = UNDEFINED_TEAM_UNIT_ID) const
inline

Maximum number of elements assigned to a single unit in total, equivalent to the local capacity of every unit in this pattern.

See also
Pattern Concept

Definition at line 1111 of file DynamicPattern.h.

1113  {
1114  return _local_capacity;
1115  }

◆ local_coords()

template<MemArrange Arrangement, typename IndexType >
std::array<IndexType, NumDimensions> dash::DynamicPattern< 1, Arrangement, IndexType >::local_coords ( const std::array< IndexType, NumDimensions > &  g_coords) const
inline

Converts global coordinates to their associated unit's respective local coordinates.

See also
Pattern Concept

Definition at line 741 of file DynamicPattern.h.

743  {
744  DASH_LOG_TRACE_VAR("DynamicPattern.local_coords()", g_coords);
745  IndexType g_index = g_coords[0];
746  index_type unit_idx = static_cast<index_type>(_nunits-1);
747  for (; unit_idx >= 0; --unit_idx) {
748  index_type block_offset = _block_offsets[unit_idx];
749  if (block_offset <= g_index) {
750  auto l_coord = g_index - block_offset;
751  DASH_LOG_TRACE_VAR("DynamicPattern.local_coords >", l_coord);
752  return std::array<IndexType, 1> { l_coord };
753  }
754  }
755  DASH_THROW(
757  "DynamicPattern.local_coords: global index " << g_index <<
758  " is out of bounds");
759  }

◆ local_extent()

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::local_extent ( dim_t  dim) const
inline

The actual number of elements in this pattern that are local to the calling unit in the given dimension.

See also
local_extents()
blocksize()
local_size()
extent()
Pattern Concept

Definition at line 612 of file DynamicPattern.h.

613  {
614  DASH_ASSERT_EQ(
615  0, dim,
616  "Wrong dimension for Pattern::local_extent. " <<
617  "Expected dimension = 0, got " << dim);
618  return _local_size;
619  }

◆ local_extents()

template<MemArrange Arrangement, typename IndexType >
std::array<SizeType, NumDimensions> dash::DynamicPattern< 1, Arrangement, IndexType >::local_extents ( team_unit_t  unit) const
inline

The actual number of elements in this pattern that are local to the given unit, by dimension.

See also
local_extent()
blocksize()
local_size()
extent()
Pattern Concept

Definition at line 632 of file DynamicPattern.h.

634  {
635  DASH_LOG_DEBUG_VAR("DynamicPattern.local_extents()", unit);
636  DASH_LOG_DEBUG_VAR("DynamicPattern.local_extents >", _local_size);
637  return std::array<SizeType, 1> { _local_size };
638  }

◆ local_index()

template<MemArrange Arrangement, typename IndexType >
local_index_t dash::DynamicPattern< 1, Arrangement, IndexType >::local_index ( const std::array< IndexType, NumDimensions > &  g_coords) const
inline

Converts global coordinates to their associated unit and their respective local index.

See also
Pattern Concept

Definition at line 767 of file DynamicPattern.h.

769  {
770  IndexType g_index = g_coords[0];
771  DASH_LOG_TRACE_VAR("DynamicPattern.local_index()", g_coords);
772  local_index_t l_index;
773  index_type unit_idx = static_cast<index_type>(_nunits-1);
774  for (; unit_idx >= 0; --unit_idx) {
775  index_type block_offset = _block_offsets[unit_idx];
776  if (block_offset <= g_index) {
777  l_index.unit = unit_idx;
778  l_index.index = g_index - block_offset;
779  DASH_LOG_TRACE_VAR("DynamicPattern.local >", l_index.unit);
780  DASH_LOG_TRACE_VAR("DynamicPattern.local >", l_index.index);
781  return l_index;
782  }
783  }
784  DASH_THROW(
786  "DynamicPattern.local: global index " << g_index << " is out of bounds");
787  }

◆ local_resize() [1/2]

template<MemArrange Arrangement, typename IndexType >
void dash::DynamicPattern< 1, Arrangement, IndexType >::local_resize ( team_unit_t  unit,
size_type  local_size 
)
inline

resize / balance

Update the number of local elements of the specified unit.

Definition at line 470 of file DynamicPattern.h.

471  {
472  _local_sizes[unit] = local_size;
473  }
SizeType local_size(team_unit_t unit=UNDEFINED_TEAM_UNIT_ID) const
The actual number of elements in this pattern that are local to the calling unit in total...

◆ local_resize() [2/2]

template<MemArrange Arrangement, typename IndexType >
void dash::DynamicPattern< 1, Arrangement, IndexType >::local_resize ( size_type  local_size)
inline

Update the number of local elements of the active unit.

Definition at line 478 of file DynamicPattern.h.

479  {
480  _local_sizes[_myid] = local_size;
481  }
SizeType local_size(team_unit_t unit=UNDEFINED_TEAM_UNIT_ID) const
The actual number of elements in this pattern that are local to the calling unit in total...

◆ local_size()

template<MemArrange Arrangement, typename IndexType >
SizeType dash::DynamicPattern< 1, Arrangement, IndexType >::local_size ( team_unit_t  unit = UNDEFINED_TEAM_UNIT_ID) const
inline

The actual number of elements in this pattern that are local to the calling unit in total.

See also
blocksize()
local_extent()
local_capacity()
Pattern Concept

Definition at line 1127 of file DynamicPattern.h.

1129  {
1130  return _local_size;
1131  }

◆ max_blocksize()

template<MemArrange Arrangement, typename IndexType >
SizeType dash::DynamicPattern< 1, Arrangement, IndexType >::max_blocksize ( ) const
inline

Maximum number of elements in a single block in all dimensions.

Returns
The maximum number of elements in a single block assigned to a unit.
See also
Pattern Concept

Definition at line 1100 of file DynamicPattern.h.

1101  {
1102  return _blocksize;
1103  }

◆ memory_order()

template<MemArrange Arrangement, typename IndexType >
static constexpr MemArrange dash::DynamicPattern< 1, Arrangement, IndexType >::memory_order ( )
inlinestatic

Memory order followed by the pattern.

Definition at line 1240 of file DynamicPattern.h.

1241  {
1242  return Arrangement;
1243  }

◆ ndim()

template<MemArrange Arrangement, typename IndexType >
static constexpr dim_t dash::DynamicPattern< 1, Arrangement, IndexType >::ndim ( )
inlinestatic

Number of dimensions of the cartesian space partitioned by the pattern.

Definition at line 1248 of file DynamicPattern.h.

References dash::global(), dash::max_element(), dash::size(), and dash::Team::size().

1249  {
1250  return 1;
1251  }

◆ num_units()

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::num_units ( ) const
inline

The number of units to which this pattern's elements are mapped.

See also
Pattern Concept

Definition at line 1138 of file DynamicPattern.h.

1139  {
1140  return _nunits;
1141  }

◆ operator!=()

template<MemArrange Arrangement, typename IndexType >
bool dash::DynamicPattern< 1, Arrangement, IndexType >::operator!= ( const self_t &  other) const
inline

Inquality comparison operator.

Parameters
otherPattern instance to compare for inequality

Definition at line 431 of file DynamicPattern.h.

434  {
435  return !(*this == other);
436  }

◆ operator=()

template<MemArrange Arrangement, typename IndexType >
self_t& dash::DynamicPattern< 1, Arrangement, IndexType >::operator= ( const self_t &  other)
default

Assignment operator.

◆ operator==()

template<MemArrange Arrangement, typename IndexType >
bool dash::DynamicPattern< 1, Arrangement, IndexType >::operator== ( const self_t &  other) const
inline

Equality comparison operator.

Parameters
otherPattern instance to compare for equality

Definition at line 408 of file DynamicPattern.h.

411  {
412  if (this == &other) {
413  return true;
414  }
415  // no need to compare all members as most are derived from
416  // constructor arguments.
417  return(
418  _size == other._size &&
419  _local_sizes == other._local_sizes &&
420  _distspec == other._distspec &&
421  _teamspec == other._teamspec &&
422  _nblocks == other._nblocks &&
423  _blocksize == other._blocksize &&
424  _nunits == other._nunits
425  );
426  }

◆ size()

template<MemArrange Arrangement, typename IndexType >
IndexType dash::DynamicPattern< 1, Arrangement, IndexType >::size ( ) const
inline

The number of elements arranged in this pattern.

See also
Pattern Concept

Definition at line 1158 of file DynamicPattern.h.

1159  {
1160  return _size;
1161  }

◆ sizespec()

template<MemArrange Arrangement, typename IndexType >
SizeSpec_t dash::DynamicPattern< 1, Arrangement, IndexType >::sizespec ( ) const
inline

Size specification of the index space mapped by this pattern.

See also
Pattern Concept

Definition at line 1185 of file DynamicPattern.h.

1186  {
1187  return SizeSpec_t(std::array<SizeType, 1> { _size });
1188  }

◆ team()

template<MemArrange Arrangement, typename IndexType >
dash::Team& dash::DynamicPattern< 1, Arrangement, IndexType >::team ( ) const
inline

The Team containing the units to which this pattern's elements are mapped.

Definition at line 1167 of file DynamicPattern.h.

1168  {
1169  return *_team;
1170  }

◆ teamspec()

template<MemArrange Arrangement, typename IndexType >
const TeamSpec_t& dash::DynamicPattern< 1, Arrangement, IndexType >::teamspec ( ) const
inline

Cartesian arrangement of the Team containing the units to which this pattern's elements are mapped.

See also
Pattern Concept

Definition at line 1206 of file DynamicPattern.h.

1207  {
1208  return _teamspec;
1209  }

◆ unit_at() [1/4]

template<MemArrange Arrangement, typename IndexType >
team_unit_t dash::DynamicPattern< 1, Arrangement, IndexType >::unit_at ( const std::array< IndexType, NumDimensions > &  coords,
const ViewSpec_t viewspec 
) const
inline

unit_at

Convert given point in pattern to its assigned unit id.

See also
Pattern Concept
Parameters
coordsAbsolute coordinates of the point
viewspecView specification (offsets) to apply on coords

Definition at line 500 of file DynamicPattern.h.

505  {
506  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at()", coords);
507  // Apply viewspec offsets to coordinates:
508  team_unit_t unit_id(((coords[0] + viewspec.offset(0)) / _blocksize)
509  % _nunits);
510  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at >", unit_id);
511  return unit_id;
512  }
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.

◆ unit_at() [2/4]

template<MemArrange Arrangement, typename IndexType >
team_unit_t dash::DynamicPattern< 1, Arrangement, IndexType >::unit_at ( const std::array< IndexType, NumDimensions > &  g_coords) const
inline

Convert given coordinate in pattern to its assigned unit id.

See also
Pattern Concept

Definition at line 519 of file DynamicPattern.h.

521  {
522  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at()", g_coords);
523  auto g_coord = g_coords[0];
524  for (team_unit_t unit_idx{0}; unit_idx < _nunits - 1; ++unit_idx) {
525  if (_block_offsets[unit_idx+1] >= g_coord) {
526  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at >", unit_idx);
527  return unit_idx;
528  }
529  }
530  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at >", _nunits-1);
531  return _nunits-1;
532  }
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319

◆ unit_at() [3/4]

template<MemArrange Arrangement, typename IndexType >
team_unit_t dash::DynamicPattern< 1, Arrangement, IndexType >::unit_at ( IndexType  global_pos,
const ViewSpec_t viewspec 
) const
inline

Convert given global linear index to its assigned unit id.

See also
Pattern Concept
Parameters
global_posGlobal linear element offset
viewspecView to apply global position

Definition at line 539 of file DynamicPattern.h.

544  {
545  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at()", global_pos);
546  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at()", viewspec);
547  // Apply viewspec offsets to coordinates:
548  auto g_coord = global_pos + viewspec.offset(0);
549  for (team_unit_t unit_idx{0}; unit_idx < _nunits - 1; ++unit_idx) {
550  if (_block_offsets[unit_idx+1] >= static_cast<size_type>(g_coord)) {
551  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at >", unit_idx);
552  return unit_idx;
553  }
554  }
555  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at >", _nunits-1);
556  return _nunits-1;
557  }
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319

◆ unit_at() [4/4]

template<MemArrange Arrangement, typename IndexType >
team_unit_t dash::DynamicPattern< 1, Arrangement, IndexType >::unit_at ( IndexType  g_index) const
inline

Convert given global linear index to its assigned unit id.

See also
Pattern Concept
Parameters
g_indexGlobal linear element offset

Definition at line 564 of file DynamicPattern.h.

567  {
568  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at()", g_index);
569  for (team_unit_t unit_idx{0}; unit_idx < _nunits - 1; ++unit_idx) {
570  if (_block_offsets[unit_idx+1] > static_cast<size_type>(g_index)) {
571  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at >", unit_idx);
572  return unit_idx;
573  }
574  }
575  DASH_LOG_TRACE_VAR("DynamicPattern.unit_at >", _nunits-1);
576  return team_unit_t(_nunits-1);
577  }
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319

The documentation for this class was generated from the following file: