DASH  0.3.0
dash::TilePattern< NumDimensions, Arrangement, IndexType > Class Template Reference

Defines how a list of global indices is mapped to single units within a Team. More...

#include <TilePattern.h>

Classes

struct  local_coords_t
 
struct  local_index_t
 

Public Types

typedef pattern_partitioning_properties< pattern_partitioning_tag::rectangular, pattern_partitioning_tag::balancedpartitioning_properties
 Satisfiable properties in pattern property category Partitioning: More...
 
typedef pattern_mapping_properties< pattern_mapping_tag::balanced, 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>
 TilePattern (SizeType arg, Args &&... args)
 Constructor, initializes a pattern from an argument list consisting of the pattern size (extent, number of elements) in every dimension followed by optional distribution types. More...
 
 TilePattern (const SizeSpec_t &sizespec, DistributionSpec_t dist, 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...
 
 TilePattern (const SizeSpec_t &sizespec, DistributionSpec_t dist=DistributionSpec_t(), Team &team=dash::Team::All())
 Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec and a Team. More...
 
 TilePattern (const self_t &other)=default
 Copy constructor. More...
 
 TilePattern (self_t &other)
 Copy constructor using non-const lvalue reference parameter. More...
 
TilePatternoperator= (const self_t &other)=default
 Assignment operator. More...
 
bool operator== (const self_t &other) const
 Equality comparison operator. More...
 
constexpr bool operator!= (const self_t &other) const
 Inquality comparison operator. More...
 
constexpr IndexType lbegin () const
 Resolves the global index of the first local element in the pattern. More...
 
constexpr IndexType lend () const
 Resolves the global index past the last local element in the pattern. 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 > &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 global_pos) const
 Convert given global linear index to its assigned unit id. More...
 
SizeType extent (dim_t dim) const
 extent More...
 
SizeType 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...
 
constexpr std::array< SizeType, NumDimensions > local_extents (team_unit_t unit=UNDEFINED_TEAM_UNIT_ID) 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 > &global_coords) const
 Converts global coordinates to their associated unit and its respective local coordinates. More...
 
constexpr 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 > &global_coords) const
 Converts global coordinates to their associated unit's respective local coordinates. More...
 
local_index_t local_index (const std::array< IndexType, NumDimensions > &global_coords) const
 Resolves the unit and the local index from global coordinates. More...
 
