Skip to content
42 changes: 20 additions & 22 deletions dash/include/dash/pattern/BlockPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ class BlockPattern
BlockSpec_t;
typedef CartesianIndexSpace<NumDimensions, Arrangement, IndexType>
BlockSizeSpec_t;
typedef DistributionSpec<NumDimensions>
DistributionSpec_t;
typedef TeamSpec<NumDimensions, IndexType>
TeamSpec_t;
typedef SizeSpec<NumDimensions, SizeType>
SizeSpec_t;
typedef ViewSpec<NumDimensions, IndexType>
ViewSpec_t;
typedef internal::PatternArguments<NumDimensions, IndexType>
Expand All @@ -107,15 +101,19 @@ class BlockPattern
std::array<index_type, NumDimensions> coords;
} local_coords_t;

typedef DistributionSpec<NumDimensions> distribution_spec;
typedef TeamSpec<NumDimensions, IndexType> team_spec;
typedef SizeSpec<NumDimensions, SizeType> size_spec;

private:
/// Distribution type (BLOCKED, CYCLIC, BLOCKCYCLIC, TILE or NONE) of
/// all dimensions. Defaults to BLOCKED in first, and NONE in higher
/// dimensions
DistributionSpec_t _distspec;
distribution_spec _distspec;
/// Team containing the units to which the patterns element are mapped
dash::Team * _team = nullptr;
/// Cartesian arrangement of units within the team
TeamSpec_t _teamspec;
team_spec _teamspec;
/// Total amount of units to which this pattern's elements are mapped
SizeType _nunits = 0;
/// The global layout of the pattern's elements in memory respective to
Expand Down Expand Up @@ -223,12 +221,12 @@ class BlockPattern
*/
BlockPattern(
/// Pattern size (extent, number of elements) in every dimension
const SizeSpec_t &sizespec,
const size_spec &sizespec,
/// Distribution type (BLOCKED, CYCLIC, BLOCKCYCLIC, TILE or NONE) of
/// all dimensions.
DistributionSpec_t dist,
distribution_spec dist,
/// Cartesian arrangement of units within the team
const TeamSpec_t &teamspec,
const team_spec &teamspec,
/// Team containing units to which this pattern maps its elements
dash::Team &team = dash::Team::All())
: _distspec(std::move(dist))
Expand Down Expand Up @@ -285,11 +283,11 @@ class BlockPattern
*/
BlockPattern(
/// Pattern size (extent, number of elements) in every dimension
const SizeSpec_t &sizespec,
const size_spec &sizespec,
/// Distribution type (BLOCKED, CYCLIC, BLOCKCYCLIC, TILE or NONE) of
/// all dimensions. Defaults to BLOCKED in first, and NONE in higher
/// dimensions
DistributionSpec_t dist = DistributionSpec_t(),
distribution_spec dist = distribution_spec(),
/// Team containing units to which this pattern maps its elements
Team &team = dash::Team::All())
: _distspec(std::move(dist))
Expand Down Expand Up @@ -1251,7 +1249,7 @@ class BlockPattern
/**
* Distribution specification of this pattern.
*/
constexpr const DistributionSpec_t & distspec() const noexcept
constexpr const distribution_spec & distspec() const noexcept
{
return _distspec;
}
Expand All @@ -1261,9 +1259,9 @@ class BlockPattern
*
* \see DashPatternConcept
*/
constexpr SizeSpec_t sizespec() const noexcept
constexpr size_spec sizespec() const noexcept
{
return SizeSpec_t(_memory_layout.extents());
return size_spec(_memory_layout.extents());
}

