Commit 80d3850d5d80998f6d554cf8e5f45a9a24ef13c1

Authored by Pavel Govyadinov
1 parent 5eeaf941

test

Showing 2 changed files with 48 additions and 48 deletions   Show diff stats
stim/gl/gl_spider.h
... ... @@ -73,8 +73,8 @@ class gl_spider
73 73 dV[best][1]*S[1]*R[1],
74 74 dV[best][2]*S[2]*R[2],
75 75 1);
76   - //next = (cT*next).norm();
77 76 next = (cT*next).norm();
  77 + //next = (cT*next);
78 78 setPosition( p[0]+next[0]*m[0]/stepsize,
79 79 p[1]+next[1]*m[0]/stepsize,
80 80 p[2]+next[2]*m[0]/stepsize);
... ... @@ -522,11 +522,11 @@ class gl_spider
522 522 gl_spider
523 523 (int samples = 1089)
524 524 {
525   - p.push(0.0,0.0,0.0);
526   - d.push(0.0,0.0,1.0);
527   - m.push(1.0, 1.0);
528   - S.push(1.0,1.0,1.0);
529   - R.push(1.0,1.0,1.0);
  525 + p = vec<float>(0.0, 0.0, 0.0);
  526 + d = vec<float>(0.0, 0.0, 1.0);
  527 + m = vec<float>(1.0, 1.0);
  528 + S = vec<float>(1.0, 1.0, 1.0);
  529 + R = vec<float>(1.0, 1.0, 1.0);
530 530 //setPosition(0.0,0.0,0.0);
531 531 //setDirection(0.0,0.0,1.0);
532 532 //setMagnitude(1.0);
... ... @@ -538,11 +538,11 @@ class gl_spider
538 538 (float pos_x, float pos_y, float pos_z, float dir_x, float dir_y, float dir_z,
539 539 float mag_x, int numSamples = 1089)
540 540 {
541   - p.push(pos_x, pos_y, pos_z);
542   - d.push(dir_x, dir_y, dir_z);
543   - m.push(mag_x, mag_x);
544   - S.push(1.0,1.0,1.0);
545   - R.push(1.0,1.0,1.0);
  541 + p = vec<float>(pos_x, pos_y, pos_z);
  542 + d = vec<float>(dir_x, dir_y, dir_z);
  543 + m = vec<float>(mag_x, mag_x);
  544 + S = vec<float>(1.0,1.0,1.0);
  545 + R = vec<float>(1.0,1.0,1.0);
546 546 //setPosition(pos_x, pos_y, pos_z);
547 547 //setDirection(dir_x, dir_y, dir_z);
548 548 //setMagnitude(mag_x);
... ... @@ -734,8 +734,8 @@ class gl_spider
734 734 {
735 735 Bind();
736 736 findOptimalDirection();
737   - findOptimalPosition();
738   - findOptimalScale();
  737 + //findOptimalPosition();
  738 + //findOptimalScale();
739 739 // branchDetection();
740 740 Unbind();
741 741 }
... ...
stim/math/mathvec.h
... ... @@ -19,36 +19,36 @@ struct vec : public std::vector&lt;T&gt;
19 19 using std::vector<T>::at;
20 20 using std::vector<T>::resize;
21 21 using std::vector<T>::push_back;
22   - vec(){
  22 + CUDA_CALLABLE vec(){
23 23  
24 24 }
25 25  
26 26 // //efficiency constructors, makes construction easier for 1D-4D vectors
27   - vec(T rhs)
28   - {
29   - resize(1, rhs);
  27 +// CUDA_CALLABLE vec(T rhs)
  28 +// {
  29 +// resize(1, rhs);
30 30 // cerr << " Created a vector " << endl;
31 31 // //for(int i=0; i<N; i++)
32 32 // // v[i] = rhs;
33   - }
  33 +// }
34 34  
35   -// vec(int s)
36   -// {
37   -// resize(s,0);
38   -// }
  35 + CUDA_CALLABLE vec(int s)
  36 + {
  37 + resize(s,0);
  38 + }
39 39  
40   - vec(T x, T y)
  40 + CUDA_CALLABLE vec(T x, T y)
41 41 {
42 42 push_back(x);
43 43 push_back(y);
44 44 }
45   - vec(T x, T y, T z)
  45 + CUDA_CALLABLE vec(T x, T y, T z)
46 46 {
47 47 push_back(x);
48 48 push_back(y);
49 49 push_back(z);
50 50 }
51   - vec(T x, T y, T z, T w)
  51 + CUDA_CALLABLE vec(T x, T y, T z, T w)
52 52 {
53 53 push_back(x);
54 54 push_back(y);
... ... @@ -59,32 +59,32 @@ struct vec : public std::vector&lt;T&gt;
59 59  
60 60  
61 61 //copy constructor
62   - vec( const vec<T>& other){
  62 + CUDA_CALLABLE vec( const vec<T>& other){
63 63 unsigned int N = other.size();
64 64 for(int i=0; i<N; i++)
65 65 push_back(other[i]);
66 66 }
67 67  
68   - vec<T> push(T x)
  68 + CUDA_CALLABLE vec<T> push(T x)
69 69 {
70 70 push_back(x);
71 71 return *this;
72 72 }
73 73  
74   - vec<T> push(T x, T y)
  74 + CUDA_CALLABLE vec<T> push(T x, T y)
75 75 {
76 76 push_back(x);
77 77 push_back(y);
78 78 return *this;
79 79 }
80   - vec<T> push(T x, T y, T z)
  80 + CUDA_CALLABLE vec<T> push(T x, T y, T z)
81 81 {
82 82 push_back(x);
83 83 push_back(y);
84 84 push_back(z);
85 85 return *this;
86 86 }
87   - vec<T> push(T x, T y, T z, T w)
  87 + CUDA_CALLABLE vec<T> push(T x, T y, T z, T w)
88 88 {
89 89 push_back(x);
90 90 push_back(y);
... ... @@ -93,7 +93,7 @@ struct vec : public std::vector&lt;T&gt;
93 93 return *this;
94 94 }
95 95 template< typename U >
96   - operator vec<U>(){
  96 + CUDA_CALLABLE operator vec<U>(){
97 97 unsigned int N = size();
98 98 vec<U> result;
99 99 for(int i=0; i<N; i++)
... ... @@ -105,7 +105,7 @@ struct vec : public std::vector&lt;T&gt;
105 105 //template<class U>
106 106 //friend vec<U, N>::operator vec<T, N>();
107 107  
108   - T len() const
  108 + CUDA_CALLABLE T len() const
109 109 {
110 110 unsigned int N = size();
111 111  
... ... @@ -119,7 +119,7 @@ struct vec : public std::vector&lt;T&gt;
119 119  
120 120 }
121 121  
122   - vec<T> cart2sph() const
  122 + CUDA_CALLABLE vec<T> cart2sph() const
123 123 {
124 124 //convert the vector from cartesian to spherical coordinates
125 125 //x, y, z -> r, theta, phi (where theta = 0 to 2*pi)
... ... @@ -136,7 +136,7 @@ struct vec : public std::vector&lt;T&gt;
136 136 return sph;
137 137 }
138 138  
139   - vec<T> sph2cart() const
  139 + CUDA_CALLABLE vec<T> sph2cart() const
140 140 {
141 141 //convert the vector from cartesian to spherical coordinates
142 142 //r, theta, phi -> x, y, z (where theta = 0 to 2*pi)
... ... @@ -149,7 +149,7 @@ struct vec : public std::vector&lt;T&gt;
149 149 return cart;
150 150 }
151 151  
152   - vec<T> norm() const
  152 + CUDA_CALLABLE vec<T> norm() const
153 153 {
154 154 unsigned int N = size();
155 155  
... ... @@ -168,7 +168,7 @@ struct vec : public std::vector&lt;T&gt;
168 168 return result;
169 169 }
170 170  
171   - vec<T> cross(const vec<T> rhs) const
  171 + CUDA_CALLABLE vec<T> cross(const vec<T> rhs) const
172 172 {
173 173 vec<T> result;
174 174  
... ... @@ -180,7 +180,7 @@ struct vec : public std::vector&lt;T&gt;
180 180 return result;
181 181 }
182 182  
183   - T dot(vec<T> rhs) const
  183 + CUDA_CALLABLE T dot(vec<T> rhs) const
184 184 {
185 185 T result = (T)0;
186 186 unsigned int N = size();
... ... @@ -192,7 +192,7 @@ struct vec : public std::vector&lt;T&gt;
192 192 }
193 193  
194 194 //arithmetic
195   - vec<T> operator+(vec<T> rhs) const
  195 + CUDA_CALLABLE vec<T> operator+(vec<T> rhs) const
196 196 {
197 197 vec<T> result;
198 198  
... ... @@ -202,7 +202,7 @@ struct vec : public std::vector&lt;T&gt;
202 202  
203 203 return result;
204 204 }
205   - vec<T> operator+(T rhs) const
  205 + CUDA_CALLABLE vec<T> operator+(T rhs) const
206 206 {
207 207 vec<T> result;
208 208 unsigned int N = size();
... ... @@ -211,7 +211,7 @@ struct vec : public std::vector&lt;T&gt;
211 211  
212 212 return result;
213 213 }
214   - vec<T> operator-(vec<T> rhs) const
  214 + CUDA_CALLABLE vec<T> operator-(vec<T> rhs) const
215 215 {
216 216 vec<T> result;
217 217  
... ... @@ -221,7 +221,7 @@ struct vec : public std::vector&lt;T&gt;
221 221  
222 222 return result;
223 223 }
224   - vec<T> operator*(T rhs) const
  224 + CUDA_CALLABLE vec<T> operator*(T rhs) const
225 225 {
226 226 vec<T> result;
227 227  
... ... @@ -231,7 +231,7 @@ struct vec : public std::vector&lt;T&gt;
231 231  
232 232 return result;
233 233 }
234   - vec<T> operator/(T rhs) const
  234 + CUDA_CALLABLE vec<T> operator/(T rhs) const
235 235 {
236 236 vec<T> result;
237 237  
... ... @@ -241,20 +241,20 @@ struct vec : public std::vector&lt;T&gt;
241 241  
242 242 return result;
243 243 }
244   - vec<T> operator*=(T rhs){
  244 + CUDA_CALLABLE vec<T> operator*=(T rhs){
245 245  
246 246 unsigned int N = size();
247 247 for(int i=0; i<N; i++)
248 248 at(i) = at(i) * rhs;
249 249 return *this;
250 250 }
251   - vec<T> operator+=(vec<T> rhs){
  251 + CUDA_CALLABLE vec<T> operator+=(vec<T> rhs){
252 252 unsigned int N = size();
253 253 for(int i=0; i<N; i++)
254 254 at(i) += rhs[i];
255 255 return *this;
256 256 }
257   - vec<T> & operator=(T rhs){
  257 + CUDA_CALLABLE vec<T> & operator=(T rhs){
258 258  
259 259 unsigned int N = size();
260 260 for(int i=0; i<N; i++)
... ... @@ -263,7 +263,7 @@ struct vec : public std::vector&lt;T&gt;
263 263 }
264 264  
265 265 template<typename Y>
266   - vec<T> & operator=(vec<Y> rhs){
  266 + CUDA_CALLABLE vec<T> & operator=(vec<Y> rhs){
267 267 unsigned int N = rhs.size();
268 268 resize(N);
269 269  
... ... @@ -272,7 +272,7 @@ struct vec : public std::vector&lt;T&gt;
272 272 return *this;
273 273 }
274 274 //unary minus
275   - vec<T> operator-() const{
  275 + CUDA_CALLABLE vec<T> operator-() const{
276 276 vec<T> r;
277 277  
278 278 //negate the vector
... ... @@ -317,7 +317,7 @@ std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, stim::vec&lt;T&gt; v)
317 317  
318 318  
319 319 template <typename T>
320   -stim::vec<T> operator*(T lhs, stim::vec<T> rhs)
  320 +CUDA_CALLABLE stim::vec<T> operator*(T lhs, stim::vec<T> rhs)
321 321 {
322 322 stim::vec<T> r;
323 323  
... ...