std::array< IndexType, NumDimensions > global (team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
 global More...
 
constexpr std::array< IndexType, NumDimensions > global (const std::array< IndexType, NumDimensions > &local_coords) const
 Converts local coordinates of a active unit to global coordinates. More...
 
IndexType global (IndexType local_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 > &local_coords) const
 Resolve an element's linear global index from a given unit's local coordinates of that element. More...
 
IndexType global_at (const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
 Global coordinates and viewspec to global position in the pattern's iteration order. More...
 
IndexType global_at (const std::array< IndexType, NumDimensions > &global_coords) const
 Global coordinates to global position in the pattern's iteration order. More...
 
IndexType at (const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
 at More...
 
IndexType at (std::array< IndexType, NumDimensions > global_coords) const
 Global coordinates to local index. More...
 
template<typename ... Values>
IndexType at (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...
 
constexpr bool is_local (IndexType index) const
 Whether the given global index is local to the unit that created this pattern instance. More...
 
index_type block_at (const std::array< index_type, NumDimensions > &g_coords) const
 block More...
 
local_index_t local_block_at (const std::array< index_type, NumDimensions > &g_coords) const
 Unit and local block index at given global coordinates. More...
 
ViewSpec_t block (index_type global_block_index) const
 View spec (offset and extents) of block at global linear block index in global cartesian element space. More...
 
ViewSpec_t block (const std::array< index_type, NumDimensions > &block_coords) const
 View spec (offset and extents) of block at global block coordinates. More...
 
constexpr ViewSpec_t local_block (index_type local_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 (team_unit_t unit, index_type local_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 local_block_index) const
 View spec (offset and extents) of block at local linear block index in local cartesian element space. More...
 
constexpr const BlockSpec_tblockspec () const
 Cartesian arrangement of pattern blocks. More...
 
constexpr const BlockSpec_tlocal_blockspec () const
 Cartesian arrangement of local pattern blocks. More...
 
constexpr SizeType blocksize (dim_t dimension) const
 Maximum number of elements in a single block in the given dimension. More...
 
constexpr SizeType max_blocksize () const
 Maximum number of elements in a single block in all dimensions. More...
 
constexpr SizeType local_capacity () 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...
 
constexpr IndexType num_units () const
 The number of units to which this pattern's elements are mapped. More...
 
constexpr IndexType capacity () const
 The maximum number of elements arranged in this pattern. More...
 
constexpr IndexType size () const
 The number of elements arranged in this pattern. More...
 
constexpr dash::Teamteam () const
 The Team containing the units to which this pattern's elements are mapped. More...
 
constexpr const DistributionSpec_tdistspec () const
 Distribution specification of this pattern. More...
 
constexpr SizeSpec_t sizespec () const
 Size specification of the index space mapped by this pattern. More...
 
constexpr const std::array< SizeType, NumDimensions > & extents () const
 Size specification (shape) of the index space mapped by this pattern. More...
 
constexpr const TeamSpec_tteamspec () const
 Cartesian arrangement of the Team containing the units to which this pattern's elements are mapped. More...
 
constexpr std::array< IndexType, NumDimensions > coords (IndexType index) const
 Convert given global linear offset (index) to global cartesian coordinates. More...
 
constexpr std::array< IndexType, NumDimensions > coords (IndexType index, const ViewSpec_t &viewspec) const
 Convert given global linear offset (index) to global cartesian coordinates. More...
 
SizeType underfilled_blocksize (dim_t dimension) const
 Number of elements missing in the overflow block of given dimension compared to the regular blocksize (. 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 = "TilePattern"
 

Detailed Description

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
class dash::TilePattern< NumDimensions, Arrangement, IndexType >

Defines how a list of global indices is mapped to single units within a Team.

Expects extent[d] to be a multiple of (blocksize[d] * nunits[d]) to ensure the balanced property.

Template Parameters
NumDimensionsThe number of dimensions of the pattern
ArrangementThe memory order of the pattern (ROW_MAJOR or COL_MAJOR), defaults to ROW_MAJOR. Memory order defines how elements in the pattern will be iterated predominantly
See also
MemArrange
Implemented concept:
Pattern Concept
Examples:
ex.06.pattern-block-visualizer/main.cpp.

Definition at line 47 of file TilePattern.h.

Member Typedef Documentation

◆ layout_properties

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
typedef pattern_layout_properties< pattern_layout_tag::blocked, pattern_layout_tag::linear > dash::TilePattern< NumDimensions, Arrangement, IndexType >::layout_properties

Satisfiable properties in pattern property category Layout:

Definition at line 75 of file TilePattern.h.

◆ mapping_properties

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
typedef pattern_mapping_properties< pattern_mapping_tag::balanced, pattern_mapping_tag::unbalanced > dash::TilePattern< NumDimensions, Arrangement, IndexType >::mapping_properties

Satisfiable properties in pattern property category Mapping:

Definition at line 66 of file TilePattern.h.

◆ partitioning_properties

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
typedef pattern_partitioning_properties< pattern_partitioning_tag::rectangular, pattern_partitioning_tag::balanced > dash::TilePattern< NumDimensions, Arrangement, IndexType >::partitioning_properties

Satisfiable properties in pattern property category Partitioning:

Definition at line 59 of file TilePattern.h.

Constructor & Destructor Documentation

◆ TilePattern() [1/5]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
template<typename ... Args>
dash::TilePattern< NumDimensions, Arrangement, IndexType >::TilePattern ( SizeType  arg,
Args &&...  args 
)
inline

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

Examples:

// A 5x3 rectangle with blocked distribution in the first dimension
TilePattern p1(10,20);
// Same as
TilePattern p1(SizeSpec<2>(10,20,
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// Same as
TilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
TeamSpec<2>(dash::Team::All(), 1));
// Same as
TilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// How teams are arranged in all dimensions, default
// is an extent of all units in first, and 1 in all
// higher dimensions:
TeamSpec<2>(dash::Team::All(), 1),
// The team containing the units to which the
// pattern maps the global indices. Defaults to all
// all units:
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 185 of file TilePattern.h.

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::TilePattern(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::underfilled_blocksize().

194  : TilePattern(PatternArguments_t(arg, args...))
195  {
196  DASH_LOG_TRACE("TilePattern()", "Constructor with Argument list");
197  initialize_local_range();
198  }
TilePattern(SizeType arg, Args &&... args)
Constructor, initializes a pattern from an argument list consisting of the pattern size (extent...
Definition: TilePattern.h:185

◆ TilePattern() [2/5]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
dash::TilePattern< NumDimensions, Arrangement, IndexType >::TilePattern ( const SizeSpec_t sizespec,
DistributionSpec_t  dist,
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.

Examples:

// A 5x3 rectangle with blocked distribution in the first dimension
TilePattern p1(10,20);
// Same as
TilePattern p1(SizeSpec<2>(10,20,
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// Same as
TilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
TeamSpec<2>(dash::Team::All(), 1));
// Same as
TilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// How teams are arranged in all dimensions, default
// is an extent of all units in first, and 1 in all
// higher dimensions:
TeamSpec<2>(dash::Team::All(), 1),
// The team containing the units to which the
// pattern maps the global indices. Defaults to all
// all units:
Parameters
sizespecTilePattern size (extent, number of elements) in every dimension
distDistribution type (BLOCKED, CYCLIC, BLOCKCYCLIC, TILE or NONE) of all dimensions.
teamspecCartesian arrangement of units within the team
teamTeam containing units to which this pattern maps its elements

Definition at line 233 of file TilePattern.h.

243  : _distspec(std::move(dist))
244  , _team(&team)
245  , _myid(_team->myid())
246  , _teamspec(teamspec, _distspec, *_team)
247  , _memory_layout(sizespec.extents())
248  , _nunits(_teamspec.size())
249  , _blocksize_spec(
250  initialize_blocksizespec(sizespec, _distspec, _teamspec))
251  , _blockspec(initialize_blockspec(sizespec, _blocksize_spec, _teamspec))
252  , _local_blockspec(
253  initialize_local_blockspec(_blockspec, _blocksize_spec, _teamspec))
254  , _local_memory_layout(initialize_local_extents(_myid))
255  , _local_capacity(initialize_local_capacity(_local_memory_layout))
256  {
257  DASH_LOG_TRACE("TilePattern()", "(sizespec, dist, teamspec, team)");
258  initialize_local_range();
259  }
constexpr SizeSpec_t sizespec() const
Size specification of the index space mapped by this pattern.
Definition: TilePattern.h:1418
constexpr const TeamSpec_t & teamspec() const
Cartesian arrangement of the Team containing the units to which this pattern&#39;s elements are mapped...
Definition: TilePattern.h:1437
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:171

◆ TilePattern() [3/5]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
dash::TilePattern< NumDimensions, Arrangement, IndexType >::TilePattern ( const SizeSpec_t sizespec,
DistributionSpec_t  dist = DistributionSpec_t(),
Team team = dash::Team::All() 
)
inline

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

Examples:

// A 5x3 rectangle with blocked distribution in the first dimension
TilePattern p1(10,20);
// Same as
TilePattern p1(SizeSpec<2>(10,20,
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// Same as
TilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
TeamSpec<2>(dash::Team::All(), 1));
// Same as
TilePattern p1(SizeSpec<2>(10,20),
DistributionSpec<2>(TILE(10/num_units),
TILE(20/num_units)));
// How teams are arranged in all dimensions, default
// is an extent of all units in first, and 1 in all
// higher dimensions:
TeamSpec<2>(dash::Team::All(), 1),
// The team containing the units to which the
// pattern maps the global indices. Defaults to all
// all units:
Parameters
sizespecTilePattern size (extent, number of elements) in every dimension
distDistribution type (BLOCKED, CYCLIC, BLOCKCYCLIC, TILE or NONE) of all dimensions. Defaults to BLOCKED in first, and NONE in higher dimensions
teamTeam containing units to which this pattern maps its elements

Definition at line 294 of file TilePattern.h.

References dash::TilePattern< NumDimensions, Arrangement, IndexType >::TilePattern().

303  : _distspec(std::move(dist))
304  , _team(&team)
305  , _myid(_team->myid())
306  , _teamspec(_distspec, *_team)
307  , _memory_layout(sizespec.extents())
308  , _nunits(_teamspec.size())
309  , _blocksize_spec(
310  initialize_blocksizespec(sizespec, _distspec, _teamspec))
311  , _blockspec(initialize_blockspec(sizespec, _blocksize_spec, _teamspec))
312  , _local_blockspec(
313  initialize_local_blockspec(_blockspec, _blocksize_spec, _teamspec))
314  , _local_memory_layout(initialize_local_extents(_myid))
315  , _local_capacity(initialize_local_capacity(_local_memory_layout))
316  {
317  DASH_LOG_TRACE("TilePattern()", "(sizespec, dist, team)");
318  initialize_local_range();
319  }
constexpr SizeSpec_t sizespec() const
Size specification of the index space mapped by this pattern.
Definition: TilePattern.h:1418
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
constexpr dash::Team & team() const
The Team containing the units to which this pattern&#39;s elements are mapped.
Definition: TilePattern.h:1402
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:171

◆ TilePattern() [4/5]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
dash::TilePattern< NumDimensions, Arrangement, IndexType >::TilePattern ( const self_t other)
default

Copy constructor.

◆ TilePattern() [5/5]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
dash::TilePattern< NumDimensions, Arrangement, IndexType >::TilePattern ( 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 332 of file TilePattern.h.

References dash::TilePattern< NumDimensions, Arrangement, IndexType >::operator=().

333  : TilePattern(static_cast<const self_t &>(other))
334  { }
TilePattern(SizeType arg, Args &&... args)
Constructor, initializes a pattern from an argument list consisting of the pattern size (extent...
Definition: TilePattern.h:185

Member Function Documentation

◆ at() [1/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::at ( const std::array< IndexType, NumDimensions > &  global_coords,
const ViewSpec_t viewspec 
) const
inline

at

Global coordinates and viewspec to local index.

See also
global_at
Pattern Concept

Definition at line 950 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::at().

953  {
954  DASH_LOG_TRACE("TilePattern.at()",
955  "gcoords:", global_coords,
956  "viewspec:", viewspec);
957  // Phase coordinates of element:
958  std::array<IndexType, NumDimensions> phase_coords;
959  // Coordinates of the block containing the element:
960  std::array<IndexType, NumDimensions> block_coords;
961  // Local coordinates of the block containing the element:
962  std::array<IndexType, NumDimensions> l_block_coords;
963  for (auto d = 0; d < NumDimensions; ++d) {
964  auto nunits_d = _teamspec.extent(d);
965  auto vs_coord = global_coords[d] + viewspec.offset(d);
966  phase_coords[d] = vs_coord % _blocksize_spec.extent(d);
967  block_coords[d] = vs_coord / _blocksize_spec.extent(d);
968  l_block_coords[d] = block_coords[d] / nunits_d;
969  }
970  index_type l_block_index = _local_blockspec.at(l_block_coords);
971  DASH_LOG_TRACE("TilePattern.at",
972  "block_coords:", block_coords,
973  "l_block_coords:", l_block_coords,
974  "l_block_index:", l_block_index,
975  "phase_coords:", phase_coords);
976  auto offset = l_block_index * _blocksize_spec.size() + // prec. blocks
977  _blocksize_spec.at(phase_coords); // elem. phase
978  DASH_LOG_TRACE_VAR("TilePattern.at >", offset);
979  return offset;
980  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ at() [2/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::at ( std::array< IndexType, NumDimensions >  global_coords) const
inline

Global coordinates to local index.

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

See also
Pattern Concept

Definition at line 990 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

992  {
993  DASH_LOG_TRACE("TilePattern.at()", "gcoords:", global_coords);
994  // Phase coordinates of element:
995  std::array<IndexType, NumDimensions> phase_coords{};
996  // Coordinates of the block containing the element:
997  std::array<IndexType, NumDimensions> block_coords{};
998  // Local coordinates of the block containing the element:
999  std::array<IndexType, NumDimensions> l_block_coords{};
1000  for (auto d = 0; d < NumDimensions; ++d) {
1001  auto nunits_d = _teamspec.extent(d);
1002  auto gcoord_d = global_coords[d];
1003  phase_coords[d] = gcoord_d % _blocksize_spec.extent(d);
1004  block_coords[d] = gcoord_d / _blocksize_spec.extent(d);
1005  l_block_coords[d] = block_coords[d] / nunits_d;
1006  }
1007  index_type l_block_index = _local_blockspec.at(l_block_coords);
1008  DASH_LOG_TRACE("TilePattern.at",
1009  "block_coords:", block_coords,
1010  "l_block_coords:", l_block_coords,
1011  "l_block_index:", l_block_index,
1012  "phase_coords:", phase_coords);
1013  auto offset = l_block_index * _blocksize_spec.size() + // prec. blocks
1014  _blocksize_spec.at(phase_coords); // elem. phase
1015  DASH_LOG_TRACE_VAR("TilePattern.at >", offset);
1016  return offset;
1017  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ at() [3/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
template<typename ... Values>
IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::at ( 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 1027 of file TilePattern.h.

References dash::TilePattern< NumDimensions, Arrangement, IndexType >::at().

1028  {
1029  static_assert(
1030  sizeof...(values) == NumDimensions,
1031  "Wrong parameter number");
1032  std::array<IndexType, NumDimensions> inputindex = {
1033  (IndexType)values...
1034  };
1035  return at(inputindex);
1036  }
IndexType at(const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
at
Definition: TilePattern.h:950

◆ block() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
ViewSpec_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::block ( index_type  global_block_index) const
inline

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

See also
Pattern Concept

Definition at line 1167 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::extents().

1169  {
1170  DASH_LOG_TRACE_VAR("TilePattern.block()", global_block_index);
1171  // block index -> block coords -> offset
1172  auto block_coords = _blockspec.coords(global_block_index);
1173  DASH_LOG_TRACE_VAR("TilePattern.block", block_coords);
1174  DASH_LOG_TRACE_VAR("TilePattern.block", _blocksize_spec.extents());
1175  std::array<index_type, NumDimensions> offsets{};
1176  std::array<size_type, NumDimensions> extents{};
1177  for (auto d = 0; d < NumDimensions; ++d) {
1178  auto blocksize_d = _blocksize_spec.extent(d);
1179  extents[d] = blocksize_d;
1180  offsets[d] = block_coords[d] * blocksize_d;
1181  }
1182  DASH_LOG_TRACE("TilePattern.block",
1183  "offsets:", offsets,
1184  "extents:", extents);
1185  auto block_vs = ViewSpec_t(offsets, extents);
1186  DASH_LOG_TRACE_VAR("TilePattern.block >", block_vs);
1187  return block_vs;
1188  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr const std::array< SizeType, NumDimensions > & extents() const
Size specification (shape) of the index space mapped by this pattern.
Definition: TilePattern.h:1427

◆ block() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
ViewSpec_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::block ( const std::array< index_type, NumDimensions > &  block_coords) const
inline

View spec (offset and extents) of block at global block coordinates.

See also
Pattern Concept
Parameters
block_coordsGlobal coordinates of element

Definition at line 1195 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::extents().

1198  {
1199  DASH_LOG_TRACE_VAR("TilePattern.block()", block_coords);
1200  // block coords -> offset
1201  DASH_LOG_TRACE_VAR("TilePattern.block", _blocksize_spec.extents());
1202  std::array<index_type, NumDimensions> offsets;
1203  std::array<size_type, NumDimensions> extents;
1204  for (auto d = 0; d < NumDimensions; ++d) {
1205  auto blocksize_d = _blocksize_spec.extent(d);
1206  extents[d] = blocksize_d;
1207  offsets[d] = block_coords[d] * blocksize_d;
1208  }
1209  DASH_LOG_TRACE("TilePattern.block",
1210  "offsets:", offsets,
1211  "extents:", extents);
1212  auto block_vs = ViewSpec_t(offsets, extents);
1213  DASH_LOG_TRACE_VAR("TilePattern.block >", block_vs);
1214  return block_vs;
1215  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr const std::array< SizeType, NumDimensions > & extents() const
Size specification (shape) of the index space mapped by this pattern.
Definition: TilePattern.h:1427

◆ block_at()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
index_type dash::TilePattern< NumDimensions, Arrangement, IndexType >::block_at ( const std::array< index_type, NumDimensions > &  g_coords) const
inline

block

Index of block in global block space at given global coordinates.

See also
Pattern Concept
Parameters
g_coordsGlobal coordinates of element

Definition at line 1114 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

1117  {
1118  std::array<index_type, NumDimensions> block_coords{};
1119  // Coord to block coord to unit coord:
1120  for (auto d = 0; d < NumDimensions; ++d) {
1121  block_coords[d] = g_coords[d] / _blocksize_spec.extent(d);
1122  }
1123  // Block coord to block index:
1124  auto block_idx = _blockspec.at(block_coords);
1125  DASH_LOG_TRACE("TilePattern.block_at",
1126  "coords", g_coords,
1127  "> block index", block_idx);
1128  return block_idx;
1129  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429

◆ blocksize()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr SizeType dash::TilePattern< NumDimensions, 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 1323 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::underfilled_blocksize().

1326  {
1327  return _blocksize_spec.extent(dimension);
1328  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ blockspec()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr const BlockSpec_t& dash::TilePattern< NumDimensions, Arrangement, IndexType >::blockspec ( ) const
inline

Cartesian arrangement of pattern blocks.

Definition at line 1303 of file TilePattern.h.

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::underfilled_blocksize().

1304  {
1305  return _blockspec;
1306  }

◆ capacity()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::capacity ( ) const
inline

The maximum number of elements arranged in this pattern.

See also
Pattern Concept

Definition at line 1385 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

1385  {
1386  return _memory_layout.size();
1387  }
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ coords() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr std::array<IndexType, NumDimensions> dash::TilePattern< NumDimensions, Arrangement, IndexType >::coords ( IndexType  index) const
inline

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

See also
Pattern Concept
Parameters
indexGlobal index (offset) to convert

Definition at line 1447 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::local().

1449  {
1450 
1451  ::std::array<IndexType, NumDimensions> pos{};
1452  auto block_coords = _blockspec.coords(index / _blocksize_spec.size());
1453  auto phase_coords = _blocksize_spec.coords(index % _blocksize_spec.size());
1454  for (auto d = 0; d < NumDimensions; ++d) {
1455  pos[d] = block_coords[d]*_blocksize_spec.extent(d) + phase_coords[d];
1456  }
1457  return pos;
1458  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ coords() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr std::array<IndexType, NumDimensions> dash::TilePattern< NumDimensions, Arrangement, IndexType >::coords ( IndexType  index,
const ViewSpec_t viewspec 
) const
inline

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

See also
Pattern Concept
Parameters
indexGlobal index (offset) to convert
viewspecView specification (offsets) to apply on coords

Definition at line 1466 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

1470  {
1471 
1472  ::std::array<IndexType, NumDimensions> pos;
1473  auto block_coords = _blockspec.coords(index / _blocksize_spec.size(),
1474  viewspec);
1475  auto phase_coords = _blocksize_spec.coords(index % _blocksize_spec.size(),
1476  viewspec);
1477  for (auto d = 0; d < NumDimensions; ++d) {
1478  pos[d] = block_coords[d]*_blocksize_spec.extent(d) + phase_coords[d];
1479  }
1480  return pos;
1481  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ distspec()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr const DistributionSpec_t& dash::TilePattern< NumDimensions, Arrangement, IndexType >::distspec ( ) const
inline

Distribution specification of this pattern.

Definition at line 1409 of file TilePattern.h.

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::underfilled_blocksize().

1409  {
1410  return _distspec;
1411  }

◆ extent()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeType dash::TilePattern< NumDimensions, 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 491 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

491  {
492  if (dim >= NumDimensions || dim < 0) {
493  DASH_THROW(
495  "Wrong dimension for TilePattern::local_extent. "
496  << "Expected dimension between 0 and " << NumDimensions-1 << ", "
497  << "got " << dim);
498  }
499  return _memory_layout.extent(dim);
500  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ extents()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr const std::array<SizeType, NumDimensions>& dash::TilePattern< NumDimensions, Arrangement, IndexType >::extents ( ) const
inline

Size specification (shape) of the index space mapped by this pattern.

See also
Pattern Concept

Definition at line 1427 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents().

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::block(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_block_local().

1427  {
1428  return _memory_layout.extents();
1429  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402

◆ global() [1/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
std::array<IndexType, NumDimensions> dash::TilePattern< NumDimensions, 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 759 of file TilePattern.h.

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::global(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::underfilled_blocksize().

762  {
763  DASH_LOG_DEBUG("TilePattern.global()",
764  "unit:", unit,
765  "lcoords:", local_coords);
766  // Global coordinate of local element:
767  std::array<IndexType, NumDimensions> global_coords{};
768  std::array<IndexType, NumDimensions> unit_ts_coords = _teamspec.coords(
769  unit);
770  for (dim_t d = 0; d < NumDimensions; ++d) {
771  auto blocksize_d = _blocksize_spec.extent(d);
772  auto nunits_d = _teamspec.extent(d);
773  auto phase = local_coords[d] % blocksize_d;
774  auto l_block_coord_d = local_coords[d] / blocksize_d;
775  auto g_block_coord_d = (l_block_coord_d * nunits_d) +
776  unit_ts_coords[d];
777  global_coords[d] = (g_block_coord_d * blocksize_d) + phase;
778  }
779  DASH_LOG_DEBUG_VAR("TilePattern.global >", global_coords);
780  return global_coords;
781  }
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
Definition: TilePattern.h:682

◆ global() [2/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr std::array<IndexType, NumDimensions> dash::TilePattern< NumDimensions, Arrangement, IndexType >::global ( const std::array< IndexType, NumDimensions > &  local_coords) const
inline

Converts local coordinates of a active unit to global coordinates.

See also
Pattern Concept

Definition at line 788 of file TilePattern.h.

References dash::TilePattern< NumDimensions, Arrangement, IndexType >::global().

789  {
790  return global(_myid, local_coords);
791  }
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global
Definition: TilePattern.h:759
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
Definition: TilePattern.h:682

◆ global() [3/3]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::global ( IndexType  local_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 global()
Pattern Concept

Definition at line 801 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::TilePattern< NumDimensions, Arrangement, IndexType >::global(), dash::TilePattern< NumDimensions, Arrangement, IndexType >::global_at(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

803  {
804  DASH_LOG_TRACE("TilePattern.global()",
805  "local_index:", local_index,
806  "unit:", _myid);
807  auto block_size = _blocksize_spec.size();
808  auto phase = local_index % block_size;
809  auto l_block_index = local_index / block_size;
810  // Block coordinate in local memory:
811  auto l_block_coord = _local_blockspec.coords(l_block_index);
812  // Coordinate of element in block:
813  auto phase_coord = _blocksize_spec.coords(phase);
814  DASH_LOG_TRACE("TilePattern.global",
815  "local block index:", l_block_index,
816  "local block coords:", l_block_coord,
817  "phase coords:", phase_coord);
818  // Coordinate of element in local memory:
819  std::array<IndexType, NumDimensions> l_coords{};
820  for (auto d = 0; d < NumDimensions; ++d) {
821  l_coords[d] = l_block_coord[d] * _blocksize_spec.extent(d) +
822  phase_coord[d];
823  }
824  std::array<IndexType, NumDimensions> g_coords =
825  global(_myid, l_coords);
826  auto offset = global_at(g_coords);
827  DASH_LOG_TRACE_VAR("TilePattern.global >", offset);
828  return offset;
829  }
IndexType global_at(const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
Global coordinates and viewspec to global position in the pattern&#39;s iteration order.
Definition: TilePattern.h:867
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global
Definition: TilePattern.h:759
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
local_index_t local_index(const std::array< IndexType, NumDimensions > &global_coords) const
Resolves the unit and the local index from global coordinates.
Definition: TilePattern.h:702

◆ global_at() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::global_at ( const std::array< IndexType, NumDimensions > &  global_coords,
const ViewSpec_t viewspec 
) const
inline

Global coordinates and viewspec to global position in the pattern's iteration order.

NOTE: Expects extent[d] to be a multiple of blocksize[d] * nunits[d] to ensure the balanced property.

See also
at
local_at
Pattern Concept

Definition at line 867 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::global().

870  {
871  DASH_LOG_TRACE("TilePattern.global_at()",
872  "gcoords:", global_coords,
873  "viewspec:", viewspec);
874  // Phase coordinates of element:
875  std::array<IndexType, NumDimensions> phase_coords{};
876  // Coordinates of the block containing the element:
877  std::array<IndexType, NumDimensions> block_coords{};
878  for (auto d = 0; d < NumDimensions; ++d) {
879  auto vs_coord = global_coords[d] + viewspec.offset(d);
880  phase_coords[d] = vs_coord % _blocksize_spec.extent(d);
881  block_coords[d] = vs_coord / _blocksize_spec.extent(d);
882  }
883  DASH_LOG_TRACE("TilePattern.global_at",
884  "block coords:", block_coords,
885  "phase coords:", phase_coords);
886  // Number of blocks preceeding the coordinates' block, equivalent
887  // to linear global block offset:
888  auto block_index = _blockspec.at(block_coords);
889  DASH_LOG_TRACE("TilePattern.global_at",
890  "block index:", block_index);
891  auto offset = block_index * _blocksize_spec.size() + // preceed. blocks
892  _blocksize_spec.at(phase_coords); // element phase
893  DASH_LOG_TRACE_VAR("TilePattern.global_at >", offset);
894  return offset;
895  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ global_at() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::global_at ( const std::array< IndexType, NumDimensions > &  global_coords) const
inline

Global coordinates to global position in the pattern's iteration order.

NOTE: Expects extent[d] to be a multiple of blocksize[d] * nunits[d] to ensure the balanced property.

See also
at
local_at
Pattern Concept

Definition at line 910 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

912  {
913  DASH_LOG_TRACE("TilePattern.global_at()",
914  "gcoords:", global_coords);
915  // Phase coordinates of element:
916  std::array<IndexType, NumDimensions> phase_coords;
917  // Coordinates of the block containing the element:
918  std::array<IndexType, NumDimensions> block_coords;
919 
920  for (auto d = 0; d < NumDimensions; ++d) {
921  auto vs_coord = global_coords[d];
922  phase_coords[d] = vs_coord % _blocksize_spec.extent(d);
923  block_coords[d] = vs_coord / _blocksize_spec.extent(d);
924  }
925  DASH_LOG_TRACE("TilePattern.global_at",
926  "block coords:", block_coords,
927  "phase coords:", phase_coords);
928  // Number of blocks preceeding the coordinates' block, equivalent
929  // to linear global block offset:
930  auto block_index = _blockspec.at(block_coords);
931  DASH_LOG_TRACE("TilePattern.global_at",
932  "block index:", block_index);
933  auto offset = block_index * _blocksize_spec.size() + // preceed. blocks
934  _blocksize_spec.at(phase_coords); // element phase
935  DASH_LOG_TRACE_VAR("TilePattern.global_at >", offset);
936  return offset;
937  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ global_index()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::global_index ( team_unit_t  unit,
const std::array< IndexType, NumDimensions > &  local_coords 
) const
inline

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

See also
at
global_at
Pattern Concept

Definition at line 840 of file TilePattern.h.

843  {
844  DASH_LOG_TRACE("TilePattern.global_index()",
845  "unit:", unit,
846  "local_coords:", local_coords);
847  std::array<IndexType, NumDimensions> global_coords =
848  global(unit, local_coords);
849  auto g_index = _memory_layout.at(global_coords);
850  DASH_LOG_TRACE_VAR("TilePattern.global_index >", g_index);
851  return g_index;
852  }
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global
Definition: TilePattern.h:759
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
Definition: TilePattern.h:682

◆ has_local_elements()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
bool dash::TilePattern< NumDimensions, 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 1048 of file TilePattern.h.

1057  {
1058  DASH_LOG_TRACE_VAR("TilePattern.has_local_elements()", dim);
1059  DASH_LOG_TRACE_VAR("TilePattern.has_local_elements()", dim_offset);
1060  DASH_LOG_TRACE_VAR("TilePattern.has_local_elements()", unit);
1061  DASH_LOG_TRACE_VAR("TilePattern.has_local_elements()", viewspec);
1062  // Apply viewspec offset in dimension to given position
1063  dim_offset += viewspec.offset(dim);
1064  // Offset to block offset
1065  IndexType block_coord_d = dim_offset / _blocksize_spec.extent(dim);
1066  DASH_LOG_TRACE_VAR("TilePattern.has_local_elements", block_coord_d);
1067  // Coordinate of unit in team spec in given dimension
1068  IndexType teamspec_coord_d = block_coord_d % _teamspec.extent(dim);
1069  DASH_LOG_TRACE_VAR("TilePattern.has_local_elements",
1070  teamspec_coord_d);
1071  // Check if unit id lies in cartesian sub-space of team spec
1072  return _teamspec.includes_index(
1073  teamspec_coord_d,
1074  dim,
1075  dim_offset);
1076  }
bool includes_index(IndexType index, dim_t dimension, IndexType dim_offset) const
Whether the given index lies in the cartesian sub-space specified by a dimension and offset in the di...
Definition: TeamSpec.h:385
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ is_local() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
bool dash::TilePattern< NumDimensions, 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 1083 of file TilePattern.h.

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::is_local().

1086  {
1087  auto glob_coords = coords(index);
1088  auto coords_unit = unit_at(glob_coords);
1089  DASH_LOG_TRACE_VAR("TilePattern.is_local >", (coords_unit == unit));
1090  return coords_unit == unit;
1091  }
team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at
Definition: TilePattern.h:398
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
constexpr std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.
Definition: TilePattern.h:1447

◆ is_local() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr bool dash::TilePattern< NumDimensions, 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 1099 of file TilePattern.h.

References dash::TilePattern< NumDimensions, Arrangement, IndexType >::is_local().

1101  {
1102  return is_local(index, _myid);
1103  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
bool is_local(IndexType index, team_unit_t unit) const
Whether the given global index is local to the specified unit.
Definition: TilePattern.h:1083

◆ lbegin()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::lbegin ( ) const
inline

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

See also
Pattern Concept

Definition at line 376 of file TilePattern.h.

376  {
377  return _lbegin;
378  }

◆ lend()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::lend ( ) const
inline

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

See also
Pattern Concept

Definition at line 385 of file TilePattern.h.

385  {
386  return _lend;
387  }

◆ local() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
local_coords_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::local ( const std::array< IndexType, NumDimensions > &  global_coords) const
inline

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

See also
Pattern Concept

Definition at line 640 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_coords().

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_index().

642  {
643  local_coords_t l_coords;
644  std::array<IndexType, NumDimensions> local_coords{};
645  std::array<IndexType, NumDimensions> unit_ts_coords{};
646  for (dim_t d = 0; d < NumDimensions; ++d) {
647  auto nunits_d = _teamspec.extent(d);
648  auto blocksize_d = _blocksize_spec.extent(d);
649  auto block_coord_d = global_coords[d] / blocksize_d;
650  auto phase_d = global_coords[d] % blocksize_d;
651  auto l_block_coord_d = block_coord_d / nunits_d;
652  unit_ts_coords[d] = block_coord_d % nunits_d;
653  local_coords[d] = (l_block_coord_d * blocksize_d) + phase_d;
654  }
655  l_coords.unit = _teamspec.at(unit_ts_coords);
656  l_coords.coords = local_coords;
657  return l_coords;
658  }
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
Definition: TilePattern.h:682

◆ local() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr local_index_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::local ( IndexType  g_index) const
inline

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

TODO: Unoptimized

See also
Pattern Concept

Definition at line 668 of file TilePattern.h.

References dash::TilePattern< NumDimensions, Arrangement, IndexType >::coords(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_index().

670  {
671  // TODO: Implement dedicated method for this, conversion to/from
672  // global coordinates is expensive.
673  return local_index(coords(g_index));
674  }
constexpr std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.
Definition: TilePattern.h:1447
local_index_t local_index(const std::array< IndexType, NumDimensions > &global_coords) const
Resolves the unit and the local index from global coordinates.
Definition: TilePattern.h:702

◆ local_at() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::TilePattern< NumDimensions, 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 (local offsets) to apply on local_coords

Definition at line 555 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_index(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

560  {
561  DASH_LOG_TRACE("TilePattern.local_at()",
562  "local_coords:", local_coords,
563  "view:", viewspec,
564  "local blocks:", _local_blockspec.extents());
565  // Phase coordinates of element:
566  std::array<IndexType, NumDimensions> phase_coords{};
567  // Coordinates of the local block containing the element:
568  std::array<IndexType, NumDimensions> block_coords_l{};
569  for (auto d = 0; d < NumDimensions; ++d) {
570  auto vs_offset_d = viewspec.offset(d);
571  auto vs_coord_d = local_coords[d] + vs_offset_d;
572  auto block_size_d = _blocksize_spec.extent(d);
573  phase_coords[d] = vs_coord_d % block_size_d;
574  block_coords_l[d] = vs_coord_d / block_size_d;
575  }
576  DASH_LOG_TRACE("TilePattern.local_at",
577  "local_coords:", local_coords);
578  DASH_LOG_TRACE("TilePattern.local_at",
579  "view:", viewspec);
580  DASH_LOG_TRACE("TilePattern.local_at",
581  "local blocks:", _local_blockspec.extents());
582  DASH_LOG_TRACE("TilePattern.local_at",
583  "local block coords:", block_coords_l);
584  DASH_LOG_TRACE("TilePattern.local_at",
585  "phase coords:", phase_coords);
586  // Number of blocks preceeding the coordinates' block:
587  auto block_offset_l = _local_blockspec.at(block_coords_l);
588  DASH_LOG_TRACE("TilePattern.local_at",
589  "local block offset:", block_offset_l);
590  auto local_index =
591  block_offset_l * _blocksize_spec.size() + // preceeding blocks
592  _blocksize_spec.at(phase_coords); // element phase
593  DASH_LOG_TRACE_VAR("TilePattern.local_at >", local_index);
594  return local_index;
595  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
Definition: TilePattern.h:682
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
local_index_t local_index(const std::array< IndexType, NumDimensions > &global_coords) const
Resolves the unit and the local index from global coordinates.
Definition: TilePattern.h:702

◆ local_at() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
IndexType dash::TilePattern< NumDimensions, 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 602 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_index(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

605  {
606  DASH_LOG_TRACE("TilePattern.local_at()",
607  "local coords:", local_coords,
608  "local blocks:", _local_blockspec.extents());
609  // Phase coordinates of element:
610  std::array<IndexType, NumDimensions> phase_coords{};
611  // Coordinates of the local block containing the element:
612  std::array<IndexType, NumDimensions> block_coords_l{};
613  for (auto d = 0; d < NumDimensions; ++d) {
614  auto gcoord_d = local_coords[d];
615  auto block_size_d = _blocksize_spec.extent(d);
616  phase_coords[d] = gcoord_d % block_size_d;
617  block_coords_l[d] = gcoord_d / block_size_d;
618  }
619  DASH_LOG_TRACE("TilePattern.local_at",
620  "local_coords:", local_coords,
621  "local blocks:", _local_blockspec.extents(),
622  "local block coords:", block_coords_l,
623  "block size:", _blocksize_spec.extents(),
624  "phase coords:", phase_coords);
625  // Number of blocks preceeding the coordinates' block:
626  auto block_offset_l = _local_blockspec.at(block_coords_l);
627  auto local_index =
628  block_offset_l * _blocksize_spec.size() + // preceeding blocks
629  _blocksize_spec.at(phase_coords); // element phase
630  DASH_LOG_TRACE_VAR("TilePattern.local_at >", local_index);
631  return local_index;
632  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
Definition: TilePattern.h:682
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395
local_index_t local_index(const std::array< IndexType, NumDimensions > &global_coords) const
Resolves the unit and the local index from global coordinates.
Definition: TilePattern.h:702

◆ local_block() [1/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr ViewSpec_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_block ( index_type  local_block_index) const
inline

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

See also
Pattern Concept

Definition at line 1223 of file TilePattern.h.

1225  {
1226  return local_block(_myid, local_block_index);
1227  }
constexpr ViewSpec_t local_block(index_type local_block_index) const
View spec (offset and extents) of block at local linear block index in global cartesian element space...
Definition: TilePattern.h:1223

◆ local_block() [2/2]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
ViewSpec_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_block ( team_unit_t  unit,
index_type  local_block_index 
) const
inline

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

See also
Pattern Concept

Definition at line 1235 of file TilePattern.h.

1238  {
1239  DASH_LOG_TRACE("TilePattern.local_block()",
1240  "unit:", unit,
1241  "lblock_idx:", local_block_index,
1242  "lblockspec:", _local_blockspec.extents());
1243 
1244  // Local block index to local block coords:
1245  auto l_block_coords = _local_blockspec.coords(local_block_index);
1246  auto unit_ts_coords = _teamspec.coords(unit);
1247  DASH_LOG_TRACE_VAR("TilePattern.local_block", l_block_coords);
1248  std::array<index_type, NumDimensions> offsets{};
1249  std::array<size_type, NumDimensions> extents{};
1250  for (auto d = 0; d < NumDimensions; ++d) {
1251  auto blocksize_d = _blocksize_spec.extent(d);
1252 
1253  // Block offsets are lobal coordinates of first block element:
1254  auto nunits_d = _teamspec.extent(d);
1255  offsets[d] = ((l_block_coords[d] * nunits_d) + unit_ts_coords[d]) *
1256  blocksize_d;
1257  // checks if the local block is the last one in this dimension
1258  auto num_blocks_d =_local_blockspec.extent(d);
1259  if(l_block_coords[d] == (num_blocks_d - 1)){
1260  size_type remaining = local_extent(d) % blocksize_d;
1261  // if block is underfilled the extent will be decreased
1262  if(remaining > 0) {
1263  blocksize_d = remaining;
1264  }
1265  }
1266  extents[d] = blocksize_d;
1267  }
1268  ViewSpec_t block_vs(offsets, extents);
1269  DASH_LOG_TRACE_VAR("TilePattern.local_block >", block_vs);
1270  return block_vs;
1271  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr const std::array< SizeType, NumDimensions > & extents() const
Size specification (shape) of the index space mapped by this pattern.
Definition: TilePattern.h:1427
SizeType local_extent(dim_t dim) const
The actual number of elements in this pattern that are local to the calling unit in the given dimensi...
Definition: TilePattern.h:513

◆ local_block_at()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
local_index_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_block_at ( const std::array< index_type, NumDimensions > &  g_coords) const
inline

Unit and local block index at given global coordinates.

See also
Pattern Concept
Parameters
g_coordsGlobal coordinates of element

Definition at line 1136 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

1139  {
1140  local_index_t l_pos;
1141 
1142  std::array<IndexType, NumDimensions> l_block_coords{};
1143  std::array<IndexType, NumDimensions> unit_ts_coords{};
1144  for (dim_t d = 0; d < NumDimensions; ++d) {
1145  auto nunits_d = _teamspec.extent(d);
1146  auto blocksize_d = _blocksize_spec.extent(d);
1147  auto block_coord_d = g_coords[d] / blocksize_d;
1148  l_block_coords[d] = block_coord_d / nunits_d;
1149  unit_ts_coords[d] = block_coord_d % nunits_d;
1150  }
1151  l_pos.unit = _teamspec.at(unit_ts_coords);
1152  l_pos.index = _local_blockspec.at(l_block_coords);
1153 
1154  DASH_LOG_TRACE("TilePattern.local_block_at >",
1155  "coords", g_coords,
1156  "unit:", l_pos.unit,
1157  "local block index:", l_pos.index);
1158  return l_pos;
1159  }
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429

◆ local_block_local()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
ViewSpec_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_block_local ( index_type  local_block_index) const
inline

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

See also
Pattern Concept

Definition at line 1279 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::extents().

1281  {
1282  DASH_LOG_TRACE_VAR("TilePattern.local_block_local()",
1283  local_block_index);
1284  // Initialize viewspec result with block extents:
1285  std::array<index_type, NumDimensions> offsets{};
1286  std::array<size_type, NumDimensions> extents =
1287  _blocksize_spec.extents();
1288  // Local block index to local block coords:
1289  auto l_block_coords = _local_blockspec.coords(local_block_index);
1290  // Local block coords to local element offset:
1291  for (auto d = 0; d < NumDimensions; ++d) {
1292  auto blocksize_d = extents[d];
1293  offsets[d] = l_block_coords[d] * blocksize_d;
1294  }
1295  ViewSpec_t block_vs(offsets, extents);
1296  DASH_LOG_TRACE_VAR("TilePattern.local_block_local >", block_vs);
1297  return block_vs;
1298  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497
constexpr const std::array< SizeType, NumDimensions > & extents() const
Size specification (shape) of the index space mapped by this pattern.
Definition: TilePattern.h:1427

◆ local_blockspec()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr const BlockSpec_t& dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_blockspec ( ) const
inline

Cartesian arrangement of local pattern blocks.

Definition at line 1311 of file TilePattern.h.

1312  {
1313  return _local_blockspec;
1314  }

◆ local_capacity()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr SizeType dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_capacity ( ) 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 1348 of file TilePattern.h.

References dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_size().

1348  {
1349  return local_size();
1350  }
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...
Definition: TilePattern.h:1362

◆ local_coords()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
std::array<IndexType, NumDimensions> dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_coords ( const std::array< IndexType, NumDimensions > &  global_coords) const
inline

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

See also
Pattern Concept

Definition at line 682 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::local().

684  {
685  std::array<IndexType, NumDimensions> local_coords{};
686  for (dim_t d = 0; d < NumDimensions; ++d) {
687  auto nunits_d = _teamspec.extent(d);
688  auto blocksize_d = _blocksize_spec.extent(d);
689  auto block_coord_d = global_coords[d] / blocksize_d;
690  auto phase_d = global_coords[d] % blocksize_d;
691  auto l_block_coord_d = block_coord_d / nunits_d;
692  local_coords[d] = (l_block_coord_d * blocksize_d) + phase_d;
693  }
694  return local_coords;
695  }
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
Definition: TilePattern.h:682

◆ local_extent()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeType dash::TilePattern< NumDimensions, 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 513 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

514  {
515  if (dim >= NumDimensions || dim < 0) {
516  DASH_THROW(
518  "Wrong dimension for TilePattern::local_extent. "
519  << "Expected dimension between 0 and " << NumDimensions-1 << ", "
520  << "got " << dim);
521  }
522  return _local_memory_layout.extent(dim);
523  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ local_extents()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr std::array<SizeType, NumDimensions> dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_extents ( team_unit_t  unit = UNDEFINED_TEAM_UNIT_ID) 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 536 of file TilePattern.h.

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::underfilled_blocksize().

538  {
539  return ( ( unit == UNDEFINED_TEAM_UNIT_ID ||
540  unit == _myid )
541  ? _local_memory_layout.extents()
542  : initialize_local_extents(unit) );
543  }
constexpr team_unit_t UNDEFINED_TEAM_UNIT_ID
Invalid local unit ID.
Definition: Types.h:341
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402

◆ local_index()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
local_index_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_index ( const std::array< IndexType, NumDimensions > &  global_coords) const
inline

Resolves the unit and the local index from global coordinates.

See also
Pattern Concept

Definition at line 702 of file TilePattern.h.

References dash::TilePattern< NumDimensions, Arrangement, IndexType >::local().

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::local(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_at().

704  {
705  DASH_LOG_TRACE_VAR("TilePattern.local_index()", global_coords);
706  // Global coordinates to unit and local offset:
707  auto l_pos_coords = local(global_coords);
708  auto l_coords = l_pos_coords.coords;
709  auto unit = l_pos_coords.unit;
710  index_type l_index = -1;
711  DASH_LOG_TRACE_VAR("TilePattern.local_index", l_coords);
712  DASH_LOG_TRACE_VAR("TilePattern.local_index", unit);
713 
714  if (unit == _myid) {
715  // Local coords to local offset:
716  l_index = local_at(l_coords);
717  } else {
718  // Global coordinates point to remote location, requires to construct
719  // _local_blockspec of remote unit:
720  auto remote_l_blockspec = initialize_local_blockspec(
721  _blockspec, _blocksize_spec, _teamspec,
722  unit);
723 
724  // Phase coordinates of element:
725  std::array<IndexType, NumDimensions> phase_coords{};
726  // Coordinates of the local block containing the element:
727  std::array<IndexType, NumDimensions> block_coords_l{};
728  for (auto d = 0; d < NumDimensions; ++d) {
729  auto gcoord_d = l_coords[d];
730  auto block_size_d = _blocksize_spec.extent(d);
731  phase_coords[d] = gcoord_d % block_size_d;
732  block_coords_l[d] = gcoord_d / block_size_d;
733  }
734  DASH_LOG_TRACE("TilePattern.local_index",
735  "local_coords:", l_coords,
736  "local blocks:", remote_l_blockspec.extents(),
737  "local block coords:", block_coords_l,
738  "block size:", _blocksize_spec.extents(),
739  "phase coords:", phase_coords);
740  // Number of blocks preceeding the coordinates' block:
741  auto block_offset_l = remote_l_blockspec.at(block_coords_l);
742  l_index = block_offset_l * _blocksize_spec.size() + // prec. blocks
743  _blocksize_spec.at(phase_coords); // elem. phase
744  }
745  DASH_LOG_TRACE_VAR("TilePattern.local_index >", l_index);
746 
747  return local_index_t { unit, l_index };
748  }
IndexType local_at(const std::array< IndexType, NumDimensions > &local_coords, const ViewSpec_t &viewspec) const
local
Definition: TilePattern.h:555
local_coords_t local(const std::array< IndexType, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit and its respective local coordinates.
Definition: TilePattern.h:640
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ local_size()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeType dash::TilePattern< NumDimensions, 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 1362 of file TilePattern.h.

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_capacity(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::underfilled_blocksize().

1362  {
1363  if (unit == UNDEFINED_TEAM_UNIT_ID) {
1364  return _local_memory_layout.size();
1365  }
1366  // Non-local query, requires to construct local memory layout of
1367  // remote unit:
1368  return LocalMemoryLayout_t(initialize_local_extents(unit)).size();
1369  }
constexpr team_unit_t UNDEFINED_TEAM_UNIT_ID
Invalid local unit ID.
Definition: Types.h:341
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ max_blocksize()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr SizeType dash::TilePattern< NumDimensions, 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 1338 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

1338  {
1339  return _blocksize_spec.size();
1340  }
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ memory_order()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
static constexpr MemArrange dash::TilePattern< NumDimensions, Arrangement, IndexType >::memory_order ( )
inlinestatic

Memory order followed by the pattern.

Definition at line 1486 of file TilePattern.h.

1486  {
1487  return Arrangement;
1488  }

◆ ndim()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
static constexpr dim_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::ndim ( )
inlinestatic

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

Definition at line 1494 of file TilePattern.h.

1494  {
1495  return NumDimensions;
1496  }

◆ num_units()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr IndexType dash::TilePattern< NumDimensions, 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 1376 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

1376  {
1377  return _teamspec.size();
1378  }
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ operator!=()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr bool dash::TilePattern< NumDimensions, Arrangement, IndexType >::operator!= ( const self_t other) const
inline

Inquality comparison operator.

Parameters
otherTilePattern instance to compare for inequality

Definition at line 364 of file TilePattern.h.

367  {
368  return !(*this == other);
369  }

◆ operator=()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
TilePattern& dash::TilePattern< NumDimensions, Arrangement, IndexType >::operator= ( const self_t other)
default

◆ operator==()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
bool dash::TilePattern< NumDimensions, Arrangement, IndexType >::operator== ( const self_t other) const
inline

Equality comparison operator.

Definition at line 344 of file TilePattern.h.

345  {
346  if (this == &other) {
347  return true;
348  }
349  // no need to compare all members as most are derived from
350  // constructor arguments.
351  return(
352  _distspec == other._distspec &&
353  _teamspec == other._teamspec &&
354  _memory_layout == other._memory_layout &&
355  _blockspec == other._blockspec &&
356  _blocksize_spec == other._blocksize_spec &&
357  _nunits == other._nunits
358  );
359  }

◆ size()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr IndexType dash::TilePattern< NumDimensions, Arrangement, IndexType >::size ( ) const
inline

The number of elements arranged in this pattern.

See also
Pattern Concept

Definition at line 1394 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size().

1394  {
1395  return _memory_layout.size();
1396  }
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ sizespec()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr SizeSpec_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::sizespec ( ) const
inline

Size specification of the index space mapped by this pattern.

See also
Pattern Concept

Definition at line 1418 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents().

1418  {
1419  return SizeSpec_t(_memory_layout.extents());
1420  }
constexpr const extents_type & extents() const noexcept
Extents of the cartesian space, by dimension.
Definition: Cartesian.h:402

◆ team()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr dash::Team& dash::TilePattern< NumDimensions, Arrangement, IndexType >::team ( ) const
inline

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

Definition at line 1402 of file TilePattern.h.

1402  {
1403  return *_team;
1404  }

◆ teamspec()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
constexpr const TeamSpec_t& dash::TilePattern< NumDimensions, 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 1437 of file TilePattern.h.

1437  {
1438  return _teamspec;
1439  }

◆ underfilled_blocksize()

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
SizeType dash::TilePattern< NumDimensions, Arrangement, IndexType >::underfilled_blocksize ( dim_t  dimension) const
inline

Number of elements missing in the overflow block of given dimension compared to the regular blocksize (.

See also
blocksize(d)), with 0 <= underfilled_blocksize(d) < blocksize(d).

Definition at line 1503 of file TilePattern.h.

References dash::TilePattern< NumDimensions, Arrangement, IndexType >::blocksize(), dash::TilePattern< NumDimensions, Arrangement, IndexType >::blockspec(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), DART_UNDEFINED_UNIT_ID, dash::TilePattern< NumDimensions, Arrangement, IndexType >::distspec(), dash::CartesianSpace< NumDimensions, SizeType >::extent(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent(), dash::CartesianSpace< NumDimensions, SizeType >::extents(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extents(), dash::TilePattern< NumDimensions, Arrangement, IndexType >::global(), dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_extents(), dash::TilePattern< NumDimensions, Arrangement, IndexType >::local_size(), dash::Distribution::max_blocksize_in_range(), dash::CartesianSpace< NumDimensions, SizeType >::size(), dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::size(), dash::TilePattern< NumDimensions, Arrangement, IndexType >::TilePattern(), dash::UNDEFINED_TEAM_UNIT_ID, and dash::Dimensional< ElementType, NumDimensions >::values().

1504  {
1505  // Underflow blocksize = regular blocksize - overflow blocksize:
1506  auto ovf_blocksize = _memory_layout.extent(dimension) %
1507  blocksize(dimension);
1508 
1509  if (ovf_blocksize == 0) {
1510  return 0;
1511  }
1512 
1513  DASH_LOG_DEBUG_VAR("TilePattern.underfilled_blocksize", ovf_blocksize);
1514  auto reg_blocksize = blocksize(dimension);
1515  return reg_blocksize - ovf_blocksize;
1516  }
constexpr SizeType blocksize(dim_t dimension) const
Maximum number of elements in a single block in the given dimension.
Definition: TilePattern.h:1323
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412

◆ unit_at() [1/4]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
team_unit_t dash::TilePattern< NumDimensions, 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 relative to the given view.
viewspecView specification (offsets) of the coordinates.

Definition at line 398 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

Referenced by dash::TilePattern< NumDimensions, Arrangement, IndexType >::unit_at().

403  {
404  DASH_LOG_TRACE("TilePattern.unit_at()",
405  "coords:", coords,
406  "viewspec:", viewspec);
407  std::array<IndexType, NumDimensions> unit_ts_coords{};
408  std::array<IndexType, NumDimensions> block_coords{};
409  // Unit id from diagonals in cartesian index space,
410  // e.g (x + y + z) % nunits
411  for (auto d = 0; d < NumDimensions; ++d) {
412  auto vs_coord = coords[d] + viewspec.offset(d);
413  // Global block coordinate:
414  block_coords[d] = vs_coord / _blocksize_spec.extent(d);
415  unit_ts_coords[d] = block_coords[d] % _teamspec.extent(d);
416  }
417  team_unit_t unit_id(_teamspec.at(unit_ts_coords));
418  DASH_LOG_TRACE_VAR("TilePattern.unit_at", block_coords);
419  DASH_LOG_TRACE_VAR("TilePattern.unit_at", unit_ts_coords);
420  DASH_LOG_TRACE_VAR("TilePattern.unit_at >", unit_id);
421  return unit_id;
422  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.
Definition: TilePattern.h:1447
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
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() [2/4]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
team_unit_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::unit_at ( const std::array< IndexType, NumDimensions > &  coords) const
inline

Convert given coordinate in pattern to its assigned unit id.

See also
Pattern Concept

Definition at line 429 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::at(), and dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::extent().

431  {
432  DASH_LOG_TRACE("TilePattern.unit_at()",
433  "coords:", coords);
434  std::array<IndexType, NumDimensions> unit_ts_coords{};
435  std::array<IndexType, NumDimensions> block_coords{};
436  // Unit id from diagonals in cartesian index space,
437  // e.g (x + y + z) % nunits
438  for (auto d = 0; d < NumDimensions; ++d) {
439  // Global block coordinate:
440  block_coords[d] = coords[d] / _blocksize_spec.extent(d);
441  unit_ts_coords[d] = block_coords[d] % _teamspec.extent(d);
442  }
443  team_unit_t unit_id(_teamspec.at(unit_ts_coords));
444  DASH_LOG_TRACE_VAR("TilePattern.unit_at", block_coords);
445  DASH_LOG_TRACE_VAR("TilePattern.unit_at", unit_ts_coords);
446  DASH_LOG_TRACE_VAR("TilePattern.unit_at >", unit_id);
447  return unit_id;
448  }
SizeType extent(dim_t dim) const
The extent of the cartesian space in the given dimension.
Definition: Cartesian.h:412
constexpr std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.
Definition: TilePattern.h:1447
constexpr IndexType at(IndexType arg, Args... args) const
Convert the given coordinates to their respective linear index.
Definition: Cartesian.h:429
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<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
team_unit_t dash::TilePattern< NumDimensions, 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 455 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::unit_at().

460  {
461  auto global_coords = _memory_layout.coords(global_pos);
462  return unit_at(global_coords, viewspec);
463  }
team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at
Definition: TilePattern.h:398
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497

◆ unit_at() [4/4]

template<dim_t NumDimensions, MemArrange Arrangement = ROW_MAJOR, typename IndexType = dash::default_index_t>
team_unit_t dash::TilePattern< NumDimensions, Arrangement, IndexType >::unit_at ( IndexType  global_pos) const
inline

Convert given global linear index to its assigned unit id.

See also
Pattern Concept
Parameters
global_posGlobal linear element offset

Definition at line 470 of file TilePattern.h.

References dash::CartesianIndexSpace< NumDimensions, Arrangement, IndexType >::coords(), and dash::TilePattern< NumDimensions, Arrangement, IndexType >::unit_at().

473  {
474  auto global_coords = _memory_layout.coords(global_pos);
475  return unit_at(global_coords);
476  }
team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at
Definition: TilePattern.h:398
std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given linear offset (index) to cartesian coordinates.
Definition: Cartesian.h:497

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