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;
32 printf("EED MHDFileInfo::Process %s \n", bbGetInputFileName().c_str() );
34 std::string inputfilename;
35 inputfilename=bbGetInputFileName();
38 int dimX=-1,dimY=-1,dimZ=-1;
40 std::string formattype("VOID");
41 float spcX=-1,spcY=-1,spcZ=-1;
42 float ox=-1,oy=-1,oz=-1;
43 long int headersize=0;
48 FILE *ffIn = fopen(inputfilename.c_str(),"r");
53 strcpy(mystring,"\n");
54 fgets(mystring,250,ffIn);
55 if (strncmp("NDims",mystring,5)==0) { sscanf(mystring,"%s %s %d" ,strTmp, strTmp, &dim); }
56 if (strncmp("DimSize",mystring,6)==0) { sscanf(mystring,"%s %s %d %d %d" ,strTmp, strTmp, &dimX, &dimY,&dimZ); }
57 if (strncmp("ElementType",mystring,11)==0) { sscanf(mystring,"%s %s %s" ,strTmp, strTmp, strTmp2); formattype=strTmp2; }
58 if (strncmp("ElementSpacing",mystring,14)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &spcX,&spcY,&spcZ); }
59 if (strncmp("ElementSize",mystring,11)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &spcX,&spcY,&spcZ); }
60 if (strncmp("Offset",mystring,6)==0) { sscanf(mystring,"%s %s %f %f %f" ,strTmp, strTmp, &ox, &oy, &oz); }
61 if (strncmp("HeaderSize",mystring,10)==0) { sscanf(mystring,"%s %s %ld" ,strTmp, strTmp, &headersize); }
66 std::vector<int> LstDimSize;
67 LstDimSize.push_back(dimX);
68 LstDimSize.push_back(dimY);
69 LstDimSize.push_back(dimZ);
71 std::vector<double> LstSpacing;
72 LstSpacing.push_back((double)spcX);
73 LstSpacing.push_back((double)spcY);
74 LstSpacing.push_back((double)spcZ);
76 std::vector<double> LstOffset;
77 LstOffset.push_back((double)ox);
78 LstOffset.push_back((double)oy);
79 LstOffset.push_back((double)oz);
81 bbSetOutputDim( dim );
82 bbSetOutputDimSize( LstDimSize );
83 bbSetOutputElementType( formattype );
84 bbSetOutputElementSpacing( LstSpacing );
85 bbSetOutputOffset( LstOffset );
86 bbSetOutputHeaderSize( headersize );
90 // 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)
92 void MHDFileInfo::bbUserSetDefaultValues()
95 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
96 // Here we initialize the input 'In' to 0
101 // 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)
103 void MHDFileInfo::bbUserInitializeProcessing()
106 // THE INITIALIZATION METHOD BODY :
108 // but this is where you should allocate the internal/output pointers
114 // 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)
116 void MHDFileInfo::bbUserFinalizeProcessing()
119 // THE FINALIZATION METHOD BODY :
121 // but this is where you should desallocate the internal/output pointers
126 // EO namespace bbcreaVtk