DASH  0.3.0
dash::DistributionSpec< NumDimensions > Class Template Reference

DistributionSpec describes distribution patterns of all dimensions,. More...

#include <Dimensional.h>

Public Member Functions

 DistributionSpec ()
 Default constructor, initializes default blocked distribution (BLOCKED, NONE*). More...
 
template<typename... Values>
 DistributionSpec (Distribution value, Values... values)
 Constructor, initializes distribution with given distribution types for every dimension. More...
 
 DistributionSpec (const std::array< Distribution, NumDimensions > &values)
 Constructor, initializes distribution with given distribution types for every dimension. More...
 
bool is_tiled_in_dimension (unsigned int dimension) const
 Whether the distribution in the given dimension is tiled. More...
 
bool is_tiled () const
 Whether the distribution is tiled in any dimension. More...
 
constexpr const std::array< Distribution, NumDimensions > & values () const
 Return value with all dimensions as array of NumDimensions elements. More...
 
Distribution dim (dim_t dimension) const
 The value in the given dimension. More...
 
constexpr Distribution operator[] (size_t dimension) const
 Subscript operator, access to value in dimension given by index. More...
 
Distributionoperator[] (size_t dimension)
 Subscript assignment operator, access to value in dimension given by index. More...
 
constexpr bool operator== (const self_t &other) const
 Equality comparison operator. More...
 
constexpr bool operator!= (const self_t &other) const
 Equality comparison operator. More...
 
constexpr dim_t rank () const
 The number of dimensions of the value. More...
 

Static Public Member Functions

static constexpr dim_t ndim ()
 The number of dimensions of the value. More...
 

Friends

template<dim_t NumDimensions_>
std::ostream & operator<< (std::ostream &os, const DistributionSpec< NumDimensions_ > &distspec)
 

Detailed Description

template<dim_t NumDimensions>
class dash::DistributionSpec< NumDimensions >

DistributionSpec describes distribution patterns of all dimensions,.

See also
dash::Distribution.
Examples:
ex.06.pattern-block-visualizer/main.cpp, ex.10.radixsort/main.cpp, ex.11.halo-stencil/main.cpp, and ex.11.simple-stencil/main.cpp.

Definition at line 222 of file Dimensional.h.

Constructor & Destructor Documentation

◆ DistributionSpec() [1/3]

template<dim_t NumDimensions>
dash::DistributionSpec< NumDimensions >::DistributionSpec ( )
inline

Default constructor, initializes default blocked distribution (BLOCKED, NONE*).

Definition at line 238 of file Dimensional.h.

239  {
240  this->_values[0] = BLOCKED;
241  for (dim_t i = 1; i < NumDimensions; ++i) {
242  this->_values[i] = NONE;
243  }
244  }
No global boundary Halos.
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39

◆ DistributionSpec() [2/3]

template<dim_t NumDimensions>
template<typename... Values>
dash::DistributionSpec< NumDimensions >::DistributionSpec ( Distribution  value,
Values...  values 
)
inline

Constructor, initializes distribution with given distribution types for every dimension.

Example:

// Blocked distribution in second dimension (y), cyclic distribution
// in third dimension (z)
DistributionSpec<3> ds(NONE, BLOCKED, CYCLIC);

Definition at line 258 of file Dimensional.h.

259  : Dimensional<Distribution, NumDimensions>::Dimensional(value, values...)
260  {
261  for (dim_t i = 1; i < NumDimensions; ++i) {
262  if (this->_values[i].type == dash::internal::DIST_TILE) {
263  _is_tiled = true;
264  break;
265  }
266  }
267  }
constexpr const std::array< Distribution, NumDimensions > & values() const
Return value with all dimensions as array of NumDimensions elements.
Definition: Dimensional.h:142
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39

◆ DistributionSpec() [3/3]

template<dim_t NumDimensions>
dash::DistributionSpec< NumDimensions >::DistributionSpec ( const std::array< Distribution, NumDimensions > &  values)
inline

Constructor, initializes distribution with given distribution types for every dimension.

Example:

// Blocked distribution in second dimension (y), cyclic distribution
// in third dimension (z)
DistributionSpec<3> ds(NONE, BLOCKED, CYCLIC);

