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

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

#include <BlockPattern1D.h>

Classes

struct  local_coords_t
 
struct  local_index_t
 

Public Types

typedef pattern_partitioning_properties< pattern_partitioning_tag::rectangular, pattern_partitioning_tag::balanced, pattern_partitioning_tag::unbalancedpartitioning_properties
 Satisfiable properties in pattern property category Partitioning: More...
 
typedef pattern_mapping_properties< pattern_mapping_tag::unbalancedmapping_properties
 Satisfiable properties in pattern property category Mapping: More...
 
typedef pattern_layout_properties< pattern_layout_tag::canonical, 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>
 BlockPattern (SizeType arg, Args &&... args)
 Constructor, initializes a pattern from an argument list consisting of the pattern size (extent, number of elements) followed by an optional distribution type. More...
 
 BlockPattern (const SizeSpec_t sizespec, const 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...
 
 BlockPattern (const SizeSpec_t sizespec, const DistributionSpec_t dist=DistributionSpec_t(), Team &team=dash::Team::All())
 Constructor, initializes a pattern from explicit instances of SizeSpec, DistributionSpec and a Team. More...
 
constexpr BlockPattern (self_t &&other)=default
 Move constructor. More...
 
constexpr BlockPattern (const self_t &other)=default
 Copy constructor. More...
 
constexpr BlockPattern (self_t &other)
 Copy constructor using non-const lvalue reference parameter. More...
 
self_toperator= (self_t &&other)=default
 Move-assignment operator. More...
 
self_toperator= (const self_t &other)=default
 Assignment operator. More...
 
constexpr 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...
 
constexpr team_unit_t unit_at (const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
 unit_at More...
 
constexpr team_unit_t unit_at (const std::array< IndexType, NumDimensions > &coords) const
 Convert given coordinate in pattern to its assigned unit id. More...
 
constexpr team_unit_t unit_at (IndexType global_pos, const ViewSpec_t &viewspec) const
 Convert given global linear index to its assigned unit id. More...
 
constexpr team_unit_t unit_at (IndexType global_pos) const
 Convert given global linear index to its assigned unit id. More...
 
IndexType extent (dim_t dim) const
 extent More...
 
template<dim_t dim = 0>
constexpr IndexType extent () const
 The number of elements in this pattern in the given dimension. More...
 
IndexType local_extent (dim_t dim) const
 The actual number of elements in this pattern that are local to the calling unit in the given dimension. More...
 
template<dim_t dim = 0>
constexpr IndexType local_extent () 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) const
 The actual number of elements in this pattern that are local to the given unit, by dimension. More...
 
constexpr std::array< SizeType, NumDimensions > local_extents () const
 The actual number of elements in this pattern that are local to the active unit, by dimension. More...
 
constexpr IndexType local_at (const std::array< IndexType, NumDimensions > &local_coords, const ViewSpec_t &viewspec) const
 local More...
 
constexpr IndexType local_at (const std::array< IndexType, NumDimensions > &local_coords) const
 Convert given local coordinates to linear local offset (index). More...
 
constexpr 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...
 
constexpr std::array< IndexType, NumDimensions > local_coords (const std::array< IndexType, NumDimensions > &global_coords) const noexcept
 Converts global coordinates to their associated unit's respective local coordinates. More...
 
constexpr local_index_t local_index (const std::array< IndexType, NumDimensions > &g_coords) const
 Resolves the unit and the local index from global coordinates. More...
 
constexpr 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 > &l_coords) const
 Converts local coordinates of active unit to global coordinates. More...
 
constexpr IndexType global (IndexType l_index) const
 Resolve an element's linear global index from the calling unit's local index of that element. More...
 
constexpr IndexType global_index (team_unit_t unit, const std::array< IndexType, NumDimensions > &l_coords) const
 Resolve an element's linear global index from a given unit's local coordinates of that element. More...
 
constexpr IndexType global_at (const std::array< IndexType, NumDimensions > &global_coords, const ViewSpec_t &viewspec) const
 Convert given global coordinates and viewspec to linear global offset (index). More...
 
constexpr IndexType global_at (const std::array< IndexType, NumDimensions > &global_coords) const
 Convert given global coordinates to linear global offset (index). More...
 
constexpr IndexType at (const std::array< IndexType, NumDimensions > &g_coords) const
 at More...
 
