SkelCL
SkelCL is a high level multi GPU skeleton library developed at the university of Münster, Germany.
 All Classes Namespaces Files Functions Variables Typedefs Groups
IndexMatrix.h
1 /*****************************************************************************
2  * Copyright (c) 2011-2012 The SkelCL Team as listed in CREDITS.txt *
3  * http://skelcl.uni-muenster.de *
4  * *
5  * This file is part of SkelCL. *
6  * SkelCL is available under multiple licenses. *
7  * The different licenses are subject to terms and condition as provided *
8  * in the files specifying the license. See "LICENSE.txt" for details *
9  * *
10  *****************************************************************************
11  * *
12  * SkelCL is free software: you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation, either version 3 of the License, or *
15  * (at your option) any later version. See "LICENSE-gpl.txt" for details. *
16  * *
17  * SkelCL is distributed in the hope that it will be useful, *
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20  * GNU General Public License for more details. *
21  * *
22  *****************************************************************************
23  * *
24  * For non-commercial academic use see the license specified in the file *
25  * "LICENSE-academic.txt". *
26  * *
27  *****************************************************************************
28  * *
29  * If you are interested in other licensing models, including a commercial- *
30  * license, please contact the author at michel.steuwer@uni-muenster.de *
31  * *
32  *****************************************************************************/
33 
39 
40 #ifndef INDEX_MATRIX_H_
41 #define INDEX_MATRIX_H_
42 
43 #include <vector>
44 
45 #include "Index.h"
46 #include "Matrix.h"
47 #include "Vector.h"
48 
49 #include "detail/DeviceList.h"
50 #include "detail/skelclDll.h"
51 
52 namespace skelcl {
53 
58 
72 template <>
73 class SKELCL_DLL Matrix<IndexPoint> {
74 public:
79 
84 
88  Matrix(const size_type size);
89 
90  ~Matrix();
91 
92  // TODO: finish matrix interface
93 // typedef ?? const_iterator;
94 // const_iterator begin() const;
95 // const_iterator end() const;
96  // ...
97 
103  size_type size() const;
104 
112  detail::Sizes sizes() const;
113 
125  value_type operator[]( size_type n ) const;
126 
137  value_type at( size_type n ) const;
138 
144  value_type front() const;
145 
152  value_type back() const;
153 
159  detail::Distribution<Matrix<IndexPoint>>& distribution() const;
160 
168  template <typename U>
169  void setDistribution(const detail::Distribution<Matrix<U>>& distribution)
170  const;
171 
179  template <typename U>
180  void setDistribution(const std::unique_ptr<detail::Distribution<Matrix<U>>>&
181  newDistribution) const;
182 
190  void setDistribution(std::unique_ptr<
191  detail::Distribution<Matrix<IndexPoint>>>&& newDistribution) const;
192 
202  static std::string deviceFunctions();
203 
210  const detail::DeviceBuffer& deviceBuffer(const detail::Device& device) const;
211 
218  std::vector<IndexPoint>& hostBuffer() const;
219 
226  void dataOnDeviceModified() const;
227 
234  void dataOnHostModified() const;
235 
236 private:
237  Matrix();// = delete;
238  Matrix(const Matrix<IndexPoint>& rhs);// = delete;
239  Matrix(Matrix<IndexPoint> && rhs);// = delete;
240  Matrix<IndexPoint>& operator=(const Matrix<IndexPoint>&);// = delete;
241  Matrix<IndexPoint>& operator=(Matrix<IndexPoint> && rhs);// = delete;
242 
243  std::string getInfo() const;
244 
245  std::string getDebugInfo() const;
246 
247  value_type _maxIndex;
248  mutable
249  std::unique_ptr<detail::Distribution<Matrix<IndexPoint>>> _distribution;
250 };
251 
252 } // namespace skelcl
253 
254 #include "detail/IndexMatrixDef.h"
255 
256 #endif // INDEX_MATRIX_H_
257 
The Matrix class is a two dimensional container which makes its data accessible on the host as well a...
Definition: Matrix.h:190
SKELCL_DLL detail::DeviceID device(size_t dID)
Creates an OpenCL device ID to be used as parameter of the init(detail::PlatformID, detail::DeviceID) function.
Definition: SkelCL.cpp:76
IndexPoint value_type
Defines the type of the elements in the Matrix.
Definition: IndexMatrix.h:78
This class defines a two dimensional size for a Matrix.
Definition: Matrix.h:67
This class defines an two-dimensional IndexPoint, i.e. a pair of unsigned integers representing a val...
Definition: Index.h:128
const Matrix< IndexPoint > IndexMatrix
An simple to use alias for the Matrix class.
Definition: IndexMatrix.h:57
skelcl::MatrixSize size_type
Defines the type used to denote size of the Matrix.
Definition: IndexMatrix.h:83
The IndexMatrix (a.k.a. Matrix) class is a special implementation of a Matrix with Elemen...
Definition: IndexMatrix.h:73