Definition at line 280 of file Dimensional.h.

281  : Dimensional<Distribution, NumDimensions>::Dimensional(values)
282  {
283  DASH_LOG_TRACE_VAR("DistributionSpec(distribution[])", values);
284  for (dim_t i = 1; i < NumDimensions; ++i) {
285  if (this->_values[i].type == dash::internal::DIST_TILE) {
286  _is_tiled = true;
287  break;
288  }
289  }
290  }
constexpr const std::array< Distribution, NumDimensions > & values() const
Return value with all dimensions as array of NumDimensions elements.
Definition: Dimensional.h:142
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39

Member Function Documentation

◆ dim()

Distribution dash::Dimensional< Distribution , NumDimensions >::dim ( dim_t  dimension) const
inlineinherited

The value in the given dimension.

Parameters
dimensionThe dimension
Returns
The value in the given dimension

Definition at line 152 of file Dimensional.h.

152  {
153  DASH_ASSERT_LT(
154  dimension, NumDimensions,
155  "Dimension for Dimensional::extent() must be lower than " <<
156  NumDimensions);
157  return _values[dimension];
158  }

◆ is_tiled()

template<dim_t NumDimensions>
bool dash::DistributionSpec< NumDimensions >::is_tiled ( ) const
inline

Whether the distribution is tiled in any dimension.

Definition at line 304 of file Dimensional.h.

Referenced by dash::TeamSpec< NumDimensions, IndexType >::TeamSpec().

304  {
305  return _is_tiled;
306  }

◆ is_tiled_in_dimension()

template<dim_t NumDimensions>
bool dash::DistributionSpec< NumDimensions >::is_tiled_in_dimension ( unsigned int  dimension) const
inline

Whether the distribution in the given dimension is tiled.

Definition at line 295 of file Dimensional.h.

296  {
297  return (_is_tiled &&
298  this->_values[dimension].type == dash::internal::DIST_TILE);
299  }

◆ ndim()

static constexpr dim_t dash::Dimensional< Distribution , NumDimensions >::ndim ( )
inlinestaticinherited

The number of dimensions of the value.

Definition at line 207 of file Dimensional.h.

207  {
208  return NumDimensions;
209  }

◆ operator!=()

constexpr bool dash::Dimensional< Distribution , NumDimensions >::operator!= ( const self_t other) const
inlineinherited

Equality comparison operator.

Definition at line 193 of file Dimensional.h.

193  {
194  return !(*this == other);
195  }

◆ operator==()

constexpr bool dash::Dimensional< Distribution , NumDimensions >::operator== ( const self_t other) const
inlineinherited

Equality comparison operator.

Definition at line 186 of file Dimensional.h.

186  {
187  return this == &other || _values == other._values;
188  }

◆ operator[]() [1/2]

constexpr Distribution dash::Dimensional< Distribution , NumDimensions >::operator[] ( size_t  dimension) const
inlineinherited

Subscript operator, access to value in dimension given by index.

Alias for dim.

Parameters
dimensionThe dimension
Returns
The value in the given dimension

Definition at line 167 of file Dimensional.h.

167  {
168  return _values[dimension];
169  }

◆ operator[]() [2/2]

Distribution & dash::Dimensional< Distribution , NumDimensions >::operator[] ( size_t  dimension)
inlineinherited

Subscript assignment operator, access to value in dimension given by index.

Alias for dim.

Parameters
dimensionThe dimension
Returns
A reference to the value in the given dimension

Definition at line 179 of file Dimensional.h.

179  {
180  return _values[dimension];
181  }

◆ rank()

constexpr dim_t dash::Dimensional< Distribution , NumDimensions >::rank ( ) const
inlineinherited

The number of dimensions of the value.

Definition at line 200 of file Dimensional.h.

Referenced by dash::TeamSpec< NumDimensions, IndexType >::TeamSpec().

200  {
201  return NumDimensions;
202  }

◆ values()

constexpr const std::array<Distribution , NumDimensions>& dash::Dimensional< Distribution , NumDimensions >::values ( ) const
inlineinherited

Return value with all dimensions as array of NumDimensions elements.

Definition at line 142 of file Dimensional.h.

142  {
143  return _values;
144  }

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