Commit 29a37cd9fa1c7a55fd7e09c0b532189789a85fb8

Authored by David Mayerich
1 parent 4d80c1dd

fixed matrix_sym errors, changed the glut_template to a CPP file

python/structen.py
... ... @@ -127,6 +127,10 @@ def sym2mat(T):
127 127  
128 128 def st2vec(S, vector='largest'):
129 129 #Create a color image from a 2D or 3D structure tensor slice
  130 +
  131 + if(S.ndim != 3):
  132 + print("ERROR: a 2D slice is expected")
  133 + return
130 134  
131 135 #convert the field to a full rank-2 tensor
132 136 T = sym2mat(S);
... ...
stim/math/matrix_sym.h
... ... @@ -48,8 +48,8 @@ protected:
48 48  
49 49 public:
50 50 //return the symmetric matrix associated with this tensor
51   - stim::matrix<T, D> mat() {
52   - stim::matrix<T, D> r;
  51 + stim::matrix<T> mat() {
  52 + stim::matrix<T> r;
53 53 r.setsym(M);
54 54 return r;
55 55 }
... ...
stim/math/tensor3.h
... ... @@ -73,12 +73,12 @@ namespace stim {
73 73 return lam;
74 74 }
75 75  
76   - CUDA_CALLABLE stim::matrix<T, 3> eig(stim::vec3<T>& lambda = stim::vec3<T>()) {
77   - stim::matrix<T, 3> V;
  76 + CUDA_CALLABLE stim::matrix<T> eig(stim::vec3<T>& lambda = stim::vec3<T>()) {
  77 + stim::matrix<T> V;
78 78  
79   - stim::matrix<T, 3> M1 = matrix_sym<T, 3>::mat();
80   - stim::matrix<T, 3> M2 = matrix_sym<T, 3>::mat();
81   - stim::matrix<T, 3> M3 = matrix_sym<T, 3>::mat(); // fill a tensor with symmetric values
  79 + stim::matrix<T> M1 = matrix_sym<T, 3>::mat();
  80 + stim::matrix<T> M2 = matrix_sym<T, 3>::mat();
  81 + stim::matrix<T> M3 = matrix_sym<T, 3>::mat(); // fill a tensor with symmetric values
82 82  
83 83 M1 = M1 - lambda[0]; // M1 = A - lambda[0] * I
84 84  
... ...
stim/visualization/glut_template.h renamed to stim/visualization/glut_template.cpp
1   -/* Don't change this file. Make a copy in your project and change parameters as necessary. */
  1 +/* Don't change this file. Make a copy in your project and change parameters as necessary.
  2 +
  3 + In order to use this template, specify the following signature in your main.cpp file:
  4 + void glut_init(int argc, char* argv[]);
  5 +
  6 +*/
2 7  
3 8 #ifndef GLUT_TEMPLATE_H
4 9 #define GLUT_TEMPLATE_H
... ... @@ -51,7 +56,6 @@ void glut_display() {
51 56 stim::vec3<float> d = gt.cam.getDirection();
52 57 gluLookAt(p[0], p[1], p[2], d[0], d[1], d[2], u[0], u[1], u[2]); //specify the camera parameters to OpenGL
53 58  
54   -
55 59 render_axes(); //render the axes if the user requests them
56 60 glutSwapBuffers(); //swap in the back buffer (double-buffering is used to prevent tearing)
57 61 }
... ... @@ -89,7 +93,7 @@ void glut_init(int argc, char* argv[]) {
89 93 glutDisplayFunc(glut_display); //set the display function (which will be called repeatedly by glutMainLoop)
90 94 glutMouseFunc(glut_mouse_press); //set the mouse press function (called when a mouse button is pressed)
91 95 glutMotionFunc(glut_mouse_drag); //set the mouse motion function (which will be called any time the mouse is dragged)
92   - glClearColor(1.0f, 1.0f, 1.0f, 1.0f); //set the clear color to white
  96 + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //set the clear color to white
93 97 gt.cam.setPosition(gt.d, gt.d, gt.d); //initialize the camera
94 98 gt.cam.LookAt(0, 0, 0, 0, 1, 1);
95 99 gt.cam.setFOV(40);
... ...