constexpr IndexType at (const std::array< IndexType, 1 > &g_coords, const ViewSpec_t &viewspec) const
 Global coordinates and viewspec to local index. More...
 
template<typename ... Values>
constexpr IndexType at (IndexType value, Values ... values) const
 Global coordinates to local index. More...
 
constexpr bool has_local_elements (dim_t dim, IndexType dim_offset, team_unit_t unit) const
 is_local More...
 
constexpr 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...
 
constexpr BlockSpec_t blockspec () const
 block More...
 
constexpr BlockSpec_t local_blockspec () const
 Cartesian arrangement of local pattern blocks. More...
 
constexpr index_type block_at (const std::array< index_type, NumDimensions > &g_coords) const
 Gobal index of block at given global coordinates. More...
 
constexpr local_index_t local_block_at (const std::array< index_type, NumDimensions > &g_coords) const
 Local index of block at given global coordinates. More...
 
constexpr ViewSpec_t block (index_type g_block_index) const
 View spec (offset and extents) of block at global linear block index in cartesian element space. More...
 
constexpr ViewSpec_t local_block (index_type l_block_index) const
 View spec (offset and extents) of block at local linear block index in global cartesian element space. More...
 
ViewSpec_t local_block_local (index_type l_block_index) const
 View spec (offset and extents) of block at local linear block index in local cartesian element space. More...
 
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...
 
constexpr SizeType local_size (team_unit_t unit) const
 The actual number of elements in this pattern that are local to the specified unit in total. More...
 
constexpr SizeType local_size () const noexcept
 The actual number of elements in this pattern that are local to the calling unit in total. More...
 
constexpr IndexType num_units () const noexcept
 The number of units to which this pattern's elements are mapped. More...
 
constexpr IndexType capacity () const noexcept
 The maximum number of elements arranged in this pattern. More...
 
constexpr IndexType size () const noexcept
 The number of elements arranged in this pattern. More...
 
constexpr dash::Teamteam () const noexcept
 The Team containing the units to which this pattern's elements are mapped. More...
 
constexpr const DistributionSpec_tdistspec () const noexcept
 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 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 using viewspec. More...
 
constexpr 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 const char * PatternName = "BlockPattern1D"
 

Detailed Description

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

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

Implemented concept:
Pattern Concept

Definition at line 35 of file BlockPattern1D.h.

Member Typedef Documentation

◆ layout_properties

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

Satisfiable properties in pattern property category Layout:

Definition at line 65 of file BlockPattern1D.h.

◆ mapping_properties

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

Satisfiable properties in pattern property category Mapping:

Definition at line 57 of file BlockPattern1D.h.

◆ partitioning_properties

Satisfiable properties in pattern property category Partitioning:

Definition at line 52 of file BlockPattern1D.h.

Constructor & Destructor Documentation

◆ BlockPattern() [1/6]

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

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

Examples:

