//===== // 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 "bbstdMathOperationVector.h" #include "bbstdPackage.h" #include #include #include namespace bbstd { BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,MathOperationVector) BBTK_BLACK_BOX_IMPLEMENTATION(MathOperationVector,bbtk::AtomicBlackBox); double MathOperationVector::g(std::vector*v,unsigned int i,double defValue ) { double result=defValue; if (i < (*v).size()) { result= (*v)[i]; } return result; } void MathOperationVector::SumVector(std::vector *v,std::vector *vr) { unsigned int i; double tmpResult=0; unsigned int sizeVec=v->size(); if ( sizeVec>0) { for (i=0;ipush_back( tmpResult ); } // if sizeVec } void MathOperationVector::MinVector(std::vector *v,std::vector *vr) { unsigned int i; double tmpResult; unsigned int sizeVec=v->size(); if ( sizeVec>0) { tmpResult=(*v)[0]; for (i=1;ipush_back( tmpResult ); } // if sizeVec } void MathOperationVector::MaxVector(std::vector *v,std::vector *vr) { unsigned int i; double tmpResult; unsigned int sizeVec=v->size(); if ( sizeVec>0) { tmpResult=(*v)[0]; for (i=1;ipush_back( tmpResult ); } // if sizeVec } //===== // 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 MathOperationVector::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') bool error; unsigned int i; unsigned int sizeVec = bbGetInputIn0().size(); double tmpResult; std::vector resultVec; std::vector _v0=bbGetInputIn0(); std::vector _v1=bbGetInputIn1(); std::vector _v2=bbGetInputIn2(); std::vector _v3=bbGetInputIn3(); std::vector _v4=bbGetInputIn4(); std::vector _v5=bbGetInputIn5(); std::vector _v6=bbGetInputIn6(); std::vector _v7=bbGetInputIn7(); std::vector _v8=bbGetInputIn8(); std::vector _v9=bbGetInputIn9(); std::vector *v0 = &_v0; std::vector *v1 = &_v1; std::vector *v2 = &_v2; std::vector *v3 = &_v3; std::vector *v4 = &_v4; std::vector *v5 = &_v5; std::vector *v6 = &_v6; std::vector *v7 = &_v7; std::vector *v8 = &_v8; std::vector *v9 = &_v9; double minTmp; double maxTmp; if (firsttime==true) { firsttime=false; /* initialize random seed: */ srand (time(NULL)); if (bbGetInputType()==7) { for (i=0;i=0) tmpResult = sqrt( bbGetInputIn0()[i] ) ; else tmpResult = 0 ; resultVec.push_back( tmpResult ); } // for i bbSetOutputOut( resultVec ); } // if Type 4 if (bbGetInputType()==5) { for (i=0;i0) tmpResult = log( bbGetInputIn0()[i] ) ; else tmpResult = -99999 ; resultVec.push_back( tmpResult ); } // for i bbSetOutputOut( resultVec ); } // if Type 5 if (bbGetInputType()==6) { for (i=0;ig(v1,i,0)) acum[i]=g(v0,i,0); } // for } // if Type 7 if (bbGetInputType()==8 ) { for (i=0;i