]> Creatis software - bbtk.git/blob - packages/std/src/bbstdReadColumnsDouble.cxx
0156e701c8daf1241d42da256a7e0c99e5c95bdc
[bbtk.git] / packages / std / src / bbstdReadColumnsDouble.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbstdReadColumnsDouble.h"
5 #include "bbstdPackage.h"
6 namespace bbstd
7 {
8
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ReadColumnsDouble)
10 BBTK_BLACK_BOX_IMPLEMENTATION(ReadColumnsDouble,bbtk::AtomicBlackBox);
11 //===== 
12 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
13 //===== 
14 void ReadColumnsDouble::Process()
15 {
16         printf("EED ReadColumnsDouble::Process start \n");
17         
18         std::vector< std::vector<double> * > tlst;
19         
20         int i;
21         for( i=0 ;  i<bbGetInputDimension() ; i++)
22         {
23                 tlst.push_back( new std::vector<double> );
24         }       
25         
26         int numberOfLines = 0;
27         char tmpValue[50];
28         std::vector<double> *vecData;
29         FILE *ff1 = fopen( bbGetInputFileName().c_str() , "r+" );
30         if (ff1!=NULL)
31         {
32                 while (!feof(ff1))
33                 {
34                         for( i=0 ;  i<bbGetInputDimension() ; i++)
35                         {
36                                 fscanf(ff1,"%s",tmpValue);
37                                 vecData=tlst[i];
38                                 vecData->push_back( atof(tmpValue) );
39                         }       
40                         numberOfLines++;                        
41                 }       
42                 fclose(ff1);
43         } else {   // else ff1
44                 printf("bbcreaMaracasVisuReadAxisTree3D::Process  ...Error... reading file InputFileName_Points>%s", bbGetInputFileName().c_str() );
45         } //ff1 
46         
47         i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); }
48         i=2; if (i<=bbGetInputDimension()) { bbSetOutputlstData2( *(tlst[i-1]) ); }
49         i=3; if (i<=bbGetInputDimension()) { bbSetOutputlstData3( *(tlst[i-1]) ); }
50         i=4; if (i<=bbGetInputDimension()) { bbSetOutputlstData4( *(tlst[i-1]) ); }
51         i=5; if (i<=bbGetInputDimension()) { bbSetOutputlstData5( *(tlst[i-1]) ); }
52         i=6; if (i<=bbGetInputDimension()) { bbSetOutputlstData6( *(tlst[i-1]) ); }
53         i=7; if (i<=bbGetInputDimension()) { bbSetOutputlstData7( *(tlst[i-1]) ); }
54         i=8; if (i<=bbGetInputDimension()) { bbSetOutputlstData8( *(tlst[i-1]) ); }
55         i=9; if (i<=bbGetInputDimension()) { bbSetOutputlstData9( *(tlst[i-1]) ); }
56         
57         printf("EED ReadColumnsDouble::Process end \n");
58         
59         
60 }
61 //===== 
62 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
63 //===== 
64 void ReadColumnsDouble::bbUserSetDefaultValues()
65 {
66
67 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
68 //    Here we initialize the input 'In' to 0
69         bbSetInputDimension(1); 
70         bbSetInputFileName(""); 
71   
72 }
73 //===== 
74 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
75 //===== 
76 void ReadColumnsDouble::bbUserInitializeProcessing()
77 {
78
79 //  THE INITIALIZATION METHOD BODY :
80 //    Here does nothing 
81 //    but this is where you should allocate the internal/output pointers 
82 //    if any 
83
84   
85 }
86 //===== 
87 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
88 //===== 
89 void ReadColumnsDouble::bbUserFinalizeProcessing()
90 {
91
92 //  THE FINALIZATION METHOD BODY :
93 //    Here does nothing 
94 //    but this is where you should desallocate the internal/output pointers 
95 //    if any
96   
97 }
98 }
99 // EO namespace bbstd
100
101