summaryrefslogtreecommitdiff
path: root/common.cuh
blob: d5a9cdffc88230f074e3102882f695c5753f42a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef COMMON_H
#define COMMON_H

#include "include/helper_math.h"

/**

template <class T> class vect_t2;
template <class T> class vect_t3;
template <class T> class vect_t4;

//this feels so hacky... idk why people are so scared of metaprogramming
template <> class vect_t2<double> { public: using vect_t = double2; };
template <> class vect_t3<double> { public: using vect_t = double3; };
template <> class vect_t4<double> { public: using vect_t = double4; };

template <> class vect_t2<float> { public: using vect_t = float2; };
template <> class vect_t3<float> { public: using vect_t = float3; };
template <> class vect_t4<float> { public: using vect_t = float4; };


template <class T, class X> __device__  T vect_create(X x);
template <class T, class X, class Y, class Z> __device__  T vect_create(X x, Y y, Z z);

//I have no fucking clue if this is right, check me later ig
template <class float3, class X> __device__ inline float3 vect_create<float3>(X x) { return make_float3(x); }

template <class float3, class X, class Y, class Z> __device__ inline float3 vect_create<float3>(X x, Y y, Z z) { return make_float3(x, y, z); }
**/

/** I'm not sure weather float or double percision is nessesary. I was using
templates, but this changes the structure of my entire project in unwanted
ways, so I'm switching over to typedefs. **/

typedef float2 vect_t2;
typedef float3 vect_t3;
typedef float4 vect_t4;
typedef float T;

#define vect1to3(x) (make_float3(x))
#define make_vect(x, y, z) (make_float3(x, y, z))

#endif