DASH  0.3.0
Pattern.h
1 #ifndef DASH__PATTERN_H__INCLUDED
2 #define DASH__PATTERN_H__INCLUDED
3 
4 #ifdef DOXYGEN
5 
6 namespace dash {
7 
83 template<
84  dim_t NumDimensions,
85  MemArrange Arrangement = ROW_MAJOR,
86  typename IndexType = dash::default_index_t
87 >
89 {
90  typedef typename std::make_unsigned<IndexType>::type SizeType;
92 
93 public:
94 
95  static constexpr char const * PatternName = "TheConcretePatternTypeName";
96 
97 public:
98 
99  typedef IndexType index_type;
100  typedef SizeType size_type;
101  typedef ViewSpecType viewspec_type;
102 
103  typedef struct {
104  team_unit_t unit;
105  index_type index;
107 
108  typedef struct {
109  team_unit_t unit;
110  std::array<index_type, NumDimensions> coords;
112 
113 public:
114 
121  PatternConcept(self_t & other);
122 
126  bool operator==(
128  const self_t & other) const;
129 
133  bool operator!=(
135  const self_t & other) const;
136 
140  PatternConcept & operator=(const PatternConcept & other);
141 
147  index_type lbegin() const;
148 
154  index_type lend() const;
155 
159 
167  const std::array<index_type, NumDimensions> & coords,
169  const ViewSpec_t & viewspec) const;
170 
177  const std::array<index_type, NumDimensions> & coords) const;
178 
186  index_type global_pos,
188  const ViewSpec_t & viewspec) const;
189 
201  index_type global_pos) const;
202 
206 
216  index_type extent(dim_t dim) const;
217 
229  index_type local_extent(dim_t dim) const;
230 
242  std::array<size_type, NumDimensions> local_extents() const;
243 
255  std::array<size_type, NumDimensions> local_extents(
256  team_unit_t unit) const;
257 
261 
268  index_type local_at(
270  const std::array<index_type, NumDimensions> & local_coords,
272  const ViewSpec_t & viewspec) const;
273 
279  index_type local_at(
281  const std::array<index_type, NumDimensions> & local_coords) const;
282 
289  local_coords_t local(
290  const std::array<index_type, NumDimensions> & global_coords) const;
291 
297  local_index_t local(
298  index_type g_index) const;
299 
306  std::array<index_type, NumDimensions> local_coords(
307  const std::array<index_type, NumDimensions> & global_coords) const;
308 
314  local_index_t local_index(
315  const std::array<index_type, NumDimensions> & global_coords) const;
316 
320 
326  std::array<index_type, NumDimensions> global(
327  team_unit_t unit,
328  const std::array<index_type, NumDimensions> & local_coords) const;
329 
335  std::array<index_type, NumDimensions> global(
336  const std::array<index_type, NumDimensions> & local_coords) const;
337 
346  index_type global(
347  index_type local_index) const;
348 
357  index_type global_index(
358  team_unit_t unit,
359  const std::array<index_type, NumDimensions> & local_coords) const;
360 
370  index_type global_at(
371  const std::array<index_type, NumDimensions> & view_coords,
372  const ViewSpec_t & viewspec) const;
373 
386  index_type global_at(
387  const std::array<index_type, NumDimensions> & global_coords) const;
388 
392 
401  index_type at(
402  const std::array<index_type, NumDimensions> & global_coords) const;
403 
411  index_type at(
412  const std::array<index_type, NumDimensions> & global_coords,
413  const ViewSpec_t & viewspec) const;
414 
422  template<typename ... Values>
423  index_type at(index_type value, Values ... values) const;
424 
428 
434  bool is_local(
435  index_type index,
436  team_unit_t unit) const;
437 
444  bool is_local(
445  index_type index) const;
446 
450 
454  const BlockSpec_t & blockspec() const;
455 
461  index_type block_at(
463  const std::array<index_type, NumDimensions> & g_coords) const;
464 
469  ViewSpec_t block(
470  index_type global_block_index) const;
471 
476  ViewSpec_t local_block(
477  index_type local_block_index) const;
478 
483  ViewSpec_t local_block_local(
484  index_type local_block_index) const;
485 
493  size_type blocksize(
495  dim_t dimension) const;
496 
505  size_type max_blocksize() const;
506 
513  inline size_type local_capacity() const;
514 
525  inline size_type local_size(
526  team_unit_t unit = UNDEFINED_TEAM_UNIT_ID) const;
527 
533  inline index_type capacity() const;
534 
540  inline index_type size() const;
541 
546  inline dash::Team & team() const;
547 
551  const DistributionSpec_t & distspec() const;
552 
558  SizeSpec_t sizespec() const;
559 
565  const std::array<size_type, NumDimensions> & extents() const;
566 
573  const TeamSpec_t & teamspec() const;
574 
581  std::array<index_type, NumDimensions> coords(
582  index_type index) const;
583 
590  std::array<index_type, NumDimensions> coords(
591  index_type index,
592  const ViewSpec_t & viewspec) const;
593 
597  constexpr static MemArrange memory_order();
598 
602  constexpr static dim_t ndim();
603 
609  size_type underfilled_blocksize(
610  dim_t dimension) const;
611 
612 };
613 
614 } // namespace dash
615 
616 #endif // DOXYGEN
617 
618 // Static regular pattern types:
619 #include <dash/pattern/BlockPattern.h>
620 #include <dash/pattern/TilePattern.h>
621 #include <dash/pattern/ShiftTilePattern.h>
622 #include <dash/pattern/SeqTilePattern.h>
623 
624 // Static irregular pattern types:
625 #include <dash/pattern/CSRPattern.h>
626 #include <dash/pattern/LoadBalancePattern.h>
627 
628 #include <dash/Types.h>
629 #include <dash/Distribution.h>
630 
631 namespace dash {
632 
639 template<
640  dim_t NumDimensions,
641  MemArrange Arrangement = ROW_MAJOR,
642  typename IndexType = dash::default_index_t
643 >
645 
646 } // namespace dash
647 
648 #include <dash/pattern/PatternIterator.h>
649 #include <dash/pattern/PatternProperties.h>
650 #include <dash/pattern/MakePattern.h>
651 
652 #endif // DASH__PATTERN_H__INCLUDED
constexpr team_unit_t UNDEFINED_TEAM_UNIT_ID
Invalid local unit ID.
Definition: Types.h:341
size_type underfilled_blocksize(dim_t dimension) const
Number of elements missing in the overflow block of given dimension compared to the regular blocksize...
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
Defines how a list of global indices is mapped to single units within a Team.
Definition: BlockPattern.h:42
size_type local_capacity() const
Maximum number of elements assigned to a single unit in total, equivalent to the local capacity of ev...
bool operator!=(const self_t &other) const
Inquality comparison operator.
This class is a simple memory pool which holds allocates elements of size ValueType.
Definition: AllOf.h:8
std::array< index_type, NumDimensions > local_coords(const std::array< index_type, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit&#39;s respective local coordinates.
static constexpr MemArrange memory_order()
Memory order followed by the pattern.
Specifies view parameters for implementing submat, rows and cols.
Definition: Dimensional.h:430
PatternConcept & operator=(const PatternConcept &other)
Assignment operator.
index_type lend() const
Resolves the global index past the last local element in the pattern.
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39
index_type global_at(const std::array< index_type, NumDimensions > &view_coords, const ViewSpec_t &viewspec) const
Global coordinates and viewspec to global position in the pattern&#39;s iteration order.
SizeSpec_t sizespec() const
Size specification of the index space mapped by this pattern.
static constexpr dim_t ndim()
Number of dimensions of the cartesian space partitioned by the pattern.
bool is_local(index_type index, team_unit_t unit) const
is_local
Defines how a list of global indices is mapped to single units within a Team.
Definition: Pattern.h:88
size_type max_blocksize() const
Maximum number of elements in a single block in all dimensions.
size_type 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...
index_type lbegin() const
Resolves the global index of the first local element in the pattern.
index_type capacity() const
The maximum number of elements arranged in this pattern.
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...
index_type block_at(const std::array< index_type, NumDimensions > &g_coords) const
Index of block at given global coordinates.
const TeamSpec_t & teamspec() const
Cartesian arrangement of the Team containing the units to which this pattern&#39;s elements are mapped...
internal::default_signed_index default_index_t
Signed integer type used as default for index values.
Definition: Types.h:59
team_unit_t unit_at(const std::array< index_type, NumDimensions > &coords, const ViewSpec_t &viewspec) const
unit_at
A Team instance specifies a subset of all available units.
Definition: Team.h:41
index_type global_index(team_unit_t unit, const std::array< index_type, NumDimensions > &local_coords) const
Resolve an element&#39;s linear global index from a given unit&#39;s local coordinates of that element...
std::array< index_type, NumDimensions > coords(index_type index) const
Convert given global linear offset (index) to global cartesian coordinates.
std::array< size_type, NumDimensions > local_extents() const
The actual number of elements in this pattern that are local to the active unit, by dimension...
index_type local_at(const std::array< index_type, NumDimensions > &local_coords, const ViewSpec_t &viewspec) const
local
index_type 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...
const std::array< size_type, NumDimensions > & extents() const
Size specification of the index space mapped by this pattern.
PatternConcept(self_t &other)
Copy constructor using non-const lvalue reference parameter.
ViewSpec_t block(index_type global_block_index) const
View spec (offset and extents) of block at global linear block index in cartesian element space...
index_type at(const std::array< index_type, NumDimensions > &global_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
index_type extent(dim_t dim) const
extent
dash::Team & team() const
The Team containing the units to which this pattern&#39;s elements are mapped.
local_coords_t local(const std::array< index_type, NumDimensions > &global_coords) const
Converts global coordinates to their associated unit and its respective local coordinates.
size_type blocksize(dim_t dimension) const
Maximum number of elements in a single block in the given dimension.
std::array< index_type, NumDimensions > global(team_unit_t unit, const std::array< index_type, NumDimensions > &local_coords) const
global
index_type size() const
The number of elements arranged in this pattern.
bool operator==(const self_t &other) const
Equality comparison operator.
local_index_t local_index(const std::array< index_type, NumDimensions > &global_coords) const
Resolves the unit and the local index from global coordinates.
const BlockSpec_t & blockspec() const
block
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...
const DistributionSpec_t & distspec() const
Distribution specification of this pattern.