/**
Expand All @@ -1283,7 +1281,7 @@ class BlockPattern
*
* \see DashPatternConcept
*/
constexpr const TeamSpec_t & teamspec() const noexcept
constexpr const team_spec & teamspec() const noexcept
{
return _teamspec;
}
Expand Down Expand Up @@ -1379,9 +1377,9 @@ class BlockPattern
* distribution spec.
*/
BlockSizeSpec_t initialize_blocksizespec(
const SizeSpec_t & sizespec,
const DistributionSpec_t & distspec,
const TeamSpec_t & teamspec) const
const size_spec & sizespec,
const distribution_spec & distspec,
const team_spec & teamspec) const
{
DASH_LOG_TRACE_VAR("BlockPattern.init_blocksizespec", teamspec.size());
if (teamspec.size() == 0) {
Expand All @@ -1404,8 +1402,8 @@ class BlockPattern
* spec.
*/
BlockSpec_t initialize_blockspec(
const SizeSpec_t & sizespec,
const DistributionSpec_t & distspec,
const size_spec & sizespec,
const distribution_spec & distspec,
const BlockSizeSpec_t & blocksizespec) const
{
if (blocksizespec.size() == 0) {
Expand Down
34 changes: 16 additions & 18 deletions dash/include/dash/pattern/BlockPattern1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ class BlockPattern<1, Arrangement, IndexType>
LocalMemoryLayout_t;
typedef CartesianSpace<NumDimensions, SizeType>
BlockSpec_t;
typedef DistributionSpec<NumDimensions>
DistributionSpec_t;
typedef TeamSpec<NumDimensions, IndexType>
TeamSpec_t;
typedef SizeSpec<NumDimensions, SizeType>
SizeSpec_t;
typedef ViewSpec<NumDimensions, IndexType>
ViewSpec_t;
typedef internal::PatternArguments<NumDimensions, IndexType>
Expand All @@ -101,18 +95,22 @@ class BlockPattern<1, Arrangement, IndexType>
std::array<index_type, NumDimensions> coords;
} local_coords_t;

typedef DistributionSpec<NumDimensions> distribution_spec;
typedef TeamSpec<NumDimensions, IndexType> team_spec;
typedef SizeSpec<NumDimensions, SizeType> size_spec;

private:
/// Extent of the linear pattern.
SizeType _size = 0;
/// Global memory layout of the pattern.
MemoryLayout_t _memory_layout;
/// Distribution type (BLOCKED, CYCLIC, BLOCKCYCLIC or NONE) of
/// all dimensions. Defaults to BLOCKED.
DistributionSpec_t _distspec;
distribution_spec _distspec;
/// Team containing the units to which the patterns element are mapped
dash::Team * _team = nullptr;
/// Cartesian arrangement of units within the team
TeamSpec_t _teamspec;
team_spec _teamspec;
/// Total amount of units to which this pattern's elements are mapped
SizeType _nunits = 0;
/// Maximum extents of a block in this pattern
Expand Down Expand Up @@ -194,11 +192,11 @@ class BlockPattern<1, Arrangement, IndexType>
*/
BlockPattern(
/// Pattern size (extent, number of elements) in every dimension
const SizeSpec_t sizespec,
const size_spec sizespec,
/// Distribution type (BLOCKED, CYCLIC, BLOCKCYCLIC or NONE).
const DistributionSpec_t dist,
const distribution_spec dist,
/// Cartesian arrangement of units within the team
const TeamSpec_t teamspec,
const team_spec teamspec,
/// Team containing units to which this pattern maps its elements
dash::Team & team = dash::Team::All())
: _size(sizespec.size()),
Expand Down Expand Up @@ -255,10 +253,10 @@ class BlockPattern<1, Arrangement, IndexType>
*/
BlockPattern(
/// Pattern size (extent, number of elements) in every dimension
const SizeSpec_t sizespec,
const size_spec sizespec,
/// Distribution type (BLOCKED, CYCLIC, BLOCKCYCLIC, TILE or NONE).
/// Defaults to BLOCKED.
const DistributionSpec_t dist = DistributionSpec_t(),
const distribution_spec dist = distribution_spec(),
/// Team containing units to which this pattern maps its elements
Team & team = dash::Team::All())
: _size(sizespec.size()),
Expand Down Expand Up @@ -1025,7 +1023,7 @@ class BlockPattern<1, Arrangement, IndexType>
/**
* Distribution specification of this pattern.
*/
constexpr const DistributionSpec_t & distspec() const noexcept {
constexpr const distribution_spec & distspec() const noexcept {
return _distspec;
}

Expand All @@ -1034,8 +1032,8 @@ class BlockPattern<1, Arrangement, IndexType>
*
* \see DashPatternConcept
*/
constexpr SizeSpec_t sizespec() const {
return SizeSpec_t(std::array<SizeType, 1> {{ _size }});
constexpr size_spec sizespec() const {
return size_spec(std::array<SizeType, 1> {{ _size }});
}

/**
Expand All @@ -1053,7 +1051,7 @@ class BlockPattern<1, Arrangement, IndexType>
*
* \see DashPatternConcept
*/
constexpr const TeamSpec_t & teamspec() const {
constexpr const team_spec & teamspec() const {
return _teamspec;
}

Expand Down Expand Up @@ -1141,7 +1139,7 @@ class BlockPattern<1, Arrangement, IndexType>
*/
SizeType initialize_blocksize(
SizeType size,
const DistributionSpec_t & distspec,
const distribution_spec & distspec,
SizeType nunits) const {
DASH_LOG_TRACE_VAR("BlockPattern<1>.init_blocksize", nunits);
if (nunits == 0) {
Expand Down
44 changes: 21 additions & 23 deletions dash/include/dash/pattern/CSRPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ class CSRPattern<1, Arrangement, IndexType>
LocalMemoryLayout_t;
typedef CartesianSpace<NumDimensions, SizeType>
BlockSpec_t;
typedef DistributionSpec<NumDimensions>
DistributionSpec_t;
typedef TeamSpec<NumDimensions, IndexType>
TeamSpec_t;
typedef SizeSpec<NumDimensions, SizeType>
SizeSpec_t;
typedef ViewSpec<NumDimensions, IndexType>
ViewSpec_t;
typedef internal::PatternArguments<NumDimensions, IndexType>
Expand All @@ -121,6 +115,10 @@ class CSRPattern<1, Arrangement, IndexType>
std::array<index_type, NumDimensions> coords;
} local_coords_t;

typedef DistributionSpec<NumDimensions> distribution_spec;
typedef TeamSpec<NumDimensions, IndexType> team_spec;
typedef SizeSpec<NumDimensions, SizeType> size_spec;

private:
/// Extent of the linear pattern.
SizeType _size = 0;
Expand All @@ -134,11 +132,11 @@ class CSRPattern<1, Arrangement, IndexType>
BlockSpec_t _blockspec;
/// Distribution type (BLOCKED, CYCLIC, BLOCKCYCLIC or NONE) of
/// all dimensions. Defaults to BLOCKED.
DistributionSpec_t _distspec;
distribution_spec _distspec;
/// Team containing the units to which the patterns element are mapped
dash::Team * _team = nullptr;
/// Cartesian arrangement of units within the team
TeamSpec_t _teamspec;
team_spec _teamspec;
/// Total amount of units to which this pattern's elements are mapped
SizeType _nunits = 0;
/// Actual number of local elements of the active unit.
Expand Down Expand Up @@ -187,11 +185,11 @@ class CSRPattern<1, Arrangement, IndexType>
*/
CSRPattern(
/// Size spec of the pattern.
const SizeSpec_t & sizespec,
const size_spec & sizespec,
/// Distribution spec.
const DistributionSpec_t & distspec,
const distribution_spec & distspec,
/// Cartesian arrangement of units within the team
const TeamSpec_t & teamspec,
const team_spec & teamspec,
/// Team containing units to which this pattern maps its elements.
Team & team = dash::Team::All())
: _size(sizespec.size()),
Expand All @@ -204,7 +202,7 @@ class CSRPattern<1, Arrangement, IndexType>
_memory_layout(std::array<SizeType, 1> {{ _size }}),
_blockspec(initialize_blockspec(
_local_sizes)),
_distspec(DistributionSpec_t()),
_distspec(distribution_spec()),
_team(&team),
_teamspec(
teamspec,
Expand Down Expand Up @@ -234,9 +232,9 @@ class CSRPattern<1, Arrangement, IndexType>
*/
CSRPattern(
/// Size spec of the pattern.
const SizeSpec_t & sizespec,
const size_spec & sizespec,
/// Distribution spec.
const DistributionSpec_t & distspec,
const distribution_spec & distspec,
/// Team containing units to which this pattern maps its elements.
Team & team = dash::Team::All())
: _size(sizespec.size()),
Expand All @@ -249,7 +247,7 @@ class CSRPattern<1, Arrangement, IndexType>
_memory_layout(std::array<SizeType, 1> {{ _size }}),
_blockspec(initialize_blockspec(
_local_sizes)),
_distspec(DistributionSpec_t()),
_distspec(distribution_spec()),
_team(&team),
_teamspec(_distspec, *_team),
_nunits(_team->size()),
Expand Down Expand Up @@ -307,7 +305,7 @@ class CSRPattern<1, Arrangement, IndexType>
/// Number of local elements for every unit in the active team.
const std::vector<size_type> & local_sizes,
/// Cartesian arrangement of units within the team
const TeamSpec_t & teamspec,
const team_spec & teamspec,
/// Team containing units to which this pattern maps its elements
dash::Team & team = dash::Team::All())
: _size(initialize_size(
Expand All @@ -318,7 +316,7 @@ class CSRPattern<1, Arrangement, IndexType>
_memory_layout(std::array<SizeType, 1> {{ _size }}),
_blockspec(initialize_blockspec(
_local_sizes)),
_distspec(DistributionSpec_t()),
_distspec(distribution_spec()),
_team(&team),
_teamspec(
teamspec,
Expand Down Expand Up @@ -362,7 +360,7 @@ class CSRPattern<1, Arrangement, IndexType>
_blockspec(
initialize_blockspec(
_local_sizes)),
_distspec(DistributionSpec_t()),
_distspec(distribution_spec()),
_team(&team),
_teamspec(_distspec, *_team),
_nunits(_team->size()),
Expand Down Expand Up @@ -1052,7 +1050,7 @@ class CSRPattern<1, Arrangement, IndexType>
/**
* Distribution specification of this pattern.
*/
constexpr const DistributionSpec_t & distspec() const noexcept
constexpr const distribution_spec & distspec() const noexcept
{
return _distspec;
}
Expand All @@ -1062,9 +1060,9 @@ class CSRPattern<1, Arrangement, IndexType>
*
* \see DashPatternConcept
*/
constexpr SizeSpec_t sizespec() const noexcept
constexpr size_spec sizespec() const noexcept
{
return SizeSpec_t(std::array<SizeType, 1> {{ _size }});
return size_spec(std::array<SizeType, 1> {{ _size }});
}

/**
Expand All @@ -1084,7 +1082,7 @@ class CSRPattern<1, Arrangement, IndexType>
*
* \see DashPatternConcept
*/
constexpr const TeamSpec_t & teamspec() const noexcept
constexpr const team_spec & teamspec() const noexcept
{
return _teamspec;
}
Expand Down Expand Up @@ -1181,7 +1179,7 @@ class CSRPattern<1, Arrangement, IndexType>
*/
std::vector<size_type> initialize_local_sizes(
size_type total_size,
const DistributionSpec_t & distspec,
const distribution_spec & distspec,
const dash::Team & team) const
{
DASH_LOG_TRACE_VAR("CSRPattern.init_local_sizes()", total_size);
Expand Down
Loading