From be6451c2d201d8b3aa3089ced1788cda69df12cc Mon Sep 17 00:00:00 2001 From: Claire Mouton Date: Wed, 11 Apr 2012 16:30:34 +0000 Subject: [PATCH] Added MixingVector box. --- packages/std/src/bbstdMixingVectors.cxx | 65 +++++++++++++++++++++++++ packages/std/src/bbstdMixingVectors.h | 51 +++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 packages/std/src/bbstdMixingVectors.cxx create mode 100644 packages/std/src/bbstdMixingVectors.h diff --git a/packages/std/src/bbstdMixingVectors.cxx b/packages/std/src/bbstdMixingVectors.cxx new file mode 100644 index 0000000..23edf04 --- /dev/null +++ b/packages/std/src/bbstdMixingVectors.cxx @@ -0,0 +1,65 @@ +#include "bbstdMixingVectors.h" +#include "bbstdPackage.h" +namespace bbstd +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,MixingVectors) +BBTK_BLACK_BOX_IMPLEMENTATION(MixingVectors,bbtk::AtomicBlackBox); + +void MixingVectors::Process() +{ +// THE MAIN PROCESSING METHOD BODY + int size1 = bbGetInputIn1().size(); + int size2 = bbGetInputIn2().size(); + int size3 = bbGetInputIn3().size(); + int size4 = bbGetInputIn4().size(); + int size5 = bbGetInputIn5().size(); + int size6 = bbGetInputIn6().size(); + int size7 = bbGetInputIn7().size(); + int size8 = bbGetInputIn8().size(); + int size9 = bbGetInputIn9().size(); + int size10 = bbGetInputIn10().size(); + std::vector outputVector; + + for (int i = 0; i < size1; i++) + { + outputVector.push_back( bbGetInputIn1()[i] ); + if (i < size2) + outputVector.push_back( bbGetInputIn2()[i] ); + if (i < size3) + outputVector.push_back( bbGetInputIn3()[i] ); + if (i < size4) + outputVector.push_back( bbGetInputIn4()[i] ); + if (i < size5) + outputVector.push_back( bbGetInputIn5()[i] ); + if (i < size6) + outputVector.push_back( bbGetInputIn6()[i] ); + if (i < size7) + outputVector.push_back( bbGetInputIn7()[i] ); + if (i < size8) + outputVector.push_back( bbGetInputIn8()[i] ); + if (i < size9) + outputVector.push_back( bbGetInputIn9()[i] ); + if (i < size10) + outputVector.push_back( bbGetInputIn10()[i] ); + } + + bbSetOutputOut(outputVector); +} + +void MixingVectors::bbUserSetDefaultValues() +{ + // THE DEFAULT INPUT/OUTPUT VALUES +} + +void MixingVectors::bbUserInitializeProcessing() +{ + +} + +void MixingVectors::bbUserFinalizeProcessing() +{ + +} +} +// EO namespace bbstd diff --git a/packages/std/src/bbstdMixingVectors.h b/packages/std/src/bbstdMixingVectors.h new file mode 100644 index 0000000..5648405 --- /dev/null +++ b/packages/std/src/bbstdMixingVectors.h @@ -0,0 +1,51 @@ +#ifndef __bbstdMixingVectors_h_INCLUDED__ +#define __bbstdMixingVectors_h_INCLUDED__ +#include "bbstd_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +namespace bbstd +{ + +class bbstd_EXPORT MixingVectors + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(MixingVectors,bbtk::AtomicBlackBox); + BBTK_DECLARE_INPUT(In1,std::vector); + BBTK_DECLARE_INPUT(In2,std::vector); + BBTK_DECLARE_INPUT(In3,std::vector); + BBTK_DECLARE_INPUT(In4,std::vector); + BBTK_DECLARE_INPUT(In5,std::vector); + BBTK_DECLARE_INPUT(In6,std::vector); + BBTK_DECLARE_INPUT(In7,std::vector); + BBTK_DECLARE_INPUT(In8,std::vector); + BBTK_DECLARE_INPUT(In9,std::vector); + BBTK_DECLARE_INPUT(In10,std::vector); + BBTK_DECLARE_OUTPUT(Out,std::vector); + BBTK_PROCESS(Process); + void Process(); +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(MixingVectors,bbtk::AtomicBlackBox); +BBTK_NAME("MixingVectors"); +BBTK_AUTHOR("Claire Mouton"); +BBTK_DESCRIPTION("Transforms a set of vectors of double into a single vector of double (starting by the first values of each vector, followed by the second values of each vector, etc.)"); +BBTK_CATEGORY("std"); +BBTK_INPUT(MixingVectors,In1,"1st input vector",std::vector,""); +BBTK_INPUT(MixingVectors,In2,"2nd input vector",std::vector,""); +BBTK_INPUT(MixingVectors,In3,"3rd input vector",std::vector,""); +BBTK_INPUT(MixingVectors,In4,"4th input vector",std::vector,""); +BBTK_INPUT(MixingVectors,In5,"5th input vector",std::vector,""); +BBTK_INPUT(MixingVectors,In6,"6th input vector",std::vector,""); +BBTK_INPUT(MixingVectors,In7,"7th input vector",std::vector,""); +BBTK_INPUT(MixingVectors,In8,"8th input vector",std::vector,""); +BBTK_INPUT(MixingVectors,In9,"9th input vector",std::vector,""); +BBTK_INPUT(MixingVectors,In10,"10th input vector",std::vector,""); +BBTK_OUTPUT(MixingVectors,Out,"Mixed vector",std::vector,""); +BBTK_END_DESCRIBE_BLACK_BOX(MixingVectors); +} +// EO namespace bbstd + +#endif // __bbstdMixingVectors_h_INCLUDED__ + -- 2.47.1