]> Creatis software - bbtk.git/commitdiff
#3068 BBTK Feature New Normal - bbstdVectorFilterDouble addition and sustraction
authorEduardo DAVILA <davila@localhost.localdomain>
Wed, 8 Mar 2017 09:04:49 +0000 (10:04 +0100)
committerEduardo DAVILA <davila@localhost.localdomain>
Wed, 8 Mar 2017 09:04:49 +0000 (10:04 +0100)
packages/std/src/bbstdVectorFilterDouble.cxx
packages/std/src/bbstdVectorFilterDouble.h

index 0fb6621500aef7c3ae2277947cf6a8754e689a10..af17d93af7d0d81ad4dc635f8b457a476a49359d 100644 (file)
@@ -123,7 +123,7 @@ void VectorFilterDouble::Process()
                } // for ipLstVec
        } // Type==1
 
-       if (bbGetInputType()==2) // Insert intermediate pointss
+       if (bbGetInputType()==2) // Insert intermediate points
        {
                int             ipLstvec;
                int     i;
@@ -146,6 +146,40 @@ void VectorFilterDouble::Process()
        } // 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
+
        bbSetOutputOut0( Out0 );
        bbSetOutputOut1( Out1 );
        bbSetOutputOut2( Out2 );
@@ -166,6 +200,7 @@ 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);
   
 }
 //===== 
index e2e685da6f1a05c94f207f2246adb09282da3e96..4f09e18d1b0d33946437682b726a4995ed1ea367 100644 (file)
@@ -52,8 +52,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(VectorFilterDouble,bbtk::AtomicBlackBox);
   BBTK_AUTHOR("InfoDev");
   BBTK_DESCRIPTION("No Description.");
   BBTK_CATEGORY("empty");
-  BBTK_INPUT(VectorFilterDouble,Type,"default (0)  0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points",int,"");
-  BBTK_INPUT(VectorFilterDouble,k1,"default (0)  nothing (Type0), k1=new size vectors (Type 1)   , ",double,"");
+  BBTK_INPUT(VectorFilterDouble,Type,"default (0)  0=Erase duplicated lines, 1=Redimention Vectors, 2=Insert intermediat points,3=Adition 4=Substraction ",int,"");
+  BBTK_INPUT(VectorFilterDouble,k1,"default (0)  nothing (Type0), k1=new size vectors (Type 1) , nothing (Type2), k1 = Addition const. (Type 3), k1 = Substraction const. (Type 4) , ",double,"");
   BBTK_INPUT(VectorFilterDouble,In0,"Input vector",std::vector<double>,"");
   BBTK_INPUT(VectorFilterDouble,In1,"Input vector",std::vector<double>,"");
   BBTK_INPUT(VectorFilterDouble,In2,"Input vector",std::vector<double>,"");