--- /dev/null
+//=====
+// 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)
+//=====
+#include "bbstdVectorFilterDouble.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,VectorFilterDouble)
+BBTK_BLACK_BOX_IMPLEMENTATION(VectorFilterDouble,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void VectorFilterDouble::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+
+ std::vector< std::vector<double> * > pLstVec;
+ std::vector< std::vector<double> * > pLstVecOut;
+ std::vector<double> In0 = bbGetInputIn0();
+ std::vector<double> In1 = bbGetInputIn1();
+ std::vector<double> In2 = bbGetInputIn2();
+ std::vector<double> In3 = bbGetInputIn3();
+ std::vector<double> In4 = bbGetInputIn4();
+ std::vector<double> In5 = bbGetInputIn5();
+ std::vector<double> In6 = bbGetInputIn6();
+ std::vector<double> In7 = bbGetInputIn7();
+ std::vector<double> In8 = bbGetInputIn8();
+ std::vector<double> In9 = bbGetInputIn9();
+
+ if (bbGetInputIn0().size()!=0) { pLstVec.push_back( &In0 ); }
+ if (bbGetInputIn1().size()!=0) { pLstVec.push_back( &In1 ); }
+ if (bbGetInputIn2().size()!=0) { pLstVec.push_back( &In2 ); }
+ if (bbGetInputIn3().size()!=0) { pLstVec.push_back( &In3 ); }
+ if (bbGetInputIn4().size()!=0) { pLstVec.push_back( &In4 ); }
+ if (bbGetInputIn5().size()!=0) { pLstVec.push_back( &In5 ); }
+ if (bbGetInputIn6().size()!=0) { pLstVec.push_back( &In6 ); }
+ if (bbGetInputIn7().size()!=0) { pLstVec.push_back( &In7 ); }
+ if (bbGetInputIn8().size()!=0) { pLstVec.push_back( &In8 ); }
+ if (bbGetInputIn9().size()!=0) { pLstVec.push_back( &In9 ); }
+
+ std::vector<double> Out0;
+ std::vector<double> Out1;
+ std::vector<double> Out2;
+ std::vector<double> Out3;
+ std::vector<double> Out4;
+ std::vector<double> Out5;
+ std::vector<double> Out6;
+ std::vector<double> Out7;
+ std::vector<double> Out8;
+ std::vector<double> Out9;
+
+ pLstVecOut.push_back( &Out0 );
+ pLstVecOut.push_back( &Out1 );
+ pLstVecOut.push_back( &Out2 );
+ pLstVecOut.push_back( &Out3 );
+ pLstVecOut.push_back( &Out4 );
+ pLstVecOut.push_back( &Out5 );
+ pLstVecOut.push_back( &Out6 );
+ pLstVecOut.push_back( &Out7 );
+ pLstVecOut.push_back( &Out8 );
+ pLstVecOut.push_back( &Out9 );
+
+
+ if (bbGetInputType()==0) // Erase duplicate lines
+ {
+ bool okSizeVec=true;
+ int ipLstvec;
+ for (ipLstvec=1;ipLstvec<pLstVec.size();ipLstvec++)
+ {
+ if ( (*pLstVec[ipLstvec]).size()!=(*pLstVec[0]).size() ) { okSizeVec=false; }
+ }
+ if ( okSizeVec==false)
+ {
+ printf("EED VectorFilterDouble::Process WARNING! vectors are not of the same size.\n");
+ } else {
+ int iLine;
+ int ipLstvec2;
+ bool okLine;
+ for (iLine=0 ; iLine < (*pLstVec[0]).size() ; iLine++ )
+ {
+ okLine=false;
+ for ( ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+ {
+ if ( (*pLstVec[ipLstvec2])[iLine]!=(*pLstVec[ipLstvec2])[iLine-1] ) { okLine=true; }
+ } // for ipLstVec2
+
+ if ( (okLine==true) || (iLine==0) )
+ {
+ for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+ {
+ (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[iLine] );
+ } // for
+ } // if okLine
+ } // for iLine
+ } // if okSizeVec
+ } // Type==0
+
+
+ if (bbGetInputType()==1) // Resize vector
+ {
+ int ipLstvec2;
+ double iLine;
+ int sizeLines = (*pLstVec[0]).size();
+ double step = (double)sizeLines/(double)bbGetInputk1();
+ for (iLine=0 ; iLine<sizeLines ; iLine=iLine+step)
+ {
+ for (ipLstvec2=0 ; ipLstvec2<pLstVec.size() ; ipLstvec2++)
+ {
+ (*pLstVecOut[ipLstvec2]).push_back( (*pLstVec[ipLstvec2])[(int)iLine] );
+ } // for
+ } // for ipLstVec
+ } // Type==1
+
+ if (bbGetInputType()==2) // Insert intermediate points
+ {
+ int ipLstvec;
+ int i;
+ int size;
+ double result;
+ for (ipLstvec=0 ; ipLstvec<pLstVec.size() ; ipLstvec++)
+ {
+ size=(*pLstVec[ipLstvec]).size();
+ if (size>=2)
+ {
+ for (i=0;i<size-1;i++)
+ {
+ (*pLstVecOut[ipLstvec]).push_back( (*pLstVec[ipLstvec])[i] ); // First item
+ result=((*pLstVec[ipLstvec])[i] + (*pLstVec[ipLstvec])[i+1] ) / 2;
+ (*pLstVecOut[ipLstvec]).push_back( result );
+ }// for size
+ (*pLstVecOut[ipLstvec]).push_back( (*pLstVec[ipLstvec])[size-1] ); // Last item
+ } // if size>=2
+ } // for pLstVec
+ } // Type==2
+
+
+ if (bbGetInputType()==3) // Addition k1
+ {
+ int ipLstvec;
+ int i;
+ int size;
+ double result;
+ for (ipLstvec=0 ; ipLstvec<pLstVec.size() ; ipLstvec++)
+ {
+ size=(*pLstVec[ipLstvec]).size();
+ for (i=0;i<size;i++)
+ {
+ result= (*pLstVec[ipLstvec])[i] + bbGetInputk1() ;
+ (*pLstVecOut[ipLstvec]).push_back( result );
+ }// for size
+ } // for pLstVec
+ } // Type==3
+
+ if (bbGetInputType()==4) // Substraction k1
+ {
+ int ipLstvec;
+ int i;
+ int size;
+ double result;
+ for (ipLstvec=0 ; ipLstvec<pLstVec.size() ; ipLstvec++)
+ {
+ size=(*pLstVec[ipLstvec]).size();
+ for (i=0;i<size;i++)
+ {
+ result= (*pLstVec[ipLstvec])[i] - bbGetInputk1() ;
+ (*pLstVecOut[ipLstvec]).push_back( result );
+ }// for size
+ } // for pLstVec
+ } // Type==4
+
+ if (bbGetInputType()==5) // Multiplication k1
+ {
+ int ipLstvec;
+ int i;
+ int size;
+ double result;
+ for (ipLstvec=0 ; ipLstvec<pLstVec.size() ; ipLstvec++)
+ {
+ size=(*pLstVec[ipLstvec]).size();
+ for (i=0;i<size;i++)
+ {
+ result= (*pLstVec[ipLstvec])[i] * bbGetInputk1() ;
+ (*pLstVecOut[ipLstvec]).push_back( result );
+ }// for size
+ } // for pLstVec
+ } // Type==5
+
+ if (bbGetInputType()==6) // Division k1
+ {
+ int ipLstvec;
+ int i;
+ int size;
+ double result;
+ for (ipLstvec=0 ; ipLstvec<pLstVec.size() ; ipLstvec++)
+ {
+ size=(*pLstVec[ipLstvec]).size();
+ for (i=0;i<size;i++)
+ {
+ if (bbGetInputk1()!=0)
+ {
+ result= (*pLstVec[ipLstvec])[i] / bbGetInputk1() ;
+ (*pLstVecOut[ipLstvec]).push_back( result );
+ } else {
+ printf("EED VectorFilterDouble::Process Warning!! Div by 0 in Type 6 \n");
+ (*pLstVecOut[ipLstvec]).push_back( -1 );
+ }
+ }// for size
+ } // for pLstVec
+ } // Type==6
+
+ bbSetOutputOut0( Out0 );
+ bbSetOutputOut1( Out1 );
+ bbSetOutputOut2( Out2 );
+ bbSetOutputOut3( Out3 );
+ bbSetOutputOut4( Out4 );
+ bbSetOutputOut5( Out5 );
+ bbSetOutputOut6( Out6 );
+ bbSetOutputOut7( Out7 );
+ bbSetOutputOut8( Out8 );
+ bbSetOutputOut9( Out9 );
+}
+//=====
+// 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)
+//=====
+void VectorFilterDouble::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputType(0);
+ bbSetInputk1(0);
+
+}
+//=====
+// 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)
+//=====
+void VectorFilterDouble::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void VectorFilterDouble::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbstd
+
+