Salome HOME
MacroNodes
authorrahuel <rahuel@opencascade.com>
Wed, 26 Oct 2005 12:53:51 +0000 (12:53 +0000)
committerrahuel <rahuel@opencascade.com>
Wed, 26 Oct 2005 12:53:51 +0000 (12:53 +0000)
src/GraphExecutor/DataFlowExecutor_DataFlow.cxx
src/Supervision/CNode_Impl.cxx
src/Supervision/Graph_Impl.cxx

index 2eb3d0df34ddcbfb3ef63dc24ad867d6c4104365..699a0d8e2ceae9e21b46f10c1ac826da66ee7531 100644 (file)
@@ -223,6 +223,18 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName ,
   RetVal = Graph()->AddOutputData( aNodeName , ToServiceParameterName , aValue ) ;
   GraphBase::OutPort * anOutPort = aMacroNode->GetChangeOutPort( ToServiceParameterName ) ;
   int i ;
+  for ( i = 0 ; i < aMacroNode->GetNodeOutPortsSize() ; i++ ) {
+    cdebug << "Out" << i << " " << aMacroNode->GetNodeOutPort( i )->PortName() << " "
+           << aMacroNode->GetChangeNodeOutPort( i )->PortState() << " Done="
+           << aMacroNode->GetChangeNodeOutPort( i )->PortDone() << " " ;
+    if ( GraphBase::Base::_prof_debug ) {
+      aMacroNode->GetNodeOutPort( i )->StringValue( *GraphBase::Base::_fdebug ) ;
+    }
+    if ( aMacroNode->GetChangeNodeOutPort( i )->IsGate() ) {
+      cdebug << " BoolValue " << aMacroNode->GetChangeNodeOutPort( i )->BoolValue() ;
+    }
+    cdebug << endl ;
+  }
 // Loop over Inports linked to that OutPort of the MacroNode
   for ( i = 0 ; i < anOutPort->InPortsSize() ; i++ ) {
     const char * ToNodeName = anOutPort->ChangeInPorts( i )->NodeName() ;
@@ -239,17 +251,35 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName ,
 //        cdebug << "GraphExecutor::DataFlow::OutputOfAny " << aLinkedNode->Name()
 //               << " IsLockedDataWait --> UnLockDataWait" << endl ;
 //      }
+      aLinkedNode->LockDataReady() ;
       sts = aLinkedNode->SendSomeDataReady( (char * ) aNodeName ) ;
       cdebug << pthread_self() << "/" << aLinkedNode->ThreadNo()
              << "GraphExecutor::DataFlow::OutputOfAny " << aLinkedNode->Name()
              << "->SendSomeDataReady( " << aNodeName << " ) sts " << sts << " " << aLinkedNode->State() << endl ;
       if ( sts ) {
-        if ( aLinkedNode->State() == GraphExecutor::DataReadyState ) {
+//        if ( aLinkedNode->State() == GraphExecutor::DataReadyState ) {
+        if ( aLinkedNode->HasAllDataReady() ) {
+          cdebug << pthread_self() << "/" << aLinkedNode->ThreadNo()
+                 << "GraphExecutor::DataFlow::OutputOfAny SendEvent(ExecuteEvent) to "
+                 << aLinkedNode->Name() << endl ;
 //JR 15.04.2005 Debug PAL8624 RetroConception :
 //          aLinkedNode->CreateNewThreadIf( true ) ;
 //          aLinkedNode->UnLockDataWait() ;
-          aLinkedNode->SendEvent( GraphExecutor::ExecuteEvent ) ;
+          aLinkedNode->CreateNewThread( true ) ;
+          aLinkedNode->UnLockDataReady() ;
+          aLinkedNode->HasAllDataReady( false ) ;
+//          aLinkedNode->SendEvent( GraphExecutor::ExecuteEvent ) ;
+          aLinkedNode->SendEvent( GraphExecutor::AllDataReadyEvent ) ;
         }
+        else {
+          aLinkedNode->UnLockDataReady() ;
+          cdebug << pthread_self() << "/" << aLinkedNode->ThreadNo()
+                 << "GraphExecutor::DataFlow::OutputOfAny NO SendEvent(ExecuteEvent) to "
+                 << aLinkedNode->Name() << endl ;
+        }
+      }
+      else {
+        aLinkedNode->UnLockDataReady() ;
       }
     }
     else if ( Graph()->GraphMacroLevel() != 0 ) {
index 65d5ee1b8e6ed2544f94a2a861b7c38bd7989cde..9dd23bbfb7676741de0438a4ab7a14414c40cb28 100644 (file)
@@ -1738,6 +1738,9 @@ void CNode_Impl::ping() {
       RetVal = false ;
     }
   }
+  if ( IsGraph() || IsStreamGraph() ) {
+    theAutomaton->GraphImpl( (Graph_Impl * ) this ) ;
+  }
 //  endService( "CNode_Impl::ping" );
   return ;
 }
