Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /examples/iso2d-spatial/main.c
ViewVC logotype

Diff of /examples/iso2d-spatial/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3012, Mon Mar 9 11:24:46 2015 UTC revision 3013, Mon Mar 9 13:06:51 2015 UTC
# Line 61  Line 61 
61         exit(EXIT_FAILURE);         exit(EXIT_FAILURE);
62      }      }
63    
     ISO_InVarSet_stepScale (dProg.wrld, 0.05);  
     ISO_InVarSet_stepsMax (dProg.wrld, 200);  
   
64      unsigned int nParticles =  ISO_NumStrands (dProg.wrld);      unsigned int nParticles =  ISO_NumStrands (dProg.wrld);
65      float r = 0.0035;      float r = 0.0035;
66     // ISO_InVarGet_rr(dProg.wrld, &r);     // ISO_InVarGet_rr(dProg.wrld, &r);
# Line 75  Line 72 
72  }  }
73  static void getData (ISO_World_t *wrld, Nrrd *nData)  static void getData (ISO_World_t *wrld, Nrrd *nData)
74  {  {
     static bool isFirst = true;  
75    // get snapshot of state    // get snapshot of state
76      if (ISO_Snapshot_outPos(wrld, nData)) {      if (ISO_Snapshot_pos(wrld, nData)) {
77        // error        // error
78          fprintf(stderr, "Error getting nrrd data\n");          fprintf(stderr, "Error getting nrrd data\n");
79          exit(1);          exit(1);
# Line 90  Line 86 
86      for(int i = 0; i < nParticles; i++)      for(int i = 0; i < nParticles; i++)
87      {      {
88          int idx = i * 2;          int idx = i * 2;
         if(isFirst){  
           printf("(%f,%f)\n",particles[idx],particles[idx + 1]);  
         }  
89          float x = particles[idx];          float x = particles[idx];
90          float y = particles[idx + 1] ;          float y = particles[idx + 1] ;
91          mat4x4_identity(final);          mat4x4_identity(final);
# Line 102  Line 95 
95          mat4x4_mul(dProg.particles->models[i],trans, final);          mat4x4_mul(dProg.particles->models[i],trans, final);
96      }      }
97     }     }
    isFirst = false;  
98  }  }
99  /***** Callback functions *****/  /***** Callback functions *****/
100  static void error (int err, const char *msg)  static void error (int err, const char *msg)
# Line 118  Line 110 
110    
111  } /* end of Display */  } /* end of Display */
112  void step(GLFWwindow *win) {  void step(GLFWwindow *win) {
113      static bool first = true;
114      if(ISO_NumActive(dProg.wrld) > 0){      if(ISO_NumActive(dProg.wrld) > 0){
115          // step the computation          // step the computation
116          ISO_Run(dProg.wrld, STEP_SIZE);          ISO_Run(dProg.wrld, STEP_SIZE);
117          // get and render the state          // get and render the state
118          getData (dProg.wrld, dProg.snapData);          getData (dProg.wrld, dProg.snapData);
119        }else {
120            if(first){
121              printf("Finished Running\n");
122              first = false;
123            }
124      }      }
125  }  }
126    

Legend:
Removed from v.3012  
changed lines
  Added in v.3013

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0