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
IndexVector.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_VECTOR_H_
41 #define INDEX_VECTOR_H_
42 
43 #include <vector>
44 
45 #include "Vector.h"
46 #include "Index.h"
47 
48 #include "detail/DeviceList.h"
49 #include "detail/skelclDll.h"
50 
51 namespace skelcl {
52 
56 typedef const Vector<Index> IndexVector;
57 
71 template <>
72 class SKELCL_DLL Vector<Index> {
73 public:
77  typedef Index value_type;
78 
82  typedef size_t size_type;
83 
87  Vector(const value_type size);
88 
93  Vector(const Vector<Index>& rhs);
94 
95  ~Vector();
96 
97  // TODO: finish vector interface
98 // typedef ?? const_iterator;
99 // const_iterator begin() const;
100 // const_iterator end() const;
101  // ...
102 
108  size_type size() const;
109 
117  detail::Sizes sizes() const;
118 
130  value_type operator[]( size_type n ) const;
131 
143  value_type at( size_type n ) const;
144 
150  value_type front() const;
151 
157  value_type back() const;
158 
161  //
164  detail::Distribution<Vector<Index>>& distribution() const;
165 
173  template <typename U>
174  void setDistribution(const detail::Distribution<Vector<U>>& distribution)
175  const;
176 
184  template <typename U>
185  void setDistribution(const std::unique_ptr<detail::Distribution<Vector<U>>>&
186  newDistribution) const;
187 
195  void setDistribution(std::unique_ptr<detail::Distribution<Vector<Index>>>&&
196  newDistribution) const;
197 
207  static std::string deviceFunctions();
208 
215  const detail::DeviceBuffer& deviceBuffer(const detail::Device& device) const;
216 
223  std::vector<Index>& hostBuffer() const;
224 
231  void dataOnDeviceModified() const;
232 
239  void dataOnHostModified() const;
240 
241 private:
242  Vector();// = delete;
243  Vector(Vector<Index> && rhs);// = delete;
244  Vector<Index>& operator=(const Vector<Index>&);// = delete;
245  Vector<Index>& operator=(Vector<Index> && rhs);// = delete;
246 
247  std::string getInfo() const;
248 
249  std::string getDebugInfo() const;
250 
251  value_type _maxIndex;
252  mutable
253  std::unique_ptr<detail::Distribution<Vector<Index>>> _distribution;
254 };
255 
256 } // namespace skelcl
257 
258 #include "detail/IndexVectorDef.h"
259 
260 #endif // INDEX_VECTOR_H_
261 
Index value_type
Defines the type of the elements in the Vector.
Definition: IndexVector.h:77
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
size_t size_type
Defines the type used to denote size of the Vector.
Definition: IndexVector.h:82
const Vector< Index > IndexVector
An simple to use alias for the Vector class.
Definition: IndexVector.h:56
The Vector class is a one dimensional container which makes its data accessible on the host as well a...
Definition: Vector.h:113
This class defines an Index, i.e. an unsigned integer representing a value in a one-dimensional index...
Definition: Index.h:54
The IndexVector (a.k.a. Vector) class is a special implementation of a Vector with Elements of...
Definition: IndexVector.h:72