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)
4 #include "bbcreaVtkMHDFileInfo.h"
5 #include "bbcreaVtkPackage.h"
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MHDFileInfo)
10 BBTK_BLACK_BOX_IMPLEMENTATION(MHDFileInfo,bbtk::AtomicBlackBox);
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)
14 void MHDFileInfo::Process()
17 // THE MAIN PROCESSING METHOD BODY
18 // Here we simply set the input 'In' value to the output 'Out'
19 // And print out the output value
20 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
21 // void bbSet{Input|Output}NAME(const TYPE&)
22 // const TYPE& bbGet{Input|Output}NAME() const
24 // * NAME is the name of the input/output
25 // (the one provided in the attribute 'name' of the tag 'input')
26 // * TYPE is the C++ type of the input/output
27 // (the one provided in the attribute 'type' of the tag 'input')
29 // bbSetOutputOut( bbGetInputIn() );
30 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
33 std::string inputfilename;
34 inputfilename=bbGetInputFileName();
37 int dimX=-1,dimY=-1,dimZ=-1;
39 std::string formattype("VOID");
40 float spcX=-1,spcY=-1,spcZ=-1;
41 float ox=-1,oy=-1,oz=-1;
42 long int headersize=0;
47 FILE *ffIn = fopen(inputfilename.c_str(),"r");
52 strcpy(mystring,"\n");
53 fgets(mystring,250,ffIn);
54 if (strncmp("NDims",mystring,5)==0) { sscanf(mystring,"%s %s %d" ,strTmp, strTmp, &dim); }
55 if (strncmp("DimSize",mystring,6)==0) { sscanf(mystring,"%s %s %d %d %d" ,strTmp, strTmp, &dimX, &dimY,&dimZ); }
56 if (strncmp("ElementType",mystring,11)==0) { sscanf(mystring,"%s %s %s" ,strTmp, strTmp, strTmp2); formattype=strTmp2; }
57 if (strncmp("ElementSpacing",mystring,14)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &spcX,&spcY,&spcZ); }
58 if (strncmp("ElementSize",mystring,11)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &spcX,&spcY,&spcZ); }
59 if (strncmp("Offset",mystring,6)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &ox, &oy, &oz); }
60 if (strncmp("HeaderSize",mystring,10)==0) { sscanf(mystring,"%s %s %ld" ,strTmp, strTmp, &headersize); }
65 std::vector<int> LstDimSize;
66 LstDimSize.push_back(dimX);
67 LstDimSize.push_back(dimY);
68 LstDimSize.push_back(dimZ);
70 std::vector<double> LstSpacing;
71 LstSpacing.push_back((double)spcX);
72 LstSpacing.push_back((double)spcY);
73 LstSpacing.push_back((double)spcZ);
75 std::vector<double> LstOffset;
76 LstOffset.push_back((double)ox);
77 LstOffset.push_back((double)oy);
78 LstOffset.push_back((double)oz);
80 bbSetOutputDim( dim );
81 bbSetOutputDimSize( LstDimSize );
82 bbSetOutputElementType( formattype );
83 bbSetOutputElementSpacing( LstSpacing );
84 bbSetOutputOffset( LstOffset );
85 bbSetOutputHeaderSize( headersize );
89 // 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)
91 void MHDFileInfo::bbUserSetDefaultValues()
94 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
95 // Here we initialize the input 'In' to 0
100 // 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)
102 void MHDFileInfo::bbUserInitializeProcessing()
105 // THE INITIALIZATION METHOD BODY :
107 // but this is where you should allocate the internal/output pointers
113 // 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)
115 void MHDFileInfo::bbUserFinalizeProcessing()
118 // THE FINALIZATION METHOD BODY :
120 // but this is where you should desallocate the internal/output pointers
125 // EO namespace bbcreaVtk