// 500 elements with blocked distribution:
Pattern p1(500, BLOCKED);
// Same as
Pattern p1(SizeSpec<1>(500),
DistributionSpec<2>(BLOCKED),
TeamSpec<1>(dash::Team::All()),
// 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 158 of file BlockPattern1D.h.

167  : BlockPattern(PatternArguments_t(arg, args...))
168  { }

◆ BlockPattern() [2/6]

template<MemArrange Arrangement, typename IndexType >
dash::BlockPattern< 1, Arrangement, IndexType >::BlockPattern ( const SizeSpec_t  sizespec,
const 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:

// 500 elements with blocked distribution:
Pattern p1(SizeSpec<1>(500),
DistributionSpec<1>(BLOCKED),
TeamSpec<1>(dash::Team::All()),
// The team containing the units to which the pattern
// maps the global indices. Defaults to all all units:
// Same as
Pattern p1(500, BLOCKED);
// Same as
Pattern p1(SizeSpec<1>(500),
DistributionSpec<1>(BLOCKED));
// Same as
Pattern p1(SizeSpec<1>(500),
DistributionSpec<1>(BLOCKED),
TeamSpec<1>(dash::Team::All()));
Parameters
sizespecPattern size (extent, number of elements) in every dimension
distDistribution type (BLOCKED, CYCLIC, BLOCKCYCLIC or NONE).
teamspecCartesian arrangement of units within the team
teamTeam containing units to which this pattern maps its elements

Definition at line 195 of file BlockPattern1D.h.

References dash::Team::size(), and dash::BlockPattern< NumDimensions, Arrangement, IndexType >::team().

204  : _size(sizespec.size()),
205  _memory_layout(std::array<SizeType, 1> {{ _size }}),
206  _distspec(dist),
207  _team(&team),
208  _teamspec(
209  teamspec,
210  _distspec,
211  *_team),
212  _nunits(_team->size()),
213  _blocksize(initialize_blocksize(
214  _size,
215  _distspec,
216  _nunits)),
217  _nblocks(initialize_num_blocks(
218  _size,
219  _blocksize,
220  _nunits)),
221  _local_size(
222  initialize_local_extent(_team->myid())),
223  _local_memory_layout(std::array<SizeType, 1> {{ _local_size }}),
224  _nlblocks(initialize_num_local_blocks(
225  _blocksize,
226  _local_size)),
227  _local_capacity(initialize_local_capacity()),
228  _lbegin_lend(initialize_local_range(_local_size))
229  { }
constexpr const TeamSpec_t & teamspec() const
Cartesian arrangement of the Team containing the units to which this pattern&#39;s elements are mapped...
constexpr SizeSpec_t sizespec() const
Size specification of the index space mapped by this pattern.
size_t size() const
The number of units in this team.
Definition: Team.h:498
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:164

◆ BlockPattern() [3/6]

template<MemArrange Arrangement, typename IndexType >
dash::BlockPattern< 1, Arrangement, IndexType >::BlockPattern ( const SizeSpec_t  sizespec,
const 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:

// 500 elements with blocked distribution:
Pattern p1(SizeSpec<1>(500),
DistributionSpec<1>(BLOCKED),
TeamSpec<1>(dash::Team::All()),
// The team containing the units to which the pattern
// maps the global indices. Defaults to all all units:
// Same as
Pattern p1(500, BLOCKED);
// Same as
Pattern p1(SizeSpec<1>(500),
DistributionSpec<1>(BLOCKED));
// Same as
Pattern p1(SizeSpec<1>(500),
DistributionSpec<1>(BLOCKED),
TeamSpec<1>(dash::Team::All()));
Parameters
sizespecPattern size (extent, number of elements) in every dimension
distDistribution type (BLOCKED, CYCLIC, BLOCKCYCLIC, TILE or NONE). Defaults to BLOCKED.
teamTeam containing units to which this pattern maps its elements

Definition at line 256 of file BlockPattern1D.h.

References dash::BlockPattern< NumDimensions, Arrangement, IndexType >::BlockPattern(), dash::Team::size(), and dash::BlockPattern< NumDimensions, Arrangement, IndexType >::team().

264  : _size(sizespec.size()),
265  _memory_layout(std::array<SizeType, 1> {{ _size }}),
266  _distspec(dist),
267  _team(&team),
268  _teamspec(_distspec, *_team),
269  _nunits(_team->size()),
270  _blocksize(initialize_blocksize(
271  _size,
272  _distspec,
273  _nunits)),
274  _nblocks(initialize_num_blocks(
275  _size,
276  _blocksize,
277  _nunits)),
278  _local_size(
279  initialize_local_extent(_team->myid())),
280  _local_memory_layout(std::array<SizeType, 1> {{ _local_size }}),
281  _nlblocks(initialize_num_local_blocks(
282  _blocksize,
283  _local_size)),
284  _local_capacity(initialize_local_capacity()),
285  _lbegin_lend(initialize_local_range(_local_size))
286  { }
constexpr SizeSpec_t sizespec() const
Size specification of the index space mapped by this pattern.
size_t size() const
The number of units in this team.
Definition: Team.h:498
constexpr dash::Team & team() const noexcept
The Team containing the units to which this pattern&#39;s elements are mapped.
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:164

◆ BlockPattern() [4/6]

template<MemArrange Arrangement, typename IndexType >
constexpr dash::BlockPattern< 1, Arrangement, IndexType >::BlockPattern ( self_t &&  other)
default

Move constructor.

◆ BlockPattern() [5/6]

template<MemArrange Arrangement, typename IndexType >
constexpr dash::BlockPattern< 1, Arrangement, IndexType >::BlockPattern ( const self_t other)
default

Copy constructor.

◆ BlockPattern() [6/6]

template<MemArrange Arrangement, typename IndexType >
constexpr dash::BlockPattern< 1, Arrangement, IndexType >::BlockPattern ( 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 304 of file BlockPattern1D.h.

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

305  : BlockPattern(static_cast<const self_t &>(other)) {
306  }

Member Function Documentation

◆ at() [1/3]

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

at

Global coordinates to local index.

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

See also
Pattern Concept

Definition at line 729 of file BlockPattern1D.h.

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

730  {
731  return local_coords(g_coords)[0];
732  }
constexpr std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const noexcept
Converts global coordinates to their associated unit&#39;s respective local coordinates.

◆ at() [2/3]

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

Global coordinates and viewspec to local index.

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

See also
Pattern Concept

Definition at line 741 of file BlockPattern1D.h.

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

743  {
744  return local_coords(
745  std::array<IndexType, 1> {{
746  g_coords[0] + viewspec.offset(0)
747  }}
748  )[0];
749  }
constexpr std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const noexcept
Converts global coordinates to their associated unit&#39;s respective local coordinates.

◆ at() [3/3]

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

Global coordinates to local index.

Convert given coordinate in pattern to its linear local index.

See also
Pattern Concept

Definition at line 759 of file BlockPattern1D.h.

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

759  {
760  static_assert(
761  sizeof...(values) == NumDimensions-1,
762  "Wrong parameter number");
763  return at(std::array<IndexType, NumDimensions> {
764  value, (IndexType)values...
765  });
766  }
constexpr IndexType at(const std::array< IndexType, NumDimensions > &g_coords) const
at

◆ block()

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

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

Parameters
g_block_indexGlobal block index

Definition at line 866 of file BlockPattern1D.h.

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

869  {
870  return ViewSpec_t(
871  {{ static_cast<index_type>(g_block_index * _blocksize) }},
872  {{ static_cast<size_type>(
873  _blocksize - ( g_block_index < _nblocks - 1
874  ? 0
875  : underfilled_blocksize(0) )
876  ) }}
877  );
878  }
constexpr SizeType underfilled_blocksize(dim_t dimension) const
Number of elements missing in the overflow block of given dimension compared to the regular blocksize...

◆ block_at()

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

Gobal index of block at given global coordinates.

See also
Pattern Concept
Parameters
g_coordsGlobal coordinates of element

Definition at line 838 of file BlockPattern1D.h.

840  {
841  return g_coords[0] / _blocksize;
842  }

◆ blocksize()

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

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

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

Definition at line 929 of file BlockPattern1D.h.

931  {
932  return _blocksize;
933  }

◆ blockspec()

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

block

Cartesian arrangement of pattern blocks.

Definition at line 821 of file BlockPattern1D.h.

821  {
822  return BlockSpec_t({ _nblocks });
823  }

◆ capacity()

template<MemArrange Arrangement, typename IndexType >
constexpr IndexType dash::BlockPattern< 1, Arrangement, IndexType >::capacity ( ) const
inlinenoexcept

The maximum number of elements arranged in this pattern.

See also
Pattern Concept

Definition at line 1004 of file BlockPattern1D.h.

1004  {
1005  return _size;
1006  }

◆ coords() [1/2]

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

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

See also
Pattern Concept

Definition at line 1066 of file BlockPattern1D.h.

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

◆ coords() [2/2]

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

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

See also
Pattern Concept

Definition at line 1077 of file BlockPattern1D.h.

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

◆ distspec()

template<MemArrange Arrangement, typename IndexType >
constexpr const DistributionSpec_t& dash::BlockPattern< 1, Arrangement, IndexType >::distspec ( ) const
inlinenoexcept

Distribution specification of this pattern.

Definition at line 1028 of file BlockPattern1D.h.

1028  {
1029  return _distspec;
1030  }

◆ extent() [1/2]

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

extent

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

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

Definition at line 438 of file BlockPattern1D.h.

438  {
439  DASH_ASSERT_EQ(
440  0, dim,
441  "Wrong dimension for Pattern::local_extent. " <<
442  "Expected dimension = 0, got " << dim);
443  return _size;
444  }

◆ extent() [2/2]

template<MemArrange Arrangement, typename IndexType >
template<dim_t dim = 0>
constexpr IndexType dash::BlockPattern< 1, Arrangement, IndexType >::extent ( ) const
inline

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

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

Definition at line 456 of file BlockPattern1D.h.

456  {
457  static_assert(
458  0 == dim,
459  "Wrong dimension for Pattern::local_extent. "
460  "Expected dimension = 0");
461  return _size;
462  }

◆ extents()

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

Size specification of the index space mapped by this pattern.

See also
Pattern Concept

Definition at line 1046 of file BlockPattern1D.h.

1046  {
1047  return std::array<SizeType, 1> {{ _size }};
1048  }

◆ global() [1/3]

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

global

Converts local coordinates of a given unit to global coordinates.

See also
Pattern Concept

Definition at line 634 of file BlockPattern1D.h.

636  {
637  return (_nunits < 2)
638  ? local_coords
639  : std::array<IndexType, 1> {{
640  static_cast<IndexType>(
641  (( _distspec[0].local_index_to_block_coord(
642  static_cast<IndexType>(unit),
643  local_coords[0],
644  _nunits)
645  ) * _blocksize)
646  + (local_coords[0] % _blocksize)
647  )
648  }};
649  }
constexpr std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const noexcept
Converts global coordinates to their associated unit&#39;s respective local coordinates.

◆ global() [2/3]

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

Converts local coordinates of active unit to global coordinates.

See also
Pattern Concept

Definition at line 656 of file BlockPattern1D.h.

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

658  {
659  return global(_team->myid(), l_coords);
660  }
constexpr std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global

◆ global() [3/3]

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

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

See also
at Inverse of global()
Pattern Concept

Definition at line 670 of file BlockPattern1D.h.

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

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

◆ global_at() [1/2]

template<MemArrange Arrangement, typename IndexType >
constexpr IndexType dash::BlockPattern< 1, Arrangement, IndexType >::global_at ( const std::array< IndexType, NumDimensions > &  global_coords,
const ViewSpec_t viewspec 
) const
inline

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

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

Definition at line 697 of file BlockPattern1D.h.

701  {
702  return global_coords[0] + viewspec.offset(0);
703  }

◆ global_at() [2/2]

template<MemArrange Arrangement, typename IndexType >
constexpr IndexType dash::BlockPattern< 1, Arrangement, IndexType >::global_at ( const std::array< IndexType, NumDimensions > &  global_coords) const
inline

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

See also
Pattern Concept
Parameters
global_coordsPoint in local memory

Definition at line 710 of file BlockPattern1D.h.

712  {
713  return global_coords[0];
714  }

◆ global_index()

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

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

See also
at
Pattern Concept

Definition at line 684 of file BlockPattern1D.h.

687  {
688  return global(unit, l_coords)[0];
689  }
constexpr std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global

◆ has_local_elements()

template<MemArrange Arrangement, typename IndexType >
constexpr bool dash::BlockPattern< 1, Arrangement, IndexType >::has_local_elements ( dim_t  dim,
IndexType  dim_offset,
team_unit_t  unit 
) 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

Definition at line 778 of file BlockPattern1D.h.

784  {
785  // Check if unit id lies in cartesian sub-space of team spec
786  return _teamspec.includes_index(
787  unit,
788  dim,
789  dim_offset);
790  }
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

◆ is_local() [1/2]

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

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

See also
Pattern Concept

Definition at line 797 of file BlockPattern1D.h.

799  {
800  return unit_at(index) == unit;
801  }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
constexpr team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at

◆ is_local() [2/2]

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

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

See also
Pattern Concept

Definition at line 809 of file BlockPattern1D.h.

References dash::BlockPattern< NumDimensions, Arrangement, IndexType >::is_local(), dash::myid(), and dash::BlockPattern< NumDimensions, Arrangement, IndexType >::team().

810  {
811  return is_local(index, team().myid());
812  }
global_unit_t myid()
Shortcut to query the global unit ID of the calling unit.
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
constexpr dash::Team & team() const noexcept
The Team containing the units to which this pattern&#39;s elements are mapped.
constexpr bool is_local(IndexType index, team_unit_t unit) const
Whether the given global index is local to the specified unit.

◆ lbegin()

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

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

See also
Pattern Concept

Definition at line 357 of file BlockPattern1D.h.

357  {
358  return _lbegin_lend[0];
359  }

◆ lend()

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

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

See also
Pattern Concept

Definition at line 366 of file BlockPattern1D.h.

366  {
367  return _lbegin_lend[1];
368  }

◆ local() [1/2]

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

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

TODO: Unoptimized

See also
Pattern Concept

Definition at line 575 of file BlockPattern1D.h.

References dash::BlockPattern< NumDimensions, Arrangement, IndexType >::local_coords(), and dash::BlockPattern< NumDimensions, Arrangement, IndexType >::unit_at().

576  {
577  return local_coords_t {
578  unit_at(global_coords), // .unit
579  local_coords(global_coords) // .coords
580  };
581  }
constexpr std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const noexcept
Converts global coordinates to their associated unit&#39;s respective local coordinates.
constexpr team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at

◆ local() [2/2]

template<MemArrange Arrangement, typename IndexType >
constexpr local_index_t dash::BlockPattern< 1, 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 590 of file BlockPattern1D.h.

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

591  {
592  return local_index(coords(g_index));
593  }
constexpr local_index_t local_index(const std::array< IndexType, NumDimensions > &g_coords) const
Resolves the unit and the local index from global coordinates.
constexpr std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.

◆ local_at() [1/2]

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

local

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

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

Definition at line 548 of file BlockPattern1D.h.

552  {
553  return local_coords[0] + viewspec.offset(0);
554  }
constexpr std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const noexcept
Converts global coordinates to their associated unit&#39;s respective local coordinates.

◆ local_at() [2/2]

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

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

See also
Pattern Concept
Parameters
local_coordsPoint in local memory

Definition at line 561 of file BlockPattern1D.h.

563  {
564  return local_coords[0];
565  }
constexpr std::array< IndexType, NumDimensions > local_coords(const std::array< IndexType, NumDimensions > &global_coords) const noexcept
Converts global coordinates to their associated unit&#39;s respective local coordinates.

◆ local_block()

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

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

Parameters
l_block_indexLocal block index

Definition at line 884 of file BlockPattern1D.h.

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

887  {
888  // Local block index to local block coords:
889  return ViewSpec_t(
890  {{ static_cast<index_type>( global(l_block_index * _blocksize) ) }},
891  {{ static_cast<size_type>(
892  (l_block_index == (_nlblocks - 1)
893  ? (_local_size % _blocksize == 0
894  ? _blocksize
895  : _local_size % _blocksize )
896  : _blocksize )
897  ) }}
898  );
899  }
constexpr std::array< IndexType, NumDimensions > global(team_unit_t unit, const std::array< IndexType, NumDimensions > &local_coords) const
global

◆ local_block_at()

template<MemArrange Arrangement, typename IndexType >
constexpr local_index_t dash::BlockPattern< 1, Arrangement, IndexType >::local_block_at ( const std::array< index_type, NumDimensions > &  g_coords) const
inline

Local index of block at given global coordinates.

See also
Pattern Concept
Parameters
g_coordsGlobal coordinates of element

Definition at line 849 of file BlockPattern1D.h.

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

851  {
852  return local_index_t {
853  // unit id:
854  static_cast<team_unit_t>(
855  (g_coords[0] / _blocksize) % _teamspec.size()),
856  // local block index:
857  static_cast<index_type>(
858  (g_coords[0] / _blocksize) / _teamspec.size())
859  };
860  }
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
constexpr SizeType size() const noexcept
The number of discrete elements within the space spanned by the coordinate.
Definition: Cartesian.h:395

◆ local_block_local()

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

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

Definition at line 905 of file BlockPattern1D.h.

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

907  {
908  DASH_LOG_DEBUG_VAR("BlockPattern<1>.local_block_local()", l_block_index);
909  index_type offset = l_block_index * _blocksize;
910  std::array<index_type, NumDimensions> offsets = {{ offset }};
911  std::array<size_type, NumDimensions> extents = {{ _blocksize }};
912  if(l_block_index == (_nlblocks - 1))
913  {
914  size_type remaining = _local_size % extents[0];
915  extents[0] = (remaining == 0) ? extents[0] : remaining;
916  }
917  ViewSpec_t block_vs(offsets, extents);
918  DASH_LOG_DEBUG_VAR("BlockPattern<1>.local_block_local >", block_vs);
919  return block_vs;
920  }
constexpr const std::array< SizeType, NumDimensions > extents() const
Size specification of the index space mapped by this pattern.

◆ local_blockspec()

template<MemArrange Arrangement, typename IndexType >
constexpr BlockSpec_t dash::BlockPattern< 1, Arrangement, IndexType >::local_blockspec ( ) const
inline

Cartesian arrangement of local pattern blocks.

Definition at line 828 of file BlockPattern1D.h.

829  {
830  return BlockSpec_t({ _nlblocks });
831  }

◆ local_capacity()

template<MemArrange Arrangement, typename IndexType >
constexpr SizeType dash::BlockPattern< 1, 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 953 of file BlockPattern1D.h.

954  {
955  return _local_capacity;
956  }

◆ local_coords()

template<MemArrange Arrangement, typename IndexType >
constexpr std::array<IndexType, NumDimensions> dash::BlockPattern< 1, Arrangement, IndexType >::local_coords ( const std::array< IndexType, NumDimensions > &  global_coords) const
inlinenoexcept

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

See also
Pattern Concept

Definition at line 601 of file BlockPattern1D.h.

603  {
604  return std::array<IndexType, 1> {{
605  static_cast<IndexType>(
606  (((global_coords[0] / _blocksize) / _nunits) * _blocksize)
607  + (global_coords[0] % _blocksize)
608  )
609  }};
610  }

◆ local_extent() [1/2]

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

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

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

Definition at line 475 of file BlockPattern1D.h.

475  {
476  DASH_ASSERT_EQ(
477  0, dim,
478  "Wrong dimension for Pattern::local_extent. " <<
479  "Expected dimension = 0, got " << dim);
480  return _local_size;
481  }

◆ local_extent() [2/2]

template<MemArrange Arrangement, typename IndexType >
template<dim_t dim = 0>
constexpr IndexType dash::BlockPattern< 1, Arrangement, IndexType >::local_extent ( ) 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 495 of file BlockPattern1D.h.

495  {
496  static_assert(
497  0 == dim,
498  "Wrong dimension for Pattern::local_extent. "
499  "Expected dimension = 0");
500  return _local_size;
501  }

◆ local_extents() [1/2]

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

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

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

Definition at line 514 of file BlockPattern1D.h.

515  {
516  return std::array<SizeType, 1> {{
517  unit == _team->myid()
518  ? _local_size
519  : initialize_local_extent(unit)
520  }};
521  }

◆ local_extents() [2/2]

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

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

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

Definition at line 534 of file BlockPattern1D.h.

534  {
535  return std::array<SizeType, 1> {{ _local_size }};
536  }

◆ local_index()

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

Resolves the unit and the local index from global coordinates.

See also
Pattern Concept

Definition at line 617 of file BlockPattern1D.h.

References dash::BlockPattern< NumDimensions, Arrangement, IndexType >::at(), and dash::BlockPattern< NumDimensions, Arrangement, IndexType >::unit_at().

618  {
619  return local_index_t {
620  team_unit_t(unit_at(g_coords[0])),
621  at(g_coords)
622  };
623  }
constexpr IndexType at(const std::array< IndexType, NumDimensions > &g_coords) const
at
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
constexpr team_unit_t unit_at(const std::array< IndexType, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at

◆ local_size() [1/2]

template<MemArrange Arrangement, typename IndexType >
constexpr SizeType dash::BlockPattern< 1, Arrangement, IndexType >::local_size ( team_unit_t  unit) const
inline

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

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

Definition at line 968 of file BlockPattern1D.h.

969  {
970  return (unit == _team->myid().id)
971  ? _local_size
972  : initialize_local_extent(unit);
973  }

◆ local_size() [2/2]

template<MemArrange Arrangement, typename IndexType >
constexpr SizeType dash::BlockPattern< 1, Arrangement, IndexType >::local_size ( ) const
inlinenoexcept

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 985 of file BlockPattern1D.h.

986  {
987  return _local_size;
988  }

◆ max_blocksize()

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

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

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

Definition at line 943 of file BlockPattern1D.h.

943  {
944  return _blocksize;
945  }

◆ memory_order()

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

Memory order followed by the pattern.

Definition at line 1086 of file BlockPattern1D.h.

1086  {
1087  return Arrangement;
1088  }

◆ ndim()

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

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

Definition at line 1093 of file BlockPattern1D.h.

1093  {
1094  return 1;
1095  }

◆ num_units()

template<MemArrange Arrangement, typename IndexType >
constexpr IndexType dash::BlockPattern< 1, Arrangement, IndexType >::num_units ( ) const
inlinenoexcept

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

See also
Pattern Concept

Definition at line 995 of file BlockPattern1D.h.

995  {
996  return _nunits;
997  }

◆ operator!=()

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

Inquality comparison operator.

Parameters
otherPattern instance to compare for inequality

Definition at line 345 of file BlockPattern1D.h.

348  {
349  return !(*this == other);
350  }

◆ operator=() [1/2]

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

Move-assignment operator.

◆ operator=() [2/2]

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

Assignment operator.

◆ operator==()

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

Equality comparison operator.

Parameters
otherPattern instance to compare for equality

Definition at line 321 of file BlockPattern1D.h.

324  {
325  // no need to compare all members as most are derived from
326  // constructor arguments.
327  return (
328  this == &other
329  || ( _size == other._size &&
330  _distspec == other._distspec &&
331  _teamspec == other._teamspec &&
332  _nblocks == other._nblocks &&
333  _nlblocks == other._nlblocks &&
334  _local_size == other._local_size &&
335  _blocksize == other._blocksize &&
336  _nunits == other._nunits &&
337  _lbegin_lend == other._lbegin_lend
338  )
339  );
340  }

◆ size()

template<MemArrange Arrangement, typename IndexType >
constexpr IndexType dash::BlockPattern< 1, Arrangement, IndexType >::size ( ) const
inlinenoexcept

The number of elements arranged in this pattern.

See also
Pattern Concept

Definition at line 1013 of file BlockPattern1D.h.

1013  {
1014  return _size;
1015  }

◆ sizespec()

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

Size specification of the index space mapped by this pattern.

See also
Pattern Concept

Definition at line 1037 of file BlockPattern1D.h.

1037  {
1038  return SizeSpec_t(std::array<SizeType, 1> {{ _size }});
1039  }

◆ team()

template<MemArrange Arrangement, typename IndexType >
constexpr dash::Team& dash::BlockPattern< 1, Arrangement, IndexType >::team ( ) const
inlinenoexcept

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

Definition at line 1021 of file BlockPattern1D.h.

1021  {
1022  return *_team;
1023  }

◆ teamspec()

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

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

See also
Pattern Concept

Definition at line 1056 of file BlockPattern1D.h.

1056  {
1057  return _teamspec;
1058  }

◆ underfilled_blocksize()

template<MemArrange Arrangement, typename IndexType >
constexpr SizeType dash::BlockPattern< 1, 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 1102 of file BlockPattern1D.h.

References dash::BlockPattern< NumDimensions, Arrangement, IndexType >::BlockPattern(), dash::BlockPattern< NumDimensions, Arrangement, IndexType >::blocksize(), dash::BlockPattern< NumDimensions, Arrangement, IndexType >::distspec(), dash::BlockPattern< NumDimensions, Arrangement, IndexType >::global(), dash::BlockPattern< NumDimensions, Arrangement, IndexType >::local_size(), dash::Distribution::max_blocksize_in_range(), dash::Team::size(), and dash::BlockPattern< NumDimensions, Arrangement, IndexType >::size().

1103  {
1104  // Underflow blocksize = regular blocksize - overflow blocksize:
1105  return ( _blocksize == 0 || _size % _blocksize == 0
1106  ? 0
1107  : _blocksize - (_size % _blocksize)
1108  );
1109  }

◆ unit_at() [1/4]

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

unit_at

Convert given point in pattern to its assigned unit id.

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

Definition at line 379 of file BlockPattern1D.h.

383  {
384  return team_unit_t (((coords[0] + viewspec.offset(0)) / _blocksize)
385  % _nunits);
386  }
constexpr std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.
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<MemArrange Arrangement, typename IndexType >
constexpr team_unit_t dash::BlockPattern< 1, 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 393 of file BlockPattern1D.h.

394  {
395  return team_unit_t((coords[0] / _blocksize) % _nunits);
396  }
constexpr std::array< IndexType, NumDimensions > coords(IndexType index) const
Convert given global linear offset (index) to global cartesian coordinates.
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319

◆ unit_at() [3/4]

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

Convert given global linear index to its assigned unit id.

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

Definition at line 403 of file BlockPattern1D.h.

408  {
409  return team_unit_t(((global_pos + viewspec.offset(0)) / _blocksize)
410  % _nunits);
411  }
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319

◆ unit_at() [4/4]

template<MemArrange Arrangement, typename IndexType >
constexpr team_unit_t dash::BlockPattern< 1, 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 418 of file BlockPattern1D.h.

421  {
422  return team_unit_t((global_pos / _blocksize) % _nunits);
423  }
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
Definition: Types.h:319

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