Commit efe2f95e6eb6ab7191c6431064ed193f91bb5c98
1 parent
945ee13c
changes needed to compile and run the bimsim code
Showing
138 changed files
with
137 additions
and
25 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 138 files are displayed.
@@ -5,7 +5,7 @@ and can therefore be used in CUDA code and on CUDA devices. | @@ -5,7 +5,7 @@ and can therefore be used in CUDA code and on CUDA devices. | ||
5 | #ifndef RTS_COMPLEX | 5 | #ifndef RTS_COMPLEX |
6 | #define RTS_COMPLEX | 6 | #define RTS_COMPLEX |
7 | 7 | ||
8 | -#include "../cuda/callable.h" | 8 | +#include "stim/cuda/cudatools/callable.h" |
9 | #include <cmath> | 9 | #include <cmath> |
10 | #include <string> | 10 | #include <string> |
11 | #include <sstream> | 11 | #include <sstream> |
1 | -#ifndef RTS_QUAD_H | ||
2 | -#define RTS_QUAD_H | 1 | +#ifndef STIM_QUAD_H |
2 | +#define STIM_QUAD_H | ||
3 | 3 | ||
4 | //enable CUDA_CALLABLE macro | 4 | //enable CUDA_CALLABLE macro |
5 | -#include <stim/cuda/callable.h> | 5 | +#include <stim/cuda/cudatools/callable.h> |
6 | #include <stim/math/vector.h> | 6 | #include <stim/math/vector.h> |
7 | #include <stim/math/triangle.h> | 7 | #include <stim/math/triangle.h> |
8 | #include <stim/math/quaternion.h> | 8 | #include <stim/math/quaternion.h> |
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | namespace stim{ | 13 | namespace stim{ |
14 | 14 | ||
15 | //template for a quadangle class in ND space | 15 | //template for a quadangle class in ND space |
16 | -template <class T, int N = 3> | 16 | +template <class T> |
17 | struct quad | 17 | struct quad |
18 | { | 18 | { |
19 | /* | 19 | /* |
@@ -30,9 +30,9 @@ struct quad | @@ -30,9 +30,9 @@ struct quad | ||
30 | T B[N]; | 30 | T B[N]; |
31 | T C[N];*/ | 31 | T C[N];*/ |
32 | 32 | ||
33 | - rts::vec<T, N> A; | ||
34 | - rts::vec<T, N> X; | ||
35 | - rts::vec<T, N> Y; | 33 | + stim::vec<T> A; |
34 | + stim::vec<T> X; | ||
35 | + stim::vec<T> Y; | ||
36 | 36 | ||
37 | 37 | ||
38 | CUDA_CALLABLE quad() | 38 | CUDA_CALLABLE quad() |
@@ -40,7 +40,7 @@ struct quad | @@ -40,7 +40,7 @@ struct quad | ||
40 | 40 | ||
41 | } | 41 | } |
42 | 42 | ||
43 | - CUDA_CALLABLE quad(vec<T, N> a, vec<T, N> b, vec<T, N> c) | 43 | + CUDA_CALLABLE quad(vec<T> a, vec<T> b, vec<T> c) |
44 | { | 44 | { |
45 | 45 | ||
46 | A = a; | 46 | A = a; |
@@ -52,20 +52,20 @@ struct quad | @@ -52,20 +52,20 @@ struct quad | ||
52 | /******************************************************************* | 52 | /******************************************************************* |
53 | Constructor - create a quad from a position, normal, and rotation | 53 | Constructor - create a quad from a position, normal, and rotation |
54 | *******************************************************************/ | 54 | *******************************************************************/ |
55 | - CUDA_CALLABLE quad(rts::vec<T, N> c, rts::vec<T, N> normal, T width, T height, T theta) | 55 | + CUDA_CALLABLE quad(stim::vec<T> c, stim::vec<T> normal, T width, T height, T theta) |
56 | { | 56 | { |
57 | 57 | ||
58 | //compute the X direction - start along world-space X | 58 | //compute the X direction - start along world-space X |
59 | - Y = rts::vec<T, N>(0, 1, 0); | 59 | + Y = stim::vec<T>(0, 1, 0); |
60 | if(Y == normal) | 60 | if(Y == normal) |
61 | - Y = rts::vec<T, N>(0, 0, 1); | 61 | + Y = stim::vec<T>(0, 0, 1); |
62 | 62 | ||
63 | X = Y.cross(normal).norm(); | 63 | X = Y.cross(normal).norm(); |
64 | 64 | ||
65 | std::cout<<X<<std::endl; | 65 | std::cout<<X<<std::endl; |
66 | 66 | ||
67 | //rotate the X axis by theta radians | 67 | //rotate the X axis by theta radians |
68 | - rts::quaternion<T> q; | 68 | + stim::quaternion<T> q; |
69 | q.CreateRotation(theta, normal); | 69 | q.CreateRotation(theta, normal); |
70 | X = q.toMatrix3() * X; | 70 | X = q.toMatrix3() * X; |
71 | Y = normal.cross(X); | 71 | Y = normal.cross(X); |
@@ -85,7 +85,7 @@ struct quad | @@ -85,7 +85,7 @@ struct quad | ||
85 | } | 85 | } |
86 | 86 | ||
87 | //boolean comparison | 87 | //boolean comparison |
88 | - bool operator==(const quad<T, N> & rhs) | 88 | + bool operator==(const quad<T> & rhs) |
89 | { | 89 | { |
90 | if(A == rhs.A && X == rhs.X && Y == rhs.Y) | 90 | if(A == rhs.A && X == rhs.X && Y == rhs.Y) |
91 | return true; | 91 | return true; |
@@ -96,21 +96,21 @@ struct quad | @@ -96,21 +96,21 @@ struct quad | ||
96 | /******************************************* | 96 | /******************************************* |
97 | Return the normal for the quad | 97 | Return the normal for the quad |
98 | *******************************************/ | 98 | *******************************************/ |
99 | - CUDA_CALLABLE rts::vec<T, N> n() | 99 | + CUDA_CALLABLE stim::vec<T> n() |
100 | { | 100 | { |
101 | return (X.cross(Y)).norm(); | 101 | return (X.cross(Y)).norm(); |
102 | } | 102 | } |
103 | 103 | ||
104 | - CUDA_CALLABLE rts::vec<T, N> p(T a, T b) | 104 | + CUDA_CALLABLE stim::vec<T> p(T a, T b) |
105 | { | 105 | { |
106 | - rts::vec<T, N> result; | 106 | + stim::vec<T> result; |
107 | //given the two parameters a, b = [0 1], returns the position in world space | 107 | //given the two parameters a, b = [0 1], returns the position in world space |
108 | result = A + X * a + Y * b; | 108 | result = A + X * a + Y * b; |
109 | 109 | ||
110 | return result; | 110 | return result; |
111 | } | 111 | } |
112 | 112 | ||
113 | - CUDA_CALLABLE rts::vec<T, N> operator()(T a, T b) | 113 | + CUDA_CALLABLE stim::vec<T> operator()(T a, T b) |
114 | { | 114 | { |
115 | return p(a, b); | 115 | return p(a, b); |
116 | } | 116 | } |
@@ -127,15 +127,15 @@ struct quad | @@ -127,15 +127,15 @@ struct quad | ||
127 | 127 | ||
128 | } | 128 | } |
129 | 129 | ||
130 | - CUDA_CALLABLE quad<T, N> operator*(T rhs) | 130 | + CUDA_CALLABLE quad<T> operator*(T rhs) |
131 | { | 131 | { |
132 | //scales the plane by a scalar value | 132 | //scales the plane by a scalar value |
133 | 133 | ||
134 | //compute the center point | 134 | //compute the center point |
135 | - rts::vec<T, N> c = A + X*0.5f + Y*0.5f; | 135 | + stim::vec<T> c = A + X*0.5f + Y*0.5f; |
136 | 136 | ||
137 | //create the new quadangle | 137 | //create the new quadangle |
138 | - quad<T, N> result; | 138 | + quad<T> result; |
139 | result.X = X * rhs; | 139 | result.X = X * rhs; |
140 | result.Y = Y * rhs; | 140 | result.Y = Y * rhs; |
141 | result.A = c - result.X*0.5f - result.Y*0.5f; | 141 | result.A = c - result.X*0.5f - result.Y*0.5f; |
@@ -144,7 +144,7 @@ struct quad | @@ -144,7 +144,7 @@ struct quad | ||
144 | 144 | ||
145 | } | 145 | } |
146 | 146 | ||
147 | - CUDA_CALLABLE T dist(vec<T, N> p) | 147 | + CUDA_CALLABLE T dist(vec<T> p) |
148 | { | 148 | { |
149 | //compute the distance between a point and this quad | 149 | //compute the distance between a point and this quad |
150 | 150 | ||
@@ -162,7 +162,7 @@ struct quad | @@ -162,7 +162,7 @@ struct quad | ||
162 | return d1; | 162 | return d1; |
163 | } | 163 | } |
164 | 164 | ||
165 | - CUDA_CALLABLE T dist_max(vec<T, N> p) | 165 | + CUDA_CALLABLE T dist_max(vec<T> p) |
166 | { | 166 | { |
167 | T da = (A - p).len(); | 167 | T da = (A - p).len(); |
168 | T db = (A+X - p).len(); | 168 | T db = (A+X - p).len(); |
@@ -176,7 +176,7 @@ struct quad | @@ -176,7 +176,7 @@ struct quad | ||
176 | } //end namespace rts | 176 | } //end namespace rts |
177 | 177 | ||
178 | template <typename T, int N> | 178 | template <typename T, int N> |
179 | -std::ostream& operator<<(std::ostream& os, rts::quad<T, N> R) | 179 | +std::ostream& operator<<(std::ostream& os, stim::quad<T> R) |
180 | { | 180 | { |
181 | os<<R.str(); | 181 | os<<R.str(); |
182 | return os; | 182 | return os; |
1 | +[General] |
No preview for this file type