]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0020605: EDF 1190 SMESH: Display performance. 80 seconds for 52000 cells.
authoreap <eap@opencascade.com>
Fri, 11 Dec 2009 10:43:31 +0000 (10:43 +0000)
committereap <eap@opencascade.com>
Fri, 11 Dec 2009 10:43:31 +0000 (10:43 +0000)
 set IsEmbeddedMode() in costructor

src/SMESH_I/SMESH_Gen_i.cxx

index f33cce68f45b3297e98adc95feab8cff0c3b1836..58ed9071fb926cf8b2d70b2c491ac4b133f4c7e9 100644 (file)
 #include "OpUtil.hxx"
 
 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
+#include CORBA_CLIENT_HEADER(SALOME_Session)
 
 #include "GEOM_Client.hxx"
 #include "Utils_ExceptHandlers.hxx"
+#include "Basics_Utils.hxx"
 
 #include <map>
 
@@ -279,6 +281,28 @@ SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr            orb,
 
   // set it in standalone mode only
   //OSD::SetSignal( true );
+
+  // 0020605: EDF 1190 SMESH: Display performance. 80 seconds for 52000 cells.
+  // find out mode (embedded or standalone) here else
+  // meshes created before calling SMESH_Client::GetSMESHGen(), which calls
+  // SMESH_Gen_i::SetEmbeddedMode(), have wrong IsEmbeddedMode flag
+  if ( SALOME_NamingService* ns = GetNS() )
+  {
+    CORBA::Object_var obj = ns->Resolve( "/Kernel/Session" );
+    SALOME::Session_var session = SALOME::Session::_narrow( obj ) ;
+    if ( !session->_is_nil() )
+    {
+      CORBA::String_var s_host = session->getHostname();
+      CORBA::Long        s_pid = session->getPID();
+      string my_host = Kernel_Utils::GetHostname();
+#ifdef WNT
+      long    my_pid = (long)_getpid();
+#else
+      long    my_pid = (long) getpid();
+#endif
+      SetEmbeddedMode( s_pid == my_pid && my_host == s_host.in() );
+    }
+  }
 }
 
 //=============================================================================