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 "bbstdSaveLstPoints.h"
5 #include "bbstdPackage.h"
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,SaveLstPoints)
10 BBTK_BLACK_BOX_IMPLEMENTATION(SaveLstPoints,bbtk::AtomicBlackBox);
13 // 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)
15 void SaveLstPoints::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')
28 // bbSetOutputOut( bbGetInputIn() );
29 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
31 printf("EED SaveLstPoints::Process Start \n");
32 std::string filenameX;
33 std::string filenameY;
34 std::string filenameZ;
35 std::vector<int> lstIndexs = bbGetInputLstIndexs();
36 std::vector<double> lstParams = bbGetInputParams();
37 std::vector<double> lstX = bbGetInputLstX();
38 std::vector<double> lstY = bbGetInputLstY();
39 std::vector<double> lstZ = bbGetInputLstZ();
40 if (bbGetInputType()==0)
45 int iPoint,sizeLstPoints;
46 int iParams,sizeParams=lstParams.size();
48 for (iParams=0; iParams<sizeParams; iParams++)
50 if (iParams<lstIndexs.size())
53 size = lstParams[iParams];
54 for (ii=0; ii<size; ii++)
56 iAcum = iAcum+lstIndexs[ii];
58 // printf( "SaveLstPoints::Process %d %d\n", iAcum, lstIndexs[iParams]);
59 sizeLstPoints = lstIndexs[iParams];
60 filenameX = bbGetInputFileNameBase()+"-X-"+std::to_string( (int)(lstParams[iParams]) ) +".pnt" ;
61 filenameY = bbGetInputFileNameBase()+"-Y-"+std::to_string( (int)(lstParams[iParams]) ) +".pnt" ;
62 filenameZ = bbGetInputFileNameBase()+"-Z-"+std::to_string( (int)(lstParams[iParams]) ) +".pnt" ;
63 ffx = fopen(filenameX.c_str(), "w+" );
64 ffy = fopen(filenameY.c_str(), "w+" );
65 ffz = fopen(filenameZ.c_str(), "w+" );
66 for (iPoint=0;iPoint<sizeLstPoints;iPoint++)
68 fprintf(ffx,"%f ", lstX[iPoint+iAcum]);
69 fprintf(ffy,"%f ", lstY[iPoint+iAcum]);
70 fprintf(ffz,"%f ", lstZ[iPoint+iAcum]);
75 } // if iParams < lstIndexs.size()
79 printf("EED SaveLstPoints::Process End \n");
84 // 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)
86 void SaveLstPoints::bbUserSetDefaultValues()
88 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
89 // Here we initialize the input 'In' to 0
94 // 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)
96 void SaveLstPoints::bbUserInitializeProcessing()
98 // THE INITIALIZATION METHOD BODY :
100 // but this is where you should allocate the internal/output pointers
105 // 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)
107 void SaveLstPoints::bbUserFinalizeProcessing()
109 // THE FINALIZATION METHOD BODY :
111 // but this is where you should desallocate the internal/output pointers
115 } // EO namespace bbstd