index b6aee77e1bd8cb40d387be9bf2718c5316d2d8e0..9be1703f16358377d18d0719da98e2e93e36e8dd 100644 (file)
@@ -1035,35 +1035,40 @@ SUPERV::Graph_ptr Graph_Impl::GraphMNode( SUPERV::Graph_ptr myMacroGraph ) {
     aDataFlowNode->SetObjRef( SUPERV::CNode::_duplicate( SUPERV::CNode::_narrow( obj ) ) ) ;
     aDataFlowNode->SetObjImpl( this ) ;
 
+    GraphBase::Graph * aSubGraph = NULL ;
 //    GraphBase::Graph * aGraph = DataFlowEditor()->Automaton()->MapGraph( myMacroGraph->Name() ) ;
-    GraphBase::Graph * aGraph ;
     //DataFlowEditor()->Automaton()->GraphBase( &aGraph ) ;
+//JR 20.09.2005 Debug SAB_data_1609_bugPAL.py from CEA (Anthony)
+//    Graph_Impl * aSubGraphImpl = dynamic_cast<Graph_Impl * >( _Poa->id_to_servant( *myMacroGraph->_Id ) ) ;
+    myMacroGraph->ping() ;
+    Graph_Impl * aSubGraphImpl = theAutomaton->GraphImpl() ;
+    aSubGraph = aSubGraphImpl->DataFlowEditor()->Graph() ;
     myMacroGraph->Coupled() ;
     GraphBase::Graph * aGraphOfMacroGraph = myMacroNode->DataFlowEditor()->Graph() ;
     GraphBase::Graph * aMacroGraph = myMacroNode->DataFlowNode()->GraphMacroNode() ;
     aMacroGraph->Kind( SUPERV::MacroNode ) ;
     aMacroGraph->GraphEditor( DataFlowEditor() ) ;
 // Creation of the Ports of the MacroNode from the ports of the GraphMacroNode
-    aMacroGraph->SetMacroPorts( aGraph ) ;
+    aMacroGraph->SetMacroPorts( aSubGraph ) ;
 // Valid ==> creation of Service and the ports of the current Graph
     DataFlowEditor()->IsValid() ;
 // Set the Input Datas from the GraphMacroNode to the current Graph
-    aMacroGraph->SetMacroDatas( aGraph , aGraphOfMacroGraph ) ;
+    aMacroGraph->SetMacroDatas( aSubGraph , aGraphOfMacroGraph ) ;
 //    aMacroGraphDataFlowEditor->UnValid() ;
-    aGraph->GraphEditor()->UnValid() ;
+    aSubGraph->GraphEditor()->UnValid() ;
 // Set the MacroNode ObjRef in the GraphMacroNode
-    aGraph->CoupledNode( aMacroGraph ) ;
-    aGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ;
+    aSubGraph->CoupledNode( aMacroGraph ) ;
+    aSubGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ;
 // Set the GraphMacroNode ObjRef in the MacroNode
     aDataFlowNode->GraphMacroNode()->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ;
-    aMacroGraph->CoupledNode( aGraph ) ;
+    aMacroGraph->CoupledNode( aSubGraph ) ;
     aMacroGraph->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ;
-//    aDataFlowNode->CoupledNode( aGraph ) ;
+//    aDataFlowNode->CoupledNode( aSubGraph ) ;
 //    aDataFlowNode->ComputingNode()->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ;
 // Set the MacroLevel of that graph
-    aGraph->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ;
+    aSubGraph->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ;
     aMacroGraph->Coordinates( 0 , 0 ) ;
-    MESSAGE( aGraph->Name() << "->CoupledNode()->GraphEditor() : " << aGraph->CoupledNode()->GraphEditor() ) ;
+    MESSAGE( aSubGraph->Name() << "->CoupledNode()->GraphEditor() : " << aSubGraph->CoupledNode()->GraphEditor() ) ;
     MESSAGE( aMacroGraph->Name() << "->CoupledNode()->GraphEditor() : "
              << aMacroGraph->CoupledNode()->GraphEditor() ) ;
     MESSAGE( "DataFlowNode Graph " << this << " DataFlowEditor " << DataFlowEditor() << " aDataFlowNode "