DASH  0.3.0
MatrixRefView.h
1 #ifndef DASH__MATRIX__MATRIX_REF_VIEW_H_INCLUDED
2 #define DASH__MATRIX__MATRIX_REF_VIEW_H_INCLUDED
3 
4 #include <dash/dart/if/dart.h>
5 
6 #include <dash/Meta.h>
7 #include <dash/Team.h>
8 #include <dash/Pattern.h>
9 #include <dash/GlobRef.h>
10 #include <dash/HView.h>
11 
12 #include <dash/iterator/GlobIter.h>
13 
14 #include <iostream>
15 #include <sstream>
16 
17 
18 namespace dash {
19 
21 template <
22  typename T,
23  dim_t NumDimensions,
24  typename IndexT,
25  class PatternT,
26  typename LocalMemT>
27 class Matrix;
29 template <
30  typename T,
31  dim_t NumDimensions,
32  dim_t CUR,
33  class PatternT,
34  typename LocalMemT >
35 class MatrixRef;
37 template <
38  typename T,
39  dim_t NumDimensions,
40  dim_t CUR,
41  class PatternT,
42  typename LocalMemT>
43 class LocalMatrixRef;
44 
52 template <
53  typename T,
54  dim_t NumDimensions,
55  class PatternT,
56  class LocalMemT>
58 {
59  using matrix_t =
61 
62 public:
63  typedef typename PatternT::index_type index_type;
64 
65  private:
67  dim_t _dim = 0;
69  matrix_t * _mat;
72  ::std::array<index_type, NumDimensions> _coord = {{ }};
77 
78  public:
79  template<
80  typename T_,
81  dim_t NumDimensions1,
82  class PatternT_,
83  typename LocalMemT_>
84  friend std::ostream & operator<<(
85  std::ostream & os,
87 
88  template<
89  typename T_,
90  dim_t NumDimensions1,
91  dim_t NumDimensions2,
92  class PatternT_,
93  typename LocalMemT_>
94  friend class MatrixRef;
95  template<
96  typename T_,
97  dim_t NumDimensions1,
98  class PatternT_,
99  typename LocalMemT_>
100  friend class MatrixRefView;
101  template<
102  typename T_,
103  dim_t NumDimensions1,
104  dim_t NumDimensions2,
105  class PatternT_,
106  typename LocalMemT_>
107  friend class LocalMatrixRef;
108  template<
109  typename T_,
110  dim_t NumDimensions1,
111  typename IndexT_,
112  class PatternT_,
113  typename LocalMemT_ >
114  friend class Matrix;
115 
117 
118  template <class T_>
121 
122  template <class T_>
125 
126  GlobRef<T> global_reference();
127  GlobRef<const T> global_reference() const;
128 
129  GlobRef<T> global_reference(
130  const ::std::array<typename PatternT::index_type, NumDimensions> & coords
131  );
132  GlobRef<const T> global_reference(
133  const ::std::array<typename PatternT::index_type, NumDimensions> & coords
134  ) const;
135 };
136 
137 template<
138  typename T_,
139  dim_t NumDimensions1,
140  class PatternT_,
141  typename LocalMemT >
142 std::ostream & operator<<(
143  std::ostream & os,
145  std::ostringstream ss;
146  ss << dash::typestr(mrefview)
147  << "("
148  << "dim:" << mrefview._dim << ", "
149  << "coords:" << mrefview._coord << ", "
150  << "view:" << mrefview._viewspec
151  << ")";
152  return operator<<(os, ss.str());
153 }
154 
155 } // namespace dash
156 
157 #include <dash/matrix/internal/MatrixRefView-inl.h>
158 
159 #endif // DASH__MATRIX__MATRIX_REF_VIEW_H_INCLUDED
Forward-declaration.
This class is a simple memory pool which holds allocates elements of size ValueType.
Definition: AllOf.h:8
int dim_t
Scalar type for a dimension value, with 0 indicating the first dimension.
Definition: Types.h:39
Stores information needed by subscripting and subdim selection.
Definition: MatrixRefView.h:57
std::string typestr(const T &obj)
Returns string containing the type name of the given object.
Definition: TypeInfo.h:20
Forward-declaration.
Forward-declaration.