From 97d535e9ee0ea003f7d31aca910f34bff316a119 Mon Sep 17 00:00:00 2001 From: davila Date: Wed, 27 Aug 2014 09:27:37 +0200 Subject: [PATCH] #2445 BBTK Feature New Normal - Block Propogation pipeline MagicBox --- kernel/src/bbtkBlackBox.h | 16 ++++--------- packages/std/src/bbstdMagicBox.cxx | 33 ++++++++++++++++++++++++-- packages/std/src/bbstdMagicBox.h | 6 +++++ packages/vtk/src/bbvtkSphereSource.xml | 22 ++++++++++------- 4 files changed, 56 insertions(+), 21 deletions(-) diff --git a/kernel/src/bbtkBlackBox.h b/kernel/src/bbtkBlackBox.h index adddc29..17f5999 100644 --- a/kernel/src/bbtkBlackBox.h +++ b/kernel/src/bbtkBlackBox.h @@ -488,7 +488,7 @@ namespace bbtk //================================================================== /// Computes the final IOStatus of inputs and outputs after processing - void bbComputePostProcessStatus(); +virtual void bbComputePostProcessStatus(); //@} //================================================================== @@ -567,17 +567,13 @@ namespace bbtk //@{ /// Connects the input to the connection c - virtual void bbConnectInput( const std::string& name, - Connection* c); + virtual void bbConnectInput( const std::string& name, Connection* c); /// Connects the output to the connection c - virtual void bbConnectOutput( const std::string& name, - Connection* c); + virtual void bbConnectOutput( const std::string& name, Connection* c); /// Disconnects the input from the connection c - virtual void bbDisconnectInput( const std::string& name, - Connection* c); + virtual void bbDisconnectInput( const std::string& name, Connection* c); /// Disconnects the output from the connection c - virtual void bbDisconnectOutput( const std::string& name, - Connection* c); + virtual void bbDisconnectOutput( const std::string& name, Connection* c); //@} //================================================================== @@ -590,8 +586,6 @@ namespace bbtk /// Sets the bbmExecuting bool returned by bbGetExecuting void bbSetExecuting(bool b) { bbmExecuting = b; } - protected: - //================================================================== protected: diff --git a/packages/std/src/bbstdMagicBox.cxx b/packages/std/src/bbstdMagicBox.cxx index 0bf4ed6..8b99a75 100644 --- a/packages/std/src/bbstdMagicBox.cxx +++ b/packages/std/src/bbstdMagicBox.cxx @@ -41,21 +41,50 @@ using namespace bbtk; namespace bbstd { + void MagicBox::bbComputePostProcessStatus() + { + AtomicBlackBox::bbComputePostProcessStatus(); + + if (bbGetInputActive()==false) + { +printf("EED MagicBox::bbComputePostProcessStatus 1\n"); + // Update the output statuses + IOStatus new_output_status = UPTODATE; + OutputConnectorMapType::iterator o; + for ( o = bbGetOutputConnectorMap().begin(); o!= bbGetOutputConnectorMap().end(); ++o) + { + o->second->SetStatus(new_output_status); + } // for o + } // if + + } + void MagicBox::bbUserSetDefaultValues() { + bbSetInputActive(true); } + void MagicBox::bbUserInitializeProcessing() { } + void MagicBox::bbUserFinalizeProcessing() { } + void MagicBox::DoProcess() { -printf("EED MagicBox::DoProcess Start\n"); - bbSetOutputOut( bbGetInputIn() ); + if (bbGetInputActive()==true) + { +printf("EED MagicBox::DoProcess Start %p\n", this); + bbSetOutputOut( bbGetInputIn() ); printf("EED MagicBox::DoProcess End\n"); + } // Active + else + { + printf("EED MagicBox::DoProcess FALSE\n"); + } } BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,MagicBox); diff --git a/packages/std/src/bbstdMagicBox.h b/packages/std/src/bbstdMagicBox.h index 47d7c9c..1f3b6e4 100644 --- a/packages/std/src/bbstdMagicBox.h +++ b/packages/std/src/bbstdMagicBox.h @@ -50,9 +50,12 @@ namespace bbstd { BBTK_BLACK_BOX_INTERFACE(MagicBox,bbtk::AtomicBlackBox); BBTK_DECLARE_INPUT(In,bbtk::Data); + BBTK_DECLARE_INPUT(Active,bool); BBTK_DECLARE_OUTPUT(Out,bbtk::Data); BBTK_PROCESS(DoProcess); void DoProcess(); + + virtual void bbComputePostProcessStatus(); }; //================================================================== @@ -114,6 +117,9 @@ namespace bbstd (&MagicBox::bbGetInputIn), new MagicBoxSetFunctor (&MagicBox::bbSetInputIn) ) ); + BBTK_INPUT(MagicBox, Active, "Active True/False (default True)",bool,""); + + AddOutputDescriptor (new bbtk::AtomicBlackBoxOutputDescriptor (typeid(MagicBoxDescriptor), diff --git a/packages/vtk/src/bbvtkSphereSource.xml b/packages/vtk/src/bbvtkSphereSource.xml index 2707131..463fca0 100644 --- a/packages/vtk/src/bbvtkSphereSource.xml +++ b/packages/vtk/src/bbvtkSphereSource.xml @@ -10,6 +10,7 @@ vtkSphereSource + @@ -20,20 +21,25 @@
  
+if (bbGetInputActive()==true)
+{
 
-bbGetVtkObject()->SetCenter(bbGetInputCenterX(), 
-          bbGetInputCenterY(), 
-          bbGetInputCenterZ());
-//bbGetVtkObject()->SetPhiResolution(bbGetInputPhiResolution());
-//bbGetVtkObject()->SetThetaResolution(bbGetInputThetaResolution());
-//bbGetVtkObject()->SetRadius(bbGetInputRadius());
-//printf("EED box vtk:SphereSource theta=%d  phi=%d\n", bbGetInputThetaResolution() , bbGetInputPhiResolution());
+	bbGetVtkObject()->SetCenter(bbGetInputCenterX(), bbGetInputCenterY(), bbGetInputCenterZ());
+   //bbGetVtkObject()->SetPhiResolution(bbGetInputPhiResolution());
+   //bbGetVtkObject()->SetThetaResolution(bbGetInputThetaResolution());
+   //bbGetVtkObject()->SetRadius(bbGetInputRadius());
+   //printf("EED box vtk:SphereSource theta=%d  phi=%d\n", bbGetInputThetaResolution() , bbGetInputPhiResolution());
+	bbGetVtkObject()->Update();
+}
 
-bbGetVtkObject()->Update();
 
+
+  bbSetInputActive(true);
+
+ -- 2.47.1