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

SCM Repository

[diderot] Diff of /branches/fem/examples/iso_d2s/init.c
ViewVC logotype

Diff of /branches/fem/examples/iso_d2s/init.c

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

revision 3233, Tue Aug 11 15:07:12 2015 UTC revision 3234, Fri Aug 14 13:35:44 2015 UTC
# Line 14  Line 14 
14    
15    
16    
17    void Nrrd2(Nrrd *nData, float  stepSize)
18    {
19        fprintf(stderr,"\n ******** Saving Results *********\n\n");
20        FILE *fp;
21        fp=fopen("a.txt","w");
22    
23        float *p = (float *)(nData->data);
24        unsigned int iPoints = nData->axis[0].size;
25        unsigned int jPoints = nData->axis[1].size;
26    
27        for (uint32_t i = 0;  i < iPoints;  i++) {
28            for (uint32_t j = 0;  j < jPoints;  j++) {
29    
30                    float pp1=p[i*iPoints+j];
31                    float pp2=p[i*iPoints+j+1];
32                    fprintf(fp,"\n F[%f][%f]=%f %f ",(i*stepSize),(j*stepSize),pp1,pp2);
33    
34            }
35        }
36        fprintf(stderr,"\n  %d-x-%d *****************\n",iPoints,jPoints);
37    
38    }
39    
40    
41    
42  void WriteOutput (Nrrd *nData)  void WriteOutput (Nrrd *nData)
43  {  {
44      char *Outfile = "x.nrrd";      char *Outfile = "x.nrrd";
# Line 26  Line 51 
51  //struct Function;  //struct Function;
52  void callDiderot2_iso(void *valM, int imgResU,int imgResV, int stepsMax,float isoval){  void callDiderot2_iso(void *valM, int imgResU,int imgResV, int stepsMax,float isoval){
53     // fprintf(stderr, "\n inside getiso\n");     // fprintf(stderr, "\n inside getiso\n");
54        double t0 = airTime();
55      iso_d2s_World_t *wrld = iso_d2s_New ();      iso_d2s_World_t *wrld = iso_d2s_New ();
56    
57      if (wrld == 0) {      if (wrld == 0) {
# Line 52  Line 78 
78      int nSteps = iso_d2s_Run (wrld, 0);      int nSteps = iso_d2s_Run (wrld, 0);
79      //second paramter is the limit to # of steps.      //second paramter is the limit to # of steps.
80      //0-to termination      //0-to termination
81         fprintf(stderr, "\n after running o\n");
82      // change here for output var      // change here for output var
83        printf("%5.3f seconds\n",  airTime() - t0);
84      if (iso_d2s_OutputGet_out(wrld, nData)) {      if (iso_d2s_OutputGet_out(wrld, nData)) {
85          // error          // error
86          fprintf(stderr, "Error getting nrrd data: %s", iso_d2s_GetErrors(wrld));          fprintf(stderr, "Error getting nrrd data: %s", iso_d2s_GetErrors(wrld));
87          exit(1);          exit(1);
88      }      }
89        // fprintf(stderr, "\n ipotst ouput n");
90        Nrrd2(nData,1);
91      WriteOutput(nData);      WriteOutput(nData);
92      iso_d2s_Shutdown (wrld);      iso_d2s_Shutdown (wrld);
93    

Legend:
Removed from v.3233  
changed lines
  Added in v.3234

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