]> Creatis software - bbtk.git/commitdiff
Feature #1743 Add a box building a vector ot arithmetic suite values.
authorClaire Mouton <Claire.Mouton@creatis.insa-lyon.fr>
Wed, 7 Nov 2012 13:31:30 +0000 (13:31 +0000)
committerClaire Mouton <Claire.Mouton@creatis.insa-lyon.fr>
Wed, 7 Nov 2012 13:31:30 +0000 (13:31 +0000)
packages/std/bbs/appli/exampleCreateArithmeticSuiteVector.bbg [new file with mode: 0644]
packages/std/bbs/appli/exampleCreateArithmeticSuiteVector.bbs [new file with mode: 0644]
packages/std/src/bbstdCreateArithmeticSuiteVector.cxx [new file with mode: 0644]
packages/std/src/bbstdCreateArithmeticSuiteVector.h [new file with mode: 0644]

diff --git a/packages/std/bbs/appli/exampleCreateArithmeticSuiteVector.bbg b/packages/std/bbs/appli/exampleCreateArithmeticSuiteVector.bbg
new file mode 100644 (file)
index 0000000..639192e
--- /dev/null
@@ -0,0 +1,35 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/mouton/Creatis/all/creatools_source/bbtk/packages/std/bbs/appli/exampleCreateArithmeticSuiteVector.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:2
+BOX
+std:CreateArithmeticSuiteVector:Box00
+ISEXEC:FALSE
+-26.352728:60.824945:-900.000000
+44.822272:50.824945:-900.000000
+PORT
+Delta:"2"
+PORT
+FirstValue:"5"
+PORT
+Size:"10"
+FIN_BOX
+BOX
+wx:OutputText:Box01
+ISEXEC:TRUE
+-28.062094:29.201672:-900.000000
+17.512906:19.201672:-900.000000
+FIN_BOX
+CONNECTIONS:1
+CONNECTION
+Box00:ArithmeticSuiteVector:Box01:In
+NumberOfControlPoints:0
+APP_END
diff --git a/packages/std/bbs/appli/exampleCreateArithmeticSuiteVector.bbs b/packages/std/bbs/appli/exampleCreateArithmeticSuiteVector.bbs
new file mode 100644 (file)
index 0000000..f864f99
--- /dev/null
@@ -0,0 +1,31 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /home/mouton/Creatis/all/creatools_source/bbtk/packages/std/bbs/appli/exampleCreateArithmeticSuiteVector.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include std
+include wx
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new CreateArithmeticSuiteVector Box00
+  set Box00.Delta "2"
+  set Box00.FirstValue "5"
+  set Box00.Size "10"
+
+new OutputText Box01
+
+
+connect Box00.ArithmeticSuiteVector Box01.In
+
+
+
+# Complex input ports
+exec Box01
diff --git a/packages/std/src/bbstdCreateArithmeticSuiteVector.cxx b/packages/std/src/bbstdCreateArithmeticSuiteVector.cxx
new file mode 100644 (file)
index 0000000..caa2c07
--- /dev/null
@@ -0,0 +1,42 @@
+#include "bbstdCreateArithmeticSuiteVector.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,CreateArithmeticSuiteVector)
+BBTK_BLACK_BOX_IMPLEMENTATION(CreateArithmeticSuiteVector,bbtk::AtomicBlackBox);
+
+void CreateArithmeticSuiteVector::Process()
+{
+// THE MAIN PROCESSING METHOD BODY
+  std::vector<double> outputVector;
+
+  double value =  bbGetInputFirstValue();
+  double delta = bbGetInputDelta();
+  for (int i = 0; i <  bbGetInputSize(); i++)
+     {
+       outputVector.push_back(value + i*delta);
+     }
+
+   bbSetOutputArithmeticSuiteVector(outputVector);  
+}
+
+void CreateArithmeticSuiteVector::bbUserSetDefaultValues()
+{
+   // THE DEFAULT INPUT/OUTPUT VALUES
+  bbSetInputFirstValue(0);
+  bbSetInputDelta(0);
+  bbSetInputSize(0);
+}
+void CreateArithmeticSuiteVector::bbUserInitializeProcessing()
+{
+}
+
+void CreateArithmeticSuiteVector::bbUserFinalizeProcessing()
+{
+  
+}
+}
+// EO namespace bbstd
diff --git a/packages/std/src/bbstdCreateArithmeticSuiteVector.h b/packages/std/src/bbstdCreateArithmeticSuiteVector.h
new file mode 100644 (file)
index 0000000..426eaa3
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef __bbstdCreateArithmeticSuiteVector_h_INCLUDED__
+#define __bbstdCreateArithmeticSuiteVector_h_INCLUDED__
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT CreateArithmeticSuiteVector
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(CreateArithmeticSuiteVector,bbtk::AtomicBlackBox);
+  BBTK_DECLARE_INPUT(FirstValue,double);
+  BBTK_DECLARE_INPUT(Delta,double);
+  BBTK_DECLARE_INPUT(Size,int);
+  BBTK_DECLARE_OUTPUT(ArithmeticSuiteVector,std::vector<double>);
+  BBTK_PROCESS(Process);
+  void Process();
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(CreateArithmeticSuiteVector,bbtk::AtomicBlackBox);
+BBTK_NAME("CreateArithmeticSuiteVector");
+BBTK_AUTHOR("Claire Mouton");
+BBTK_DESCRIPTION("Creates a vector with the values of an arithmetic suite, given the first value, the difference between two consecutive elements (delta) and its size.");
+BBTK_CATEGORY("std");
+BBTK_INPUT(CreateArithmeticSuiteVector,FirstValue,"The first value of the vector.",double,"");
+BBTK_INPUT(CreateArithmeticSuiteVector,Delta,"The difference between two consecutive elements (Put 0 to get a constatn vector).",double,"");
+BBTK_INPUT(CreateArithmeticSuiteVector,Size,"Size of the vector to create.",int,"");
+BBTK_OUTPUT(CreateArithmeticSuiteVector,ArithmeticSuiteVector,"The created vector.",std::vector<double>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(CreateArithmeticSuiteVector);
+}
+// EO namespace bbstd
+
+#endif // __bbstdCreateArithmeticSuiteVector_h_INCLUDED__
+