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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/lib/common/output.c
ViewVC logotype

Diff of /branches/pure-cfg/src/lib/common/output.c

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

revision 1516, Fri Oct 7 19:52:07 2011 UTC revision 1517, Fri Oct 7 19:52:25 2011 UTC
# Line 10  Line 10 
10    
11  #include <stdio.h>  #include <stdio.h>
12  #include "Diderot/diderot.h"  #include "Diderot/diderot.h"
13    #include "Diderot/output.h"
14  #include <teem/nrrd.h>  #include <teem/nrrd.h>
15  #include <teem/air.h>  #include <teem/air.h>
16    
 #include "Diderot/output.h"  
   
17  /*! \brief Print the strand output state to a text file.  /*! \brief Print the strand output state to a text file.
18   */   */
19  void Diderot_Print (Output_Args_t *args)  void Diderot_Print (Output_Args_t *args)
# Line 36  Line 35 
35    
36      uint8_t * strandPtr = (uint8_t *)args->inState;      uint8_t * strandPtr = (uint8_t *)args->inState;
37      for (int i = 0;  i < args->numStrands;  i++, strandPtr += args->outputSzb) {      for (int i = 0;  i < args->numStrands;  i++, strandPtr += args->outputSzb) {
38          if (args->isStatusInt && args->status[i * 4] == DIDEROT_STABLE || args->status[i] == DIDEROT_STABLE) {  
39            if ((args->isStatusInt && (args->status[i * 4] == DIDEROT_STABLE))
40            || (args->status[i] == DIDEROT_STABLE)) {
41          /*if (args->status[i] == DIDEROT_STABLE) {*/          /*if (args->status[i] == DIDEROT_STABLE) {*/
42              Diderot_Strands[0]->print (outS, strandPtr);              Diderot_Strands[0]->print (outS, strandPtr);
43          }          }
# Line 63  Line 64 
64    // allocate the correct amount of space for output    // allocate the correct amount of space for output
65      int numStabilized = 0;      int numStabilized = 0;
66      for (int i = 0;  i < args->numStrands;  i++) {      for (int i = 0;  i < args->numStrands;  i++) {
67            if (args->isStatusInt && args->status[i * 4] == DIDEROT_STABLE || args->status[i] == DIDEROT_STABLE)  // FIXME: this conditional is not portable because of endianess issues.
68            if ((args->isStatusInt && (args->status[i * 4] == DIDEROT_STABLE))
69            || (args->status[i] == DIDEROT_STABLE))
70              numStabilized++;              numStabilized++;
71      }      }
72      void *outData = CheckedAlloc(numStabilized * args->outputSzb);      void *outData = CheckedAlloc(numStabilized * args->outputSzb);
# Line 73  Line 76 
76    // copy data into outData    // copy data into outData
77      void *outPos = outData;      void *outPos = outData;
78      for (int i = 0;  i < args->numStrands;  i++) {      for (int i = 0;  i < args->numStrands;  i++) {
79      fprintf(stderr, "%c", 'a');          if ((args->isStatusInt && (args->status[i * 4] == DIDEROT_STABLE))
80           if (args->isStatusInt && args->status[i * 4] == DIDEROT_STABLE || args->status[i] == DIDEROT_STABLE) {          || (args->status[i] == DIDEROT_STABLE)) {
   
     fprintf(stderr, "%c", 'b');  
81              Diderot_Strands[0]->output (outPos, &args->inState[i]);              Diderot_Strands[0]->output (outPos, &args->inState[i]);
     fprintf(stderr, "%c", 'c');  
82              outPos += args->outputSzb;              outPos += args->outputSzb;
     fprintf(stderr, "%c", 'd');  
83          }          }
84      }      }
     fprintf(stderr, "%d", 3);  
85    
86    // make a new nrrd    // make a new nrrd
87      Nrrd *outNrrd;      Nrrd *outNrrd;

Legend:
Removed from v.1516  
changed lines
  Added in v.1517

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