]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: merge from tag mergefrom_HEAD_24Jan05 + corrections
authorprascle <prascle>
Wed, 26 Jan 2005 06:47:57 +0000 (06:47 +0000)
committerprascle <prascle>
Wed, 26 Jan 2005 06:47:57 +0000 (06:47 +0000)
89 files changed:
INSTALL
Makefile.in
bin/VERSION
bin/orbmodule.py
bin/runSalome.py
doc/salome/tui/Makefile.in
idl/Makefile.in
idl/SALOME_Component.idl
resources/KERNELCatalog.xml
salome_adm/unix/make_commence.in
salome_adm/unix/make_conclude.in
src/Container/Component_i.cxx
src/Container/Container_i.cxx
src/Container/Makefile.in
src/Container/SALOME_Component_i.hxx
src/Container/SALOME_Container.cxx
src/Container/SALOME_Container_i.hxx
src/DataTypeCatalog/Makefile.in
src/LifeCycleCORBA/LifeCycleCORBA.py
src/LifeCycleCORBA/Makefile.in
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx
src/Loader/Makefile.in
src/Logger/SALOME_Logger_Server.cxx
src/MEDWrapper/Base/MED_Algorithm.cxx
src/MEDWrapper/Base/MED_Algorithm.hxx
src/MEDWrapper/Base/MED_Common.hxx
src/MEDWrapper/Base/MED_Structures.cxx
src/MEDWrapper/Base/MED_Structures.hxx
src/MEDWrapper/Base/MED_TStructures.hxx
src/MEDWrapper/Base/MED_TWrapper.hxx
src/MEDWrapper/Base/MED_Utilities.cxx
src/MEDWrapper/Base/MED_Utilities.hxx
src/MEDWrapper/Base/MED_Wrapper.cxx
src/MEDWrapper/Base/MED_Wrapper.hxx
src/MEDWrapper/Base/Makefile.in
src/MEDWrapper/Factory/MED_Factory.hxx
src/MEDWrapper/Factory/MED_Test.cxx
src/MEDWrapper/Factory/Makefile.in
src/MEDWrapper/V2_1/MED_V2_1_Wrapper.cxx
src/MEDWrapper/V2_1/MED_V2_1_Wrapper.hxx
src/MEDWrapper/V2_1/Makefile.in
src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx
src/MEDWrapper/V2_2/MED_V2_2_Wrapper.hxx
src/MPIContainer/MPIContainer_i.cxx
src/MSG2QM/Makefile.in
src/Makefile.in
src/ModuleCatalog/Makefile.in
src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx
src/NamingService/NamingService_WaitForServerReadiness.cxx
src/NamingService/SALOME_NamingService.cxx
src/NamingService/SALOME_NamingService.hxx
src/OCCViewer/Makefile.in
src/Plot2d/Makefile.in
src/Registry/Makefile.in
src/RessourcesCatalog/Makefile.in
src/SALOMEDS/Makefile.in
src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx
src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx
src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx
src/SALOMEDS/SALOMEDS_IORAttribute.cxx
src/SALOMEDS/SALOMEDS_IORAttribute.hxx
src/SALOMEDS/SALOMEDS_SObject_i.cxx
src/SALOMEDS/SALOMEDS_SObject_i.hxx
src/SALOMEDS/SALOMEDS_Server.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx
src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
src/SALOMEDS/SALOMEDS_StudyManager_i.hxx
src/SALOMEDS/SALOMEDS_Study_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.hxx
src/SALOMEGUI/CLIENT_msg_en.po
src/SALOMEGUI/Makefile.in
src/SALOMEGUI/PyInterp_base.cxx
src/SALOMELocalTrace/Makefile.in
src/SALOME_PY/Makefile.in
src/SALOME_PYQT/Makefile.in
src/SALOME_SWIG_WITHOUTIHM/salome.py
src/SALOME_SWIG_WITHOUTIHM/salome_iapp.py
src/SALOME_SWIG_WITHOUTIHM/salome_kernel.py
src/SALOME_SWIG_WITHOUTIHM/salome_study.py
src/SUPERVGraph/Makefile.in
src/Session/Makefile.in
src/Session/Session_ServerLauncher.cxx
src/Session/Session_ServerThread.cxx
src/Session/Session_ServerThread.hxx
src/TOOLSGUI/Makefile.in
src/TestContainer/Makefile.in
src/VTKViewer/Makefile.in

diff --git a/INSTALL b/INSTALL
index a8d9d6266804b8a968bb3841619378c902818b66..f3e4b69171fa5db955cd8ff0cf2c862bd11c77a6 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,8 @@
-This is the version 2.1.0 of KERNEL
+This is the version 2.2.0 of KERNEL
 
 Previous versions :
-        - 2.0.0
+        - 2.1.0
+       - 2.0.0
         - 1.4.1
        - 1.3.0
        - 1.2.1
index 426130bbdc03de15b1744e4b3366b2fe55011e45..ab8870626c6973b823d9a0c6502fd9497bf28f91 100644 (file)
@@ -21,6 +21,7 @@ back.xpm \
 cascade.png \
 CatalogDataType.xml \
 KERNELCatalog.xml \
+CatalogResources.xml \
 CatalogRessources.xml \
 close.png \
 config \
index f15697e352f79c739e4a4609daa6ed1e90a66ae2..9f5dca97555cdfb53650b44ff00280777d64ebda 100755 (executable)
@@ -1 +1 @@
-THIS IS SALOME - KERNEL VERSION: 2.1.0
+THIS IS SALOME - KERNEL VERSION: 2.2.0
index a96bc98474421374d75f781c0d150a8916c83177..a7cc2a2eb6845f70680c36b0da5af66858fc17d0 100755 (executable)
@@ -118,9 +118,9 @@ class client:
 
    # --------------------------------------------------------------------------
 
-   def waitNS(self,name,typobj=None,maxcount=70):
+   def waitNS(self,name,typobj=None,maxcount=40):
       count=0
-      delta=0.3
+      delta=0.5
       print "Searching %s in Naming Service " % name,
       while(1):
           count += 1
@@ -161,9 +161,9 @@ class client:
    
    # --------------------------------------------------------------------------
 
-   def waitLogger(self,name,typobj=None,maxcount=10):
+   def waitLogger(self,name,typobj=None,maxcount=40):
       count=0
-      delta=0.3
+      delta=0.5
       print "Searching %s in Naming Service " % name,
       while(1):
           count += 1
index 1bc6049700e6f3497fb5e5c641c34f5a84cff7f1..8f95627030b23537f91fc639f1c6a5baaa5c6100 100755 (executable)
@@ -252,7 +252,6 @@ class Server:
         pid = os.spawnvp(os.P_NOWAIT, command[0], command)
         process_id[pid]=self.CMD
 
-# ---
 
 class InterpServer(Server):
     def __init__(self,args):
@@ -465,6 +464,8 @@ def startSalome(args, modules_list, modules_root_dir):
     # Notify Server launch
     #
 
+    print "Notify Server to launch"
+
     myServer=NotifyServer(args,modules_root_dir)
     myServer.run()
 
@@ -482,6 +483,7 @@ def startSalome(args, modules_list, modules_root_dir):
     # Lancement Catalog Server,
     # attente de la disponibilité du Catalog Server dans le Naming Service
     #
+    
 
     if 'moduleCatalog' not in args['embedded']:
         cataServer=CatalogServer(args)
@@ -543,7 +545,7 @@ def startSalome(args, modules_list, modules_root_dir):
             os.environ["HOSTNAME"]=os.getenv("HOST")
 
     theComputer = getShortHostName()
-  
+    
     #
     # Lancement Container C++ local,
     # attente de la disponibilité du Container C++ local dans le Naming Service
index 3f4811e43e6b41c6859461091c1f3cd608e8a092..eeaff820dcf95c738a4c50aa76240fd73ed50960 100644 (file)
@@ -23,6 +23,7 @@ docs:
        mv -f doxyfile1 doxyfile; \
        $(doxygen) ./doxyfile; \
        cd ..; \
+       mkdir KERNEL; \
        cp -fr $(srcdir)/KERNEL/sources/static/*.* ./KERNEL/
        cp -fr $(srcdir)/KERNEL/sources/ KERNEL/
        cp -fr $(srcdir)/KERNEL/HTML/ KERNEL/
index 6e46e61bd1c4b576c0e36f9236923ddafe4736bb..40542236a397809ec23585c5484278f36033d79e 100644 (file)
@@ -20,6 +20,7 @@ IDL_FILES = \
   SALOMEDS_Attributes.idl \
   SALOME_Session.idl \
   SALOME_Component.idl \
+  SALOME_ContainerManager.idl \
   SALOME_TestComponent.idl \
   SALOME_Registry.idl \
   SALOME_MPIObject.idl \
index ecad1fa416abb8442c7cc01f1554e62088e28a32..8760ae9dffd1616088d30ab04e39a05a4eb1ee53 100644 (file)
@@ -52,12 +52,6 @@ module Engines
 */
   interface Container
   {
-/*!
-    Initializes the %container with a definite name.
-    \param ContainerName Name of the container
-    \return an initialized container
-*/
-    Container start_impl( in string ContainerName ) ;
 
 /*!
     Loads into the container a new component, registers it and starts it's CORBA servant.
@@ -94,6 +88,10 @@ module Engines
    Returns True if the %container has been killed
 */
     boolean Kill_impl() ;
+/*!
+   Shutdown the Container process.
+*/
+    oneway void Shutdown();
 /*!
    Returns the hostname of the container
 */
index c0d046504edb48917b2e694a5e856e600d7be0cc..1208eb26ffa20b95f67d00b82d5064a39befa9fd 100644 (file)
@@ -16,7 +16,7 @@
                <component-username>Salome</component-username>
                <component-type>Other</component-type>
                <component-author>NRI</component-author>
-               <component-version>2.1.0</component-version>
+               <component-version>2.2.0</component-version>
                <component-comment>GUI Neutral Context</component-comment>
                <component-multistudy>1</component-multistudy>
 
index 77747e2b817073799c45d4643c0246468f3cb02d..7e5122adbc32a661ab6f7d2d315dd0f8df839258 100644 (file)
@@ -11,10 +11,13 @@ HAVE_SSTREAM=@HAVE_SSTREAM@
 
 
 LIBS=@LIBS@ 
+LIBSFORBIN=@LIBS@
 # LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome
 LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome
+LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib/salome
 # add libstdc++ to link c++ library with libtool !
 LDFLAGS+= @STDLIB@
+LDFLAGSFORBIN+= @STDLIB@
 
 #CP=@CP@
 
index 9c35798ec08d2b833ad053a3bbbc225b9e4295e1..2b8f95495ffc84b81fdfa33e08ba7694f88c2a99 100644 (file)
@@ -95,7 +95,7 @@ $(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/
        ln -sf $(CURDIR)/$< $@
 
 $(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
-       $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGS) $(LIBS)
+       $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN)
 
 # copy python scripts in $(top_builddir)/bin/salome
 #
index 880bb043829df4650e0c48abf2d38cae72918b05..ff343a2cc5065e9a6c22413bd13dc2dfca994d59 100644 (file)
@@ -27,6 +27,7 @@
 //  $Header$
 
 #include "SALOME_Component_i.hxx"
+#include "SALOME_Container_i.hxx"
 #include "RegistryConnexion.hxx"
 #include "OpUtil.hxx"
 #include <stdio.h>
@@ -397,3 +398,20 @@ CORBA::Long Engines_Component_i::CpuUsed_impl() {
 void Engines_Component_i::sendMessage(const char *event_type, const char *message) {
     _notifSupplier->Send(graphName(), nodeName(), event_type, message);
 }
+
+string Engines_Component_i::GetDynLibraryName(const char *componentName)
+{
+  string ret="lib";
+  ret+=componentName;
+  ret+="Engine.so";
+  return ret;
+}
+
+string Engines_Component_i::BuildComponentNameForNS(const char *ComponentName, const char *ContainerName, const char *hostname)
+{
+  string ret=Engines_Container_i::BuildContainerNameForNS(ContainerName,hostname);
+  ret+="/";
+  ret+=ComponentName;
+  return ret;
+}
+
index e36089f5e2493ec8ea9ac850cd2cfcdcaca35441..301b56719d2ad9983d49eedec06f75c0e21d8bea 100644 (file)
@@ -30,8 +30,9 @@
 #include CORBA_SERVER_HEADER(SALOME_Component)
 #include "SALOME_Container_i.hxx"
 #include "SALOME_NamingService.hxx"
-#include "Utils_SINGLETON.hxx"
+//#include "Utils_SINGLETON.hxx"
 #include "OpUtil.hxx"
+#include <string.h>
 #include <stdio.h>
 #include <dlfcn.h>
 #include <unistd.h>
@@ -52,6 +53,8 @@ char ** _ArgV ;
 extern "C" {void ActSigIntHandler() ; }
 extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; }
 
+const char *Engines_Container_i::_defaultContainerName="FactoryServer";
+
 Engines_Container_i::Engines_Container_i () :
  _numInstance(0)
 {
@@ -61,13 +64,12 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
                                          PortableServer::POA_ptr poa,
                                          char *containerName ,
                                           int argc , char* argv[],
-                                         bool regist,
-                                         bool activ ) :
+                                         bool activAndRegist ) :
  _numInstance(0)
 {
   _pid = (long)getpid();
 
-  if(regist)
+  if(activAndRegist)
     ActSigIntHandler() ;
 
   _ArgC = argc ;
@@ -98,35 +100,20 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
 
   SCRUTE(hostname);
 
-  _containerName = "/Containers/";
-  if (strlen(containerName)== 0)
-    {
-      _containerName += hostname;
-    }
-  else
-    {
-      _containerName += hostname;
-      _containerName += "/" ;
-      _containerName += containerName;
-    }
+  _containerName = BuildContainerNameForNS(containerName,hostname.c_str());
 
   _orb = CORBA::ORB::_duplicate(orb) ;
   _poa = PortableServer::POA::_duplicate(poa) ;
-  // Pour les containers paralleles: il ne faut pas activer le container generique, mais le container specialise
-  if(activ){
-    MESSAGE("activate object");
-    _id = _poa->activate_object(this);
-  }
-
-  // Pour les containers paralleles: il ne faut pas enregistrer le container generique, mais le container specialise
-  if(regist){
-    //   _NS = new SALOME_NamingService(_orb);
-    _NS = SINGLETON_<SALOME_NamingService>::Instance() ;
-    ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
-    _NS->init_orb( orb ) ;
 
-    Engines::Container_ptr pCont 
-      = Engines::Container::_narrow(_this());
+  // Pour les containers paralleles: il ne faut pas enregistrer et activer le container generique, mais le container specialise
+  if(activAndRegist){
+    _id = _poa->activate_object(this);
+    _NS = new SALOME_NamingService();//SINGLETON_<SALOME_NamingService>::Instance() ;
+    //ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
+    _NS->init_orb( CORBA::ORB::_duplicate(_orb) ) ;
+    CORBA::Object_var obj=_poa->id_to_reference(*_id);
+    Engines::Container_var pCont 
+      = Engines::Container::_narrow(obj);
     SCRUTE(_containerName);
     _NS->Register(pCont, _containerName.c_str()); 
   }
@@ -135,6 +122,7 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
 Engines_Container_i::~Engines_Container_i()
 {
   MESSAGE("Container_i::~Container_i()");
+  delete _id;
 }
 
 char* Engines_Container_i::name()
@@ -154,6 +142,16 @@ void Engines_Container_i::ping()
   MESSAGE("Engines_Container_i::ping() pid "<< getpid());
 }
 
+// shutdown corba server
+void Engines_Container_i::Shutdown()
+{
+  MESSAGE("Engines_Container_i::Shutdown()");
+  _NS->Destroy_Name(_containerName.c_str());
+  //_remove_ref();
+  //_poa->deactivate_object(*_id);
+  _orb->shutdown(0);
+}
+
 //! Kill current container
 bool Engines_Container_i::Kill_impl() {
   MESSAGE("Engines_Container_i::Kill() pid "<< getpid() << " containerName "
@@ -162,147 +160,6 @@ bool Engines_Container_i::Kill_impl() {
   exit( 0 ) ;
 }
 
-//! Launch a new container from the current container
-Engines::Container_ptr Engines_Container_i::start_impl(
-                                      const char* ContainerName ) {
-  MESSAGE("start_impl argc " << _argc << " ContainerName " << ContainerName
-          << hex << this << dec) ;
-  _numInstanceMutex.lock() ; // lock on the instance number
-
-  CORBA::Object_var obj = Engines::Container::_nil() ;
-  bool nilvar = true ;
-  try {
-    string cont("/Containers/");
-    cont += machineName() ;
-    cont += "/" ;
-    cont += ContainerName;
-    INFOS(machineName() << " start_impl unknown container " << cont.c_str()
-          << " try to Resolve" );
-    obj = _NS->Resolve( cont.c_str() );
-    nilvar = CORBA::is_nil( obj ) ;
-    if ( nilvar ) {
-      INFOS(machineName() << " start_impl unknown container "
-            << ContainerName);
-    }
-  }
-  catch (ServiceUnreachable&) {
-    INFOS(machineName() << "Caught exception: Naming Service Unreachable");
-  }
-  catch (...) {
-    INFOS(machineName() << "Caught unknown exception.");
-  }
-  if ( !nilvar ) {
-    _numInstanceMutex.unlock() ;
-    MESSAGE("start_impl container found without new launch") ;
-    return Engines::Container::_narrow(obj);
-  }
-  int i = 0 ;
-  while ( _argv[ i ] ) {
-    MESSAGE("           argv" << i << " " << _argv[ i ]) ;
-    i++ ;
-  }
-  string shstr = string(getenv("KERNEL_ROOT_DIR")) + "/bin/salome/SALOME_Container ";
-//   string shstr( "./runSession SALOME_Container " ) ;
-  shstr += ContainerName ;
-  if ( _argc == 4 ) {
-    shstr += " " ;
-    shstr += _argv[ 2 ] ;
-    shstr += " " ;
-    shstr += _argv[ 3 ] ;
-  }
-
-  // asv : 16.11.04 : creation of log file in /tmp/logs/$USER dir. 
-  // "/tmp/logs/$USER" was created by  runSalome.py -> orbmodule.py.
-  string tempfilename = "/tmp/logs/";
-  tempfilename += getenv( "USER" ) ;
-  tempfilename += "/" ;
-  tempfilename += ContainerName ;
-  tempfilename += ".log" ;
-  FILE* f = fopen ( tempfilename.c_str(), "a" );
-  if ( f ) { // check if file can be opened for writing
-    fclose( f );
-    shstr += " > " ;
-    shstr += tempfilename;
-    shstr += " 2>&1 &" ;
-  }
-  else { // if file can't be opened - use a guaranteed temp file name
-    char* tmpFileName = tempnam( NULL, ContainerName );
-    shstr += " > ";
-    shstr += tmpFileName;
-    shstr += " 2>&1 &";
-    free( tmpFileName );    
-  }
-
-  MESSAGE("system(" << shstr << ")") ;
-  int status = system( shstr.c_str() ) ;
-  if (status == -1) {
-    INFOS("Engines_Container_i::start_impl SALOME_Container failed (system command status -1)") ;
-  }
-  else if (status == 217) {
-    INFOS("Engines_Container_i::start_impl SALOME_Container failed (system command status 217)") ;
-  }
-  INFOS(machineName() << " Engines_Container_i::start_impl SALOME_Container launch done");
-
-//   pid_t pid = fork() ;
-//   if ( pid == 0 ) {
-//     string anExe( _argv[ 0 ] ) ;
-//     anExe += "runSession" ;
-//     char * args[ 6 ] ;
-//     args[ 0 ] = "runSession" ;
-//     args[ 1 ] = "SALOME_Container" ;
-//     args[ 2 ] = strdup( ContainerName ) ;
-//     args[ 3 ] = strdup( _argv[ 2 ] ) ;
-//     args[ 4 ] = strdup( _argv[ 3 ] ) ;
-//     args[ 5 ] = NULL ;
-//     MESSAGE("execl(" << anExe.c_str() << " , " << args[ 0 ] << " , "
-//                      << args[ 1 ] << " , " << args[ 2 ] << " , " << args[ 3 ]
-//                      << " , " << args[ 4 ] << ")") ;
-//     int status = execv( anExe.c_str() , args ) ;
-//     if (status == -1) {
-//       INFOS("Engines_Container_i::start_impl execl failed (system command status -1)") ;
-//       perror( "Engines_Container_i::start_impl execl error ") ;
-//     }
-//     else {
-//       INFOS(machineName() << " Engines_Container_i::start_impl execl done");
-//     }
-//     exit(0) ;
-//   }
-
-  obj = Engines::Container::_nil() ;
-  try {
-    string cont("/Containers/");
-    cont += machineName() ;
-    cont += "/" ;
-    cont += ContainerName;
-    nilvar = true ;
-    int count = 20 ;
-    while ( nilvar && count >= 0) {
-      sleep( 1 ) ;
-      obj = _NS->Resolve(cont.c_str());
-      nilvar = CORBA::is_nil( obj ) ;
-      if ( nilvar ) {
-        INFOS(count << ". " << machineName()
-              << " start_impl unknown container " << cont.c_str());
-        count -= 1 ;
-      }
-    }
-    _numInstanceMutex.unlock() ;
-    if ( !nilvar ) {
-      MESSAGE("start_impl container found after new launch of SALOME_Container") ;
-    }
-    return Engines::Container::_narrow(obj);
-  }
-  catch (ServiceUnreachable&) {
-    INFOS(machineName() << "Caught exception: Naming Service Unreachable");
-  }
-  catch (...) {
-    INFOS(machineName() << "Caught unknown exception.");
-  }
-  _numInstanceMutex.unlock() ;
-  MESSAGE("start_impl container not found after new launch of SALOME_Container") ;
-  return Engines::Container::_nil() ;
-}
-
 Engines::Component_ptr Engines_Container_i::load_impl( const char* nameToRegister,
                                                       const char* componentName ) {
 
@@ -477,3 +334,27 @@ long Engines_Container_i::getPID() {
 char* Engines_Container_i::getHostName() {
     return((char*)(GetHostname().c_str()));
 }
+
+// Retrieves only with container naming convention if it is a python container
+bool Engines_Container_i::isPythonContainer(const char* ContainerName)
+{
+  bool ret=false;
+  int len=strlen(ContainerName);
+  if(len>=2)
+    if(strcmp(ContainerName+len-2,"Py")==0)
+      ret=true;
+  return ret;
+}
+
+string Engines_Container_i::BuildContainerNameForNS(const char *ContainerName, const char *hostname)
+{
+  string ret="/Containers/";
+  ret += hostname;
+  ret+="/";
+  if (strlen(ContainerName)== 0)
+    ret+=_defaultContainerName;
+  else
+    ret += ContainerName;
+  return ret;
+}
+
index 5cd3980a522bc6324e712cdf28995cfc7f540f5f..1ed861ed014cb06824dccabd9b1f2570993797c3 100644 (file)
@@ -38,24 +38,28 @@ EXPORT_PYSCRIPTS = SALOME_ComponentPy.py SALOME_ContainerPy.py
 
 EXPORT_HEADERS = \
        SALOME_Component_i.hxx \
-       SALOME_Container_i.hxx
+       SALOME_Container_i.hxx \
+       SALOME_ContainerManager.hxx
 
 # Libraries targets
 
 LIB = libSalomeContainer.la 
-LIB_SRC = Component_i.cxx  Container_i.cxx
-LIB_SERVER_IDL = SALOME_Registry.idl SALOME_Component.idl
+LIB_SRC = Component_i.cxx  Container_i.cxx SALOME_ContainerManager.cxx
+LIB_SERVER_IDL = SALOME_Registry.idl SALOME_Component.idl SALOME_ContainerManager.idl
+LIB_CLIENT_IDL = 
 
 # Executables targets
 BIN = SALOME_Container
 BIN_SRC = SALOME_Container_SignalsHandler.cxx
-BIN_SERVER_IDL = SALOME_Component.idl
+BIN_SERVER_IDL = SALOME_Component.idl SALOME_ContainerManager.idl
 
-CPPFLAGS+= $(PYTHON_INCLUDES) $(MPI_INCLUDE) $(OCC_INCLUDES)
+CPPFLAGS+= $(PYTHON_INCLUDES) $(MPI_INCLUDE) $(OCC_INCLUDES) $(QT_MT_INCLUDES)
 CXXFLAGS+=$(OCC_CXXFLAGS)
 
-LDFLAGS+= -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace -lSALOMETraceCollector -lSalomeResourcesManager
 
-LIBS += @LDEXPDYNFLAGS@ $(PYTHON_LIBS) $(MPI_LIBS) -lCASCatch
+LIBS += @LDEXPDYNFLAGS@ $(PYTHON_LIBS) $(MPI_LIBS)
 
+LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
+LIBSFORBIN= $(LIBS)
 @CONCLUDE@
index 2911434da75cfa8b56fc96088133de21f47e97a9..620ca149985180f4ad5e05556e2a2f8757a9a46a 100644 (file)
@@ -92,6 +92,8 @@ public:
   long CpuUsed() ;
   CORBA::Long CpuUsed_impl() ;
 
+  static std::string GetDynLibraryName(const char *componentName);
+  static std::string BuildComponentNameForNS(const char *ComponentName, const char *ContainerName, const char *hostname);
 protected:
   std::string _instanceName ;
   std::string _interfaceName ;
index 646480535f34b818bd2960e1703ea120254eb82c..dfd501e9ff11bc86d1c7747f82808b5c728d1a76 100644 (file)
@@ -30,8 +30,9 @@
 #include <string>
 #include <stdio.h>
 
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
+//#include "Utils_ORB_INIT.hxx"
+//#include "Utils_SINGLETON.hxx"
+#include <unistd.h>
 #include "SALOME_NamingService.hxx"
 #include "SALOME_Container_i.hxx"
 #include "utilities.h"
@@ -59,8 +60,8 @@ int main(int argc, char* argv[])
   MPI_Init(&argc,&argv);
 #endif
   // Initialise the ORB.
-  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
-  CORBA::ORB_var &orb = init( argc , argv ) ;
+  //ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+  CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
   SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
   INFOS_COMPILATION;
   BEGIN_OF(argv[0]);
@@ -73,7 +74,7 @@ int main(int argc, char* argv[])
     // Obtain a reference to the root POA.
     // obtain the root poa manager
     //
-    long TIMESleep = 250000000;
+    long TIMESleep = 500000000;
     int NumberOfTries = 40;
     int a;
     timespec ts_req;
@@ -87,7 +88,7 @@ int main(int argc, char* argv[])
     CORBA::Object_var theObj;
     CORBA::Object_var obj;
     CORBA::Object_var object;
-    SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+    //SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
     int CONTAINER=0;
     const char * Env = getenv("USE_LOGGER");
     int EnvL =0;
@@ -139,47 +140,14 @@ int main(int argc, char* argv[])
        break;
     }
     
-    // define policy objects     
-    PortableServer::ImplicitActivationPolicy_var implicitActivation =
-      root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
-    
-    // default = NO_IMPLICIT_ACTIVATION
-    PortableServer::ThreadPolicy_var threadPolicy =
-      root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL);
-    // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
-    
-    // create policy list
-    CORBA::PolicyList policyList;
-    policyList.length(2);
-    policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
-    policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
-    
-    // create the child POA
-    PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
-    PortableServer::POA_var factory_poa =
-      root_poa->create_POA("factory_poa", pman, policyList) ;
-    //with nil_mgr instead of pman, a new POA manager is created with the new POA
-    
-    // destroy policy objects
-    implicitActivation->destroy() ;
-    threadPolicy->destroy() ;
-    
     char *containerName = "";
     if(argc > 1){
       containerName = argv[1] ;
     }
     
     Engines_Container_i * myContainer 
-      = new Engines_Container_i(orb, factory_poa, containerName , argc , argv );
-    
-    //     Engines_Container_i * myContainer 
-    //      = new Engines_Container_i(string(argv[1]),string(argv[2]), orb, factory_poa);
-    
-    // use naming service
-    //     myContainer->_NS.init_orb(orb);
-    //     Engines::Container_ptr pCont = Engines::Container::_narrow(myContainer->_this());
-    //     myContainer->_NS.Register(pCont, argv[2]); 
-    
+      = new Engines_Container_i(orb, root_poa, containerName , argc , argv );
+
     pman->activate();
     
 #ifdef CHECKTIME
@@ -191,8 +159,6 @@ int main(int argc, char* argv[])
 #endif
     
     HandleServerSideSignals(orb);
-    
-    orb->destroy();
   }catch(CORBA::SystemException&){
     INFOS("Caught CORBA::SystemException.");
   }catch(PortableServer::POA::WrongPolicy&){
index 6f309c50c8302c1d91249d0562d18a7680b9e23c..249f806574ac41fe79d104ae10b24c6540c97782 100644 (file)
@@ -52,14 +52,10 @@ public:
                      PortableServer::POA_ptr poa,
                      char * containerName ,
                       int argc, char* argv[],
-                     bool regist = true,
-                     bool activ = true);
+                     bool activAndRegist = true);
   virtual ~Engines_Container_i();
 
 
-  //! Launch a new container from the current container
-  Engines::Container_ptr start_impl(const char* ContainerName);
-
   //! Load component in current container
   Engines::Component_ptr load_impl(const char* nameToRegister,
                                   const char* componentName);
@@ -71,13 +67,16 @@ public:
   char* name();
   char* machineName();
   void ping();
-
+  void Shutdown();
   //! Kill current container
   bool Kill_impl() ;
 
   char* getHostName();
   CORBA::Long getPID();
+  static bool isPythonContainer(const char* ContainerName);
 
+  static std::string BuildContainerNameForNS(const char *ContainerName, const char *hostname);
+  static const char *_defaultContainerName;
 protected:
 
   SALOME_NamingService *_NS ;
index f5bd3bc353d5d298e4e4795a76710ce6bab8f2f7..7ba1a085f17d6cb7bd6f98add0a20812a3f3762f 100644 (file)
@@ -54,6 +54,7 @@ BIN_SERVER_IDL = SALOME_DataTypeCatalog.idl
 
 CPPFLAGS+= $(QT_MT_INCLUDES) 
 CXXFLAGS+= 
-LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
+LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
 
 @CONCLUDE@
index 273916dd4d9b48e37ddfd76561c27c5e396c8120..82c3649368b57350d234e7dee3cbe816f6850800 100644 (file)
@@ -78,6 +78,15 @@ class LifeCycleCORBA:
         if self._catalog is None:
             MESSAGE( "/Kernel.dir/ModulCatalog.object exists but is not a ModulCatalog" )
 
+        name = [CosNaming.NameComponent("ContainerManager","object")]
+        try:
+            obj = self._rootContext.resolve(name)
+        except CosNaming.NamingContext.NotFound, ex:
+            MESSAGE( "ContainerManager.object not found in Naming Service" )
+        self._contManager = obj._narrow(Engines.ContainerManager)
+        if self._contManager is None:
+            MESSAGE( "ContainerManager.object exists but is not a ContainerManager")
+
     #-------------------------------------------------------------------------
 
     def ContainerName(self, containerName):
@@ -130,120 +139,81 @@ class LifeCycleCORBA:
     
     #-------------------------------------------------------------------------
 
-    def FindOrStartContainer(self, theComputer , theContainer ):
-        MESSAGE( "FindOrStartContainer" + theComputer + theContainer )
-        aContainer = self.FindContainer( theComputer + "/" + theContainer )
-        if aContainer is None :
-            if (theContainer == "FactoryServer") | (theContainer == "FactoryServerPy") :
-                myMachine=getShortHostName()
-                if theComputer == myMachine :
-                    rshstr = ""
-                else :
-                    rshstr = "rsh -n " + theComputer + " "
-                path = self.ComputerPath( theComputer )
-##                if path != "" :
-##                    rshstr = rshstr + path + "/../bin/"
-##                else :
-##                    rshstr = rshstr + os.getenv( "KERNEL_ROOT_DIR" ) + "/bin/"
-                if theContainer == "FactoryServer" :
-                    rshstr = rshstr + path + "SALOME_Container "
-                else :
-                    rshstr = rshstr + path + "SALOME_ContainerPy.py '"
-                rshstr = rshstr + theContainer + " -"
-               omniORBcfg = os.getenv( "OMNIORB_CONFIG" )
-                file = os.open( omniORBcfg , os.O_RDONLY )
-                ORBInitRef = os.read(file,132)
-                if ORBInitRef[len(ORBInitRef)-1] == '\n' :
-                    ORBInitRef,bsn = ORBInitRef.split('\n')
-                os.close( file )
-                rshstr = rshstr + ORBInitRef
-                if theContainer == "FactoryServerPy" :
-                    rshstr = rshstr + "'"
-                rshstr = rshstr + " > /tmp/" + theContainer + "_"
-                rshstr = rshstr + theComputer
-                rshstr = rshstr + ".log 2>&1 &"
-                os.system( rshstr )
-                MESSAGE( "FindOrStartContainer" + rshstr + " done" )
-            else :
-                if theContainer.find('Py') == -1 :
-                    aContainer = self.FindContainer( theComputer + "/" + "FactoryServer" )
-                else :
-                    aContainer = self.FindContainer( theComputer + "/" + "FactoryServerPy" )
-                aContainer = aContainer.start_impl( theContainer )
-
-            count = 21
-            while aContainer is None :
-                time.sleep(1)
-                count = count - 1
-                MESSAGE( str(count) + ". Waiting for " + theComputer + "/" + theContainer )
-                aContainer = self.FindContainer( theComputer + "/" + theContainer )
-                if count == 0 :
-                    return aContainer
-            
-        return  aContainer       
-        #os.system("rsh -n dm2s0017 /export/home/KERNEL_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515")
+    def FindComponent(self,containerName,componentName,listOfMachines):
+        if containerName!="":
+            machinesOK=[]
+            for i in range(len(listOfMachines)):
+                currentMachine=listOfMachines[i]
+                componentNameForNS= [CosNaming.NameComponent(currentMachine,"dir"),
+                                     CosNaming.NameComponent(containerName,"dir"),
+                                     CosNaming.NameComponent(componentName,"object")]
+                obj=None
+                try:
+                    obj = self._containerRootContext.resolve(componentNameForNS)
+                except CosNaming.NamingContext.NotFound, ex:
+                    MESSAGE( "component " + componentName + " not found on machine " + currentMachine + " , trying to load" )
+                    pass
+                if obj is not None:
+                    machinesOK.append(currentMachine)
+                    pass
+                pass
+            if len(machinesOK)!=0:
+                bestMachine=self._contManager.FindBest(machinesOK)
+                componentNameForNS= [CosNaming.NameComponent(bestMachine,"dir"),
+                                     CosNaming.NameComponent(containerName,"dir"),
+                                     CosNaming.NameComponent(componentName,"object")]
+                obj=None
+                try:
+                    obj = self._containerRootContext.resolve(componentNameForNS)
+                except:
+                    pass
+                if obj is not None:
+                    return obj._narrow(Engines.Component)
+                else:
+                    MESSAGE( "Big problem !!!")
+                    return None
+            else:
+                return None
+        else:
+            bestMachine=self._contManager.FindBest(listOfMachines)
+            MESSAGE("Not implemented yet ...")
+            return None
+        pass
 
     #-------------------------------------------------------------------------
 
-    def FindOrLoadComponent(self, containerName, componentName):
-
-        theComputer,theContainer = self.ContainerName( containerName )
-        name = [CosNaming.NameComponent(theComputer,"dir"),
-                CosNaming.NameComponent(theContainer,"dir"),
-                CosNaming.NameComponent(componentName,"object")]
+    def LoadComponent(self,containerName,componentName,listOfMachine):
+        container=self._contManager.FindOrStartContainer(containerName,listOfMachine)
+        implementation="lib"+componentName+"Engine.so"
         try:
-            obj = self._containerRootContext.resolve(name)
-        except CosNaming.NamingContext.NotFound, ex:
-            MESSAGE( "component " + componentName + " not found, trying to load" )
-            container = self.FindContainer(theComputer + "/" + theContainer)
-            if container is None:
-                MESSAGE( "container " + theComputer + "/" + theContainer + " not found in Naming Service, trying to start" )
-                if (theContainer != "FactoryServer") & (theContainer != "FactoryServerPy") :
-                    if theContainer.find('Py') == -1 :
-                        theFactorycontainer = "FactoryServer"
-                    else :
-                        theFactorycontainer = "FactoryServerPy"
-                    Factorycontainer = self.FindContainer(theComputer + "/" + theFactorycontainer)
-                    if Factorycontainer is None:
-                        MESSAGE( "container " + theComputer + "/" + theFactorycontainer + " not found in Naming Service, trying to start" )
-                        Factorycontainer = self.FindOrStartContainer(theComputer,theFactorycontainer)
-                else:
-                    Factorycontainer = self.FindOrStartContainer(theComputer,theContainer)
-                if Factorycontainer != None :
-                    container = self.FindOrStartContainer(theComputer,theContainer)
-
-            if container != None:
-                compoinfo = self._catalog.GetComponent(componentName)
-                if compoinfo is None:
-                    MESSAGE( "component " + componentName + " not found in Module Catalog" )
-                else:
-                    try:
-                        machineName = theComputer
-                        path = compoinfo.GetPathPrefix(machineName) + "/"
-                    except SALOME_ModuleCatalog.NotFound, ex:
-                        MESSAGE( "machine " + machineName + " not found in Module Catalog" )
-                        MESSAGE( "trying localhost" )
-                        try:
-                            path = compoinfo.GetPathPrefix("localhost") + "/"
-                        except SALOME_ModuleCatalog.NotFound, ex:
-                            path = ""
-                    implementation = path + "lib" + componentName + "Engine.so"
-                    MESSAGE( "Trying to load " + implementation )
-                    try:
-                        component = container.load_impl(componentName, implementation)
-                        MESSAGE( "component " + component._get_instanceName() + " launched !" )
-                        return component
-                    except:
-                        MESSAGE( "component " + componentName + " NOT launched !" )
+            component = container.load_impl(componentName, implementation)
+            MESSAGE( "component " + component._get_instanceName() + " launched !" )
+            return component
+        except:
+            MESSAGE( "component " + componentName + " NOT launched !" )
+            return None
 
+    #-------------------------------------------------------------------------
+    
+
+    def FindOrLoadComponent(self, containerName, componentName):
+        sp=containerName.split("/")
+        if len(sp)==1:
+            listOfMachine=[]
+            listOfMachine.append(getShortHostName())
+            comp=self.FindComponent(containerName,componentName,listOfMachine)
+            if comp is None:
+                return self.LoadComponent(containerName,componentName,listOfMachine)
+            else:
+                return comp
+            pass
         else:
-            try:
-                component = obj._narrow(Engines.Component)
-                if component is None:
-                    MESSAGE( componentName + " is not a component !" )
-                else:
-                    MESSAGE( "component " + component._get_instanceName() + " found !" )
-                return component
-            except:
-                MESSAGE( componentName + " failure" )
-                return None
+            params= Engines.MachineParameters(sp[1],sp[0],"LINUX",0,0,0,0)
+            listOfMachine=self._contManager.GetFittingResources(params,componentName)
+            ret=self.FindComponent(sp[1],componentName,listOfMachine);
+            if ret is None:
+                return self.LoadComponent(sp[1],componentName,listOfMachine)
+            else:
+                return ret
+            pass
+        
index 33ee1ac8177237a20a2c510aa58d01382ffae7be..64daf70e88ce3d675a31478afc25be604fda4df9 100644 (file)
@@ -43,15 +43,18 @@ EXPORT_PYSCRIPTS = LifeCycleCORBA.py
 LIB = libSalomeLifeCycleCORBA.la
 LIB_SRC = SALOME_LifeCycleCORBA.cxx
 LIB_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \
-                SALOME_ModuleCatalog.idl
+                SALOME_ModuleCatalog.idl SALOME_ContainerManager.idl
 
 # Executables targets
 BIN = TestLifeCycleCORBA
 BIN_SRC =
 BIN_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \
-                SALOME_ModuleCatalog.idl
+                SALOME_ModuleCatalog.idl SALOME_ContainerManager.idl
 
-LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace
+CPPFLAGS += $(QT_MT_INCLUDES)
+
+LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSalomeContainer -lSalomeResourcesManager
+LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification -lSALOMETraceCollector
 
 @CONCLUDE@
 
index 7908d60aead9ffa91c5c1924cdf0082d586114a3..4b110ce6b7d0db3032872d5257d618e4091fe2d0 100644 (file)
 
 #include "SALOME_LifeCycleCORBA.hxx"
 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
+#include "SALOME_ContainerManager.hxx"
+#include "SALOME_Component_i.hxx"
 #include "SALOME_NamingService.hxx"
 using namespace std;
 
-SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA()
-{
-  _NS = NULL;
-  _FactoryServer = NULL ;
-}
-
 SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns)
 {
   _NS = ns;
-  _FactoryServer = NULL ;
+  //add try catch
+  CORBA::Object_var obj=_NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
+  ASSERT( !CORBA::is_nil(obj));
+  _ContManager=Engines::ContainerManager::_narrow(obj);
 }
 
 SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA()
@@ -86,9 +85,38 @@ string SALOME_LifeCycleCORBA::ContainerName(
     theComputerContainer += "/" ;
     theComputerContainer += *theContainer ;
   }
+  delete [] ContainerName;
   return theComputerContainer ;
 }
 
+bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName)
+{
+
+  try
+    {
+      CORBA::Object_var obj = _NS->Resolve("/Kernel/ModulCatalog");
+      SALOME_ModuleCatalog::ModuleCatalog_var Catalog = 
+       SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ;
+      SALOME_ModuleCatalog::Acomponent_ptr compoInfo = 
+       Catalog->GetComponent(componentName);
+      if (CORBA::is_nil (compoInfo)) 
+       {
+         INFOS("Catalog Error : Component not found in the catalog");
+         return false;
+       }
+      else return true;
+    }
+  catch (ServiceUnreachable&)
+    {
+      INFOS("Caught exception: Naming Service Unreachable");
+    }
+  catch (...)
+    {
+      INFOS("Caught unknown exception.");
+    }
+  return false;
+}
+
 string SALOME_LifeCycleCORBA::ComputerPath(
                                          const char * theComputer ) {
   CORBA::String_var path;
@@ -106,7 +134,8 @@ string SALOME_LifeCycleCORBA::ComputerPath(
   return CORBA::string_dup( path ) ;
 }
 
-Engines::Container_var SALOME_LifeCycleCORBA::FindContainer(const char *containerName ) {
+Engines::Container_ptr SALOME_LifeCycleCORBA::FindContainer(const char *containerName)
+{
   ASSERT(_NS != NULL);
   string cont ;
   if ( strncmp( containerName , "/Containers/" , 12 ) ) { // Compatibility ...
@@ -135,287 +164,105 @@ Engines::Container_var SALOME_LifeCycleCORBA::FindContainer(const char *containe
   return Engines::Container::_nil();
 }
 
-Engines::Container_var SALOME_LifeCycleCORBA::FindOrStartContainer(
-                                              const string aComputerContainer ,
-                                              const string theComputer ,
-                                              const string theContainer ) {
-  Engines::Container_var aContainer = FindContainer( aComputerContainer.c_str() ) ;
-  Engines::Container_var aFactoryServer ;
-  SCRUTE( aComputerContainer ) ;
-  SCRUTE( theComputer ) ;
-  SCRUTE( theContainer ) ;
-  bool pyCont = false ;
-  int len = theContainer.length() ;
-  if ( !strcmp( &theContainer.c_str()[len-2] , "Py" ) ) {
-    pyCont = true ;
-  }
-  if ( !CORBA::is_nil( aContainer ) ) {
-    return aContainer ;
-  }
-  else {
-    string FactoryServer = theComputer ;
-    if ( pyCont ) {
-      FactoryServer += "/FactoryServerPy" ;
-    }
-    else {
-      FactoryServer += "/FactoryServer" ;
-    }
-    aFactoryServer = FindContainer( FactoryServer.c_str() ) ;
-    if ( CORBA::is_nil( aFactoryServer ) ) {
-// rsh -n ikkyo /export/home/rahuel/SALOME_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515 &
-      string rsh( "" ) ;
-      if ( theComputer!= GetHostname() ) {
-        rsh += "rsh -n " ;
-        rsh += theComputer ;
-        rsh += " " ;
-      }
-      string path = ComputerPath( theComputer.c_str() ) ;
-      SCRUTE( path ) ;
-      if ( path[0] != '\0' ) {
-        rsh += path ;
-        rsh += "/../bin/" ;
-      }
-      rsh += "runSession " ;
-      if ( pyCont ) {
-        rsh += "SALOME_ContainerPy.py " ;
-        rsh += "FactoryServerPy -" ;
-      }
-      else {
-        rsh += "SALOME_Container " ;
-        rsh += "FactoryServer -" ;
-      }
-      string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ;
-      ifstream omniORBfile( omniORBcfg.c_str() ) ;
-      char ORBInitRef[12] ;
-      char nameservice[132] ;
-      omniORBfile >> ORBInitRef ;
-      rsh += ORBInitRef ;
-      rsh += " " ;
-      omniORBfile >> nameservice ;
-      omniORBfile.close() ;
-      char * bsn = strchr( nameservice , '\n' ) ;
-      if ( bsn ) {
-        bsn[ 0 ] = '\0' ;
-      }
-      rsh += nameservice ;
-      if ( pyCont ) {
-        rsh += " > /tmp/FactoryServerPy_" ;
-      }
-      else {
-        rsh += " > /tmp/FactoryServer_" ;
-      }
-      rsh += theComputer ;
-      rsh += ".log 2>&1 &" ;
-      SCRUTE( rsh );
-      int status = system( rsh.c_str() ) ;
-      if (status == -1) {
-        MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status -1)") ;
-      }
-      else if (status == 217) {
-        MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status 217)") ;
-      }
-      else {
-        int count = 21 ;
-        while ( CORBA::is_nil( aFactoryServer ) && count ) {
-          sleep( 1 ) ;
-          count-- ;
-          if ( count != 10 )
-            MESSAGE( count << ". Waiting for FactoryServer on " << theComputer)
-          aFactoryServer = FindContainer( FactoryServer.c_str() ) ;
-       }
-        if ( CORBA::is_nil( aFactoryServer ) ) {
-          MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed") ;
-       }
-        else if ( strcmp( theComputer.c_str() , GetHostname().c_str() ) ) {
-          _FactoryServer = aFactoryServer ;
+Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component
+                                  (const char *containerName,
+                                  const char *componentName)
+{
+  if (! isKnownComponentClass(componentName)) return Engines::Component::_nil();
+  char *stContainer=strdup(containerName);
+  string st2Container(stContainer);
+  int rg=st2Container.find("/");
+  if(rg>=0)
+    {
+      stContainer[rg]='\0';
+      if(strcmp(stContainer,"localhost")==0)
+       {
+         Engines::Component_ptr ret=FindOrLoad_Component(stContainer+rg+1,componentName);
+         free(stContainer);
+         return ret;
        }
-      }
-    }
-    if ( !CORBA::is_nil( aFactoryServer ) ) {
-      if ( strcmp( theContainer.c_str() , "FactoryServer" ) ||
-           strcmp( theContainer.c_str() , "FactoryServerPy" ) ) {
-        MESSAGE("Container not found ! trying to start " << aComputerContainer);
-        Engines::Container_var myContainer = aFactoryServer->start_impl( theContainer.c_str() ) ;
-        if ( !CORBA::is_nil( myContainer ) ) {
-          MESSAGE("Container " << aComputerContainer << " started");
-          return myContainer ;
-        }
-        else {
-          MESSAGE("Container " << aComputerContainer << " NOT started");
-        }
-      }
-      else {
-        MESSAGE("Container " << aComputerContainer << " started");
-        return aFactoryServer ;
-      }
     }
+  if(rg<0) {
+    //containerName doesn't contain "/" => Local container
+    free(stContainer);
+    Engines::MachineList_var listOfMachine=new Engines::MachineList;
+    listOfMachine->length(1);
+    listOfMachine[0]=CORBA::string_dup(GetHostname().c_str());
+    Engines::Component_ptr ret=FindComponent(containerName,componentName,listOfMachine.in());
+    if(CORBA::is_nil(ret))
+      return LoadComponent(containerName,componentName,listOfMachine);
+    else
+      return ret;
+  }
+  else {
+    //containerName contains "/" => Remote container
+    stContainer[rg]='\0';
+    Engines::MachineParameters_var params=new Engines::MachineParameters;
+    params->container_name=CORBA::string_dup(stContainer+rg+1);
+    params->hostname=CORBA::string_dup(stContainer);
+    params->OS=CORBA::string_dup("LINUX");
+    free(stContainer);
+    return FindOrLoad_Component(params,componentName);
   }
-  return Engines::Container::_nil();
 }
 
-Engines::Component_var SALOME_LifeCycleCORBA::FindOrLoad_Component
-                                   (const char *containerName,
-                                   const char *componentName,
-                                   const char *implementation)
+Engines::Component_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component(const Engines::MachineParameters& params,
+                                                                  const char *componentName)
 {
-  BEGIN_OF("FindOrLoad_Component(1)");
-  ASSERT(_NS != NULL);
-  string theComputer ;
-  string theContainer ;
-  string theComputerContainer = ContainerName( containerName ,
-                                               &theComputer ,
-                                               &theContainer ) ;
-  Engines::Container_var cont = FindOrStartContainer( theComputerContainer ,
-                                                      theComputer ,
-                                                      theContainer ) ;
-//  ASSERT(!CORBA::is_nil(cont));
+  if (! isKnownComponentClass(componentName)) return Engines::Component::_nil();
+  Engines::MachineList_var listOfMachine=_ContManager->GetFittingResources(params,componentName);
+  Engines::Component_ptr ret=FindComponent(params.container_name,componentName,listOfMachine);
+  if(CORBA::is_nil(ret))
+    return LoadComponent(params.container_name,componentName,listOfMachine);
+  else
+    return ret;
+}
 
-  string path( theComputerContainer );
-  path = path + "/";
-  path = path + componentName;
-  SCRUTE(path);
-  try
+Engines::Component_ptr SALOME_LifeCycleCORBA::FindComponent(const char *containerName,
+                                                                const char *componentName,
+                                                                const Engines::MachineList& listOfMachines)
+{
+  if (! isKnownComponentClass(componentName)) return Engines::Component::_nil();
+  if(containerName[0]!='\0')
     {
-      CORBA::Object_var obj = _NS->Resolve(path.c_str());
-      if (CORBA::is_nil(obj))
-       {
-         MESSAGE("Component not found ! trying to load " << path);
-         Engines::Component_var compo 
-           = cont->load_impl(componentName, implementation);
-//       ASSERT(!CORBA::is_nil(compo));
-         MESSAGE("Component launched !" << path);
-         return compo;
-       }
-      else
+      Engines::MachineList_var machinesOK=new Engines::MachineList;
+      unsigned int lghtOfmachinesOK=0;
+      machinesOK->length(listOfMachines.length());
+      for(unsigned int i=0;i<listOfMachines.length();i++)
        {
-         MESSAGE("Component found !" << path);
-         Engines::Component_var compo = Engines::Component::_narrow(obj);
-//       ASSERT(!CORBA::is_nil(compo));
-         try
+         const char *currentMachine=listOfMachines[i];
+         string componentNameForNS=Engines_Component_i::BuildComponentNameForNS(componentName,containerName,currentMachine);
+         CORBA::Object_var obj = _NS->Resolve(componentNameForNS.c_str());
+         if(!CORBA::is_nil(obj))
            {
-             compo->ping(); 
+             machinesOK[lghtOfmachinesOK++]=CORBA::string_dup(currentMachine);
            }
-         catch (CORBA::COMM_FAILURE&)
-           {
-             INFOS("Caught CORBA::SystemException CommFailure. Engine "
-                   << path << "does not respond" );
-           }
-         return compo;
        }
+      if(lghtOfmachinesOK!=0)
+       {
+         machinesOK->length(lghtOfmachinesOK);
+         CORBA::String_var bestMachine=_ContManager->FindBest(machinesOK);
+         string componentNameForNS=Engines_Component_i::BuildComponentNameForNS(componentName,containerName,bestMachine);
+         CORBA::Object_var obj=_NS->Resolve(componentNameForNS.c_str());
+         return Engines::Component::_narrow(obj);
+       }
+      else
+       return Engines::Component::_nil();
     }
-  catch (ServiceUnreachable&)
-    {
-      INFOS("Caught exception: Naming Service Unreachable");
-    }
-  catch (...)
+  else
     {
-      INFOS("Caught unknown exception.");
+      //user specified no container name so trying to find a component in the best machine among listOfMachines
+      CORBA::String_var bestMachine=_ContManager->FindBest(listOfMachines);
+      //Normally look at all containers launched on bestMachine to see if componentName is already launched on one of them. To do..
+      string componentNameForNS=Engines_Component_i::BuildComponentNameForNS(componentName,containerName,bestMachine);
+      CORBA::Object_var obj = _NS->Resolve(componentNameForNS.c_str());
+      return Engines::Component::_narrow(obj);
     }
-  return Engines::Component::_nil();
 }
 
-Engines::Component_var SALOME_LifeCycleCORBA::FindOrLoad_Component
-                                  (const char *containerName,
-                                  const char *componentName)
+Engines::Component_ptr SALOME_LifeCycleCORBA::LoadComponent(const char *containerName, const char *componentName, const Engines::MachineList& listOfMachines)
 {
-//  BEGIN_OF("FindOrLoad_Component(2)");
-  ASSERT(_NS != NULL);
-  string theComputer ;
-  string theContainer ;
-  string theComputerContainer = ContainerName( containerName ,
-                                               &theComputer ,
-                                               &theContainer ) ;
-  Engines::Container_var cont = FindOrStartContainer( theComputerContainer ,
-                                                      theComputer ,
-                                                      theContainer ) ;
-
-  if ( CORBA::is_nil( cont ) ) {
-    MESSAGE("Container not found ! " << theComputerContainer );
-    return Engines::Component::_nil();
-  }
-
-//  char * machine = cont->machineName() ;
-  const char * machine = theComputer.c_str() ;
-
-  string path( theComputerContainer );
-  path += "/";
-  path += componentName;
-  SCRUTE(path);
-
-  try {
-    CORBA::Object_var obj = _NS->Resolve(path.c_str());
-    if ( CORBA::is_nil( obj ) ) {
-      MESSAGE("Component not found ! trying to load " << path);
-         CORBA::Object_var obj2 = _NS->Resolve("/Kernel/ModulCatalog");
-         SALOME_ModuleCatalog::ModuleCatalog_var Catalog = 
-           SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj2);
-
-         SALOME_ModuleCatalog::Acomponent_ptr compoInfo = 
-           Catalog->GetComponent(componentName);
-         if (CORBA::is_nil (compoInfo)) 
-           {
-             INFOS("Catalog Error : Component not found in the catalog")
-              return Engines::Component::_nil();
-//             exit (-1);
-           }
-         
-         string  path;
-         try
-           {
-             path = compoInfo->GetPathPrefix( machine ) ;
-              path += "/" ;
-           }
-         catch (SALOME_ModuleCatalog::NotFound&)
-           {
-             INFOS("GetPathPrefix(" << machine << ") not found!"
-                     << "trying localhost");
-             try {
-                path = compoInfo->GetPathPrefix("localhost") ;
-                path += "/" ;
-             }
-             catch (SALOME_ModuleCatalog::NotFound&) {
-               INFOS("GetPathPrefix(localhost) not found!") ;
-                path = "" ;
-             }
-           }
-
-         SCRUTE(path); 
-         string implementation(path);
-         implementation += "lib";
-         implementation += componentName;
-         implementation += "Engine.so";
-         
-         Engines::Component_var compo 
-           = cont->load_impl(componentName, implementation.c_str());
-
-//       ASSERT(!CORBA::is_nil(compo));
-//       MESSAGE("Component launched !" << path);
-         return compo;
-    }
-    else
-       {
-         MESSAGE("Component found !" << path);
-         Engines::Component_var compo = Engines::Component::_narrow(obj);
-//       ASSERT(!CORBA::is_nil(compo));
-         try
-           {
-             string instanceName = compo->instanceName(); 
-           }
-         catch (CORBA::COMM_FAILURE&)
-           {
-             INFOS("Caught CORBA::SystemException CommFailure. Engine "
-                   << path << "does not respond" );
-           }
-         return compo;
-       }
-    }
-  catch (ServiceUnreachable&)
-    {
-      INFOS("Caught exception: Naming Service Unreachable");
-    }
-  catch (...)
-    {
-      INFOS("Caught unknown exception.");
-    }
-  return Engines::Component::_nil();
+  Engines::Container_var cont=_ContManager->FindOrStartContainer(containerName,listOfMachines);
+  string implementation=Engines_Component_i::GetDynLibraryName(componentName);
+  return cont->load_impl(componentName, implementation.c_str());
 }
index 23b4e8797bd0ac4ed8b2b532f8fc9e8ff61dd855..a7a145c275a62210785d33b4b8bea543b758967b 100644 (file)
@@ -34,6 +34,7 @@
 #include <string>
 
 #include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
 #include CORBA_CLIENT_HEADER(SALOME_Component)
 
 class SALOME_NamingService;
@@ -41,29 +42,31 @@ class SALOME_NamingService;
 class SALOME_LifeCycleCORBA
 {
 public:
-  SALOME_LifeCycleCORBA();
   SALOME_LifeCycleCORBA(SALOME_NamingService *ns);
   virtual ~SALOME_LifeCycleCORBA();
-
-  Engines::Container_var FindContainer(const char *containerName);
-  Engines::Component_var FindOrLoad_Component(const char *containerName,
-                                             const char *componentName,
-                                             const char *implementationPath);
-  Engines::Component_var FindOrLoad_Component(const char *containerName,
+  Engines::Container_ptr FindContainer(const char *containerName); // for supervision
+  Engines::Component_ptr FindOrLoad_Component(const Engines::MachineParameters& params,
+                                             const char *componentName);
+  Engines::Component_ptr FindOrLoad_Component(const char *containerName,
                                              const char *componentName);
+  bool isKnownComponentClass(const char *componentName);
 protected:
-  SALOME_NamingService *_NS;
-  Engines::Container_var _FactoryServer ;
+  //! Establish if a component called "componentName" in a container called "containerName" exists among the list of resources
+  //! in "listOfMachines". This method uses Naming Service to find the component.
+  Engines::Component_ptr FindComponent(const char *containerName,
+                                           const char *componentName,
+                                           const Engines::MachineList& listOfMachines);
 
+  Engines::Component_ptr LoadComponent(const char *containerName, const char *componentName, const Engines::MachineList& listOfMachines);
+
+  SALOME_NamingService *_NS;
+  Engines::ContainerManager_var _ContManager;
+  
   //private:
   std::string ContainerName( const char * aComputerContainer ,
-                        std::string * theComputer ,
-                        std::string * theContainer ) ;
+                            std::string * theComputer ,
+                            std::string * theContainer ) ;
   std::string ComputerPath( const char * theComputer ) ;
-  Engines::Container_var FindOrStartContainer(const std::string aComputerContainer ,
-                                              const std::string theComputer ,
-                                              const std::string theContainer ) ;
-
 } ;
 
 #endif
index 99c98ab060a4a376b12dbcb0b490a0eaa8e47054..7660e9882a495e18426b14c3fb94c03b348a147d 100644 (file)
@@ -31,7 +31,8 @@ BIN_CLIENT_IDL = SALOME_Session.idl \
 
 CPPFLAGS+=$(QT_MT_INCLUDES)
 CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace 
+LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
 
 
 @CONCLUDE@
index df2cd8a1cc3bea72ef69e09719193e1c0ad1108c..f4b6fd53b3d7c6d4f4cc59db87df950c050d9197 100644 (file)
@@ -67,7 +67,7 @@ int main(int argc, char **argv)
   try
     {
       //Initialize the ORB
-      const long TIMESleep = 250000000;
+      const long TIMESleep = 500000000;
       const int NumberOfTries = 40;
       int i;
       timespec ts_req = {0, TIMESleep};
index cafc21b0bf53da8bc41a5793dfde754a10b6ee4f..a1a42ed965a6a711f4042e18eb1dfc8a01aa3b67 100644 (file)
@@ -39,35 +39,51 @@ static int MYVALUEDEBUG = 0;
 
 namespace MED{
   //---------------------------------------------------------------
-  TCellGroup 
-  GetCellsByEntity(TWrapper& theWrapper, 
+  TElemGroup 
+  GetElemsByEntity(TWrapper& theWrapper, 
                   const PMeshInfo& theMeshInfo,
                   const MED::TEntityInfo& theEntityInfo)
   {
-    MSG(MYDEBUG,"GetCellsByEntity(...)");
-    TCellGroup aGroup;
+    MSG(MYDEBUG,"GetElemsByEntity(...)");
+    TElemGroup aGroup;
     MED::TEntityInfo::const_iterator anIter = theEntityInfo.begin();
     for(; anIter != theEntityInfo.end(); anIter++){
       const EEntiteMaillage& anEntity = anIter->first;
       if(anEntity == eNOEUD) continue;
       const MED::TGeom& aGeom = anIter->second;
-      TCellSet& aCellSet = aGroup[anEntity];
+      TElemSet& aElemSet = aGroup[anEntity];
       MED::TGeom::const_iterator anGeomIter = aGeom.begin();
       for(; anGeomIter != aGeom.end(); anGeomIter++){
        const EGeometrieElement& aGeo = anGeomIter->first;
-       PCellInfo aCellInfo = theWrapper.GetPCellInfo(theMeshInfo,anEntity,aGeo);
-       aCellSet.insert(aCellInfo);
-       if(MYDEBUG){
-         TInt aNbElem = aCellInfo->GetNbElem();
-         INITMSG(MYDEBUG,"aGeo = "<<aGeo<<"; aNbElem = "<<aNbElem<<": ");
-         for(TInt iElem = 0; iElem < aNbElem; iElem++){
-           TInt iConnEnd = aCellInfo->GetConnDim();
-           for(TInt iConn = 0; iConn < iConnEnd; iConn++){
-             ADDMSG(MYVALUEDEBUG,aCellInfo->GetConn(iElem,iConn)<<",");
+       switch(aGeo){
+       case ePOLYGONE:
+         {
+           PPolygoneInfo aPolygoneInfo = theWrapper.GetPPolygoneInfo(theMeshInfo,anEntity,aGeo);
+           aElemSet.insert(aPolygoneInfo);
+           TElemNum aConn  = aPolygoneInfo->GetConnectivite();
+           TElemNum aIndex = aPolygoneInfo->GetIndex();
+           TInt aNbIndex = aIndex.size();
+           TInt aIndex0 = aIndex[0];
+           INITMSG(MYDEBUG,"aGeo = "<<aGeo<<"; aNbElem = "<<aNbIndex-1<<": ");
+           for(TInt iElem = 1; iElem < aNbIndex; iElem++){
+             for (TInt i = aIndex0; i < aIndex[iElem];i++)
+               ADDMSG(MYVALUEDEBUG,aConn[i-1]<<",");
+             ADDMSG(MYDEBUG," ");
+             aIndex0 = aIndex[iElem];
            }
-           ADDMSG(MYVALUEDEBUG," ");
+           ADDMSG(MYDEBUG,endl);
+           ADDMSG(MYDEBUG,"           Indexes :");
+           for(TInt iElem = 0; iElem < aIndex.size(); iElem++){
+             ADDMSG(MYVALUEDEBUG,aIndex[iElem]<<",");
+           }
+           ADDMSG(MYDEBUG,endl);
+           break;
+         }
+       default:
+         {
+           PCellInfo aCellInfo = theWrapper.GetPCellInfo(theMeshInfo,anEntity,aGeo);
+           aElemSet.insert(aCellInfo);
          }
-         ADDMSG(MYDEBUG,"\n");
        }
       }
     }
@@ -82,24 +98,14 @@ namespace MED{
              const PMeshInfo& theMeshInfo)
   {
     MSG(MYDEBUG,"GetFamilies(...)");
+    TErr anErr;
     TFamilyGroup aGroup;
     TInt aNbFam = theWrapper.GetNbFamilies(*theMeshInfo);
     INITMSG(MYDEBUG,"GetNbFamilies() = "<<aNbFam<<"\n");
     for(TInt iFam = 1; iFam <= aNbFam; iFam++){
-      PFamilyInfo aFamilyInfo = theWrapper.GetPFamilyInfo(theMeshInfo,iFam);
-      aGroup.insert(aFamilyInfo);
-      if(MYDEBUG){
-       string aName = aFamilyInfo->GetName();
-       TInt aNbAttr = aFamilyInfo->GetNbAttr();
-       TInt aNbGroup = aFamilyInfo->GetNbGroup();
-       INITMSG(MYDEBUG,
-               "aFamilyName = '"<<aName<<"'; andId = "<<aFamilyInfo->GetId()<<
-               "; aNbAttr = "<<aNbAttr<<"; aNbGroup = "<<aNbGroup<<"\n");
-       for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
-         aName = aFamilyInfo->GetGroupName(iGroup);
-         INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
-       }
-      }
+      PFamilyInfo aFamilyInfo = theWrapper.GetPFamilyInfo(theMeshInfo,iFam,&anErr);
+      if(anErr >= 0)
+       aGroup.insert(aFamilyInfo);
     }
     ADDMSG(MYDEBUG,"\n");
     return aGroup;
@@ -119,6 +125,8 @@ namespace MED{
        aGroup[aFamilyInfo->GetGroupName(iGroup)].insert(aFamilyInfo);
       } 
     }
+
+#ifdef _DEBUG_
     if(MYDEBUG){
       TGroupInfo::const_iterator anIter = aGroup.begin();
       for(; anIter != aGroup.end(); anIter++){
@@ -133,6 +141,8 @@ namespace MED{
       }
       ADDMSG(MYDEBUG,"\n");
     }
+#endif
+
     return aGroup;
   }
 
@@ -149,9 +159,8 @@ namespace MED{
     INITMSG(MYDEBUG,"GetNbFields() = "<<aNbFields<<"\n");
     for(TInt iField = 1; iField <= aNbFields; iField++){
       PFieldInfo aFieldInfo = theWrapper.GetPFieldInfo(theMeshInfo,iField);
-      TInt aNbComp = aFieldInfo->GetNbComp();
-      string aName = aFieldInfo->GetName();
-      INITMSG(MYDEBUG,"aFieldName = '"<<aName<<"'; aNbComp = "<<aNbComp<<"; ");
+      INITMSG(MYDEBUG,"aFieldName = '"<<aFieldInfo->GetName()<<
+             "'; aNbComp = "<<aFieldInfo->GetNbComp()<<"; ");
       MED::TGeom aGeom;
       EEntiteMaillage anEntity = EEntiteMaillage(-1);
       TInt aNbTimeStamps = theWrapper.GetNbTimeStamps(aFieldInfo,theEntityInfo,anEntity,aGeom);
@@ -189,7 +198,7 @@ namespace MED{
   TFamilyByEntity
   GetFamiliesByEntity(TWrapper& theWrapper, 
                      const PNodeInfo& theNodeInfo,
-                     const TCellGroup& theCellGroup,
+                     const TElemGroup& theElemGroup,
                      const TFamilyGroup& theFamilyGroup)
   {
     MSG(MYDEBUG,"GetFamiliesByEntity(...)");
@@ -217,18 +226,18 @@ namespace MED{
        }
       }
       
-      if(!theCellGroup.empty()){
-       TCellGroup::const_iterator anIter = theCellGroup.begin();
-       for(; anIter != theCellGroup.end(); anIter++){
+      if(!theElemGroup.empty()){
+       TElemGroup::const_iterator anIter = theElemGroup.begin();
+       for(; anIter != theElemGroup.end(); anIter++){
          const EEntiteMaillage& anEntity = anIter->first;
          TFamilyIdSet& aFamilyIdSet = aFamilyIdByEntity[anEntity];
-         const TCellSet& aCellSet = anIter->second;
-         TCellSet::const_iterator anCellIter = aCellSet.begin();
-         for(; anCellIter != aCellSet.end(); anCellIter++){
-           const PCellInfo& aCellInfo = *anCellIter;
-           if(TInt aNbElem = aCellInfo->GetNbElem()){
+         const TElemSet& aElemSet = anIter->second;
+         TElemSet::const_iterator anElemIter = aElemSet.begin();
+         for(; anElemIter != aElemSet.end(); anElemIter++){
+           const PElemInfo& aElemInfo = *anElemIter;
+           if(TInt aNbElem = aElemInfo->GetNbElem()){
              for(TInt i = 0; i < aNbElem; i++){
-               aFamilyIdSet.insert(aCellInfo->GetFamNum(i));
+               aFamilyIdSet.insert(aElemInfo->GetFamNum(i));
              }
            }
          }
index 7d519c0ad1b7d16409730b2cefeb061b3f720c9e..e72917a743aa47259758a353d535bdb8450a9b14 100644 (file)
 
 namespace MED{
   //---------------------------------------------------------------
-  typedef std::set<PCellInfo> TCellSet;
-  typedef std::map<EEntiteMaillage,TCellSet> TCellGroup;
+  typedef std::set<PElemInfo> TElemSet;
+  typedef std::map<EEntiteMaillage,TElemSet> TElemGroup;
 
-  TCellGroup GetCellsByEntity(TWrapper& theWrapper, 
+  TElemGroup GetElemsByEntity(TWrapper& theWrapper, 
                              const PMeshInfo& theMeshInfo,
                              const MED::TEntityInfo& theEntityInfo);
 
@@ -56,7 +56,7 @@ namespace MED{
   
   TFamilyByEntity GetFamiliesByEntity(TWrapper& theWrapper, 
                                      const PNodeInfo& theNodeInfo, 
-                                     const TCellGroup& theCellGroup,
+                                     const TElemGroup& theElemGroup,
                                      const TFamilyGroup& theFamilyGroup);
 
 
index 51307abe89abe90ed52f155074d9298161a5e180..5cac8fbd1650ccb8422caca31b1d92fb5729a622 100644 (file)
@@ -97,14 +97,21 @@ namespace MED{
 
   const TEntity2GeomSet& GetEntity2GeomSet();
 
-  inline TInt GetNbConn(EEntiteMaillage theEntity, 
-                       EGeometrieElement theElem,
-                       TInt theMeshDim)
-  {
-    TInt anElemDim = theElem / 100, nsup = 0;
-    if(theEntity == eMAILLE && anElemDim < theMeshDim) nsup = 1;
-    return nsup + theElem % 100;
-  }
+  enum EVersion {eVUnknown = -1, eV2_1, eV2_2};
+  
+  TInt GetNbConnectivities(EGeometrieElement typmai);
+
+  template<int EVersion>
+  TInt GetNbConn(EGeometrieElement typmai,
+                TInt mdim);
+  
+  template<>
+  TInt GetNbConn<eV2_1>(EGeometrieElement typmai,
+                       TInt mdim);
+
+  template<>
+  TInt GetNbConn<eV2_2>(EGeometrieElement typmai,
+                       TInt mdim);
 
   struct TNameInfo;
   typedef MED::shared_ptr<TNameInfo> PNameInfo;
@@ -121,6 +128,12 @@ namespace MED{
   struct TNodeInfo;
   typedef MED::shared_ptr<TNodeInfo> PNodeInfo;
 
+  struct TPolygoneInfo;
+  typedef MED::shared_ptr<TPolygoneInfo> PPolygoneInfo;
+
+  struct TPolyedreInfo;
+  typedef MED::shared_ptr<TPolyedreInfo> PPolyedreInfo;
+
   struct TCellInfo;
   typedef MED::shared_ptr<TCellInfo> PCellInfo;
 
index 24185816fa74f228e0b50e13a7d7be6b91cae7e1..3ec5eece456b553ab04f07c4c730406e343f1ae7 100644 (file)
@@ -123,19 +123,6 @@ TInt TCellInfo::GetConn(TInt theElemId, TInt theConnId) const {
 void TCellInfo::SetConn(TInt theElemId, TInt theConnId, TInt theVal){
   GETINDEX(myConn,GetConnDim()*theElemId + theConnId) = theVal;
 }
-
-TConstConnSlice 
-TCellInfo::GetConnSlice(TInt theElemId) const
-{
-  return TConstConnSlice(myConn,std::slice(GetConnDim()*theElemId,GetNbConnectivities(myTGeom),1));
-}
-
-TConnSlice 
-TCellInfo::GetConnSlice(TInt theElemId)
-{
-  return TConnSlice(myConn,std::slice(GetConnDim()*theElemId,GetNbConnectivities(myTGeom),1));
-}
-
 //---------------------------------------------------------------
 TInt TPolygoneInfo::GetNbConn(TInt theElemId) const {
   TInt i1 = GETINDEX(myIndex,theElemId);
index 8ade5eb2fa3b160f374ec11e2c494a60d788dfdf..888c3aeb103c0ffa1adc2c302abcae169cd59809 100644 (file)
@@ -36,22 +36,12 @@ namespace MED{
   //---------------------------------------------------------------
   typedef std::vector<char> TString;
 
-  inline std::string GetString(TInt theId, TInt theStep, 
-                              const TString& theString)
-  {
-    const char* aPos = &theString[theId*theStep];
-    TInt aSize = std::min(TInt(strlen(aPos)),theStep);
-    return std::string(aPos,aSize);
-  }
-
-  inline void SetString(TInt theId, TInt theStep, 
-                       TString& theString, 
-                       const std::string& theValue)
-  {
-    TInt aSize = std::min(TInt(theValue.size()+1),theStep);
-    strncpy(&theString[theId*theStep],theValue.c_str(),aSize);
-  }
+  std::string GetString(TInt theId, TInt theStep, 
+                       const TString& theString);
 
+  void SetString(TInt theId, TInt theStep, 
+                TString& theString, 
+                const std::string& theValue);
 
   //---------------------------------------------------------------
   struct TBase
@@ -107,12 +97,12 @@ namespace MED{
     TInt GetNbAttr() const { return myNbAttr;}
 
     TFamAttr myAttrId;
-    TInt GetAttrId(TInt theId) const { return myAttrId[theId];}
-    void SetAttrId(TInt theId, TInt theVal) { myAttrId[theId] = theVal;}
+    TInt GetAttrId(TInt theId) const;
+    void SetAttrId(TInt theId, TInt theVal);
 
     TFamAttr myAttrVal;
-    TInt GetAttrVal(TInt theId) const { return myAttrVal[theId];}
-    void SetAttrVal(TInt theId, TInt theVal) { myAttrVal[theId] = theVal;}
+    TInt GetAttrVal(TInt theId) const;
+    void SetAttrVal(TInt theId, TInt theVal);
 
     TString myAttrDesc;
     virtual std::string GetAttrDesc(TInt theId) const = 0;
@@ -132,15 +122,15 @@ namespace MED{
     TInt GetNbElem() const { return myNbElem;}
     
     TElemNum myFamNum;
-    TInt GetFamNum(TInt theId) const { return myFamNum[theId];}
-    void SetFamNum(TInt theId, TInt theVal) { myFamNum[theId] = theVal;}
+    TInt GetFamNum(TInt theId) const;
+    void SetFamNum(TInt theId, TInt theVal);
 
     EBooleen myIsElemNum;
     EBooleen IsElemNum() const { return myIsElemNum;}
 
     TElemNum myElemNum;
-    TInt GetElemNum(TInt theId) const { return myElemNum[theId];}
-    void SetElemNum(TInt theId, TInt theVal) { myElemNum[theId] = theVal;}
+    TInt GetElemNum(TInt theId) const;
+    void SetElemNum(TInt theId, TInt theVal);
 
     EBooleen myIsElemNames;
     EBooleen IsElemNames() const { return myIsElemNames;}
@@ -157,12 +147,8 @@ namespace MED{
   struct TNodeInfo: virtual TElemInfo
   {
     TNodeCoord myCoord;
-    TFloat GetNodeCoord(TInt theId, TInt theComp) const {
-      return myCoord[myMeshInfo->myDim*theId + theComp];
-    }
-    void SetNodeCoord(TInt theId, TInt theComp, TFloat theVal){
-      myCoord[myMeshInfo->myDim*theId + theComp] = theVal;
-    }
+    TFloat GetNodeCoord(TInt theId, TInt theComp) const;
+    void SetNodeCoord(TInt theId, TInt theComp, TFloat theVal);
 
     ERepere mySystem;
     ERepere GetSystem() const { return mySystem;}
@@ -190,18 +176,63 @@ namespace MED{
     EConnectivite myTConn;
     EConnectivite GetConn() const { return myTConn;}
 
+    virtual TInt GetConnDim() const = 0;
+
+    TElemNum myConn;
+    TInt GetConn(TInt theElemId, TInt theConnId) const;
+    void SetConn(TInt theElemId, TInt theConnId, TInt theVal);
+  };
+
+  //---------------------------------------------------------------
+  struct TPolygoneInfo: virtual TElemInfo
+  {
+    EEntiteMaillage myTEntity; // MED_FACE|MED_MAILLE
+    EEntiteMaillage GetEntity() const { return myTEntity;}
+
+    EGeometrieElement myTGeom; // ePOLYGONE
+    EGeometrieElement GetGeom() const { return ePOLYGONE;}
+
+    EConnectivite myTConn; // eNOD|eDESC(eDESC not used)
+    EConnectivite GetConn() const { return myTConn;}
+
     TInt myConnDim;
     TInt GetConnDim() const { return myConnDim;}
 
-    TElemNum myConn;
-    TInt GetConn(TInt theElemId, TInt theConnId) const {
-      return myConn[myConnDim*theElemId + theConnId];
-    }
-    void SetConn(TInt theElemId, TInt theConnId, TInt theVal){
-      myConn[myConnDim*theElemId + theConnId] = theVal;
-    }
+    TElemNum myConn; // Table de connectivities
+    TElemNum GetConnectivite() const { return myConn;}
+
+    TElemNum myIndex; // Table de indexes
+    TElemNum GetIndex() {return myIndex;}
+    TInt GetNbConn(TInt theElemId) const;
   };
 
+  //---------------------------------------------------------------
+  struct TPolyedreInfo: virtual TElemInfo
+  {
+    EEntiteMaillage myTEntity; // MED_FACE|MED_MAILLE
+    EEntiteMaillage GetEntity() const { return myTEntity;}
+
+    EGeometrieElement myTGeom; // ePOLYEDRE
+    EGeometrieElement GetGeom() const { return ePOLYEDRE;}
+
+    EConnectivite myTConn; // eNOD|eDESC(eDESC not used)
+    EConnectivite GetConn() const { return myTConn;}
+
+    TInt myNbConn;
+    TInt GetNbConn() const { return myNbConn;}
+
+    TElemNum myConn; // Table de connectivities
+    TElemNum GetConnectivite() const { return myConn;}
+    
+    TInt myNbFacesIndex;
+    TInt GetNbFacesIndex() const { return myNbFacesIndex;}
+    
+    TElemNum myFacesIndex; // Table de faces indexes
+    TElemNum GetFacesIndex() {return myFacesIndex;}
+    
+    TElemNum myIndex; // Table de indexes
+    TElemNum GetIndex() {return myIndex;}
+  };
 
   //---------------------------------------------------------------
   struct TFieldInfo: virtual TNameInfo
@@ -272,24 +303,10 @@ namespace MED{
 
     TMeshValue myMeshValue;
     TFloat GetVal(EGeometrieElement theGeom, TInt theId, 
-                 TInt theComp, TInt theGauss = 0) const
-    {
-      TInt aNbComp = myTimeStampInfo->myFieldInfo->myNbComp;
-      TInt aNbGauss = myTimeStampInfo->myNbGauss;
-      TInt aStep = aNbComp*aNbGauss;
-      TMeshValue::const_iterator anIter = myMeshValue.find(theGeom);
-      if(anIter != myMeshValue.end())
-       return anIter->second[theId*aStep + theComp*aNbGauss + theGauss];
-      return TFloat();
-    }
+                 TInt theComp, TInt theGauss = 0) const;
+
     void SetVal(EGeometrieElement theGeom, TInt theId, 
-               TInt theComp, TFloat theVal, TInt theGauss = 0)
-    {
-      TInt aNbComp = myTimeStampInfo->myFieldInfo->myNbComp;
-      TInt aNbGauss = myTimeStampInfo->myNbGauss;
-      TInt aStep = aNbComp*aNbGauss;
-      myMeshValue[theGeom][theId*aStep + theComp*aNbGauss + theGauss] = theVal;
-    }
+               TInt theComp, TFloat theVal, TInt theGauss = 0);
     EModeProfil myPflMode;
     EModeProfil GetPflMode() const { return myPflMode;}
     void GetPflMode(EModeProfil theVal) { myPflMode = theVal;}
index 93dc7b66b7ab5cf6e56eef28b58ca9015ee305a4..15319fe7e72c105332ab4269c4fa656654d05766 100644 (file)
@@ -39,7 +39,7 @@ namespace MED{
   const TInt LNOM = 80;
 
   //---------------------------------------------------------------
-  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
   struct TTNameInfo: virtual TNameInfo
   {
     TTNameInfo(const std::string& theValue = "")
@@ -59,10 +59,10 @@ namespace MED{
 
 
   //---------------------------------------------------------------
-  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
-  struct TTMeshInfo: TMeshInfo, TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+  struct TTMeshInfo: TMeshInfo, TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
   {
-    typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TNameInfoBase;
+    typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
 
     TTMeshInfo(const PMeshInfo& theInfo):
       TNameInfoBase(theInfo->GetName())
@@ -98,10 +98,10 @@ namespace MED{
 
 
   //---------------------------------------------------------------
-  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
-  struct TTFamilyInfo: TFamilyInfo, TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+  struct TTFamilyInfo: TFamilyInfo, TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
   {
-    typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TNameInfoBase;
+    typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
 
     TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
       TNameInfoBase(theInfo->GetName())
@@ -206,7 +206,7 @@ namespace MED{
 
 
   //---------------------------------------------------------------
-  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
   struct TTElemInfo: virtual TElemInfo
   {
     TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
@@ -301,10 +301,10 @@ namespace MED{
 
 
   //---------------------------------------------------------------
-  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
-  struct TTNodeInfo: TNodeInfo, TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+  struct TTNodeInfo: TNodeInfo, TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
   {
-    typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TElemInfoBase;
+    typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
 
     TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
       TElemInfoBase(theMeshInfo,theInfo)
@@ -398,12 +398,140 @@ namespace MED{
     }
   };
 
+  //---------------------------------------------------------------
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+  struct TTPolygoneInfo: TPolygoneInfo, TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+  {
+    typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
 
+    TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
+      TElemInfoBase(theMeshInfo,theInfo)
+    {
+      myTEntity = theInfo->GetEntity();
+      myTGeom = theInfo->GetGeom();
+      myTConn  = theInfo->GetConn();
+      myConnDim = theInfo->GetConnDim();
+      myConn = theInfo->GetConnectivite();
+      myIndex = theInfo->GetIndex();
+    }
+
+    TTPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                  TInt theNbElem,
+                  TInt theNbConn,
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn = eNOD,
+                  EBooleen theIsElemNum = eVRAI,
+                  EBooleen theIsElemNames = eVRAI):
+      TElemInfoBase(theMeshInfo,
+                   theNbElem,
+                   theIsElemNum,
+                   theIsElemNames)
+    {
+      myTEntity = theTEntity;
+      myTGeom = theTGeom;
+      myTConn  = theTConn;
+      myConnDim = theNbConn;
+      myConn.resize(myConnDim);
+      myIndex.resize(theNbElem+1);
+    }
+    
+    TTPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn,
+                  const TIntVector& theConnectivities,
+                  const TIntVector& theIndexes,
+                  const TIntVector& theFamilyNums,
+                  const TIntVector& theElemNums,
+                  const TStringVector& theElemNames = TStringVector()):
+      TElemInfoBase(theMeshInfo,
+                   theFamilyNums,
+                   theElemNums,
+                   theElemNames)
+    {
+      myTEntity = theTEntity;
+      myTGeom = theTGeom;
+      myTConn  = theTConn;
+      myConnDim = theConnectivities.size();
+      myConn = theConnectivities;
+      myIndex = theIndexes;
+    }
+  };
   //---------------------------------------------------------------
-  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
-  struct TTCellInfo: TCellInfo, TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+  struct TTPolyedreInfo: TPolyedreInfo, TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
   {
-    typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TElemInfoBase;
+    typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
+
+    TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
+      TElemInfoBase(theMeshInfo,theInfo)
+    {
+      myTEntity = theInfo->GetEntity();
+      myTGeom = theInfo->GetGeom();
+      myTConn  = theInfo->GetConn();
+      myNbConn = theInfo->GetNbConn();
+      myNbFacesIndex = theInfo->GetNbFacesIndex();
+      myConn = theInfo->GetConnectivite();
+      myFacesIndex = theInfo->GetFacesIndex();
+      myIndex = theInfo->GetIndex();
+    }
+
+    TTPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                  TInt theNbElem,
+                  TInt theNbConn,
+                  TInt theNbFacesIndex,
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn = eNOD,
+                  EBooleen theIsElemNum = eVRAI,
+                  EBooleen theIsElemNames = eVRAI):
+      TElemInfoBase(theMeshInfo,
+                   theNbElem,
+                   theIsElemNum,
+                   theIsElemNames)
+    {
+      myTEntity = theTEntity;
+      myTGeom = theTGeom;
+      myTConn  = theTConn;
+      myNbConn = theNbConn;
+      myNbFacesIndex = theNbFacesIndex;
+      myConn.resize(myNbConn);
+      myFacesIndex.resize(myNbFacesIndex);
+      myIndex.resize(theNbElem+1);
+    }
+    
+    TTPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn,
+                  const TIntVector& theConnectivities,
+                  const TIntVector& theFacesIndexes,
+                  const TIntVector& theIndexes,
+                  const TIntVector& theFamilyNums,
+                  const TIntVector& theElemNums,
+                  const TStringVector& theElemNames = TStringVector()):
+      TElemInfoBase(theMeshInfo,
+                   theFamilyNums,
+                   theElemNums,
+                   theElemNames)
+    {
+      myTEntity = theTEntity;
+      myTGeom = theTGeom;
+      myTConn  = theTConn;
+      myNbConn = theConnectivities.size();
+      myNbFacesIndex = theFacesIndexes.size();
+      myConn = theConnectivities;
+      myFacesIndex = theFacesIndexes;
+      myIndex = theIndexes;
+    }
+  };
+
+  //---------------------------------------------------------------
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+  struct TTCellInfo: TCellInfo, TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+  {
+    typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
 
     TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
       TElemInfoBase(theMeshInfo,theInfo)
@@ -411,11 +539,11 @@ namespace MED{
       myTEntity = theInfo->GetEntity();
       myTGeom = theInfo->GetGeom();
       myTConn  = theInfo->GetConn();
-      myConnDim = theInfo->GetConnDim();
       
-      myConn.resize(myNbElem*myConnDim);
+      TInt aConnDim = GetNbConnectivities(myTGeom);
+      myConn.resize(myNbElem*GetNbConn<nV>(myTGeom,myMeshInfo->myDim));
       for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
-       for(TInt anConnId = 0; anConnId < myConnDim; anConnId++){
+       for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
          SetConn(anElemId,anConnId,theInfo->GetConn(anElemId,anConnId));
        }
       }
@@ -436,8 +564,7 @@ namespace MED{
       myTEntity = theTEntity;
       myTGeom = theTGeom;
       myTConn  = theTConn;
-      myConnDim = GetNbConn(myTEntity,myTGeom,theMeshInfo->myDim);
-      myConn.resize(theNbElem*myConnDim);
+      myConn.resize(theNbElem*GetNbConn<nV>(theTGeom,theMeshInfo->myDim));
     }
     
     TTCellInfo(const PMeshInfo& theMeshInfo, 
@@ -448,28 +575,38 @@ namespace MED{
               const TIntVector& theFamilyNums,
               const TIntVector& theElemNums,
               const TStringVector& theElemNames = TStringVector()):
-      TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>(theMeshInfo,
-                                               theFamilyNums,
-                                               theElemNums,
-                                               theElemNames)
+      TElemInfoBase(theMeshInfo,
+                   theFamilyNums,
+                   theElemNums,
+                   theElemNames)
     {
       myTEntity = theTEntity;
       myTGeom = theTGeom;
       myTConn  = theTConn;
-      myConnDim = GetNbConn(myTEntity,myTGeom,theMeshInfo->myDim);
-      myConn.resize(theConnectivities.size());
-      for(TInt anId = 0, anEnd = myConn.size(); anId < anEnd; anId++){
-       myConn[anId] = theConnectivities[anId];
+
+      TInt aConnDim = GetNbConnectivities(myTGeom);
+      myNbElem = theConnectivities.size() / aConnDim;
+      myConn.resize(myNbElem*GetNbConn<nV>(myTGeom,myMeshInfo->myDim));
+      for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
+       for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
+         SetConn(anElemId,anConnId,theConnectivities[anElemId*aConnDim+anConnId]);
+       }
       }
+
+    }
+
+    virtual TInt GetConnDim() const { 
+      return GetNbConn<nV>(myTGeom,myMeshInfo->myDim);
     }
+
   };
 
 
   //---------------------------------------------------------------
-  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
-  struct TTFieldInfo: TFieldInfo, TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+  struct TTFieldInfo: TFieldInfo, TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
   {
-    typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TNameInfoBase;
+    typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
 
     TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
       TNameInfoBase(theInfo->GetName())
@@ -532,7 +669,7 @@ namespace MED{
 
 
   //---------------------------------------------------------------
-  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
   struct TTTimeStampInfo: TTimeStampInfo
   {
     TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
@@ -600,7 +737,7 @@ namespace MED{
 
 
   //---------------------------------------------------------------
-  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
   struct TTTimeStampVal: TTimeStampVal
   {
     TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo, const PTimeStampVal& theInfo)
index b5811b09e767fa114c86947262e596655668406c..e07ae30f8db013b6fb1661276670bdd4ad04af36 100644 (file)
 
 namespace MED{
 
-  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
+  template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
   class TTWrapper: public TWrapper{
   public:
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual PMeshInfo CrMeshInfo(TInt theDim = 0,
-                                const std::string& theValue = "",
-                                EMaillage theType = eNON_STRUCTURE,
-                                const std::string& theDesc = "")
+    virtual 
+    PMeshInfo
+    CrMeshInfo(TInt theDim = 0,
+              const std::string& theValue = "",
+              EMaillage theType = eNON_STRUCTURE,
+              const std::string& theDesc = "")
     {
-      return PMeshInfo(new TTMeshInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PMeshInfo(new TTMeshInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                       (theDim,
                        theValue,
                        theType,
                        theDesc));
     }
 
-    virtual PMeshInfo CrMeshInfo(const PMeshInfo& theInfo)
+    virtual 
+    PMeshInfo
+    CrMeshInfo(const PMeshInfo& theInfo)
     {
-      return PMeshInfo(new TTMeshInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>(theInfo));
+      return PMeshInfo(new TTMeshInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>(theInfo));
     }
-
+    
 
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual PFamilyInfo CrFamilyInfo(const PMeshInfo& theMeshInfo,
-                                    TInt theNbGroup = 0, 
-                                    TInt theNbAttr = 0,
-                                    TInt theId = 0,
-                                    const std::string& theValue = "")
+    virtual
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                TInt theNbGroup = 0, 
+                TInt theNbAttr = 0,
+                TInt theId = 0,
+                const std::string& theValue = "")
     {
-      return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                         (theMeshInfo,
                          theNbGroup,
                          theNbAttr,
@@ -71,15 +77,17 @@ namespace MED{
                          theValue));
     }
 
-    virtual PFamilyInfo CrFamilyInfo(const PMeshInfo& theMeshInfo,
-                                    const std::string& theValue,
-                                    TInt theId,
-                                    const MED::TStringSet& theGroupNames, 
-                                    const MED::TStringVector& theAttrDescs = MED::TStringVector(), 
-                                    const MED::TIntVector& theAttrIds = MED::TIntVector(), 
-                                    const MED::TIntVector& theAttrVals = MED::TIntVector())
+    virtual
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                const std::string& theValue,
+                TInt theId,
+                const MED::TStringSet& theGroupNames, 
+                const MED::TStringVector& theAttrDescs = MED::TStringVector(), 
+                const MED::TIntVector& theAttrIds = MED::TIntVector(), 
+                const MED::TIntVector& theAttrVals = MED::TIntVector())
     {
-      return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                         (theMeshInfo,
                          theValue,
                          theId,
@@ -89,23 +97,27 @@ namespace MED{
                          theAttrVals));
     }
 
-    virtual PFamilyInfo CrFamilyInfo(const PMeshInfo& theMeshInfo,
-                                    const PFamilyInfo& theInfo)
+    virtual
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                const PFamilyInfo& theInfo)
     {
-      return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                         (theMeshInfo,
                          theInfo));
     }
 
 
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual PNodeInfo CrNodeInfo(const PMeshInfo& theMeshInfo, 
-                                TInt theNbElem,
-                                ERepere theSystem = eCART, 
-                                EBooleen theIsElemNum = eVRAI,
-                                EBooleen theIsElemNames = eVRAI)
+    virtual
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo, 
+              TInt theNbElem,
+              ERepere theSystem = eCART, 
+              EBooleen theIsElemNum = eVRAI,
+              EBooleen theIsElemNames = eVRAI)
     {
-      return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                       (theMeshInfo,
                        theNbElem,
                        theSystem,
@@ -113,16 +125,18 @@ namespace MED{
                        theIsElemNames));
     }
 
-    virtual PNodeInfo CrNodeInfo(const PMeshInfo& theMeshInfo, 
-                                ERepere theSystem, 
-                                const TFloatVector& theNodeCoords,
-                                const TStringVector& theCoordNames,
-                                const TStringVector& theCoordUnits,
-                                const TIntVector& theFamilyNums,
-                                const TIntVector& theElemNums,
-                                const TStringVector& theElemNames = TStringVector())
+    virtual 
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo, 
+              ERepere theSystem, 
+              const TFloatVector& theNodeCoords,
+              const TStringVector& theCoordNames,
+              const TStringVector& theCoordUnits,
+              const TIntVector& theFamilyNums,
+              const TIntVector& theElemNums,
+              const TStringVector& theElemNames = TStringVector())
     {
-      return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                       (theMeshInfo,
                        theSystem,
                        theNodeCoords,
@@ -133,25 +147,146 @@ namespace MED{
                        theElemNames));
     }
 
-    virtual PNodeInfo CrNodeInfo(const PMeshInfo& theMeshInfo,
-                                const PNodeInfo& theInfo)
+    virtual 
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo,
+              const PNodeInfo& theInfo)
     {
-      return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                       (theMeshInfo,
                        theInfo));
     }
     
+    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    virtual
+    PPolygoneInfo
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                  TInt theNbElem,
+                  TInt theNbConn,
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn = eNOD,
+                  EBooleen theIsElemNum = eVRAI,
+                  EBooleen theIsElemNames = eVRAI)
+    {
+      return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+                          (theMeshInfo,
+                           theNbElem,
+                           theNbConn,
+                           theTEntity,
+                           theTGeom,
+                           theTConn,
+                           theIsElemNum,
+                           theIsElemNames));
+    }
+
+    virtual
+    PPolygoneInfo
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn,
+                  const TIntVector& theConnectivities,
+                  const TIntVector& theIndexes,
+                  const TIntVector& theFamilyNums,
+                  const TIntVector& theElemNums,
+                  const TStringVector& theElemNames = TStringVector())
+    {
+      return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+                          (theMeshInfo,
+                           theTEntity,
+                           theTGeom,
+                           theTConn,
+                           theConnectivities,
+                           theIndexes,
+                           theFamilyNums,
+                           theElemNums,
+                           theElemNames));
+    }
+
+    virtual
+    PPolygoneInfo
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+                  const PPolygoneInfo& theInfo)
+    {
+      return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+                          (theMeshInfo,
+                           theInfo));
+    }
     
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual PCellInfo CrCellInfo(const PMeshInfo& theMeshInfo, 
-                                TInt theNbElem,
-                                EEntiteMaillage theTEntity, 
-                                EGeometrieElement theTGeom,
-                                EConnectivite theTConn = eNOD,
-                                EBooleen theIsElemNum = eVRAI,
-                                EBooleen theIsElemNames = eVRAI)
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                  TInt theNbElem,
+                  TInt theNbConn,
+                  TInt theNbFaces,
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn = eNOD,
+                  EBooleen theIsElemNum = eVRAI,
+                  EBooleen theIsElemNames = eVRAI)
+    {
+      return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+                          (theMeshInfo,
+                           theNbElem,
+                           theNbConn,
+                           theNbFaces,
+                           theTEntity,
+                           theTGeom,
+                           theTConn,
+                           theIsElemNum,
+                           theIsElemNames));
+    }
+
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn,
+                  const TIntVector& theConnectivities,
+                  const TIntVector& theFacesIndexes,
+                  const TIntVector& theIndexes,
+                  const TIntVector& theFamilyNums,
+                  const TIntVector& theElemNums,
+                  const TStringVector& theElemNames = TStringVector())
+    {
+      return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+                          (theMeshInfo,
+                           theTEntity,
+                           theTGeom,
+                           theTConn,
+                           theConnectivities,
+                           theFacesIndexes,
+                           theIndexes,
+                           theFamilyNums,
+                           theElemNums,
+                           theElemNames));
+    }
+
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+                  const PPolyedreInfo& theInfo)
+    {
+      return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+                          (theMeshInfo,
+                           theInfo));
+    }
+
+    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo, 
+              TInt theNbElem,
+              EEntiteMaillage theTEntity, 
+              EGeometrieElement theTGeom,
+              EConnectivite theTConn = eNOD,
+              EBooleen theIsElemNum = eVRAI,
+              EBooleen theIsElemNames = eVRAI)
     {
-      return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                       (theMeshInfo,
                        theNbElem,
                        theTEntity,
@@ -161,16 +296,18 @@ namespace MED{
                        theIsElemNames));
     }
 
-    virtual PCellInfo CrCellInfo(const PMeshInfo& theMeshInfo, 
-                                EEntiteMaillage theTEntity, 
-                                EGeometrieElement theTGeom,
-                                EConnectivite theTConn,
-                                const TIntVector& theConnectivities,
-                                const TIntVector& theFamilyNums,
-                                const TIntVector& theElemNums,
-                                const TStringVector& theElemNames = TStringVector())
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo, 
+              EEntiteMaillage theTEntity, 
+              EGeometrieElement theTGeom,
+              EConnectivite theTConn,
+              const TIntVector& theConnectivities,
+              const TIntVector& theFamilyNums,
+              const TIntVector& theElemNums,
+              const TStringVector& theElemNames = TStringVector())
     {
-      return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                       (theMeshInfo,
                        theTEntity,
                        theTGeom,
@@ -181,24 +318,28 @@ namespace MED{
                        theElemNames));
     }
 
-    virtual PCellInfo CrCellInfo(const PMeshInfo& theMeshInfo,
-                                const PCellInfo& theInfo)
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo,
+              const PCellInfo& theInfo)
     {
-      return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                       (theMeshInfo,
                        theInfo));
     }
     
 
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual PFieldInfo CrFieldInfo(const PMeshInfo& theMeshInfo, 
-                                  TInt theNbComp = 0,
-                                  ETypeChamp theType = eFLOAT64,
-                                  const std::string& theValue = "",
-                                  EBooleen theIsLocal = eVRAI,
-                                  TInt theNbRef = 1)
+    virtual
+    PFieldInfo
+    CrFieldInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbComp = 0,
+               ETypeChamp theType = eFLOAT64,
+               const std::string& theValue = "",
+               EBooleen theIsLocal = eVRAI,
+               TInt theNbRef = 1)
     {
-      return PFieldInfo(new TTFieldInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PFieldInfo(new TTFieldInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                        (theMeshInfo,
                         theNbComp,
                         theType,
@@ -207,27 +348,31 @@ namespace MED{
                         theNbRef));
     }
 
-    virtual PFieldInfo CrFieldInfo(const PMeshInfo& theMeshInfo,
-                                  const PFieldInfo& theInfo)
+    virtual
+    PFieldInfo
+    CrFieldInfo(const PMeshInfo& theMeshInfo,
+               const PFieldInfo& theInfo)
     {
-      return PFieldInfo(new TTFieldInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PFieldInfo(new TTFieldInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                        (theMeshInfo,
                         theInfo));
     }
     
 
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual PTimeStampInfo CrTimeStampInfo(const PFieldInfo& theFieldInfo, 
-                                          EEntiteMaillage theEntity,
-                                          const TGeom& theGeom,
-                                          TInt theNbGauss = 0,
-                                          TInt theNumDt = 0,
-                                          TInt theNumOrd = 0,
-                                          TFloat theDt = 0,
-                                          const std::string& theUnitDt = "",
-                                          const std::string& theGaussName = "")
+    virtual
+    PTimeStampInfo
+    CrTimeStampInfo(const PFieldInfo& theFieldInfo, 
+                   EEntiteMaillage theEntity,
+                   const TGeom& theGeom,
+                   TInt theNbGauss = 0,
+                   TInt theNumDt = 0,
+                   TInt theNumOrd = 0,
+                   TFloat theDt = 0,
+                   const std::string& theUnitDt = "",
+                   const std::string& theGaussName = "")
     {
-      return PTimeStampInfo(new TTTimeStampInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PTimeStampInfo(new TTTimeStampInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                            (theFieldInfo,
                             theEntity,
                             theGeom,
@@ -239,30 +384,36 @@ namespace MED{
                             theGaussName));
     }
 
-    virtual PTimeStampInfo CrTimeStampInfo(const PFieldInfo& theFieldInfo,
-                                          const PTimeStampInfo& theInfo)
+    virtual
+    PTimeStampInfo
+    CrTimeStampInfo(const PFieldInfo& theFieldInfo,
+                   const PTimeStampInfo& theInfo)
     {
-      return PTimeStampInfo(new TTTimeStampInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PTimeStampInfo(new TTTimeStampInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                            (theFieldInfo,
                             theInfo));
     }
     
 
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual PTimeStampVal CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
-                                        const std::string& thePflName = "",
-                                        EModeProfil thePflMode = eCOMPACT)
+    virtual
+    PTimeStampVal
+    CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                  const std::string& thePflName = "",
+                  EModeProfil thePflMode = eCOMPACT)
     {
-      return PTimeStampVal(new TTTimeStampVal<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PTimeStampVal(new TTTimeStampVal<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                           (theTimeStampInfo,
                            thePflName,
                            thePflMode));
     }
 
-    virtual PTimeStampVal CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
-                                        const PTimeStampVal& theInfo)
+    virtual
+    PTimeStampVal
+    CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                  const PTimeStampVal& theInfo)
     {
-      return PTimeStampVal(new TTTimeStampVal<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+      return PTimeStampVal(new TTTimeStampVal<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
                           (theTimeStampInfo,
                            theInfo));
     }
index 1454a96f33c39d21e40a998745a040d5d3ee7102..5c53a4df29c7ff7fe879a29b01e981b63a38753e 100644 (file)
@@ -77,6 +77,7 @@ bool InitEntity2GeomSet()
   aGeomFACESet.insert(eQUAD4);
   aGeomFACESet.insert(eTRIA6);
   aGeomFACESet.insert(eQUAD8);
+  aGeomFACESet.insert(ePOLYGONE);
 
   TGeomSet& aGeomMAILLESet = Entity2GeomSet[eMAILLE];
   aGeomMAILLESet.insert(ePOINT1);
@@ -90,6 +91,7 @@ bool InitEntity2GeomSet()
   aGeomMAILLESet.insert(ePYRA13);
   aGeomMAILLESet.insert(ePENTA15);
   aGeomMAILLESet.insert(eHEXA20);
+  aGeomMAILLESet.insert(ePOLYEDRE);
   
   return true;
 }
index 96f1b30fca3452e60e28fc7097e77d60a5ff4ec1..3c3882cc79ea4ca4ce9098b6e3ddd298cdb5edd6 100644 (file)
@@ -48,7 +48,7 @@ namespace MED{
   };
 };
 
-
+//#define _DEBUG_
 #ifdef _DEBUG_
   #define MSG(deb,msg) if(deb) std::cout<<MED::PrefixPrinter::GetPrefix()<<msg<<" ("<<__FILE__<<" ["<<__LINE__<<"])\n"
   #define BEGMSG(deb,msg) if(deb) std::cout<<MED::PrefixPrinter::GetPrefix()<<msg
index bc76b56239673ff5da90dfb3e52a2739e70b8ab0..f536162c712c922e9a193ca25a62e6e364bda12a 100644 (file)
 #include "MED_Wrapper.hxx"
 #include "MED_Utilities.hxx"
  
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYVALUEDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+static int MYVALUEDEBUG = 0;
+#endif
+
 namespace MED{
   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  PMeshInfo TWrapper::GetPMeshInfo(TInt theId)
+  PMeshInfo TWrapper::GetPMeshInfo(TInt theId,
+                                  TErr* theErr)
   {
     PMeshInfo anInfo = CrMeshInfo();
-    GetMeshInfo(theId,*anInfo);
+    GetMeshInfo(theId,*anInfo,theErr);
     return anInfo;
   }
 
 
   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  PFamilyInfo TWrapper::GetPFamilyInfo(const PMeshInfo& theMeshInfo, TInt theId)
+  PFamilyInfo TWrapper::GetPFamilyInfo(const PMeshInfo& theMeshInfo, 
+                                      TInt theId,
+                                      TErr* theErr)
   {
     TInt aNbAttr = GetNbFamAttr(theId,*theMeshInfo);
     TInt aNbGroup = GetNbFamGroup(theId,*theMeshInfo);
     PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo,aNbGroup,aNbAttr);
-    GetFamilyInfo(theId,*anInfo);
+    GetFamilyInfo(theId,*anInfo,theErr);
+
+#ifdef _DEBUG_
+    string aName = anInfo->GetName();
+    INITMSG(MYDEBUG,
+           "aFamilyName = '"<<aName<<"'; andId = "<<anInfo->GetId()<<
+           "; aNbAttr = "<<aNbAttr<<"; aNbGroup = "<<aNbGroup<<"\n");
+    for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
+      aName = anInfo->GetGroupName(iGroup);
+      INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
+    }
+#endif
+    
     return anInfo;
   }
 
 
   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  PNodeInfo TWrapper::GetPNodeInfo(const PMeshInfo& theMeshInfo)
+  PNodeInfo TWrapper::GetPNodeInfo(const PMeshInfo& theMeshInfo,
+                                  TErr* theErr)
   {
     TInt aNbElems = GetNbNodes(*theMeshInfo);
     PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems);
-    GetNodeInfo(*anInfo);
+    GetNodeInfo(*anInfo,theErr);
+
+#ifdef _DEBUG_
+    TInt aDim = theMeshInfo->myDim;
+    TInt aNbElem = anInfo->GetNbElem();
+    INITMSG(MYDEBUG,"GetPNodeInfo - aCoords: "<<aNbElem<<": ");
+    TNodeCoord& aCoord = anInfo->myCoord;
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      for(TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++){
+       ADDMSG(MYVALUEDEBUG,aCoord[anId]<<",");
+      }
+      ADDMSG(MYVALUEDEBUG," ");
+    }
+    ADDMSG(MYDEBUG,endl);
+
+    BEGMSG(MYDEBUG,"GetPNodeInfo - GetFamNum: ");
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
+    }
+    ADDMSG(MYDEBUG,endl);
+
+    if(anInfo->IsElemNum()){
+      BEGMSG(MYDEBUG,"GetPNodeInfo - GetElemNum: ");
+      for(TInt iElem = 0; iElem < aNbElem; iElem++){
+       ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
+      }
+      ADDMSG(MYDEBUG,endl);
+    }
+
+    ADDMSG(MYDEBUG,endl);
+#endif
+    
     return anInfo;
   }
 
-
+  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  PPolygoneInfo TWrapper::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
+                                          EEntiteMaillage theEntity, 
+                                          EGeometrieElement theGeom, 
+                                          EConnectivite theConn)
+  {
+    TInt aNbElem = GetNbPolygones(*theMeshInfo,theEntity,theGeom,theConn);
+    TInt aNbConn = GetNbPolygoneConn(*theMeshInfo,theEntity,theGeom,theConn);
+    PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,aNbElem,aNbConn,theEntity,theGeom,theConn);
+    GetPolygoneInfo(*anInfo);
+    return anInfo;
+  }
+  
+  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  PPolyedreInfo TWrapper::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
+                                          EEntiteMaillage theEntity, 
+                                          EGeometrieElement theGeom, 
+                                          EConnectivite theConn)
+  {
+    TInt aNbElem  = GetNbPolyedres(*theMeshInfo,theEntity,theGeom,theConn);
+    TInt aNbConn = 0;
+    TInt aNbFaces = 0;
+    GetNbPolyedreConnF(*theMeshInfo,theConn,aNbFaces,aNbConn);
+    PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,aNbElem,aNbConn,aNbFaces,theEntity,theGeom,theConn);
+    GetPolyedreInfo(*anInfo);
+    return anInfo;
+  }
+  
   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   PCellInfo TWrapper::GetPCellInfo(const PMeshInfo& theMeshInfo,
                                   EEntiteMaillage theEntity, 
                                   EGeometrieElement theGeom, 
-                                  EConnectivite theConn)
+                                  EConnectivite theConn,
+                                  TErr* theErr)
   {
     TInt aNbElem = GetNbCells(*theMeshInfo,theEntity,theGeom,theConn);
     PCellInfo anInfo = CrCellInfo(theMeshInfo,aNbElem,theEntity,theGeom,theConn);
-    GetCellInfo(*anInfo);
+    GetCellInfo(*anInfo,theErr);
+
+#ifdef _DEBUG_
+    TInt aConnDim = anInfo->GetConnDim();
+    INITMSG(MYDEBUG,"GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
+    BEGMSG(MYDEBUG,"GetPCellInfo - aNbElem: "<<aNbElem<<": ");
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      for(TInt iConn = 0; iConn < aConnDim; iConn++){
+       ADDMSG(MYVALUEDEBUG,anInfo->GetConn(iElem,iConn)<<",");
+      }
+      ADDMSG(MYVALUEDEBUG," ");
+    }
+    ADDMSG(MYDEBUG,endl);
+
+    BEGMSG(MYDEBUG,"GetPCellInfo - GetFamNum: ");
+    for(TInt iElem = 0; iElem < aNbElem; iElem++){
+      ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
+    }
+    ADDMSG(MYDEBUG,endl);
+
+    if(anInfo->IsElemNum()){
+      BEGMSG(MYDEBUG,"GetPCellInfo - GetElemNum: ");
+      for(TInt iElem = 0; iElem < aNbElem; iElem++){
+       ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
+      }
+      ADDMSG(MYDEBUG,endl);
+    }
+
+    ADDMSG(MYDEBUG,endl);
+#endif
+    
     return anInfo;
   }
 
 
   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  PFieldInfo TWrapper::GetPFieldInfo(const PMeshInfo& theMeshInfo, TInt theId)
+  PFieldInfo TWrapper::GetPFieldInfo(const PMeshInfo& theMeshInfo, 
+                                    TInt theId,
+                                    TErr* theErr)
   {
     TInt aNbComp = GetNbComp(theId);
     PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
-    GetFieldInfo(theId,*anInfo);
+    GetFieldInfo(theId,*anInfo,theErr);
     return anInfo;
   }
 
@@ -67,19 +182,21 @@ namespace MED{
   PTimeStampInfo TWrapper::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
                                             EEntiteMaillage theEntity,
                                             const MED::TGeom& theGeom,
-                                            TInt theId)
+                                            TInt theId,
+                                            TErr* theErr)
   {
     PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom);
-    GetTimeStampInfo(theId,*anInfo);
+    GetTimeStampInfo(theId,*anInfo,theErr);
     return anInfo;
   }
 
 
   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  PTimeStampVal TWrapper::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo)
+  PTimeStampVal TWrapper::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                                          TErr* theErr)
   {
     PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
-    GetTimeStampVal(*anInfo);
+    GetTimeStampVal(*anInfo,theErr);
     return anInfo;
   }
 }
index 102e38ef165738a980f7e53f988782660a68ebcf..4865a156e37fa658217567021815c0ba7309d0b1 100644 (file)
@@ -35,209 +35,452 @@ namespace MED{
 
   struct TWrapper{
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual PMeshInfo CrMeshInfo(TInt theDim = 0,
-                                const std::string& theValue = "",
-                                EMaillage theType = eNON_STRUCTURE,
-                                const std::string& theDesc = "") = 0;
-
-    virtual PMeshInfo CrMeshInfo(const PMeshInfo& theInfo) = 0;
-
-    virtual TInt GetNbMeshes(TErr* theErr = NULL) = 0;
+    virtual 
+    PMeshInfo 
+    CrMeshInfo(TInt theDim = 0,
+              const std::string& theValue = "",
+              EMaillage theType = eNON_STRUCTURE,
+              const std::string& theDesc = "") = 0;
+
+    virtual 
+    PMeshInfo 
+    CrMeshInfo(const PMeshInfo& theInfo) = 0;
+
+    virtual 
+    TInt 
+    GetNbMeshes(TErr* theErr = NULL) = 0;
     
-    virtual void GetMeshInfo(TInt theMeshId, TMeshInfo&,
-                            TErr* theErr = NULL) = 0;
-
-    virtual void SetMeshInfo(const TMeshInfo& theInfo,
-                            TErr* theErr = NULL) = 0;
+    virtual 
+    void 
+    GetMeshInfo(TInt theMeshId, TMeshInfo&,
+               TErr* theErr = NULL) = 0;
+
+    virtual 
+    void
+    SetMeshInfo(const TMeshInfo& theInfo,
+               TErr* theErr = NULL) = 0;
     
-    virtual PMeshInfo GetPMeshInfo(TInt theId);
+    virtual 
+    PMeshInfo
+    GetPMeshInfo(TInt theId,
+                TErr* theErr = NULL);
 
 
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual TInt GetNbFamilies(const TMeshInfo& theMeshInfo,
-                              TErr* theErr = NULL) = 0;
-
-    virtual TInt GetNbFamAttr(TInt theFamId, 
-                             const TMeshInfo& theInfo,
-                             TErr* theErr = NULL) = 0;
-
-    virtual TInt GetNbFamGroup(TInt theFamId, 
-                              const TMeshInfo& theInfo,
-                              TErr* theErr = NULL) = 0;
+    virtual 
+    TInt
+    GetNbFamilies(const TMeshInfo& theMeshInfo,
+                 TErr* theErr = NULL) = 0;
+
+    virtual 
+    TInt
+    GetNbFamAttr(TInt theFamId, 
+                const TMeshInfo& theInfo,
+                TErr* theErr = NULL) = 0;
     
-    virtual void GetFamilyInfo(TInt theFamId, 
-                              TFamilyInfo& theInfo,
-                              TErr* theErr = NULL) = 0;
+    virtual
+    TInt
+    GetNbFamGroup(TInt theFamId, 
+                 const TMeshInfo& theInfo,
+                 TErr* theErr = NULL) = 0;
     
-    virtual void SetFamilyInfo(const TFamilyInfo& theInfo,
-                              TErr* theErr = NULL) = 0;
+    virtual
+    void
+    GetFamilyInfo(TInt theFamId, 
+                 TFamilyInfo& theInfo,
+                 TErr* theErr = NULL) = 0;
     
-    virtual PFamilyInfo CrFamilyInfo(const PMeshInfo& theMeshInfo,
-                                    TInt theNbGroup = 0, 
-                                    TInt theNbAttr = 0,
-                                    TInt theId = 0,
-                                    const std::string& theValue = "") = 0;
+    virtual
+    void
+    SetFamilyInfo(const TFamilyInfo& theInfo,
+                 TErr* theErr = NULL) = 0;
+    
+    virtual 
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                TInt theNbGroup = 0, 
+                TInt theNbAttr = 0,
+                TInt theId = 0,
+                const std::string& theValue = "") = 0;
+    
+    virtual 
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                const std::string& theValue,
+                TInt theId,
+                const TStringSet& theGroupNames, 
+                const TStringVector& theAttrDescs = TStringVector(), 
+                const TIntVector& theAttrIds = TIntVector(), 
+                const TIntVector& theAttrVals = TIntVector()) = 0;
+    
+    virtual
+    PFamilyInfo
+    CrFamilyInfo(const PMeshInfo& theMeshInfo,
+                const PFamilyInfo& theInfo) = 0;
+    
+    PFamilyInfo
+    GetPFamilyInfo(const PMeshInfo& theMeshInfo, 
+                  TInt theId,
+                  TErr* theErr = NULL);
     
-    virtual PFamilyInfo CrFamilyInfo(const PMeshInfo& theMeshInfo,
-                                    const std::string& theValue,
-                                    TInt theId,
-                                    const TStringSet& theGroupNames, 
-                                    const TStringVector& theAttrDescs = TStringVector(), 
-                                    const TIntVector& theAttrIds = TIntVector(), 
-                                    const TIntVector& theAttrVals = TIntVector()) = 0;
-
-    virtual PFamilyInfo CrFamilyInfo(const PMeshInfo& theMeshInfo,
-                                    const PFamilyInfo& theInfo) = 0;
-
-    PFamilyInfo GetPFamilyInfo(const PMeshInfo& theMeshInfo, TInt theId);
-
 
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual TInt GetNbNodes(const TMeshInfo& theMeshInfo,
-                           TErr* theErr = NULL) = 0;
+    virtual
+    TInt
+    GetNbNodes(const TMeshInfo& theMeshInfo,
+              TErr* theErr = NULL) = 0;
     
-    virtual void GetNodeInfo(TNodeInfo& theInfo,
-                            TErr* theErr = NULL) = 0;
-
-    virtual void SetNodeInfo(const TNodeInfo& theInfo,
-                            TErr* theErr = NULL) = 0;
+    virtual
+    void
+    GetNodeInfo(TNodeInfo& theInfo,
+               TErr* theErr = NULL) = 0;
+
+    virtual 
+    void
+    SetNodeInfo(const TNodeInfo& theInfo,
+               TErr* theErr = NULL) = 0;
+    
+    virtual 
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo, 
+              TInt theNbElem,
+              ERepere theSystem = eCART, 
+              EBooleen theIsElemNum = eVRAI,
+              EBooleen theIsElemNames = eVRAI) = 0;
+
+    virtual 
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo, 
+              ERepere theSystem, 
+              const TFloatVector& theNodeCoords,
+              const TStringVector& theCoordNames,
+              const TStringVector& theCoordUnits,
+              const TIntVector& theFamilyNums,
+              const TIntVector& theElemNums,
+              const TStringVector& theElemNames = TStringVector()) = 0;
+    
+    virtual
+    PNodeInfo
+    CrNodeInfo(const PMeshInfo& theMeshInfo,
+              const PNodeInfo& theInfo) = 0;
+    
+    PNodeInfo
+    GetPNodeInfo(const PMeshInfo& theMeshInfo,
+                TErr* theErr = NULL);
     
-    virtual PNodeInfo CrNodeInfo(const PMeshInfo& theMeshInfo, 
-                                TInt theNbElem,
-                                ERepere theSystem = eCART, 
-                                EBooleen theIsElemNum = eVRAI,
-                                EBooleen theIsElemNames = eVRAI) = 0;
-
-    virtual PNodeInfo CrNodeInfo(const PMeshInfo& theMeshInfo, 
-                                ERepere theSystem, 
-                                const TFloatVector& theNodeCoords,
-                                const TStringVector& theCoordNames,
-                                const TStringVector& theCoordUnits,
-                                const TIntVector& theFamilyNums,
-                                const TIntVector& theElemNums,
-                                const TStringVector& theElemNames = TStringVector()) = 0;
-
-    virtual PNodeInfo CrNodeInfo(const PMeshInfo& theMeshInfo,
-                                const PNodeInfo& theInfo) = 0;
-
-    PNodeInfo GetPNodeInfo(const PMeshInfo& theMeshInfo);
-
-
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual TEntityInfo GetEntityInfo(const TMeshInfo& theMeshInfo,
-                                     EConnectivite theTConn = eNOD,
-                                     TErr* theErr = NULL) = 0;
-    
-    virtual TInt GetNbCells(const TMeshInfo& theMeshInfo, 
-                           EEntiteMaillage, 
-                           EGeometrieElement, 
-                           EConnectivite theTConn = eNOD,
-                           TErr* theErr = NULL) = 0;
-    
-    virtual void GetCellInfo(TCellInfo& theInfo,
-                            TErr* theErr = NULL) = 0;
-
-    virtual void SetCellInfo(const TCellInfo& theInfo,
-                            TErr* theErr = NULL) = 0;
-    
-    virtual PCellInfo CrCellInfo(const PMeshInfo& theMeshInfo, 
-                                TInt theNbElem,
-                                EEntiteMaillage theTEntity, 
-                                EGeometrieElement theTGeom,
-                                EConnectivite theTConn = eNOD,
-                                EBooleen theIsElemNum = eVRAI,
-                                EBooleen theIsElemNames = eVRAI) = 0;
-
-    virtual PCellInfo CrCellInfo(const PMeshInfo& theMeshInfo, 
-                                EEntiteMaillage theTEntity, 
-                                EGeometrieElement theTGeom,
-                                EConnectivite theTConn,
-                                const TIntVector& theConnectivities,
-                                const TIntVector& theFamilyNums,
-                                const TIntVector& theElemNums,
-                                const TStringVector& theElemNames = TStringVector()) = 0;
-
-    virtual PCellInfo CrCellInfo(const PMeshInfo& theMeshInfo,
-                                const PCellInfo& theInfo) = 0;
-
-    PCellInfo GetPCellInfo(const PMeshInfo& theMeshInfo,
-                          EEntiteMaillage theEntity, 
-                          EGeometrieElement theGeom, 
-                          EConnectivite theConn = eNOD);
-
-
+    virtual
+    void
+    GetPolygoneInfo(TPolygoneInfo& theInfo,
+                   TErr* theErr = NULL) 
+    {}
+
+    virtual
+    void
+    SetPolygoneInfo(const TPolygoneInfo& theInfo,
+                   TErr* theErr = NULL) 
+    {}
+
+    virtual
+    TInt
+    GetNbPolygones(const TMeshInfo& theMeshInfo,
+                  EEntiteMaillage,
+                  EGeometrieElement,
+                  EConnectivite,
+                  TErr* theErr = NULL) 
+    { return 0;}
+
+    virtual
+    TInt
+    GetNbPolygoneConn(const TMeshInfo& theMeshInfo,
+                     EEntiteMaillage,
+                     EGeometrieElement,
+                     EConnectivite,
+                     TErr* theErr = NULL)
+    { return 0;}
+    
+    virtual 
+    PPolygoneInfo
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                  TInt theNbElem,
+                  TInt theNbConn,
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn = eNOD,
+                  EBooleen theIsElemNum = eVRAI,
+                  EBooleen theIsElemNames = eVRAI)
+    {
+      return PPolygoneInfo();
+    }
+    
+    virtual
+    PPolygoneInfo 
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn,
+                  const TIntVector& theConnectivities,
+                  const TIntVector& theFamilyNums,
+                  const TIntVector& theElemNums,
+                  const TStringVector& theElemNames = TStringVector())
+    {
+      return PPolygoneInfo();
+    }
+
+    virtual
+    PPolygoneInfo
+    CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+                  const PPolygoneInfo& theInfo)
+    {
+      return PPolygoneInfo();
+    }
+    
+    PPolygoneInfo
+    GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
+                    EEntiteMaillage theEntity, 
+                    EGeometrieElement theGeom, 
+                    EConnectivite theConn = eNOD);
+    
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual TInt GetNbFields(TErr* theErr = NULL) = 0;
+    virtual 
+    void
+    GetPolyedreInfo(TPolyedreInfo& theInfo,
+                   TErr* theErr = NULL) 
+    {}
+
+    virtual
+    void
+    SetPolyedreInfo(const TPolyedreInfo& theInfo,
+                   TErr* theErr = NULL)
+    {}
     
-    virtual TInt GetNbComp(TInt theFieldId,
-                          TErr* theErr = NULL) = 0;
+    virtual
+    TInt
+    GetNbPolyedres(const TMeshInfo& theMeshInfo,
+                  EEntiteMaillage,
+                  EGeometrieElement,
+                               EConnectivite,
+                  TErr* theErr = NULL)
+    { return 0;}
+
+    virtual 
+    void
+    GetNbPolyedreConnF(const TMeshInfo& theMeshInfo,
+                      EConnectivite theConn,
+                      TInt& nf,
+                      TInt& nc,
+                      TErr* theErr = NULL)
+    {}
     
-    virtual void GetFieldInfo(TInt theFieldId, 
-                             TFieldInfo& theInfo,
-                             TErr* theErr = NULL) = 0;
-
-    virtual void SetFieldInfo(const TFieldInfo& theInfo,
-                             TErr* theErr = NULL) = 0;
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                  TInt theNbElem,
+                  TInt theNbConn,
+                  TInt theNbFaces,
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn = eNOD,
+                  EBooleen theIsElemNum = eVRAI,
+                  EBooleen theIsElemNames = eVRAI)
+    {
+      return PPolyedreInfo();
+    }
+    
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
+                  EEntiteMaillage theTEntity, 
+                  EGeometrieElement theTGeom,
+                  EConnectivite theTConn,
+                  const TIntVector& theConnectivities,
+                  const TIntVector& theFamilyNums,
+                  const TIntVector& theElemNums,
+                  const TStringVector& theElemNames = TStringVector())
+    {
+      return PPolyedreInfo();
+    }
+
+    virtual
+    PPolyedreInfo
+    CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+                  const PPolyedreInfo& theInfo)
+    {
+      return PPolyedreInfo();
+    }
+    
+    PPolyedreInfo
+    GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
+                    EEntiteMaillage theEntity, 
+                    EGeometrieElement theGeom, 
+                    EConnectivite theConn = eNOD);
+    
+    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    virtual
+    TEntityInfo
+    GetEntityInfo(const TMeshInfo& theMeshInfo,
+                 EConnectivite theTConn = eNOD,
+                 TErr* theErr = NULL) = 0;
+    
+    virtual
+    TInt
+    GetNbCells(const TMeshInfo& theMeshInfo, 
+              EEntiteMaillage, 
+              EGeometrieElement, 
+              EConnectivite theTConn = eNOD,
+              TErr* theErr = NULL) = 0;
+    
+    virtual
+    void
+    GetCellInfo(TCellInfo& theInfo,
+               TErr* theErr = NULL) = 0;
+    
+    virtual 
+    void
+    SetCellInfo(const TCellInfo& theInfo,
+               TErr* theErr = NULL) = 0;
+    
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo, 
+              TInt theNbElem,
+              EEntiteMaillage theTEntity, 
+              EGeometrieElement theTGeom,
+              EConnectivite theTConn = eNOD,
+              EBooleen theIsElemNum = eVRAI,
+              EBooleen theIsElemNames = eVRAI) = 0;
+    
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo, 
+              EEntiteMaillage theTEntity, 
+              EGeometrieElement theTGeom,
+              EConnectivite theTConn,
+              const TIntVector& theConnectivities,
+              const TIntVector& theFamilyNums,
+              const TIntVector& theElemNums,
+              const TStringVector& theElemNames = TStringVector()) = 0;
+    
+    virtual
+    PCellInfo
+    CrCellInfo(const PMeshInfo& theMeshInfo,
+              const PCellInfo& theInfo) = 0;
     
+    PCellInfo
+    GetPCellInfo(const PMeshInfo& theMeshInfo,
+                EEntiteMaillage theEntity, 
+                EGeometrieElement theGeom, 
+                EConnectivite theConn = eNOD,
+                TErr* theErr = NULL);
 
-    virtual PFieldInfo CrFieldInfo(const PMeshInfo& theMeshInfo, 
-                                  TInt theNbComp = 0,
-                                  ETypeChamp theType = eFLOAT64,
-                                  const std::string& theValue = "",
-                                  EBooleen theIsLocal = eVRAI,
-                                  TInt theNbRef = 1) = 0;
 
-    virtual PFieldInfo CrFieldInfo(const PMeshInfo& theMeshInfo,
-                                  const PFieldInfo& theInfo) = 0;
+    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    virtual 
+    TInt
+    GetNbFields(TErr* theErr = NULL) = 0;
+    
+    virtual
+    TInt
+    GetNbComp(TInt theFieldId,
+             TErr* theErr = NULL) = 0;
+    
+    virtual 
+    void
+    GetFieldInfo(TInt theFieldId, 
+                TFieldInfo& theInfo,
+                TErr* theErr = NULL) = 0;
+
+    virtual 
+    void
+    SetFieldInfo(const TFieldInfo& theInfo,
+                TErr* theErr = NULL) = 0;
+    
 
-    PFieldInfo GetPFieldInfo(const PMeshInfo& theMeshInfo, TInt theId);
+    virtual 
+    PFieldInfo
+    CrFieldInfo(const PMeshInfo& theMeshInfo, 
+               TInt theNbComp = 0,
+               ETypeChamp theType = eFLOAT64,
+               const std::string& theValue = "",
+               EBooleen theIsLocal = eVRAI,
+               TInt theNbRef = 1) = 0;
+
+    virtual 
+    PFieldInfo
+    CrFieldInfo(const PMeshInfo& theMeshInfo,
+               const PFieldInfo& theInfo) = 0;
+    
+    PFieldInfo
+    GetPFieldInfo(const PMeshInfo& theMeshInfo, 
+                 TInt theId,
+                 TErr* theErr = NULL);
 
 
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual TInt GetNbTimeStamps(const TFieldInfo& theInfo, 
-                                const TEntityInfo& theEntityInfo,
-                                EEntiteMaillage& theEntity,
-                                TGeom& theGeom,
-                                TErr* theErr = NULL) = 0;
-    
-    virtual void GetTimeStampInfo(TInt theTimeStampId, 
-                                 TTimeStampInfo& theInfo,
-                                 TErr* theErr = NULL) = 0;
-
-    virtual PTimeStampInfo CrTimeStampInfo(const PFieldInfo& theFieldInfo, 
-                                          EEntiteMaillage theEntity,
-                                          const TGeom& theGeom,
-                                          TInt theNbGauss = 0,
-                                          TInt theNumDt = 0,
-                                          TInt theNumOrd = 0,
-                                          TFloat theDt = 0,
-                                          const std::string& theUnitDt = "",
-                                          const std::string& theGaussName = "") = 0;
-
-    virtual PTimeStampInfo CrTimeStampInfo(const PFieldInfo& theFieldInfo,
-                                          const PTimeStampInfo& theInfo) = 0;
-
-    PTimeStampInfo GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
-                                    EEntiteMaillage theEntity,
-                                    const MED::TGeom& theGeom,
-                                    TInt theId);
+    virtual 
+    TInt
+    GetNbTimeStamps(const TFieldInfo& theInfo, 
+                   const TEntityInfo& theEntityInfo,
+                   EEntiteMaillage& theEntity,
+                   TGeom& theGeom,
+                   TErr* theErr = NULL) = 0;
+    
+    virtual 
+    void
+    GetTimeStampInfo(TInt theTimeStampId, 
+                    TTimeStampInfo& theInfo,
+                    TErr* theErr = NULL) = 0;
+
+    virtual 
+    PTimeStampInfo
+    CrTimeStampInfo(const PFieldInfo& theFieldInfo, 
+                   EEntiteMaillage theEntity,
+                   const TGeom& theGeom,
+                   TInt theNbGauss = 0,
+                   TInt theNumDt = 0,
+                   TInt theNumOrd = 0,
+                   TFloat theDt = 0,
+                   const std::string& theUnitDt = "",
+                   const std::string& theGaussName = "") = 0;
+
+    virtual 
+    PTimeStampInfo 
+    CrTimeStampInfo(const PFieldInfo& theFieldInfo,
+                   const PTimeStampInfo& theInfo) = 0;
+    
+    PTimeStampInfo
+    GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
+                     EEntiteMaillage theEntity,
+                     const MED::TGeom& theGeom,
+                     TInt theId,
+                     TErr* theErr = NULL);
     
 
     //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    virtual void GetTimeStampVal(TTimeStampVal& theVal,
-                                TErr* theErr = NULL) = 0;
+    virtual 
+    void
+    GetTimeStampVal(TTimeStampVal& theVal,
+                   TErr* theErr = NULL) = 0;
     
-    virtual void SetTimeStamp(const TTimeStampVal& theTimeStampVal,
-                             TErr* theErr = NULL) = 0;
-
-    virtual PTimeStampVal CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
-                                        const std::string& thePflName = "",
-                                        EModeProfil thePflMode = eCOMPACT) = 0;
-
-    virtual PTimeStampVal CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
-                                        const PTimeStampVal& theInfo) = 0;
-
-    PTimeStampVal GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo);
+    virtual 
+    void
+    SetTimeStamp(const TTimeStampVal& theTimeStampVal,
+                TErr* theErr = NULL) = 0;
+    
+    virtual
+    PTimeStampVal
+    CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                  const std::string& thePflName = "",
+                  EModeProfil thePflMode = eCOMPACT) = 0;
+
+    virtual 
+    PTimeStampVal
+    CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                  const PTimeStampVal& theInfo) = 0;
+    
+    PTimeStampVal
+    GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+                    TErr* theErr = NULL);
 
   };
 
index b32b0284ae5e65733e86ca86a9f8f74dd2fb2c67..ae80425cbe6f8ae2d691cfa0f2edeb33c0602ec8 100644 (file)
@@ -46,7 +46,9 @@ EXPORT_HEADERS = \
 # Libraries targets
 
 LIB = libMEDWrapperBase.la
-LIB_SRC = MED_Wrapper.cxx MED_Algorithm.cxx MED_Utilities.cxx
+LIB_SRC = \
+       MED_Structures.cxx MED_Wrapper.cxx \
+       MED_Algorithm.cxx MED_Utilities.cxx
 
 # Executables targets
 BIN = 
index 3bdb2ae72ac56d461e0f65f859f92c3b3d694e91..ba2116894ff4b47d204227fb92afc284b9c0c1db 100644 (file)
@@ -33,8 +33,6 @@
 
 namespace MED{
 
-  enum EVersion {eVUnknown = -1, eV2_1, eV2_2};
-
   EVersion GetVersionId(const std::string& theFileName);
 
   PWrapper CrWrapper(const std::string& theFileName);
index e7c8940909ffe586bb44b6977d5b60855c879cfa..2167c17cb8a6c92327f4dc46dd841f7c635209fa 100644 (file)
@@ -61,11 +61,11 @@ void CheckMed(const std::string& theFileName)
       
       TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
       
-      TCellGroup aCellGroup = GetCellsByEntity(aMed,aMeshInfo,aEntityInfo);
+      TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
       
       TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
       
-      TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aNodeInfo,aCellGroup,aFamilyGroup);
+      TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aNodeInfo,aElemGroup,aFamilyGroup);
       
       TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
       
@@ -166,6 +166,9 @@ void CopyMed(const PWrapper& theMed,
       TInt aNbGroup = aFamilyInfo->GetNbGroup();
       TInt aNbAttr = aFamilyInfo->GetNbAttr();
       TInt anId = aFamilyInfo->GetId();
+      if(anId == 0)
+       continue;
+
       aName = aFamilyInfo->GetName();
       INITMSG(MYDEBUG,"aName = '"<<aName<<"'; anId = "<<anId<<
              "; aNbAttr = "<<aNbAttr<<"; aNbGroup = "<<aNbGroup<<"\n");
@@ -193,17 +196,6 @@ void CopyMed(const PWrapper& theMed,
       INITMSG(MYDEBUG,"anEntity = "<<anEntity<<"\n");
       if(anEntity == eNOEUD){
        PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
-       TInt aNbNodes = aNodeInfo->GetNbElem();
-       INITMSG(MYDEBUG,"GetNodeInfo - aNbNodes = "<<aNbNodes<<": ");
-       TNodeCoord& aCoord = aNodeInfo->myCoord;
-       for(TInt iNode = 0; iNode < aNbNodes; iNode++){
-         for(TInt iDim = 0, anId = iNode*aDim; iDim < aDim; iDim++, anId++){
-           ADDMSG(MYVALUEDEBUG,aCoord[anId]<<",");
-           aCoord[anId] += theIncr;
-         }
-         ADDMSG(MYVALUEDEBUG," ");
-       }
-       ADDMSG(MYDEBUG,endl);
        PNodeInfo aNodeInfo2 = theMed->CrNodeInfo(aMeshInfo2,aNodeInfo);
        if(MYWRITEDEBUG) theMed2->SetNodeInfo(aNodeInfo2);
        continue;
@@ -214,17 +206,63 @@ void CopyMed(const PWrapper& theMed,
        const EGeometrieElement& aGeom = anTGeomIter->first;
        const TInt& aNbElem = anTGeomIter->second;
        INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<": ");
-       PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
-       TInt aConnDim = aCellInfo->GetConnDim();
-       for(TInt iElem = 0; iElem < aNbElem; iElem++){
-         for(TInt iConn = 0; iConn < aConnDim; iConn++){
-           ADDMSG(MYVALUEDEBUG,aCellInfo->GetConn(iElem,iConn)<<",");
+       switch(aGeom){
+       case ePOLYGONE:
+         {
+           PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
+           TElemNum aConn  = aPolygoneInfo->GetConnectivite();
+           TElemNum aIndex = aPolygoneInfo->GetIndex();
+           TInt aNbIndex = aIndex.size();
+           TInt aIndex0 = aIndex[0];
+           for(TInt iElem = 1; iElem < aNbIndex; iElem++){
+             for (TInt i = aIndex0; i < aIndex[iElem];i++)
+               ADDMSG(MYVALUEDEBUG,aConn[i-1]<<",");
+             ADDMSG(MYDEBUG," ");
+             aIndex0 = aIndex[iElem];
+           }
+           ADDMSG(MYDEBUG,endl);
+           INITMSG(MYDEBUG,"Indexes :");
+           for(TInt iElem = 0; iElem < aIndex.size(); iElem++){
+             ADDMSG(MYVALUEDEBUG,aIndex[iElem]<<",");
+           }
+           ADDMSG(MYDEBUG,endl);
+           PPolygoneInfo aPolygoneInfo2 = theMed->CrPolygoneInfo(aMeshInfo2,aPolygoneInfo);
+           if(MYWRITEDEBUG) theMed2->SetPolygoneInfo(aPolygoneInfo2);
+           break;
+         }
+       case ePOLYEDRE:
+         {
+           PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
+           TElemNum aConn        = aPolyedreInfo->GetConnectivite();
+           TElemNum aFacesIndex  = aPolyedreInfo->GetFacesIndex();
+           TElemNum aIndex       = aPolyedreInfo->GetIndex();
+           
+           TInt aNbIndex      = aIndex.size();
+           
+           for (int aNp = 0; aNp < aNbIndex-1;aNp++){
+             if (aPolyedreInfo->IsElemNames())
+               ADDMSG(MYDEBUG,aPolyedreInfo->GetElemName(aNp)<<endl);
+             else 
+               ADDMSG(MYDEBUG,"POLYEDRE "<<aNp+1<<endl);
+
+             for (int aNf = aIndex[aNp]-1;aNf < aIndex[aNp+1]-1;aNf++){
+               ADDMSG(MYDEBUG,"Face "<<aNf-aIndex[aNp]+2<<": [");
+               for (int aNc = aFacesIndex[aNf]-1; aNc < aFacesIndex[aNf+1]-1;aNc++){
+                 ADDMSG(MYDEBUG," "<<aConn[aNc]);
+               }
+               ADDMSG(MYDEBUG," ]"<<endl;);
+             }
+           }
+
+           PPolyedreInfo aPolyedreInfo2 = theMed->CrPolyedreInfo(aMeshInfo2,aPolyedreInfo);
+           if(MYWRITEDEBUG) theMed2->SetPolyedreInfo(aPolyedreInfo2);
+           break;
          }
-         ADDMSG(MYVALUEDEBUG," ");
+       default:
+         PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
+         PCellInfo aCellInfo2 = theMed2->CrCellInfo(aMeshInfo2,aCellInfo);
+         if(MYWRITEDEBUG) theMed2->SetCellInfo(aCellInfo2);
        }
-       ADDMSG(MYDEBUG,endl);
-       PCellInfo aCellInfo2 = theMed->CrCellInfo(aMeshInfo2,aCellInfo);
-       if(MYWRITEDEBUG) theMed2->SetCellInfo(aCellInfo2);
       }
     }
     
@@ -238,7 +276,7 @@ void CopyMed(const std::string& theFileName,
             MED::EVersion theVersion,
             int theNbCopy)
 {
-  MSG(MYDEBUG,"CopyMed - theFileName = '"<<theFileName<<"'; theFileName2 = '"<<theFileName2<<"'");
+  MSG(MYDEBUG,"CopyMed - theFileName = '"<<theFileName<<"'; theFileName2 = '"<<theFileName2<<"', theVersion = "<<theVersion);
 
   PWrapper aMed = CrWrapper(theFileName);
 
@@ -251,7 +289,7 @@ void CopyMed(const std::string& theFileName,
 
 void ReadMed(const char* theFileName, 
             const char* theFileName2,
-            MED::EVersion theVersion = eV2_1,
+            MED::EVersion theVersion = eV2_2,
             int theNbCopy = 1)
 {
   MSG(MYDEBUG,"theFileName = '"<<theFileName<<"'; "<<
@@ -277,7 +315,7 @@ int main(int argc, char** argv){
   }catch(std::exception& exc){
     MSG(MYDEBUG,"Follow exception was accured :\n"<<exc.what());
   }catch(...){
-    MSG(MYDEBUG,"Unknown exception was accured in VISU_Convertor_impl");
+    MSG(MYDEBUG,"Unknown exception was accured");
   } 
   return 1;
 }
index 1fb3531d5e793b94d20fa6ed9f5e4a3f9816c0bb..2b1b97d4fb18607110221c044adb48714d695248 100644 (file)
@@ -49,6 +49,8 @@ BIN_SRC =
 
 CPPFLAGS+= $(BOOST_CPPFLAGS) $(MED2_INCLUDES)
 
-LDFLAGS+= -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase
+LDFLAGS+= -lMEDWrapper_V2_2 -lMEDWrapper_V2_1
+
+LDFLAGSFORBIN=$(LDFLAGS) -lMEDWrapperBase
 
 @CONCLUDE@
index fafc8671ad765deaa115e6f3917cad245abbd621..a406c0d4b4952f9d511a92904463eccc313df1d7 100644 (file)
@@ -308,6 +308,8 @@ namespace MED{
     TInt TVWrapper::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
                              TErr* theErr)
     {
+      MSG(MYDEBUG,"TVWrapper::GetNbNodes");
+      INITMSG(MYDEBUG,"GetNbNodes ... ");
       TFileWrapper aFileWrapper(myFile,eLECT,theErr);
       
       if(theErr && *theErr < 0)
@@ -315,21 +317,26 @@ namespace MED{
       
       MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
       
-      return MEDnEntMaa(myFile->Id(),
-                       &aMeshInfo.myName[0],
-                       MED_COOR,
-                       MED_NOEUD,
-                       med_geometrie_element(0),
-                       med_connectivite(0));
+      TInt aRet = MEDnEntMaa(myFile->Id(),
+                            &aMeshInfo.myName[0],
+                            MED_COOR,
+                            MED_NOEUD,
+                            med_geometrie_element(0),
+                            med_connectivite(0));
+      
+      ADDMSG(MYDEBUG," nbnodes="<<aRet<<" ... OK"<<endl);
+      return aRet;
     }
     
     
     void TVWrapper::GetNodeInfo(MED::TNodeInfo& theInfo,
                               TErr* theErr)
     {
+      MSG(MYDEBUG,"TVWrapper::GetNodeInfo");
+      INITMSG(MYDEBUG,"GetNodeInfo ... ");
       TFileWrapper aFileWrapper(myFile,eLECT,theErr);
       
-      if(theErr && *theErr < 0)
+      if(theErr && *theErr < 0 || theInfo.myNbElem<=0)
        return;
       
       MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
@@ -352,10 +359,13 @@ namespace MED{
                                &anIsElemNum,
                                &theInfo.myFamNum[0],
                                theInfo.myNbElem);
+
+      ADDMSG(MYDEBUG," myDim="<<aMeshInfo.myDim<<" myNbElem="<<theInfo.myNbElem<<" ... ");
       if(theErr) 
        *theErr = aRet;
       else if(aRet < 0)
        EXCEPTION(runtime_error,"GetNodeInfo - MEDnoeudsLire(...)");
+      ADDMSG(MYDEBUG,"OK"<<endl);
     }
     
     
@@ -419,7 +429,8 @@ namespace MED{
       if(theErr && *theErr < 0)
        return anInfo;
       
-      if(TInt aNbElem = GetNbNodes(theMeshInfo)){
+      TInt aNbElem = GetNbNodes(theMeshInfo);
+      if(aNbElem > 0){
        anInfo[eNOEUD][ePOINT1] = aNbElem;
        const TEntity2GeomSet& anEntity2GeomSet = GetEntity2GeomSet();
        TEntity2GeomSet::const_iterator anIter = anEntity2GeomSet.begin();
@@ -431,9 +442,9 @@ namespace MED{
          TGeomSet::const_iterator anIterEnd2 = aGeomSet.end();
          for(; anIter2 != anIterEnd2; anIter2++){
            const EGeometrieElement& aGeom = *anIter2;
-           if(TInt aNb = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr)){
-             anInfo[anEntity][aGeom] = aNb;
-           }
+           aNbElem = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr);
+           if(aNbElem > 0)
+             anInfo[anEntity][aGeom] = aNbElem;
          }
        }
       }
@@ -454,9 +465,9 @@ namespace MED{
       
       MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
       
-      med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
-      med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
-      med_connectivite& aConn = static_cast<med_connectivite>(theTConn);
+      med_entite_maillage anEntity = med_entite_maillage(theTEntity);
+      med_geometrie_element aGeom = med_geometrie_element(theTGeom);
+      med_connectivite aConn = med_connectivite(theTConn);
 
       return MEDnEntMaa(myFile->Id(),
                        &aMeshInfo.myName[0],
index 7314d386bcc261ecdbb377f0de518e7b3cf6efa3..0b903b74e42f34058a318b61fedee30037238601 100644 (file)
@@ -36,19 +36,19 @@ namespace MED{
 
     const TInt PNOM = 8;
 
-    typedef MED::TTMeshInfo<PNOM,DESC,IDENT,NOM,LNOM> TVMeshInfo;
+    typedef MED::TTMeshInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVMeshInfo;
 
-    typedef MED::TTFamilyInfo<PNOM,DESC,IDENT,NOM,LNOM> TVFamilyInfo;
+    typedef MED::TTFamilyInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVFamilyInfo;
 
-    typedef MED::TTNodeInfo<PNOM,DESC,IDENT,NOM,LNOM> TVNodeInfo;
+    typedef MED::TTNodeInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVNodeInfo;
 
-    typedef MED::TTCellInfo<PNOM,DESC,IDENT,NOM,LNOM> TVCellInfo;
+    typedef MED::TTCellInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVCellInfo;
 
-    typedef MED::TTFieldInfo<PNOM,DESC,IDENT,NOM,LNOM> TVFieldInfo;
+    typedef MED::TTFieldInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVFieldInfo;
 
-    typedef MED::TTTimeStampInfo<PNOM,DESC,IDENT,NOM,LNOM> TVTimeStampInfo;
+    typedef MED::TTTimeStampInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVTimeStampInfo;
 
-    typedef MED::TTTimeStampVal<PNOM,DESC,IDENT,NOM,LNOM> TVTimeStampVal;
+    typedef MED::TTTimeStampVal<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVTimeStampVal;
 
     //---------------------------------------------------------------
     class TFile;
@@ -57,7 +57,8 @@ namespace MED{
     typedef enum {eLECT, eECRI, eREMP} EModeAcces; 
 
     //---------------------------------------------------------------
-    class TVWrapper: public MED::TTWrapper<PNOM,DESC,IDENT,NOM,LNOM>{
+    class TVWrapper: public MED::TTWrapper<PNOM,DESC,IDENT,NOM,LNOM,eV2_1>
+    {
       TVWrapper();
       TVWrapper(const TVWrapper&);
       TVWrapper& operator=(const TVWrapper&);
index 32939397b042d50418daf6d57055967a4574bfd9..1cadac2ba71075d0efb69d0389c23e6ecf428499 100644 (file)
@@ -163,4 +163,6 @@ CPPFLAGS+= $(BOOST_CPPFLAGS) $(HDF5_INCLUDES) -DPCLINUX
 
 LDFLAGS+= $(HDF5_LIBS) -lMEDWrapperBase
 
+LDFLAGSFORBIN=$(LDFLAGS)
+
 @CONCLUDE@
index 2405e774379894488c891583ab4992bbfed75968..60d40d48ee5e7689ed081f2cee612faf05419ae4 100644 (file)
@@ -424,6 +424,293 @@ namespace MED{
        SetNodeInfo(theInfo,eLECTURE_AJOUT,theErr);
     }
     
+    void TVWrapper::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
+                                   TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && !*theErr)
+       return;
+
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+      TInt aNbElem = theInfo.myElemNum.size();
+
+      med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
+      med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
+      
+      TErr aRet = 0;
+      
+      aRet = MEDpolygoneConnLire(myFile->Id(), 
+                                &aMeshInfo.myName[0],
+                                &theInfo.myIndex[0],
+                                aNbElem+1,
+                                &theInfo.myConn[0],
+                                anEntity,
+                                aConn);
+
+      if(theErr) 
+       *theErr = aRet;
+      else if(aRet < 0)
+       EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolygoneInfo(...)");
+    }
+    
+    void TVWrapper::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+                                   TErr* theErr)
+    {
+      SetPolygoneInfo(theInfo,eLECTURE_ECRITURE,theErr);
+    }
+    
+    void TVWrapper::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+                                   EModeAcces theMode,
+                                   TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && !*theErr)
+       return;
+
+      MED::TPolygoneInfo& anInfo = const_cast<MED::TPolygoneInfo&>(theInfo);
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+      med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
+      med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
+      med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
+      med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
+      
+      TErr aRet = MEDpolygoneConnEcr(myFile->Id(),
+                                    &aMeshInfo.myName[0],
+                                    &anInfo.myIndex[0],
+                                    anInfo.myNbElem+1,
+                                    &anInfo.myConn[0],
+                                    anEntity,
+                                    aConn);
+      
+      if(theErr) 
+       *theErr = aRet;
+      else if(aRet < 0)
+       EXCEPTION(runtime_error,"SetPolygoneInfo - MEDpolygoneConnEcr(...)");
+      
+      if (anIsElemNames){
+       aRet  = MEDnomEcr(myFile->Id(),
+                         &aMeshInfo.myName[0],
+                         &anInfo.myElemNames[0],
+                         anInfo.myElemNames.size(),
+                         anEntity,
+                         MED_POLYGONE);
+       if(theErr) 
+         *theErr = aRet;
+       else if(aRet < 0)
+         EXCEPTION(runtime_error,"SetPolygoneInfo - MEDnomEcr(...)");
+      }
+      
+      if (anIsElemNum){
+       aRet  = MEDnumEcr(myFile->Id(),
+                         &aMeshInfo.myName[0],
+                         &anInfo.myElemNum[0],
+                         anInfo.myElemNum.size(),
+                         anEntity,
+                         MED_POLYGONE);
+       if(theErr) 
+         *theErr = aRet;
+       else if(aRet < 0)
+         EXCEPTION(runtime_error,"SetPolygoneInfo - MEDnumEcr(...)");
+      }
+      
+      aRet = MEDfamEcr(myFile->Id(),
+                      &aMeshInfo.myName[0],
+                      &anInfo.myFamNum[0],
+                      anInfo.myFamNum.size(),
+                      anEntity,
+                      MED_POLYGONE);
+      
+      if(theErr) 
+       *theErr = aRet;
+      else if(aRet < 0)
+       EXCEPTION(runtime_error,"SetPolygoneInfo - MEDfamEcr(...)");
+    }
+
+    TInt TVWrapper::GetNbPolygones(const MED::TMeshInfo& theMeshInfo, 
+                                  EEntiteMaillage theTEntity, 
+                                  EGeometrieElement theTGeom, 
+                                  EConnectivite theTConn,
+                                  TErr* theErr)
+    {
+      return GetNbCells(theMeshInfo,theTEntity,theTGeom,theTConn,theErr);
+    }
+    
+    TInt TVWrapper::GetNbPolygoneConn(const MED::TMeshInfo& theMeshInfo, 
+                                     EEntiteMaillage theTEntity, 
+                                     EGeometrieElement theTGeom, 
+                                     EConnectivite theTConn,
+                                     TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && !*theErr)
+       return 0;
+
+      MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+      
+      med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
+      med_connectivite& aConn = static_cast<med_connectivite>(theTConn);
+
+      med_int taille = 0;
+
+      TErr aRet = MEDpolygoneInfo(myFile->Id(), 
+                                 &aMeshInfo.myName[0], 
+                                 anEntity, 
+                                 aConn,
+                                 &taille);
+      
+      if(theErr) 
+       *theErr = aRet;
+      else if(aRet < 0)
+       EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolygoneInfo(...)");
+
+      return TInt(taille);
+    }
+
+    void TVWrapper::GetPolyedreInfo(TPolyedreInfo& theInfo,
+                                   TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && !*theErr)
+       return;
+
+      MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+      TInt aNbElem = theInfo.myElemNum.size();
+
+      med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
+      
+      TErr aRet = 0;
+      
+      aRet = MEDpolyedreConnLire(myFile->Id(), 
+                                &aMeshInfo.myName[0],
+                                &theInfo.myIndex[0],
+                                aNbElem+1,
+                                &theInfo.myFacesIndex[0],
+                                theInfo.myNbFacesIndex,
+                                &theInfo.myConn[0],
+                                aConn);
+
+      if(theErr) 
+       *theErr = aRet;
+      else if(aRet < 0)
+       EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolyedreConnLire(...)");
+    }
+
+    void TVWrapper::SetPolyedreInfo(const TPolyedreInfo& theInfo,
+                                   TErr* theErr)
+    {
+      SetPolyedreInfo(theInfo,eLECTURE_ECRITURE,theErr);
+    }
+    
+    void TVWrapper::SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
+                                   EModeAcces theMode,
+                                   TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,theMode,theErr);
+      
+      if(theErr && !*theErr)
+       return;
+
+      MED::TPolyedreInfo& anInfo = const_cast<MED::TPolyedreInfo&>(theInfo);
+      MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+      med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
+      med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
+      med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
+      med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
+      
+      TErr aRet = MEDpolyedreConnEcr(myFile->Id(),
+                                    &aMeshInfo.myName[0],
+                                    &anInfo.myIndex[0],
+                                    anInfo.myNbElem+1,
+                                    &anInfo.myFacesIndex[0],
+                                    anInfo.myNbFacesIndex,
+                                    &anInfo.myConn[0],
+                                    aConn);
+      
+      if(theErr) 
+       *theErr = aRet;
+      else if(aRet < 0)
+       EXCEPTION(runtime_error,"SetPolyedreInfo - MEDpolyedreConnEcr(...)");
+      
+      if (anIsElemNames){
+       aRet  = MEDnomEcr(myFile->Id(),
+                         &aMeshInfo.myName[0],
+                         &anInfo.myElemNames[0],
+                         anInfo.myElemNames.size(),
+                         anEntity,
+                         MED_POLYEDRE);
+       if(theErr) 
+         *theErr = aRet;
+       else if(aRet < 0)
+         EXCEPTION(runtime_error,"SetPolyedreInfo - MEDnomEcr(...)");
+      }
+      
+      if (anIsElemNum){
+       aRet  = MEDnumEcr(myFile->Id(),
+                         &aMeshInfo.myName[0],
+                         &anInfo.myElemNum[0],
+                         anInfo.myElemNum.size(),
+                         anEntity,
+                         MED_POLYEDRE);
+       if(theErr) 
+         *theErr = aRet;
+       else if(aRet < 0)
+         EXCEPTION(runtime_error,"SetPolyedreInfo - MEDnumEcr(...)");
+      }
+      
+      
+      aRet = MEDfamEcr(myFile->Id(),
+                      &aMeshInfo.myName[0],
+                      &anInfo.myFamNum[0],
+                      anInfo.myFamNum.size(),
+                      anEntity,
+                      MED_POLYEDRE);
+      
+      if(theErr) 
+       *theErr = aRet;
+      else if(aRet < 0)
+       EXCEPTION(runtime_error,"SetPolyedreInfo - MEDfamEcr(...)");
+    }
+
+    TInt TVWrapper::GetNbPolyedres(const MED::TMeshInfo& theMeshInfo, 
+                                  EEntiteMaillage theTEntity, 
+                                  EGeometrieElement theTGeom, 
+                                  EConnectivite theTConn,
+                                  TErr* theErr)
+    {
+      return GetNbCells(theMeshInfo,theTEntity,theTGeom,theTConn,theErr);
+    }
+
+    void TVWrapper::GetNbPolyedreConnF(const MED::TMeshInfo& theMeshInfo, 
+                                      EConnectivite theTConn,
+                                      TInt& nf,
+                                      TInt& nc,
+                                      TErr* theErr)
+    {
+      TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+      if(theErr && !*theErr) EXCEPTION(runtime_error,"GetPolyedreInfo - (...)");
+
+      MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+      med_connectivite& aConn = static_cast<med_connectivite>(theTConn);
+      
+      TErr aRet = MEDpolyedreInfo(myFile->Id(), 
+                                 &aMeshInfo.myName[0], 
+                                 aConn,
+                                 &nf,
+                                 &nc);
+
+      if(theErr) 
+       *theErr = aRet;
+      else if(aRet < 0)
+       EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolyedreInfo(...)");
+
+    }
     
     TEntityInfo TVWrapper::GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
                                        EConnectivite theTConn,
@@ -433,10 +720,11 @@ namespace MED{
       
       TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
       
-      if(theErr && !*theErr)
+      if(theErr && *theErr < 0)
        return anInfo;
       
-      if(TInt aNbElem = GetNbNodes(theMeshInfo)){
+      TInt aNbElem = GetNbNodes(theMeshInfo);
+      if(aNbElem > 0){
        anInfo[eNOEUD][ePOINT1] = aNbElem;
        const TEntity2GeomSet& anEntity2GeomSet = GetEntity2GeomSet();
        TEntity2GeomSet::const_iterator anIter = anEntity2GeomSet.begin();
@@ -448,9 +736,9 @@ namespace MED{
          TGeomSet::const_iterator anIterEnd2 = aGeomSet.end();
          for(; anIter2 != anIterEnd2; anIter2++){
            const EGeometrieElement& aGeom = *anIter2;
-           if(TInt aNb = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr)){
-             anInfo[anEntity][aGeom] = aNb;
-           }
+           aNbElem = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr);
+           if(aNbElem > 0)
+             anInfo[anEntity][aGeom] = aNbElem;
          }
        }
       }
@@ -471,9 +759,9 @@ namespace MED{
       
       MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
       
-      med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
-      med_geometrie_element& aGeom = static_cast<med_geometrie_element>(theTGeom);
-      med_connectivite& aConn = static_cast<med_connectivite>(theTConn);
+      med_entite_maillage anEntity = med_entite_maillage(theTEntity);
+      med_geometrie_element aGeom = med_geometrie_element(theTGeom);
+      med_connectivite aConn = med_connectivite(theTConn);
 
       return MEDnEntMaa(myFile->Id(),
                        &aMeshInfo.myName[0],
@@ -485,7 +773,7 @@ namespace MED{
     
     
     void TVWrapper::GetCellInfo(MED::TCellInfo& theInfo,
-                              TErr* theErr)
+                               TErr* theErr)
     {
       TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
 
@@ -558,7 +846,7 @@ namespace MED{
       if(theErr) 
        *theErr = aRet;
       else if(aRet < 0)
-       EXCEPTION(runtime_error,"GetCellInfo - MEDelementsLire(...)");
+       EXCEPTION(runtime_error,"SetCellInfo - MEDelementsLire(...)");
     }
     
 
@@ -681,13 +969,15 @@ namespace MED{
        TGeom::const_iterator anGeomIter = aTGeom.begin();
        for(; anGeomIter != aTGeom.end(); anGeomIter++){
          const med_geometrie_element& aGeom = static_cast<const med_geometrie_element>(anGeomIter->first);
-         aNbTimeStamps = MEDnPasdetemps(myFile->Id(),&anInfo.myName[0],anEntity,aGeom);
-         if(aNbTimeStamps){
+         TInt aTmp = MEDnPasdetemps(myFile->Id(),&anInfo.myName[0],anEntity,aGeom);
+         aNbTimeStamps = max(aTmp,aNbTimeStamps);
+         BEGMSG(MYDEBUG,"GetNbTimeStamps aNbTimeStamps="<<aTmp<<"; aGeom="<<aGeom<<"; anEntity="<<anEntity<<"\n");
+         if(aTmp){
            theEntity = EEntiteMaillage(anEntity);
            theGeom[EGeometrieElement(aGeom)] = anGeomIter->second;
          }
        }
-       if(aNbTimeStamps
+       if(!theGeom.empty()
          break;
       }
       return aNbTimeStamps;
@@ -810,8 +1100,10 @@ namespace MED{
                              aTimeStampInfo.myNumDt,
                              aTimeStampInfo.myNumOrd);
          if(aRet >= 0) 
-           for(TInt i = 0; i < iEnd; i++) 
+           for(TInt i = 0; i < iEnd; i++) {
              aValue[i] = anArray[i];
+             MSG(MYDEBUG," "<<anArray[i]);
+           }
          break;
        }
        default: {
index 0d60ca7e5082adadc839d2e3c1a59e04ae784d8c..6adcab87c2ad9e9c5f3f8ab48c212224367fd35d 100644 (file)
@@ -37,19 +37,19 @@ namespace MED{
 
     const TInt PNOM = 16;
 
-    typedef MED::TTMeshInfo<PNOM,DESC,IDENT,NOM,LNOM> TVMeshInfo;
+    typedef MED::TTMeshInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVMeshInfo;
 
-    typedef MED::TTFamilyInfo<PNOM,DESC,IDENT,NOM,LNOM> TVFamilyInfo;
+    typedef MED::TTFamilyInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVFamilyInfo;
 
-    typedef MED::TTNodeInfo<PNOM,DESC,IDENT,NOM,LNOM> TVNodeInfo;
+    typedef MED::TTNodeInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVNodeInfo;
 
-    typedef MED::TTCellInfo<PNOM,DESC,IDENT,NOM,LNOM> TVCellInfo;
+    typedef MED::TTCellInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVCellInfo;
 
-    typedef MED::TTFieldInfo<PNOM,DESC,IDENT,NOM,LNOM> TVFieldInfo;
+    typedef MED::TTFieldInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVFieldInfo;
 
-    typedef MED::TTTimeStampInfo<PNOM,DESC,IDENT,NOM,LNOM> TVTimeStampInfo;
+    typedef MED::TTTimeStampInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVTimeStampInfo;
 
-    typedef MED::TTTimeStampVal<PNOM,DESC,IDENT,NOM,LNOM> TVTimeStampVal;
+    typedef MED::TTTimeStampVal<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVTimeStampVal;
 
     //---------------------------------------------------------------
     class TFile;
@@ -58,7 +58,7 @@ namespace MED{
     typedef enum {eLECTURE, eLECTURE_ECRITURE, eLECTURE_AJOUT, eCREATION} EModeAcces; 
 
     //---------------------------------------------------------------
-    class TVWrapper: public MED::TTWrapper<PNOM,DESC,IDENT,NOM,LNOM>{
+    class TVWrapper: public MED::TTWrapper<PNOM,DESC,IDENT,NOM,LNOM,eV2_2>{
       TVWrapper();
       TVWrapper(const TVWrapper&);
       TVWrapper& operator=(const TVWrapper&);
@@ -67,119 +67,233 @@ namespace MED{
       TVWrapper(const std::string& theFileName);
 
       //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-      virtual TInt GetNbMeshes(TErr* theErr = NULL);
+      virtual 
+      TInt
+      GetNbMeshes(TErr* theErr = NULL);
       
-      virtual void GetMeshInfo(TInt theMeshId, MED::TMeshInfo&,
+      virtual
+      void
+      GetMeshInfo(TInt theMeshId, MED::TMeshInfo&,
                               TErr* theErr = NULL);
 
-      virtual void SetMeshInfo(const MED::TMeshInfo& theInfo,
-                              TErr* theErr = NULL);
+      virtual
+      void
+      SetMeshInfo(const MED::TMeshInfo& theInfo,
+                 TErr* theErr = NULL);
       
       void SetMeshInfo(const MED::TMeshInfo& theInfo,
                       EModeAcces theMode,
                       TErr* theErr = NULL);
-
+      
       
       //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-      virtual TInt GetNbFamilies(const MED::TMeshInfo& theMeshInfo,
-                                TErr* theErr = NULL);
+      virtual
+      TInt
+      GetNbFamilies(const MED::TMeshInfo& theMeshInfo,
+                   TErr* theErr = NULL);
 
-      virtual TInt GetNbFamAttr(TInt theFamId, 
-                               const MED::TMeshInfo& theInfo,
-                               TErr* theErr = NULL);
-
-      virtual TInt GetNbFamGroup(TInt theFamId, 
-                                const MED::TMeshInfo& theInfo,
-                                TErr* theErr = NULL);
+      virtual 
+      TInt
+      GetNbFamAttr(TInt theFamId, 
+                  const MED::TMeshInfo& theInfo,
+                  TErr* theErr = NULL);
       
-      virtual void GetFamilyInfo(TInt theFamId, 
-                                MED::TFamilyInfo& theInfo,
-                                TErr* theErr = NULL);
-
-      virtual void SetFamilyInfo(const MED::TFamilyInfo& theInfo,
-                                TErr* theErr = NULL);
+      virtual
+      TInt
+      GetNbFamGroup(TInt theFamId, 
+                   const MED::TMeshInfo& theInfo,
+                   TErr* theErr = NULL);
+      
+      virtual
+      void
+      GetFamilyInfo(TInt theFamId, 
+                   MED::TFamilyInfo& theInfo,
+                   TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+                   TErr* theErr = NULL);
+      
+      void 
+      SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+                   EModeAcces theMode,
+                   TErr* theErr = NULL);
       
-      void SetFamilyInfo(const MED::TFamilyInfo& theInfo,
-                        EModeAcces theMode,
-                        TErr* theErr = NULL);
-
       
       //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-      virtual TInt GetNbNodes(const MED::TMeshInfo& theMeshInfo,
-                             TErr* theErr = NULL);
+      virtual
+      TInt
+      GetNbNodes(const MED::TMeshInfo& theMeshInfo,
+                TErr* theErr = NULL);
       
-      virtual void GetNodeInfo(MED::TNodeInfo& theInfo,
-                              TErr* theErr = NULL);
+      virtual 
+      void
+      GetNodeInfo(MED::TNodeInfo& theInfo,
+                 TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetNodeInfo(const MED::TNodeInfo& theInfo,
+                 TErr* theErr = NULL);
+      
+      void
+      SetNodeInfo(const MED::TNodeInfo& theInfo,
+                 EModeAcces theMode,
+                 TErr* theErr = NULL);
+      
+      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+      virtual
+      void
+      GetPolygoneInfo(TPolygoneInfo& theInfo,
+                     TErr* theErr = NULL);
 
-      virtual void SetNodeInfo(const MED::TNodeInfo& theInfo,
-                              TErr* theErr = NULL);
+      virtual 
+      void
+      SetPolygoneInfo(const TPolygoneInfo& theInfo,
+                                  TErr* theErr = NULL);
       
-      void SetNodeInfo(const MED::TNodeInfo& theInfo,
-                      EModeAcces theMode,
-                      TErr* theErr = NULL);
+      void
+      SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+                     EModeAcces theMode,
+                     TErr* theErr = NULL);
 
+      virtual 
+      TInt
+      GetNbPolygones(const TMeshInfo& theMeshInfo,
+                    EEntiteMaillage,
+                    EGeometrieElement,
+                    EConnectivite,
+                    TErr* theErr = NULL);
       
+      virtual 
+      TInt
+      GetNbPolygoneConn(const TMeshInfo& theMeshInfo,
+                       EEntiteMaillage,
+                       EGeometrieElement,
+                       EConnectivite,
+                       TErr* theErr = NULL);
+
       //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-      virtual TEntityInfo GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
-                                       EConnectivite theTConn = eNOD,
-                                       TErr* theErr = NULL);
+      virtual 
+      void
+      GetPolyedreInfo(TPolyedreInfo& theInfo,
+                     TErr* theErr = NULL);
       
-      virtual TInt GetNbCells(const MED::TMeshInfo& theMeshInfo, 
-                             EEntiteMaillage, 
-                             EGeometrieElement, 
-                             EConnectivite theTConn = eNOD,
-                             TErr* theErr = NULL);
+      virtual
+      void
+      SetPolyedreInfo(const TPolyedreInfo& theInfo,
+                     TErr* theErr = NULL);
       
-      virtual void GetCellInfo(MED::TCellInfo& theInfo,
-                              TErr* theErr = NULL);
-
-      virtual void SetCellInfo(const MED::TCellInfo& theInfo,
-                              TErr* theErr = NULL);
+      void
+      SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
+                     EModeAcces theMode,
+                     TErr* theErr = NULL);
       
-      void SetCellInfo(const MED::TCellInfo& theInfo,
-                      EModeAcces theMode,
-                      TErr* theErr = NULL);
-
+      virtual
+      TInt
+      GetNbPolyedres(const TMeshInfo& theMeshInfo,
+                    EEntiteMaillage,
+                    EGeometrieElement,
+                    EConnectivite,
+                    TErr* theErr = NULL);
+      
+      virtual 
+      void
+      GetNbPolyedreConnF(const TMeshInfo& theMeshInfo,
+                        EConnectivite,
+                        TInt& nf,
+                        TInt& nc,
+                        TErr* theErr = NULL);
       
       //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-      virtual TInt GetNbFields(TErr* theErr = NULL);
+      virtual
+      TEntityInfo
+      GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
+                   EConnectivite theTConn = eNOD,
+                   TErr* theErr = NULL);
       
-      virtual TInt GetNbComp(TInt theFieldId,
-                            TErr* theErr = NULL);
+      virtual 
+      TInt
+      GetNbCells(const MED::TMeshInfo& theMeshInfo, 
+                EEntiteMaillage, 
+                EGeometrieElement, 
+                EConnectivite theTConn = eNOD,
+                TErr* theErr = NULL);
       
-      virtual void GetFieldInfo(TInt theFieldId, 
-                               MED::TFieldInfo& theInfo,
-                               TErr* theErr = NULL);
+      virtual
+      void
+      GetCellInfo(MED::TCellInfo& theInfo,
+                 TErr* theErr = NULL);
 
-      virtual void SetFieldInfo(const MED::TFieldInfo& theInfo,
-                               TErr* theErr = NULL);
+      virtual 
+      void
+      SetCellInfo(const MED::TCellInfo& theInfo,
+                 TErr* theErr = NULL);
+      
+      void 
+      SetCellInfo(const MED::TCellInfo& theInfo,
+                 EModeAcces theMode,
+                 TErr* theErr = NULL);
       
-      void SetFieldInfo(const MED::TFieldInfo& theInfo,
-                       EModeAcces theMode,
-                       TErr* theErr = NULL);
-
       
       //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-      virtual TInt GetNbTimeStamps(const MED::TFieldInfo& theInfo, 
-                                  const MED::TEntityInfo& theEntityInfo,
-                                  EEntiteMaillage& theEntity,
-                                  TGeom& theGeom,
-                                  TErr* theErr = NULL);
+      virtual
+      TInt
+      GetNbFields(TErr* theErr = NULL);
       
-      virtual void GetTimeStampInfo(TInt theTimeStampId, 
-                                   MED::TTimeStampInfo& theInfo,
-                                   TErr* theErr = NULL);
-
-      virtual void GetTimeStampVal(MED::TTimeStampVal& theVal,
-                                  TErr* theErr = NULL);
+      virtual
+      TInt
+      GetNbComp(TInt theFieldId,
+               TErr* theErr = NULL);
       
-      virtual void SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
-                               TErr* theErr = NULL);
+      virtual 
+      void
+      GetFieldInfo(TInt theFieldId, 
+                  MED::TFieldInfo& theInfo,
+                  TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetFieldInfo(const MED::TFieldInfo& theInfo,
+                  TErr* theErr = NULL);
+      
+      void
+      SetFieldInfo(const MED::TFieldInfo& theInfo,
+                  EModeAcces theMode,
+                  TErr* theErr = NULL);
+      
+      
+      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+      virtual 
+      TInt
+      GetNbTimeStamps(const MED::TFieldInfo& theInfo, 
+                     const MED::TEntityInfo& theEntityInfo,
+                     EEntiteMaillage& theEntity,
+                     TGeom& theGeom,
+                     TErr* theErr = NULL);
+      
+      virtual 
+      void
+      GetTimeStampInfo(TInt theTimeStampId, 
+                      MED::TTimeStampInfo& theInfo,
+                      TErr* theErr = NULL);
+      
+      virtual
+      void
+      GetTimeStampVal(MED::TTimeStampVal& theVal,
+                     TErr* theErr = NULL);
+      
+      virtual
+      void
+      SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
+                  TErr* theErr = NULL);
+      
+      void 
+      SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
+                  EModeAcces theMode,
+                  TErr* theErr = NULL);
       
-      void SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
-                       EModeAcces theMode,
-                       TErr* theErr = NULL);
-
     protected:
       PFile myFile;
     };
index ad729c45ae07eaf880699114ef8356a2c294fb27..73e9ffaa0e3b01ce610d1aa9c7091d7dcb4de996 100644 (file)
@@ -40,7 +40,7 @@ Engines_MPIContainer_i::Engines_MPIContainer_i(int nbproc, int numproc,
                                               PortableServer::POA_ptr poa,
                                               char * containerName,
                                               int argc, char *argv[]) 
-  : Engines_Container_i(orb,poa,containerName,argc,argv,false,false), MPIObject_i(nbproc,numproc)
+  : Engines_Container_i(orb,poa,containerName,argc,argv,false), MPIObject_i(nbproc,numproc)
 {
   MESSAGE("[" << numproc << "] activate object");
   _id = _poa->activate_object(this);
index 0cf36702e8734758f69a81d3703f054b18b00e66..a77f47893ca5f5e97e679ebe12db4b5fa85de7c8 100644 (file)
@@ -38,5 +38,6 @@ BIN_SRC       =
 CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES)
 LDFLAGS+=$(QT_MT_LIBS) $(OGL_LIBS)
 
+LDFLAGSFORBIN=$(LDFLAGS)
 
 @CONCLUDE@
index 2cca687dfd4ca6c38461accb701289637563b96f..91f81257ec63339db11971c4acbd0f143201a9b8 100644 (file)
@@ -36,7 +36,7 @@ ifeq (@WITHIHM@,yes)
 SUBDIRS = MSG2QM SALOMELocalTrace SALOMETraceCollector Logger Utils CASCatch PatchQt \
           GenericObj MEDWrapper NamingService Registry \
          ModuleCatalog DataTypeCatalog RessourcesCatalog \
-          Notification  NOTIFICATION_SWIG \
+          ResourcesManager Notification  NOTIFICATION_SWIG \
          Container TestContainer LifeCycleCORBA HDFPersist Prs \
          VTKFilter OBJECT \
           TOOLSDS SALOMEDS Event \
@@ -50,7 +50,7 @@ ifeq (@WITHIHM@,no)
 SUBDIRS = MSG2QM SALOMELocalTrace SALOMETraceCollector Logger Utils CASCatch \
           GenericObj NamingService Registry \
          ModuleCatalog DataTypeCatalog RessourcesCatalog \
-         Notification  NOTIFICATION_SWIG \
+         ResourcesManager Notification  NOTIFICATION_SWIG \
          Container TestContainer LifeCycleCORBA HDFPersist Prs \
           TOOLSDS SALOMEDS Event \
           SALOME_SWIG_WITHOUTIHM ModuleGenerator Loader Communication
index 0ba61bbaabba6be257d4b23c912af01bbca999a6..bc4a90babbd56572ef06cd1d21c4e3238c402e61 100644 (file)
@@ -62,6 +62,7 @@ LIB_CLIENT_IDL = SALOME_ModuleCatalog.idl
 BIN_SERVER_IDL = SALOME_ModuleCatalog.idl
 
 CPPFLAGS+= $(QT_MT_INCLUDES) 
-LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
 
+LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
 @CONCLUDE@
index 9a5fb15ce66863b288c6bf55a43b56a79ab951c6..ad8cdd43dee065c66351dfab412b57f61f41c811 100644 (file)
@@ -48,7 +48,7 @@ int main(int argc,char **argv)
 
       // initialize POA
       //
-      long TIMESleep = 250000000;
+      long TIMESleep = 500000000;
       int NumberOfTries = 40;
       int a;
       timespec ts_req;
index b2ba19a51cd3112fca81740f26ba0a5636b1b25d..7cb1a6bce9dafd1f889274d554bb8fcd2c985548 100644 (file)
@@ -37,7 +37,7 @@ using namespace std;
  * \param serverName name of the server to find.
  * \param NS SALOME_NamingService object
  * Wait until the given server is ready i.e. is name is found in namingService.
- * Try 40 times, with 250 ms sleep between each try.
+ * Try 40 times, with 500 ms sleep between each try.
  * If Logger is used for traces, it must be ready before this call, because
  * SALOME_NamingService client uses SALOME traces. So, Logger readiness must be
  * checked in Launch script before execution of WaitForServerReadiness.
@@ -48,8 +48,8 @@ using namespace std;
 void NamingService_WaitForServerReadiness(SALOME_NamingService* NS,
                                          string serverName)
 {
-  long TIMESleep = 250000000; // 250 ms.
-  int NumberOfTries = 40;     // total wait = 10 s.
+  long TIMESleep = 500000000; // 500 ms.
+  int NumberOfTries = 40;     // total wait = 20 s.
   int found = 0;
 
   timespec ts_req;
index 07b0e93423de3be5914a2aa34133d8f965a79dae..2db7a59b5e9c2f4ed207c8f9f910adb928fae569 100644 (file)
@@ -645,7 +645,7 @@ char* SALOME_NamingService::Current_Directory()
       // the directories
       length_path = length_path + strlen(result_path[k]) + 1;
     }
-  char* return_Path = new char[length_path +1];
+  char* return_Path = new char[length_path +2];
   return_Path[0] = '/' ;
   return_Path[1] = '\0' ;
   for (int k = 0 ; k <i ;k++) 
@@ -737,6 +737,23 @@ vector<string> SALOME_NamingService::list_directory()
   return _list;
 }
 
+//----------------------------------------------------------------------
+/*! Function : list_directory_recurs
+ *  Purpose  : method to get all the contexts contained in the current 
+ *             directory
+ *             Get only objects and is recursive 
+ *  If the NamingService is out, the exception ServiceUnreachable is thrown
+ */ 
+//----------------------------------------------------------------------
+vector<string> SALOME_NamingService::list_directory_recurs()
+    throw(ServiceUnreachable)
+{
+  vector<string> _list ;
+  char *currentDir=Current_Directory();
+  _list_directory_recurs(_list,0,currentDir);
+  delete [] currentDir;
+  return _list;
+}
 
 //----------------------------------------------------------------------
 /*! Function : Destroy_Name 
@@ -1310,4 +1327,58 @@ SALOME_NamingService::_current_directory(char** result_path,
   // We go to the last directory where an occurence was found
   _current_context = _ref_context ; 
 }
+
+
+//----------------------------------------------------------------------
+/*! Function :_list_directory_recurs.
+ * Purpose  : method to list recursively all the objects contained in the tree of absCurDirectory/relativeSubDir.
+ *  \param myList The list that will be filled.
+ *  \param relativeSubDir The directory from absCurDirectory in which the objects are found.
+ *  \param absCurDirectory The directory in ABSOLUTE form.
+ *  _current_context must refer to absCurDirectory.
+ */
+//----------------------------------------------------------------------
+void SALOME_NamingService::_list_directory_recurs(vector<string>& myList, const char *relativeSubDir,const char *absCurDirectory)
+{
+  CosNaming::BindingList_var _binding_list;
+  CosNaming::BindingIterator_var _binding_iterator;
+  unsigned long nb=0 ; // for using only the BindingIterator to access the bindings
+  CosNaming::Binding_var _binding ;
+  char *absDir;
+
+  CosNaming::NamingContext_var _ref_context = _current_context;
+  if(relativeSubDir)
+    {
+      Change_Directory(relativeSubDir);
+      absDir=new char[strlen(absCurDirectory)+2+strlen(relativeSubDir)];
+      strcpy(absDir,absCurDirectory);
+      strcat(absDir,relativeSubDir);
+      strcat(absDir,"/");
+    }
+  else
+    absDir=(char *)absCurDirectory;
+  _current_context->list(nb, _binding_list, _binding_iterator) ;
+
+  while (_binding_iterator->next_one(_binding)) {
+    CosNaming::Name _bindingName = _binding->binding_name;
+    if (_binding->binding_type == CosNaming::ncontext) {
+      _list_directory_recurs(myList,_bindingName[0].id,absDir);
+    }
+    else if (_binding->binding_type == CosNaming::nobject) {
+      char *elt=new char[strlen(absDir)+2+strlen(_bindingName[0].id)];
+      strcpy(elt,absDir);
+      strcat(elt,_bindingName[0].id);
+      myList.push_back(elt);
+      delete [] elt;
+    }
+  }
+  if(relativeSubDir)
+    {
+      _current_context = _ref_context ;
+      delete [] absDir;
+    }
+
+  _binding_iterator->destroy();
+}
+
 //----------------------------------------------------------------------
index 4504e6ec7bdd71d58d59a3a446d7e0757d791a7e..e6ee8921324155cb07583994ae3606e1e2844a91 100644 (file)
@@ -84,6 +84,10 @@ public:
   // Get only objects, isn't iterative
   std::vector<std::string> list_directory()
     throw(ServiceUnreachable);
+
+  //!methods that lists all objects RECUSIVELY in the current directory
+  std::vector<std::string> list_directory_recurs()
+    throw(ServiceUnreachable);
  
   //! method to destroy an association Path-Object Reference
   void Destroy_Name(const char* Path)
@@ -120,6 +124,10 @@ protected:
                          int& length_result,
                          CosNaming::NamingContext_var context_to_found,
                          CORBA::Boolean& _continue);
+
+  //! internal method to list all (recursively) the objects contains in absCurDirectory/relativeSubDir.
+  void _list_directory_recurs(std::vector<std::string>& myList, const char *relativeSubDir,const char *absCurDirectory);
+
 };
 
 #endif // SALOME_NAMINGSERVICE_H
index 55719f6e8d425db34c6c5b4e1dea1da7e72c4ee5..669b4f8ca86174f7829be40863f46c062f180205 100644 (file)
@@ -39,6 +39,7 @@ LIB_MOC = \
 LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_ModuleCatalog.idl \
                 SALOME_Component.idl \
+                SALOME_ContainerManager.idl \
                 SALOME_Exception.idl
 
 
index 375a786b08b215df5467908c2bee466a19546172..ca9f91bf11bcd8b6c059126c732e2fcd9ebf2f20 100644 (file)
@@ -43,6 +43,7 @@ LIB_MOC = \
 LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_ModuleCatalog.idl \
                 SALOME_Component.idl \
+                SALOME_ContainerManager.idl \
                 SALOME_Exception.idl
 
 CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(OGL_INCLUDES) $(PYTHON_INCLUDES) $(QWT_INCLUDES) 
index cbcbf39316181a8d79cc72710e6ed892df89e885..8b5eb524ccd1a30abd3cd04532ef7b187e82c670 100644 (file)
@@ -53,6 +53,8 @@ BIN = SALOME_Registry_Server
 BIN_SRC = 
 BIN_SERVER_IDL = SALOME_Registry.idl
 
-LDFLAGS+= -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+= -lSalomeNS -lOpUtil -lSALOMELocalTrace
+
+LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
 
 @CONCLUDE@
index b43546776fe645f77269af3d9c88748be8dc09fd..17f8c42afca68b0536a36db6e284d9065442e3d3 100644 (file)
@@ -54,7 +54,8 @@ BIN_SERVER_IDL = SALOME_RessourcesCatalog.idl
 
 CPPFLAGS+= $(QT_MT_INCLUDES) 
 CXXFLAGS+= 
-LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
+LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
 
 @CONCLUDE@
 
index 41c2227333ebdc898aa5052938e60974e67cd105..5a4adbf4e62687107bfe9d9da9e834b4685e4963 100644 (file)
@@ -113,14 +113,14 @@ LIB_SRC =         \
 # Executables targets
 BIN = SALOMEDS_Server SALOMEDS_Client
 BIN_SRC = 
-LIB_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl
+LIB_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl SALOME_ContainerManager.idl
 BIN_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl
 BIN_CLIENT_IDL = 
 LIB_CLIENT_IDL = SALOME_Component.idl SALOME_GenericObj.idl
 
 CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES)
 CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF -lTKBO -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA
+LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF -lTKBO -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA -lSalomeContainer -lSalomeResourcesManager
 
 # _CS_gbo_090604 Ajout Spécifique Calibre 3, pour l'utilisation de la version 5.12 de la bibliothèque OCC.
 # La bibliothèque OCC5.12 a été compilée sur Calibre 3 avec l'extention Xmu (impossible de compiler sans).
@@ -129,7 +129,7 @@ LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOME
 #
 LDXMUFLAGS= -L/usr/X11R6/lib -lXmu
 LDFLAGS+=$(LDXMUFLAGS)
-
+LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification -lSALOMETraceCollector
 
 @CONCLUDE@
 
index be6969df4bb3d35f32bbd27204d8984f8ea945ac..dec61d3587609e21ab4a7f134df77b547de384be 100644 (file)
@@ -44,13 +44,12 @@ char* SALOMEDS_AttributeIOR_i::Value()
 void SALOMEDS_AttributeIOR_i::SetValue(const char* value) 
 {
   CheckLocked();
-  const CORBA::ORB_var& anORB = _mySObject->GetORB();
 
-  SALOMEDS::Study_var aStudy = SALOMEDS_Study_i::GetStudy(_myAttr->Label(),anORB);
+  SALOMEDS_Study_i* aStudy = _mySObject->GetStudyServant();
   aStudy->AddCreatedPostponed(value);
   aStudy->AddPostponed(Value());
 
   CORBA::String_var Str = CORBA::string_dup(value);
   Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str));
-  SALOMEDS_Study_i::IORUpdated(Handle(SALOMEDS_IORAttribute)::DownCast(_myAttr),anORB);
+  aStudy->IORUpdated(Handle(SALOMEDS_IORAttribute)::DownCast(_myAttr));
 }
index 6396ada74e12ca7840cdd9836a000887b5f0556d..d256bb669257b046510e90b42459d42978ed5f83 100644 (file)
@@ -46,8 +46,6 @@ SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(SALOMEDS_Study_i* theStudy,
   _lab(theLabel),
   _study(theStudy)
 {
-  TCollection_AsciiString anEntry;
-  TDF_Tool::Entry(theLabel,anEntry);
 }
 
 //============================================================================
@@ -66,7 +64,7 @@ SALOMEDS_ChildIterator_i::~SALOMEDS_ChildIterator_i()
 //============================================================================
 void SALOMEDS_ChildIterator_i::Init()
 { 
-  _it.Initialize (_lab);
+  _it.Initialize(_lab);
 }
 
 //============================================================================
@@ -74,9 +72,9 @@ void SALOMEDS_ChildIterator_i::Init()
  * 
  */
 //============================================================================
-void SALOMEDS_ChildIterator_i::InitEx(CORBA::Boolean allLevels)
+void SALOMEDS_ChildIterator_i::InitEx(CORBA::Boolean theIsAllLevels)
 { 
-  _it.Initialize (_lab, allLevels);
+  _it.Initialize(_lab,theIsAllLevels);
 }
 
 //============================================================================
@@ -97,8 +95,6 @@ CORBA::Boolean SALOMEDS_ChildIterator_i::More()
 void SALOMEDS_ChildIterator_i::Next()
 {
   _it.Next();
-  TCollection_AsciiString anEntry;
-  TDF_Tool::Entry(_it.Value(),anEntry);
 }
 
 
@@ -113,3 +109,7 @@ SALOMEDS::SObject_ptr SALOMEDS_ChildIterator_i::Value()
   return SALOMEDS_SObject_i::NewRef(_study,_it.Value())._retn();
 }
 
+SALOMEDS_SObject_i* SALOMEDS_ChildIterator_i::GetValue()
+{
+  return SALOMEDS_SObject_i::NewPtr(_study,_it.Value());
+}
index 083fd9935d62f3aecf8e121720110dfa623c3969..dc7cfbe9cea0d05ae9a1fb74208e72f88c191ec3 100644 (file)
@@ -38,6 +38,7 @@
 #include <TDF_Label.hxx>
 
 class SALOMEDS_Study_i;
+class SALOMEDS_SObject_i;
 
 class SALOMEDS_ChildIterator_i: public POA_SALOMEDS::ChildIterator,
                                public PortableServer::RefCountServantBase 
@@ -57,7 +58,7 @@ public:
 
   ~SALOMEDS_ChildIterator_i();
   
-  TDF_Label GetValue() { return _it.Value();}
+  SALOMEDS_SObject_i* GetValue();
 
   virtual void Init();
   virtual void InitEx(CORBA::Boolean);
index f71b538fd5d59051bb0018ac78ce8b719bf74881..b749c54644b014c073aaeb6c80d7ff6bbdf6b8c9 100644 (file)
 //  Module : SALOME
 //  $Header$
 
-#include "SALOMEDS_IORAttribute.ixx"
 #include <TDataStd_Comment.hxx>
 #include <TCollection_ExtendedString.hxx>
+
+#include "SALOMEDS_IORAttribute.ixx"
 #include "SALOMEDS_Study_i.hxx"
+
 using namespace std;
 
 //=======================================================================
@@ -52,7 +54,7 @@ const Standard_GUID& SALOMEDS_IORAttribute::GetID ()
 
 Handle(SALOMEDS_IORAttribute) SALOMEDS_IORAttribute::Set (const TDF_Label& L,
                                                          const TCollection_ExtendedString& S,
-                                                         CORBA::ORB_ptr orb
+                                                         SALOMEDS_Study_i* theStudy
 {
   Handle(SALOMEDS_IORAttribute) A;
   if (!L.FindAttribute(SALOMEDS_IORAttribute::GetID(),A)) {
@@ -61,7 +63,7 @@ Handle(SALOMEDS_IORAttribute) SALOMEDS_IORAttribute::Set (const TDF_Label& L,
   }
   
   (Handle(TDataStd_Comment)::DownCast(A))->Set (S); 
-  SALOMEDS_Study_i::IORUpdated(A,orb);
+  theStudy->IORUpdated(A);
   return A;
 }
 
index 5bd63c9add9fbe119b88ef808afab952c4095c8c..8f9fd314a106f27f121f507a3a20af0af4c0aa0a 100644 (file)
@@ -54,7 +54,7 @@ class TDF_Label;
 class TCollection_ExtendedString;
 class TDF_Attribute;
 class TDF_RelocationTable;
-
+class SALOMEDS_Study_i;
 
 class SALOMEDS_IORAttribute : public TDataStd_Comment {
 
@@ -79,7 +79,9 @@ public:
  // Methods PUBLIC
  // 
 Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_IORAttribute Set(const TDF_Label& label,const TCollection_ExtendedString& string, CORBA::ORB_ptr orb) ;
+Standard_EXPORT static Handle_SALOMEDS_IORAttribute Set(const TDF_Label& label,
+                                                       const TCollection_ExtendedString& string,
+                                                       SALOMEDS_Study_i* theStudy) ;
 Standard_EXPORT SALOMEDS_IORAttribute();
 Standard_EXPORT  const Standard_GUID& ID() const;
 Standard_EXPORT   void Restore(const Handle(TDF_Attribute)& with) ;
index 5d6e163825e2b97cedfc328308e12615355ace29..5f5ddded8977a4af4324f3905c2e1d3135c4516f 100644 (file)
@@ -286,12 +286,14 @@ SALOMEDS_SObject_i::New(SALOMEDS_Study_i* theStudy,
   if(anIter != anSObjectMap.end())
     aSObjectHolder = anIter->second;
   else{
-    TCollection_AsciiString anEntry;
-    TDF_Tool::Entry(theLabel,anEntry);
     SALOMEDS_SObject_i* aSObject = new SALOMEDS_SObject_i(theStudy,theLabel);
     aSObjectHolder.first = aSObject;
     aSObjectHolder.second = aSObject->_this();
     anSObjectMap[theLabel] = aSObjectHolder;
+
+    //TCollection_AsciiString anEntry;
+    //TDF_Tool::Entry(theLabel,anEntry);
+    //cout<<"APO - SALOMEDS_SObject_i::New - anEntry = "<<anEntry.ToCString()<<endl;
   }
   return aSObjectHolder;
 }
@@ -525,27 +527,17 @@ char* SALOMEDS_SObject_i::GetIOR() {
  *  Purpose  : Returns list of all attributes for this sobject
  */
 //============================================================================
-SALOMEDS_GenericAttribute_i* 
+SALOMEDS_SObject_i::TAttrHolder 
 SALOMEDS_SObject_i::_FindGenAttribute(const Handle(TDF_Attribute)& theAttr)
 {
-  SALOMEDS_GenericAttribute_i* anGenAttr = NULL;
+  TAttrHolder anGenAttr;
 
   Standard_GUID aGUID = theAttr->ID();
 
   TGUID2AttrIDMap::const_iterator anIter = __GUID2AttrIDMap__.find(aGUID);
-  if(anIter != __GUID2AttrIDMap__.end())
-  {
-    const ::TAttributeID& anAttributeID = anIter->second;
-    TAttrMap::const_iterator anIter = myAttrMap.find(anAttributeID);
-    if(anIter != myAttrMap.end())
-      anGenAttr = anIter->second;
-
-    if(anGenAttr != NULL){
-      if(anGenAttr->GetAttribute() != theAttr)
-       anGenAttr->SetAttribute(theAttr);
-    }else{
-      anGenAttr = _CreateGenAttribute(theAttr,anAttributeID.c_str());
-    }
+  if(anIter != __GUID2AttrIDMap__.end()){
+    const TAttributeID& anAttributeID = anIter->second;
+    anGenAttr = _FindGenAttribute(anAttributeID.c_str());
   }
 
   return anGenAttr;
@@ -559,10 +551,12 @@ SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes()
     Standard_Integer i = 0;
     for(TDF_AttributeIterator iter(_lab); iter.More(); iter.Next()) {
       Handle(TDF_Attribute) anAttr = iter.Value();
-      if(SALOMEDS_GenericAttribute_i* anGenAttr = _FindGenAttribute(anAttr))
+      TAttrHolder anAttrHolder = _FindGenAttribute(anAttr);
+      SALOMEDS::GenericAttribute_var anGenAttr = anAttrHolder.second;
+      if(!anGenAttr->_is_nil())
       {
        aSeqOfAttr->length(++i);
-       aSeqOfAttr[i-1] = anGenAttr->_this();
+       aSeqOfAttr[i-1] = anGenAttr._retn();
       }
     }
   }
@@ -576,11 +570,11 @@ SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes()
  *  Purpose  : Find attribute of given type on this SObject
  */
 //============================================================================
-SALOMEDS_GenericAttribute_i* 
+SALOMEDS_SObject_i::TAttrHolder 
 SALOMEDS_SObject_i::_CreateGenAttribute(const Handle(TDF_Attribute)& theAttr,
                                        const char* theType) 
 {
-  
+  SALOMEDS_GenericAttribute_i* anAttr;
   TAttrID2FunMap::const_iterator anIter = __AttrID2FunMap__.find(theType);
   if(anIter != __AttrID2FunMap__.end()){
     const TAttrID2FunMap::data_type& aValue = anIter->second;
@@ -588,56 +582,66 @@ SALOMEDS_SObject_i::_CreateGenAttribute(const Handle(TDF_Attribute)& theAttr,
     if(aValue.myIsCheckLockedStudy())
       _study->CheckLocked();
     
-    return aValue.myNewInstance(theAttr,this);
+    anAttr = aValue.myNewInstance(theAttr,this);
+    return TAttrHolder(anAttr,anAttr->_this());
   }
   
   if(strncmp(theType,"AttributeTreeNode",17) == 0){
-    return new SALOMEDS_AttributeTreeNode_i(theAttr,this);
+    anAttr = new SALOMEDS_AttributeTreeNode_i(theAttr,this);
+    return TAttrHolder(anAttr,anAttr->_this());
   }
   
   if(strncmp(theType,"AttributeUserID",15) == 0){
-    return new SALOMEDS_AttributeUserID_i(theAttr,this);
+    anAttr =  new SALOMEDS_AttributeUserID_i(theAttr,this);
+    return TAttrHolder(anAttr,anAttr->_this());
   }
   
-  return NULL;
+  return TAttrHolder();
 }
 
 
-SALOMEDS_GenericAttribute_i* 
+SALOMEDS_SObject_i::TAttrHolder 
 SALOMEDS_SObject_i::_FindGenAttribute(const char* theType)
 {
-  SALOMEDS_GenericAttribute_i* anGenAttr = NULL;
+  TAttrHolder anAttrHolder;
   TAttrMap::const_iterator anIter = myAttrMap.find(theType);
   if(anIter != myAttrMap.end())
-    anGenAttr = anIter->second;
+    anAttrHolder = anIter->second;
 
   Standard_GUID aGUID = ::GetGUID(theType);
   Handle(TDF_Attribute) anAttr;
 
   if(_lab.FindAttribute(aGUID,anAttr)){
-    if(anGenAttr != NULL){
-      if(anGenAttr->GetAttribute() != anAttr)
-       anGenAttr->SetAttribute(anAttr);
+    SALOMEDS_GenericAttribute_i* aGenAttr = anAttrHolder.first;
+    if(aGenAttr != NULL){
+      if(aGenAttr->GetAttribute() != anAttr)
+       aGenAttr->SetAttribute(anAttr);
     }else{
-      anGenAttr = _CreateGenAttribute(anAttr,theType);
+      anAttrHolder = _CreateGenAttribute(anAttr,theType);
     }
-    if(anGenAttr != NULL)
-      myAttrMap[theType] = anGenAttr;
+    aGenAttr = anAttrHolder.first;
+    if(aGenAttr != NULL)
+      myAttrMap[theType] = anAttrHolder;
   }else{
-    myAttrMap.erase(theType);
+    //myAttrMap.erase(theType);
     //if(anGenAttr != NULL)
     //  anGenAttr->Destroy();
+    return TAttrHolder();
   }
 
-  return anGenAttr;
+  return anAttrHolder;
 }
 
 
 SALOMEDS::GenericAttribute_ptr 
 SALOMEDS_SObject_i::_FindCORBAAttribute(const char* theType)
 {
-  if(SALOMEDS_GenericAttribute_i* anGenAttr = _FindGenAttribute(theType))
-    return anGenAttr->_this();
+  TAttrHolder anAttr = _FindGenAttribute(theType);
+  SALOMEDS::GenericAttribute_var anGenAttr = anAttr.second;
+  if(!CORBA::is_nil(anGenAttr)){
+    return anGenAttr._retn();
+  }
+
   return SALOMEDS::GenericAttribute::_nil();
 }
 
@@ -707,14 +711,19 @@ Handle(TDF_Attribute)
 SALOMEDS::GenericAttribute_ptr 
 SALOMEDS_SObject_i::FindOrCreateAttribute(const char* theType)
 {
-  if(SALOMEDS_GenericAttribute_i* anGenAttr = _FindGenAttribute(theType))
-    return anGenAttr->_this();
+  TAttrHolder anAttrHolder = _FindGenAttribute(theType);
+  SALOMEDS::GenericAttribute_var anGenAttr = anAttrHolder.second;
+  if(!anGenAttr->_is_nil())
+    return anGenAttr._retn();
+
   Handle(TDF_Attribute) anAttr = _AddAttribute(theType);
   if(!anAttr.IsNull()){
-    if(SALOMEDS_GenericAttribute_i* anGenAttr = _CreateGenAttribute(anAttr,theType)){
-      return anGenAttr->_this();
-    }
+    anAttrHolder = _CreateGenAttribute(anAttr,theType);
+    anGenAttr = anAttrHolder.second;
+    if(!anGenAttr->_is_nil())
+      return anGenAttr._retn();
   }
+
   return SALOMEDS::GenericAttribute::_nil();
 }
 
@@ -736,8 +745,28 @@ void SALOMEDS_SObject_i::RemoveAttribute(const char* theType)
   }
   TAttrMap::iterator anIter = myAttrMap.find(theType);
   if(anIter != myAttrMap.end()){
-    myAttrMap.erase(anIter);
+    //myAttrMap.erase(anIter);
   }
   _lab.ForgetAttribute(::GetGUID(theType));
 }
 
+
+void SALOMEDS_SObject_i::OnRemove()
+{
+  Handle(TDF_Reference) aReference;
+  if(_lab.FindAttribute(TDF_Reference::GetID(),aReference)){
+    Handle(SALOMEDS_TargetAttribute) aTarget;
+    if(aReference->Get().FindAttribute(SALOMEDS_TargetAttribute::GetID(),aTarget))
+      aTarget->Remove(_lab);
+  }
+
+  Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects
+  if(_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr)){
+    _study->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString());
+  }
+
+  //myAttrMap.clear();
+
+  //SALOMEDS_Study_i::TSObjectMap& anSObjectMap = _study->GetSObjectMap();
+  //anSObjectMap.erase(_lab);
+}
index 2f28e74c2c12131545b5654b1bee667902656686..a4c73ce43c8bffcf6bef0355079e5c7e01d1ace8 100644 (file)
@@ -105,9 +105,12 @@ public:
   FindOrCreateAttribute(const char* theTypeOfAttribute);
 
   void RemoveAttribute(const char* theTypeOfAttribute);
+  void OnRemove();
 
   SALOMEDS_Study_i* GetStudyServant(){ return _study;}
 
+  TDF_Label GetLabel(){ return _lab;}
+
   CORBA::ORB_var GetORB() const;
 
   PortableServer::POA_var GetPOA() const;
@@ -115,14 +118,19 @@ public:
 protected:
   friend class SALOMEDS_GenericAttribute_i;
 
-  SALOMEDS_GenericAttribute_i* 
+  typedef std::string TAttributeID;
+  typedef std::pair<SALOMEDS_GenericAttribute_i*,SALOMEDS::GenericAttribute_var> TAttrHolder;
+  typedef std::map<TAttributeID,TAttrHolder> TAttrMap;
+  TAttrMap myAttrMap;
+
+  TAttrHolder 
   _FindGenAttribute(const Handle(TDF_Attribute)& theAttr);
 
-  SALOMEDS_GenericAttribute_i* 
+  TAttrHolder 
   _CreateGenAttribute(const Handle(TDF_Attribute)& theAttr,
                      const char* theTypeOfAttribute);
 
-  SALOMEDS_GenericAttribute_i* 
+  TAttrHolder 
   _FindGenAttribute(const char* theTypeOfAttribute);
 
   SALOMEDS::GenericAttribute_ptr 
@@ -135,11 +143,6 @@ protected:
   std::string _name;
   TDF_Label _lab;
 
-  typedef std::string TAttributeID;
-  typedef SALOMEDS_GenericAttribute_i* TAttrHolder;
-  typedef std::map<TAttributeID,TAttrHolder> TAttrMap;
-  TAttrMap myAttrMap;
-
   SALOMEDS_SObject_i(SALOMEDS_Study_i* theStudy, 
                     const TDF_Label& theLabel);
   
index b0e8863bd48be5bf4c4b3ae6ea2603f3d1404ac6..70919bba0ca431d2d28d824fbb3e715d9968f758 100644 (file)
@@ -57,7 +57,7 @@ int main(int argc, char** argv)
       omniORB::MaxMessageSize(100 * 1024 * 1024);
       // Obtain a reference to the root POA.
       //
-      long TIMESleep = 250000000;
+      long TIMESleep = 500000000;
       int NumberOfTries = 40;
       int a;
       timespec ts_req;
index 143d3c0b7eb38a9c6e2bbc8b97cb8108cdd1fe88..c6b74d1318669ae5709f671109cde56e66825bed 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "SALOMEDS_SObject_i.hxx"
 #include "SALOMEDS_SComponent_i.hxx"
+#include "SALOMEDS_ChildIterator_i.hxx"
 
 #include "SALOMEDS_TargetAttribute.hxx"
 #include "SALOMEDS_IORAttribute.hxx"
@@ -158,7 +159,7 @@ void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr t
 
   //add theObject definition 
   aString = GetORB()->object_to_string(theObject);
-  SALOMEDS_IORAttribute::Set(Lab,const_cast<char*>(aString.in()),GetORB());
+  SALOMEDS_IORAttribute::Set(Lab,const_cast<char*>(aString.in()),_study);
 }
 
 //============================================================================
@@ -246,31 +247,26 @@ SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ptr theFatherObject,
 //============================================================================
 void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr theSObject)
 {
-  CheckLocked();
-
-  if(CORBA::is_nil(theSObject))
-    return;
-
-  OnRemoveSObject(theSObject);
-
-  TDF_Label Lab;
-  CORBA::String_var aString(theSObject->GetID());
-  TDF_Tool::Label(_doc->GetData(),const_cast<char*>(aString.in()),Lab);
+  RemoveSObject(theSObject);
+}
 
-  Handle(TDF_Reference) aReference;
-  if(Lab.FindAttribute(TDF_Reference::GetID(),aReference)){
-    Handle(SALOMEDS_TargetAttribute) aTarget;
-    if(aReference->Get().FindAttribute(SALOMEDS_TargetAttribute::GetID(),aTarget))
-      aTarget->Remove(Lab);
-  }
+SALOMEDS_SObject_i*
+SALOMEDS_StudyBuilder_i::RemoveSObject(SALOMEDS::SObject_ptr theSObject,
+                                      bool theIsForgetAllAttributes)
+{
+  CheckLocked();
 
-  Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects
-  if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr)){
-    SALOMEDS::Study_ptr aStudy = SALOMEDS_Study_i::GetStudy(_doc->Main(),GetORB());
-    aStudy->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString());
+  if(SALOMEDS_SObject_i* aSObject = _study->DownCast(theSObject)){
+    OnRemoveSObject(theSObject);
+    aSObject->OnRemove();
+    if(theIsForgetAllAttributes){
+      TDF_Label aLabel = aSObject->GetLabel();
+      aLabel.ForgetAllAttributes();
+    }
+    return aSObject;
   }
 
-  Lab.ForgetAllAttributes();
+  return NULL;
 }
 
 //============================================================================
@@ -280,48 +276,15 @@ void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr theSObject)
 //============================================================================
 void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr theSObject)
 {
-  CheckLocked();
-
-  if(CORBA::is_nil(theSObject))
-    return;
-
-  OnRemoveSObject(theSObject);
-
-  TDF_Label Lab;
-  CORBA::String_var aString(theSObject->GetID());
-  TDF_Tool::Label(_doc->GetData(),aString,Lab);
-
-  Handle(TDF_Reference) aReference;
-  if (Lab.FindAttribute(TDF_Reference::GetID(), aReference)) {
-    Handle(SALOMEDS_TargetAttribute) aTarget;
-    if (aReference->Get().FindAttribute(SALOMEDS_TargetAttribute::GetID(),aTarget))
-      aTarget->Remove(Lab);
-  }
-
-  Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects
-  if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr)){
-    SALOMEDS::Study_ptr aStudy = SALOMEDS_Study_i::GetStudy(_doc->Main(),GetORB());
-    aStudy->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString());
-  }
-
-  TDF_ChildIterator it(Lab, Standard_True);
-  for(;it.More();it.Next()) {
-    TDF_Label aLabel = it.Value();
-
-    if (aLabel.FindAttribute(TDF_Reference::GetID(), aReference)) {
-      Handle(SALOMEDS_TargetAttribute) aTarget;
-      if (aReference->Get().FindAttribute(SALOMEDS_TargetAttribute::GetID(),aTarget))
-       aTarget->Remove(aLabel);
-    }
-
-    Handle(SALOMEDS_IORAttribute) anAttr; // postponed removing of CORBA objects
-    if (aLabel.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr)){
-      SALOMEDS::Study_ptr aStudy = SALOMEDS_Study_i::GetStudy(_doc->Main(),GetORB());
-      aStudy->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString());
+  if(SALOMEDS_SObject_i* aSObject = RemoveSObject(theSObject,false)){
+    SALOMEDS_ChildIterator_i aChildIter(_study,aSObject->GetLabel(),true);
+    for(; aChildIter.More(); aChildIter.Next()){
+      if(SALOMEDS_SObject_i* aSObj = aChildIter.GetValue())
+       aSObj->OnRemove();
     }
+    TDF_Label aLabel = aSObject->GetLabel();
+    aLabel.ForgetAllAttributes(Standard_True);
   }
-
-  Lab.ForgetAllAttributes(Standard_True);
 }
 
 //============================================================================
@@ -331,7 +294,6 @@ void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr the
 //============================================================================
 static void  Translate_persistentID_to_IOR(TDF_Label theLabel,
                                           SALOMEDS::Driver_ptr theDriver,
-                                          CORBA::ORB_ptr theORB,
                                           SALOMEDS_Study_i* theStudy,
                                           CORBA::Boolean theIsMultiFile,
                                           CORBA::Boolean theIsASCII)
@@ -354,10 +316,10 @@ static void  Translate_persistentID_to_IOR(TDF_Label theLabel,
 
       CORBA::String_var anIOR = 
        theDriver->LocalPersistentIDToIOR(aSObject,ch.ToCString(),theIsMultiFile,theIsASCII);
-      SALOMEDS_IORAttribute::Set (aCurrentLabel,const_cast<char*>(anIOR.in()),theORB); 
+      SALOMEDS_IORAttribute::Set(aCurrentLabel,const_cast<char*>(anIOR.in()),theStudy); 
     }
 
-    Translate_persistentID_to_IOR(aCurrentLabel,theDriver,theORB,theStudy,theIsMultiFile,theIsASCII);
+    Translate_persistentID_to_IOR(aCurrentLabel,theDriver,theStudy,theIsMultiFile,theIsASCII);
   }
 }
 
@@ -387,14 +349,14 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr theSComponent,
     if(CORBA::is_nil(theDriver))
       return;
 
-    int aLocked = theSComponent->GetStudy()->GetProperties()->IsLocked();
+    int aLocked = _study->GetProperties()->IsLocked();
     if(aLocked) 
-      theSComponent->GetStudy()->GetProperties()->SetLocked(false);
+      _study->GetProperties()->SetLocked(false);
     
     // mpv 06.03.2003: SAL1927 - if component data if already loaded, it is not necessary to do it again
     if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), Att)) {
       if(aLocked) 
-       theSComponent->GetStudy()->GetProperties()->SetLocked(true);
+       _study->GetProperties()->SetLocked(true);
       return;
     }
     DefineComponentInstance (theSComponent,theDriver);
@@ -496,21 +458,21 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr theSComponent,
        SALOMEDS_Tool::RemoveTemporaryFiles(aDir,aFilesToRemove,true);
       }
       if(aLocked)
-       theSComponent->GetStudy()->GetProperties()->SetLocked(true);
+       _study->GetProperties()->SetLocked(true);
       THROW_SALOME_CORBA_EXCEPTION("No persistent file Name found",SALOME::BAD_PARAM);
     }
     
     try {
-      Translate_persistentID_to_IOR(Lab,theDriver,GetORB(),_study, aMultifileState[0]=='M', ASCIIfileState[0] == 'A');
+      Translate_persistentID_to_IOR(Lab,theDriver,_study,aMultifileState[0]=='M',ASCIIfileState[0] == 'A');
     } catch (SALOME::SALOME_Exception) {
       INFOS("Can't translate PersRef to IOR");
       if (aLocked) 
-       theSComponent->GetStudy()->GetProperties()->SetLocked(true);
+       _study->GetProperties()->SetLocked(true);
       THROW_SALOME_CORBA_EXCEPTION("Unable to convert component persistent data to the transient",SALOME::BAD_PARAM);
       //        throw HDFexception("Unable to load component data");
     }
     if(aLocked)
-      theSComponent->GetStudy()->GetProperties()->SetLocked(true);
+      _study->GetProperties()->SetLocked(true);
   } else
     MESSAGE("No persistent file Name");
 }
@@ -536,15 +498,9 @@ SALOMEDS::GenericAttribute_ptr
 SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SALOMEDS::SObject_ptr theObject, 
                                               const char* theTypeOfAttribute)
 {
-  if(!CORBA::is_nil(theObject)){
-    PortableServer::POA_var aPOA = GetPOA();
-    PortableServer::ServantBase_var aServant = SALOMEDS::GetServant(theObject,aPOA);
-    if(aServant.in() != NULL){
-      if(SALOMEDS_SObject_i* anSObject = dynamic_cast<SALOMEDS_SObject_i*>(aServant.in())){
-       return anSObject->FindOrCreateAttribute(theTypeOfAttribute);
-      }
-    }
-  }
+  if(SALOMEDS_SObject_i* aSObject = _study->DownCast(theObject))
+    return aSObject->FindOrCreateAttribute(theTypeOfAttribute);
+
   return SALOMEDS::GenericAttribute::_nil();
 }
 
@@ -558,14 +514,9 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr theO
                                                      SALOMEDS::GenericAttribute_out theAttr, 
                                                      const char* theTypeOfAttribute)
 {
-  if(!CORBA::is_nil(theObject)){
-    PortableServer::ServantBase_var aServant = SALOMEDS::GetServant(theObject,GetPOA());
-    if(aServant.in() != NULL){
-      if(SALOMEDS_SObject_i* anSObject = dynamic_cast<SALOMEDS_SObject_i*>(aServant.in())){
-       return anSObject->FindAttribute(theAttr,theTypeOfAttribute);
-      }
-    }
-  }
+  if(SALOMEDS_SObject_i* aSObject = _study->DownCast(theObject))
+    return aSObject->FindAttribute(theAttr,theTypeOfAttribute);
+
   return Standard_False;
 }
 
@@ -590,8 +541,9 @@ void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr theSObject,
   if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0) { // postponed removing of CORBA objects
     Handle(SALOMEDS_IORAttribute) anAttr;
     if (Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr))
-      SALOMEDS_Study_i::GetStudy(_doc->Main(),GetORB())->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString());
-    else return;
+      _study->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString());
+    else
+      return;
   }
 
   Lab.ForgetAttribute(SALOMEDS::GetGUID(aTypeOfAttribute));
@@ -668,10 +620,9 @@ void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath)
   Handle(TDataStd_Name) aName;
   TDF_Label aLabel;
   SALOMEDS::SObject_var anObject = SALOMEDS_SObject_i::NewRef(_study,_doc->Main()); 
-  SALOMEDS::Study_var aStudy = anObject->GetStudy();
 
   try { 
-    anObject = aStudy->FindObjectByPath(thePath); //Check if the directory already exists
+    anObject = _study->FindObjectByPath(thePath); //Check if the directory already exists
   }
   catch(...) { }
 
@@ -679,7 +630,7 @@ void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath)
 
   if(aPath.Value(1) != '/') { //Relative path 
     aPath.Prepend('/');
-    aPath = TCollection_AsciiString(aStudy->GetContext()) + aPath;
+    aPath = TCollection_AsciiString(_study->GetContext()) + aPath;
   }
 
   TCollection_AsciiString aToken = aPath.Token("/", 1);
@@ -696,7 +647,7 @@ void SALOMEDS_StudyBuilder_i::AddDirectory(const char* thePath)
 
   anObject = SALOMEDS::SObject::_nil();
   try { 
-    anObject = aStudy->FindObjectByPath(aFatherPath.ToCString()); //Check if the father directory exists
+    anObject = _study->FindObjectByPath(aFatherPath.ToCString()); //Check if the father directory exists
   }
   catch(...) { ; }
   if(anObject->_is_nil()) 
@@ -792,7 +743,7 @@ void SALOMEDS_StudyBuilder_i::CommitCommand() throw (SALOMEDS::StudyBuilder::Loc
     AbortCommand();
     throw SALOMEDS::StudyBuilder::LockProtection();
   } else {
-    SALOMEDS_Study_i::GetStudy(_doc->Main(),GetORB())->RemovePostponed(_doc->GetUndoLimit());
+    _study->RemovePostponed(_doc->GetUndoLimit());
 
     int aModif = anAttr->GetModified();
     if (aModif < 0) aModif = 1000; // if user make undo and then - new transaction "modify" will never be zero
@@ -818,7 +769,7 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::HasOpenCommand()
 //============================================================================
 void SALOMEDS_StudyBuilder_i::AbortCommand()
 {
-  SALOMEDS_Study_i::GetStudy(_doc->Main(),GetORB())->UndoPostponed(0);
+  _study->UndoPostponed(0);
   
   _doc->AbortCommand();
 }
@@ -840,7 +791,7 @@ void SALOMEDS_StudyBuilder_i::Undo() throw (SALOMEDS::StudyBuilder::LockProtecti
     MESSAGE("Locked document modification !!!");
     throw SALOMEDS::StudyBuilder::LockProtection();
   } else {
-    SALOMEDS_Study_i::GetStudy(_doc->Main(),GetORB())->UndoPostponed(1);
+    _study->UndoPostponed(1);
     _doc->Undo();
     anAttr->SetModified(anAttr->GetModified()-1);
   }
@@ -865,7 +816,7 @@ void SALOMEDS_StudyBuilder_i::Redo() throw (SALOMEDS::StudyBuilder::LockProtecti
     throw SALOMEDS::StudyBuilder::LockProtection();
   } else {
     _doc->Redo();
-    SALOMEDS_Study_i::GetStudy(_doc->Main(),GetORB())->UndoPostponed(-1);
+    _study->UndoPostponed(-1);
     anAttr->SetModified(anAttr->GetModified()+1);
   }
  }
@@ -1010,5 +961,5 @@ void SALOMEDS_StudyBuilder_i::SetIOR(SALOMEDS::SObject_ptr theSO, const char* th
   TDF_Label aLabel;
   CORBA::String_var aSOID = theSO->GetID();
   TDF_Tool::Label(_doc->GetData(), aSOID, aLabel);
-  SALOMEDS_IORAttribute::Set(aLabel, TCollection_ExtendedString((char*)theValue),GetORB());
+  SALOMEDS_IORAttribute::Set(aLabel, TCollection_ExtendedString((char*)theValue),_study);
 }
index b2bddafa5903ee0ab6ed71089a04dc0c9f1b32d6..38f29b44078d34e8752fd7ba4918414d7b1fb1b0 100644 (file)
@@ -38,6 +38,7 @@
 #include <TDocStd_Document.hxx>
 
 class SALOMEDS_Study_i;
+class SALOMEDS_SObject_i;
 class SALOMEDS_Callback_i;
 
 class SALOMEDS_StudyBuilder_i: public virtual POA_SALOMEDS::StudyBuilder,
@@ -110,6 +111,8 @@ public:
     throw(SALOME::SALOME_Exception);
   virtual void Load(SALOMEDS::SObject_ptr sco);
 
+  SALOMEDS_SObject_i* RemoveSObject(SALOMEDS::SObject_ptr theSObject,
+                                   bool theIsForgetAllAttributes = true);
   virtual void RemoveObject(SALOMEDS::SObject_ptr anObject);
   virtual void RemoveObjectWithChildren(SALOMEDS::SObject_ptr anObject);
 
index 5030d08803b1a680caceb6a49ffc66806bfc9068..614ca3611a66a59a6bd572c4fa47ac994c499b62 100644 (file)
 
 #include "SALOMEDS_StudyManager_i.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
-#include "SALOMEDS_SObject_i.hxx"
+
 #include "SALOMEDS_Study_i.hxx"
+#include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS_StudyBuilder_i.hxx"
 
 #include "SALOMEDS_IORAttribute.hxx"
 #include "SALOMEDS_PersRefAttribute.hxx"
@@ -112,9 +114,11 @@ namespace SALOMEDS{
 //===========================================================================
 //Function : LoadAttributes
 //===========================================================================
-static void ReadAttributes(SALOMEDS::Study_ptr theStudy,
-                          SALOMEDS::SObject_ptr aSO,
-                          HDFdataset* hdf_dataset)
+static 
+void 
+ReadAttributes(SALOMEDS_Study_i* theStudy,
+              SALOMEDS::SObject_ptr aSO,
+              HDFdataset* hdf_dataset)
 {
   hdf_dataset->OpenOnDisk();
 
@@ -124,15 +128,15 @@ static void ReadAttributes(SALOMEDS::Study_ptr theStudy,
   hdf_dataset->ReadFromDisk(current_string);
 
   if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) {
-    anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, "AttributeComment");
+    anAttr = theStudy->GetBuilder()->FindOrCreateAttribute(aSO, "AttributeComment");
   } else if (!strcmp(hdf_dataset->GetName(),"Reference")) {
-    theStudy->NewBuilder()->Addreference(aSO, theStudy->CreateObjectID(current_string));
+    theStudy->GetBuilder()->Addreference(aSO, theStudy->CreateObjectID(current_string));
     delete(current_string);
     hdf_dataset->CloseOnDisk();
     return;
   } else {
     MESSAGE("Read attribute "<<hdf_dataset->GetName())
-    anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, hdf_dataset->GetName());
+    anAttr = theStudy->GetBuilder()->FindOrCreateAttribute(aSO, hdf_dataset->GetName());
   }
 
   if (!CORBA::is_nil(anAttr)) {
@@ -149,18 +153,18 @@ static void ReadAttributes(SALOMEDS::Study_ptr theStudy,
 //============================================================================
 //Function : Translate_IOR_to_persistentID
 //============================================================================
-static void Translate_IOR_to_persistentID (SALOMEDS::Study_ptr theStudy,
-                                          SALOMEDS::StudyBuilder_ptr theBuilder,
-                                          SALOMEDS::SObject_ptr theSObject,
-                                          SALOMEDS::Driver_ptr theEngine,
-                                          CORBA::Boolean theIsMultiFile,
-                                          CORBA::Boolean theIsASCII)
+static void Translate_IOR_to_persistentID(SALOMEDS_Study_i* theStudy,
+                                         SALOMEDS_StudyBuilder_i* theBuilder,
+                                         SALOMEDS::SObject_ptr theSObject,
+                                         SALOMEDS::Driver_ptr theEngine,
+                                         CORBA::Boolean theIsMultiFile,
+                                         CORBA::Boolean theIsASCII)
 {
   MESSAGE("In Translate_IOR_to_persistentID");
-  SALOMEDS::ChildIterator_var anIter = theStudy->NewChildIterator(theSObject);
-  for (; anIter->More(); anIter->Next()){
+  SALOMEDS_ChildIterator_i anIter = theStudy->GetChildIterator(theSObject);
+  for(; anIter.More(); anIter.Next()){
     SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::SObject_var aSObject = anIter->Value();
+    SALOMEDS::SObject_var aSObject = anIter.Value();
     if(aSObject->FindAttribute(anAttr,"AttributeIOR")){
       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
       CORBA::String_var aString = anIOR->Value();
@@ -178,7 +182,9 @@ static void Translate_IOR_to_persistentID (SALOMEDS::Study_ptr theStudy,
 //============================================================================
 //Function : BuildlTree
 //============================================================================
-static void BuildTree (SALOMEDS::Study_ptr theStudy,HDFgroup* hdf_current_group)
+static 
+void 
+BuildTree(SALOMEDS_Study_i* theStudy, HDFgroup* hdf_current_group)
 {
   hdf_current_group->OpenOnDisk();
   
@@ -210,7 +216,7 @@ static void BuildTree (SALOMEDS::Study_ptr theStudy,HDFgroup* hdf_current_group)
     else if (type == HDF_GROUP)   {
       MESSAGE( "--> Group: Internal Object Name : " << name);
       HDFgroup* new_group = new HDFgroup(name,hdf_current_group);
-      BuildTree (theStudy, new_group);
+      BuildTree(theStudy, new_group);
       new_group = 0; // will be deleted by father destructor
     }
   }
@@ -247,6 +253,18 @@ SALOMEDS_StudyManager_i::~SALOMEDS_StudyManager_i()
   _name_service.Destroy_Directory("/Study");
 }
 
+SALOMEDS_Study_i* 
+SALOMEDS_StudyManager_i::DownCast(SALOMEDS::Study_ptr theStudy) const
+{
+  if(!CORBA::is_nil(theStudy)){
+    PortableServer::POA_var aPOA = GetPOA();
+    PortableServer::ServantBase_var aServant = SALOMEDS::GetServant(theStudy,aPOA);
+    if(aServant.in())
+      return dynamic_cast<SALOMEDS_Study_i*>(aServant.in());
+  }
+  return NULL;
+}
+
 //============================================================================
 /*! Function : register_name
  *  Purpose  : Register the study Manager in the naming service under the  
@@ -286,7 +304,9 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* theStudyName)
                                                   
   // Assign the value of the IOR in the study->root
   CORBA::String_var anIOR = _orb->object_to_string(aStudy);
-  SALOMEDS_IORAttribute::Set(aDocument->Main().Root(),const_cast<char*>(anIOR.in()),_orb);
+  SALOMEDS_IORAttribute::Set(aDocument->Main().Root(),
+                            const_cast<char*>(anIOR.in()),
+                            aStudyServant);
 
   // set Study properties
   SALOMEDS::AttributeStudyProperties_var aProp = aStudyServant->GetProperties();
@@ -350,12 +370,14 @@ SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* theURL)
   aStudy->StudyId( _IDcounter );
 
   // Assign the value of the URL in the study object
-  aStudy->URL(theURL);
+  aStudyServant->URL(theURL);
   SCRUTE(theURL);
 
   // Assign the value of the IOR in the study->root
   CORBA::String_var anIOR = _orb->object_to_string(aStudy);
-  SALOMEDS_IORAttribute::Set(Doc->Main().Root(),const_cast<char*>(anIOR.in()),_orb);
+  SALOMEDS_IORAttribute::Set(Doc->Main().Root(),
+                            const_cast<char*>(anIOR.in()),
+                            aStudyServant);
 
   SALOMEDS_PersRefAttribute::Set(Doc->Main(),const_cast<char*>(theURL)); 
 
@@ -370,7 +392,7 @@ SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* theURL)
   Handle(TDF_Data) DF = Doc->GetData();
 
   try{
-    BuildTree (aStudy,hdf_group_study_structure);
+    BuildTree(aStudyServant,hdf_group_study_structure);
   }catch(HDFexception){
     std::ostringstream aStream;
     aStream<<"Can't open file "<<theURL;
@@ -385,7 +407,7 @@ SALOMEDS::Study_ptr  SALOMEDS_StudyManager_i::Open(const char* theURL)
   if(!_name_service.Change_Directory("/Study")){
     MESSAGE( "Unable to access the study directory" );
   }else{
-    CORBA::String_var aString(aStudy->Name());
+    CORBA::String_var aString(aStudyServant->Name());
     _name_service.Register(aStudy,aString.in());
   }
 
@@ -590,12 +612,10 @@ static void SaveAttributes(SALOMEDS::SObject_ptr SO, HDFgroup *hdf_group_sobject
  *  Purpose  : save the study properties in HDF file
  */
 //============================================================================
-void SALOMEDS_StudyManager_i::_SaveProperties(SALOMEDS::Study_ptr aStudy, HDFgroup *hdf_group) 
+void SALOMEDS_StudyManager_i::_SaveProperties(SALOMEDS_Study_i* theStudy, HDFgroup *hdf_group) 
 {
   // add modifications list (user and date of save)
-  SALOMEDS::AttributeStudyProperties_ptr aProp = aStudy->GetProperties();
-  SALOMEDS::StudyBuilder_var SB= aStudy->NewBuilder();
-//    SB->NewCommand();
+  SALOMEDS::AttributeStudyProperties_ptr aProp = theStudy->GetProperties();
   int aLocked = aProp->IsLocked();
   if (aLocked) 
     aProp->SetLocked(Standard_False);
@@ -609,7 +629,6 @@ void SALOMEDS_StudyManager_i::_SaveProperties(SALOMEDS::Study_ptr aStudy, HDFgro
                         CORBA::Long(aDate.Year()));
   if(aLocked) 
     aProp->SetLocked(Standard_True);
-//    SB->CommitCommand();
 
   SALOMEDS::StringSeq_var aNames;
   SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears;
@@ -647,7 +666,7 @@ void SALOMEDS_StudyManager_i::_SaveProperties(SALOMEDS::Study_ptr aStudy, HDFgro
  */
 //============================================================================
 void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl, 
-                                     SALOMEDS::Study_ptr aStudy,
+                                     SALOMEDS::Study_ptr theStudy,
                                      CORBA::Boolean theMultiFile,
                                      CORBA::Boolean theASCII)
 {
@@ -657,72 +676,66 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
   // * Study Structure -> Exactly what is contained in OCAF document
   //   Informations in data group hdf_group_study_structure
 
-  HDFfile *hdf_file=0;         
-  HDFgroup *hdf_group_study_structure =0;
-  HDFgroup *hdf_sco_group =0;
-  HDFgroup *hdf_sco_group2 =0;
+  if(SALOMEDS_Study_i* aStudy = DownCast(theStudy)){
+    HDFfile *hdf_file=0;         
+    HDFgroup *hdf_group_study_structure =0;
+    HDFgroup *hdf_sco_group =0;
+    HDFgroup *hdf_sco_group2 =0;
 
-  HDFgroup *hdf_group_datacomponent =0;
-  HDFdataset *hdf_dataset =0;
-  hdf_size size[1];
-  hdf_int32 name_len = 0;
-
-  int aLocked = aStudy->GetProperties()->IsLocked();
-  if (aLocked) aStudy->GetProperties()->SetLocked(false);
-
-  SALOMEDS::StudyBuilder_var SB= aStudy->NewBuilder();
+    HDFgroup *hdf_group_datacomponent =0;
+    HDFdataset *hdf_dataset =0;
+    hdf_size size[1];
+    hdf_int32 name_len = 0;
+  
+    int aLocked = aStudy->GetProperties()->IsLocked();
+    if(aLocked) 
+      aStudy->GetProperties()->SetLocked(false);
 
-  ASSERT(!CORBA::is_nil(aStudy));
-  try
-    {
+    SALOMEDS_StudyBuilder_i* SB= aStudy->GetBuilder();
+    try{
       // mpv 15.12.2003: for saving components we have to load all data from all modules
-
-      SALOMEDS::SComponentIterator_var itcomponent1 = aStudy->NewComponentIterator();
-      for (; itcomponent1->More(); itcomponent1->Next())
-       {
-         SALOMEDS::SComponent_var sco = itcomponent1->Value();
-         // if there is an associated Engine call its method for saving
-         CORBA::String_var IOREngine;
-         try {
+      SALOMEDS_SComponentIterator_i aComponentIter = aStudy->GetComponentIterator();
+      for(; aComponentIter.More(); aComponentIter.Next()){
+       SALOMEDS::SComponent_var sco = aComponentIter.Value();
+       // if there is an associated Engine call its method for saving
+       CORBA::String_var IOREngine;
+       try{
+         if(!sco->ComponentIOR(IOREngine)){
+           SALOMEDS::GenericAttribute_var aGeneric;
+           SALOMEDS::AttributeName_var aName;
+           if(sco->FindAttribute(aGeneric, "AttributeName"))
+             aName = SALOMEDS::AttributeName::_narrow(aGeneric);
            
-           if (!sco->ComponentIOR(IOREngine)) {
-             SALOMEDS::GenericAttribute_var aGeneric;
-             SALOMEDS::AttributeName_var aName;
-             if(sco->FindAttribute(aGeneric, "AttributeName"))
-               aName = SALOMEDS::AttributeName::_narrow(aGeneric);
-
-             if (!aName->_is_nil()) {
-               
-               CORBA::String_var aCompType = aName->Value();
-
-               
-               CORBA::String_var aFactoryType;
-               if (strcmp(aCompType, "SUPERV") == 0) aFactoryType = "SuperVisionContainer";
-               else aFactoryType = "FactoryServer";
+           if(!aName->_is_nil()){
+             CORBA::String_var aCompType = aName->Value();
+
+             CORBA::String_var aFactoryType;
+             if(strcmp(aCompType, "SUPERV") == 0) 
+               aFactoryType = "SuperVisionContainer";
+             else
+               aFactoryType = "FactoryServer";
+             
+             Engines::Component_var aComp =
+               SALOME_LifeCycleCORBA(&_name_service).FindOrLoad_Component(aFactoryType, aCompType);
                
+             if(aComp->_is_nil()){
                Engines::Component_var aComp =
-                 SALOME_LifeCycleCORBA(&_name_service).FindOrLoad_Component(aFactoryType, aCompType);
-               
-               if (aComp->_is_nil()) {
-                 Engines::Component_var aComp =
-                   SALOME_LifeCycleCORBA(&_name_service).FindOrLoad_Component("FactoryServerPy", aCompType);
-               }
+                 SALOME_LifeCycleCORBA(&_name_service).FindOrLoad_Component("FactoryServerPy", aCompType);
+             }
                
-               if (!aComp->_is_nil()) {
-                 SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aComp);
-                 if (!CORBA::is_nil(aDriver)) {
-                   SB->LoadWith(sco, aDriver);
-                 }
+             if(!aComp->_is_nil()){
+               SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aComp);
+               if (!CORBA::is_nil(aDriver)) {
+                 SB->LoadWith(sco, aDriver);
                }
              }
            }
-         } catch(...) {
-           MESSAGE("Can not restore information to resave it");
-           return;
          }
+       }catch(...){
+         MESSAGE("Can not restore information to resave it");
+         return;
        }
-
-
+      }
 
       CORBA::String_var anOldName = aStudy->Name();
       aStudy->URL(aUrl);
@@ -739,116 +752,112 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
       hdf_group_datacomponent = new HDFgroup("DATACOMPONENT",hdf_file);
       hdf_group_datacomponent->CreateOnDisk();
 
-      SALOMEDS::SComponentIterator_var itcomponent = aStudy->NewComponentIterator();
-      
       //SRN: Added 17 Nov, 2003
       SALOMEDS::SObject_var anAutoSaveSO = aStudy->FindObjectID(AUTO_SAVE_TAG);
       //SRN: End
 
-      for (; itcomponent->More(); itcomponent->Next())
-       {
-         SALOMEDS::SComponent_var sco = itcomponent->Value();
+      aComponentIter.Init();
+      for(; aComponentIter.More(); aComponentIter.Next()){
+       SALOMEDS::SComponent_var sco = aComponentIter.Value();
          
-         CORBA::String_var scoid = sco->GetID();
-         hdf_sco_group = new HDFgroup(scoid,hdf_group_datacomponent);
-         hdf_sco_group->CreateOnDisk();
-
-         CORBA::String_var componentDataType = sco->ComponentDataType();
-         MESSAGE ( "Look for  an engine for data type :"<< componentDataType);
-
-         //SRN: Added 17 Nov 2003: If there is a specified attribute, the component peforms a special save       
-         if(!CORBA::is_nil(anAutoSaveSO) && SB->IsGUID(sco, AUTO_SAVE_GUID)) {     
-       
-           SALOMEDS::GenericAttribute_var aGeneric;
-           SALOMEDS::AttributeTableOfString_var aTable;
-           if(anAutoSaveSO->FindAttribute(aGeneric, "AttributeTableOfString")) {
-             aTable = SALOMEDS::AttributeTableOfString::_narrow(aGeneric);
-             Standard_Integer nbRows = aTable->GetNbRows(), k, aTimeOut = 0;
-              if(nbRows > 0 && aTable->GetNbColumns() > 1) {   
-
-               SALOMEDS::StringSeq_var aRow;
-               for(k=1; k<=nbRows; k++) {
-                 aRow = aTable->GetRow(k);
-                 if (strcmp(aRow[0], componentDataType) == 0) {
-                   CORBA::String_var anEntry = CORBA::string_dup(aRow[1]);
-                   SALOMEDS::SObject_var aCompSpecificSO = aStudy->FindObjectID(anEntry);
-                   if(!CORBA::is_nil(aCompSpecificSO)) {
-                     SALOMEDS::AttributeInteger_var anInteger;
-                     if(aCompSpecificSO->FindAttribute(aGeneric, "AttributeInteger")) {
-                       anInteger = SALOMEDS::AttributeInteger::_narrow(aGeneric);
-                       anInteger->SetValue(-1);
-                       while(anInteger->Value() < 0) { sleep(2); if(++aTimeOut > AUTO_SAVE_TIME_OUT_IN_SECONDS) break; }
-                     }  // if(aCompSpecificSO->FindAttribute(anInteger, "AttributeInteger"))
-                   }  // if(!CORBA::is_nil(aCompSpecificSO)) 
-                 }  // if (strcmp(aRow[0], componentDataType) == 0)
-               }  // for
-
-             }  // if(nbRows > 0 && aTable->GetNbColumns() > 1)
-
-           }  // if(anAutoSaveSO->FindAttribute(aTable, "AttributeTableOfString")
-
-         }  // if(SB->IsGUID(AUTO_SAVE_GUID)
-
-         //SRN: End
-
-         CORBA::String_var IOREngine;
-         if (sco->ComponentIOR(IOREngine))
-           {
-             // we have found the associated engine to write the data 
-             MESSAGE ( "We have found an engine for data type :"<< componentDataType);
-             CORBA::Object_var obj = _orb->string_to_object(IOREngine);
-             SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
+       CORBA::String_var scoid = sco->GetID();
+       hdf_sco_group = new HDFgroup(scoid,hdf_group_datacomponent);
+       hdf_sco_group->CreateOnDisk();
+       
+       CORBA::String_var componentDataType = sco->ComponentDataType();
+       MESSAGE ( "Look for  an engine for data type :"<< componentDataType);
+       
+       //SRN: Added 17 Nov 2003: If there is a specified attribute, the component peforms a special save         
+       if(!CORBA::is_nil(anAutoSaveSO) && SB->IsGUID(sco, AUTO_SAVE_GUID)){        
+         SALOMEDS::GenericAttribute_var aGeneric;
+         SALOMEDS::AttributeTableOfString_var aTable;
+         if(anAutoSaveSO->FindAttribute(aGeneric, "AttributeTableOfString")){
+           aTable = SALOMEDS::AttributeTableOfString::_narrow(aGeneric);
+           Standard_Integer nbRows = aTable->GetNbRows(), k, aTimeOut = 0;
+           if(nbRows > 0 && aTable->GetNbColumns() > 1) {      
+             SALOMEDS::StringSeq_var aRow;
+             for(k=1; k<=nbRows; k++){
+               aRow = aTable->GetRow(k);
+               if(strcmp(aRow[0], componentDataType) == 0){
+                 CORBA::String_var anEntry = CORBA::string_dup(aRow[1]);
+                 SALOMEDS::SObject_var aCompSpecificSO = aStudy->FindObjectID(anEntry);
+                 if(!CORBA::is_nil(aCompSpecificSO)) {
+                   SALOMEDS::AttributeInteger_var anInteger;
+                   if(aCompSpecificSO->FindAttribute(aGeneric, "AttributeInteger")) {
+                     anInteger = SALOMEDS::AttributeInteger::_narrow(aGeneric);
+                     anInteger->SetValue(-1);
+                     while(anInteger->Value() < 0) { sleep(2); if(++aTimeOut > AUTO_SAVE_TIME_OUT_IN_SECONDS) break; }
+                   }  // if(aCompSpecificSO->FindAttribute(anInteger, "AttributeInteger"))
+                 }  // if(!CORBA::is_nil(aCompSpecificSO)) 
+               }  // if (strcmp(aRow[0], componentDataType) == 0)
+             }  // for
              
-             if (!CORBA::is_nil(Engine))
-               {
-                 MESSAGE ( "Save the data of type:"<< componentDataType);
-                 MESSAGE("Engine :"<<Engine->ComponentDataType());
-
-                 SALOMEDS::TMPFile_var aStream;
-
-                  if (theASCII) aStream = Engine->SaveASCII(sco,SALOMEDS_Tool::GetDirFromPath(aUrl).c_str(),theMultiFile);
-                 else aStream = Engine->Save(sco,SALOMEDS_Tool::GetDirFromPath(aUrl).c_str(),theMultiFile);
-
-                 HDFdataset *hdf_dataset;
-                 hdf_size aHDFSize[1];
-                 if(aStream->length() > 0) {  //The component saved some auxiliary files, then put them into HDF file 
-
-                   aHDFSize[0] = aStream->length();
-                     
-                   HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group, HDF_STRING, aHDFSize, 1);
-                   hdf_dataset->CreateOnDisk();
-                   hdf_dataset->WriteOnDisk((unsigned char*) &aStream[0]);  //Save the stream in the HDF file
-                   hdf_dataset->CloseOnDisk();
-                 }
-                 // store multifile state
-                 aHDFSize[0] = 2;
-                 hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1);
-                 hdf_dataset->CreateOnDisk();
-                 hdf_dataset->WriteOnDisk((void*)(theMultiFile?"M":"S")); // save: multi or single
-                 hdf_dataset->CloseOnDisk();
-                 hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor                
-
-                 // store ASCII state
-                 aHDFSize[0] = 2;
-                 hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1);
-                 hdf_dataset->CreateOnDisk();
-                 hdf_dataset->WriteOnDisk((void*)(theASCII?"A":"B")); // save: ASCII or BINARY
-                 hdf_dataset->CloseOnDisk();
-                 hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor                
-
-                 Translate_IOR_to_persistentID (aStudy,SB,sco,Engine,theMultiFile, theASCII);
-                 MESSAGE("After Translate_IOR_to_persistentID");
-                 
-                 // Creation of the persistance reference  attribute
-               }
+           }  // if(nbRows > 0 && aTable->GetNbColumns() > 1)
+           
+         }  // if(anAutoSaveSO->FindAttribute(aTable, "AttributeTableOfString")
+         
+       }  // if(SB->IsGUID(AUTO_SAVE_GUID)
+       
+       //SRN: End
+       
+       CORBA::String_var IOREngine;
+       if(sco->ComponentIOR(IOREngine)){
+         // we have found the associated engine to write the data 
+         MESSAGE ( "We have found an engine for data type :"<< componentDataType);
+         CORBA::Object_var obj = _orb->string_to_object(IOREngine);
+         SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
+         
+         if(!CORBA::is_nil(Engine)){
+           MESSAGE ( "Save the data of type:"<< componentDataType);
+           MESSAGE("Engine :"<<Engine->ComponentDataType());
+           
+           SALOMEDS::TMPFile_var aStream;
+           
+           if(theASCII) 
+             aStream = Engine->SaveASCII(sco,SALOMEDS_Tool::GetDirFromPath(aUrl).c_str(),theMultiFile);
+           else
+             aStream = Engine->Save(sco,SALOMEDS_Tool::GetDirFromPath(aUrl).c_str(),theMultiFile);
+
+           HDFdataset *hdf_dataset;
+           hdf_size aHDFSize[1];
+           if(aStream->length() > 0){  //The component saved some auxiliary files, then put them into HDF file 
+             
+             aHDFSize[0] = aStream->length();
+             
+             HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group, HDF_STRING, aHDFSize, 1);
+             hdf_dataset->CreateOnDisk();
+             hdf_dataset->WriteOnDisk((unsigned char*) &aStream[0]);  //Save the stream in the HDF file
+             hdf_dataset->CloseOnDisk();
            }
-         hdf_sco_group->CloseOnDisk();
-         hdf_sco_group=0; // will be deleted by hdf_group_datacomponent destructor
+           // store multifile state
+           aHDFSize[0] = 2;
+           hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1);
+           hdf_dataset->CreateOnDisk();
+           hdf_dataset->WriteOnDisk((void*)(theMultiFile?"M":"S")); // save: multi or single
+           hdf_dataset->CloseOnDisk();
+           hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor              
+           
+           // store ASCII state
+           aHDFSize[0] = 2;
+           hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1);
+           hdf_dataset->CreateOnDisk();
+           hdf_dataset->WriteOnDisk((void*)(theASCII?"A":"B")); // save: ASCII or BINARY
+           hdf_dataset->CloseOnDisk();
+           hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor              
+           
+           Translate_IOR_to_persistentID(aStudy,SB,sco,Engine,theMultiFile, theASCII);
+           MESSAGE("After Translate_IOR_to_persistentID");
+                 
+           // Creation of the persistance reference  attribute
+         }
        }
+       hdf_sco_group->CloseOnDisk();
+       hdf_sco_group=0; // will be deleted by hdf_group_datacomponent destructor
+      }
       hdf_group_datacomponent->CloseOnDisk();
       hdf_group_datacomponent =0;  // will be deleted by hdf_file destructor
-
-
+      
+      
       //-----------------------------------------------------------------------
       //3 - Write the Study Structure
       //-----------------------------------------------------------------------
@@ -856,36 +865,35 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
       hdf_group_study_structure->CreateOnDisk();
 
       // save component attributes
-      SALOMEDS::SComponentIterator_var itcomp = aStudy->NewComponentIterator();
-      for (; itcomp->More(); itcomp->Next()) 
-       {
-         SALOMEDS::SComponent_var SC = itcomp->Value();
-         
-         CORBA::String_var scid = SC->GetID();
-         hdf_sco_group2 = new HDFgroup(scid,hdf_group_study_structure);
-         hdf_sco_group2->CreateOnDisk();
-          SaveAttributes(SC, hdf_sco_group2);
-         // ComponentDataType treatment
-         CORBA::String_var component_name = SC->ComponentDataType();
-         MESSAGE("Component data type " << component_name << " treated");
-         
-         name_len = (hdf_int32) strlen(component_name.in());
-         size[0] = name_len +1 ; 
-         hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1);
-         hdf_dataset->CreateOnDisk();
-         hdf_dataset->WriteOnDisk(const_cast<char*>(component_name.in()));
-         MESSAGE("component name " <<  component_name << " wrote on file");
-         hdf_dataset->CloseOnDisk();
-         hdf_dataset=0; //will be deleted by hdf_sco_group destructor
-         _SaveObject(aStudy, SC, hdf_sco_group2);
-         hdf_sco_group2->CloseOnDisk();
-         hdf_sco_group2=0; // will be deleted by hdf_group_study_structure destructor
-       }
+      aComponentIter.Init();
+      for(; aComponentIter.More(); aComponentIter.Next()){
+       SALOMEDS::SComponent_var SC = aComponentIter.Value();
+       
+       CORBA::String_var scid = SC->GetID();
+       hdf_sco_group2 = new HDFgroup(scid,hdf_group_study_structure);
+       hdf_sco_group2->CreateOnDisk();
+       SaveAttributes(SC, hdf_sco_group2);
+       // ComponentDataType treatment
+       CORBA::String_var component_name = SC->ComponentDataType();
+       MESSAGE("Component data type " << component_name << " treated");
+       
+       name_len = (hdf_int32) strlen(component_name.in());
+       size[0] = name_len +1 ; 
+       hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1);
+       hdf_dataset->CreateOnDisk();
+       hdf_dataset->WriteOnDisk(const_cast<char*>(component_name.in()));
+       MESSAGE("component name " <<  component_name << " wrote on file");
+       hdf_dataset->CloseOnDisk();
+       hdf_dataset=0; //will be deleted by hdf_sco_group destructor
+       _SaveObject(aStudy, SC, hdf_sco_group2);
+       hdf_sco_group2->CloseOnDisk();
+       hdf_sco_group2=0; // will be deleted by hdf_group_study_structure destructor
+      }
       //-----------------------------------------------------------------------
       //4 - Write the Study UseCases Structure
       //-----------------------------------------------------------------------
       SALOMEDS::SObject_var aSO = aStudy->FindObjectID(USE_CASE_LABEL_ID);
-      if (!aSO->_is_nil()) {
+      if(!aSO->_is_nil()){
        HDFgroup *hdf_soo_group = new HDFgroup(USE_CASE_LABEL_ID,hdf_group_study_structure);
        hdf_soo_group->CreateOnDisk();
        SaveAttributes(aSO, hdf_soo_group);
@@ -895,7 +903,8 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
        hdf_soo_group=0; // will be deleted by hdf_group_study_structure destructor
       }
 
-      if (aLocked) aStudy->GetProperties()->SetLocked(true);
+      if (aLocked) 
+       aStudy->GetProperties()->SetLocked(true);
       //-----------------------------------------------------------------------
       //5 - Write the Study Properties
       //-----------------------------------------------------------------------
@@ -916,18 +925,17 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
 
       _name_service.Change_Directory("/Study");
       _name_service.Destroy_Name(anOldName);
-      _name_service.Register(aStudy, aStudy->Name());
+      _name_service.Register(theStudy, aStudy->Name());
 
       aStudy->IsSaved(true);
       hdf_group_study_structure =0; // will be deleted by hdf_file destructor
       delete hdf_file; // recursively deletes all hdf objects...
+    }catch(HDFexception){
+      MESSAGE( "HDFexception ! " );
     }
-  catch (HDFexception)
-    {
-      MESSAGE( "HDFexception ! " )
+    if(theASCII){ // save file in ASCII format
+      HDFascii::ConvertFromHDFToASCII(aUrl, true);
     }
-  if (theASCII) { // save file in ASCII format
-    HDFascii::ConvertFromHDFToASCII(aUrl, true);
   }
 }
 
@@ -936,8 +944,8 @@ void SALOMEDS_StudyManager_i::_SaveAs(const char* aUrl,
  *  Purpose  :
  */
 //============================================================================
-void SALOMEDS_StudyManager_i::_SaveObject(SALOMEDS::Study_ptr aStudy, 
-                                         SALOMEDS::SObject_ptr SC
+void SALOMEDS_StudyManager_i::_SaveObject(SALOMEDS_Study_i* theStudy, 
+                                         SALOMEDS::SObject_ptr theSObject
                                          HDFgroup *hdf_group_datatype)
 {
   // Write in group hdf_group_datatype all informations of SObject SC
@@ -945,36 +953,37 @@ void SALOMEDS_StudyManager_i::_SaveObject(SALOMEDS::Study_ptr aStudy,
   SALOMEDS::SObject_var RefSO;
   HDFgroup *hdf_group_sobject = 0;
 
-  SALOMEDS::ChildIterator_var itchild = aStudy->NewChildIterator(SC);
-  for (; itchild->More(); itchild->Next()) 
-    {
-      SALOMEDS::SObject_var SO = itchild->Value();
-
-      // mpv: don't save empty labels
-      if (SO->GetAllAttributes()->length() == 0 && !SO->ReferencedObject(RefSO)) {
-       SALOMEDS::ChildIterator_var subchild = aStudy->NewChildIterator(SC);
-       if (!subchild->More()) {
-         continue;
-       }
-       subchild->InitEx(true);
-       bool anEmpty = true;
-       for (; subchild->More() && anEmpty; subchild->Next()) 
-         if (subchild->Value()->GetAllAttributes()->length() != 0 ||
-              subchild->Value()->ReferencedObject(RefSO)) anEmpty = false;
-       if (anEmpty) {
-         continue;
-       }
+  SALOMEDS_ChildIterator_i aChildIter = theStudy->GetChildIterator(theSObject);
+  for(; aChildIter.More(); aChildIter.Next()){
+    SALOMEDS::SObject_var aSObject = aChildIter.Value();
+    SALOMEDS::ListOfAttributes_var anAllAttributes = aSObject->GetAllAttributes();
+    
+    // mpv: don't save empty labels
+    if(anAllAttributes->length() == 0 && !aSObject->ReferencedObject(RefSO)){
+      SALOMEDS_ChildIterator_i aSubChildIter = theStudy->GetChildIterator(theSObject);
+      if(!aSubChildIter.More())
+       continue;
+
+      aSubChildIter.InitEx(true);
+      bool anEmpty = true;
+      for(; aSubChildIter.More() && anEmpty; aSubChildIter.Next()){
+       SALOMEDS::SObject_var aSObj = aSubChildIter.Value();
+       SALOMEDS::ListOfAttributes_var anAllAttr = aSObj->GetAllAttributes();
+       if(anAllAttr->length() != 0 || aSObj->ReferencedObject(RefSO)) 
+         anEmpty = false;
       }
-
-      CORBA::String_var scoid(SO->GetID());
-      hdf_group_sobject = new HDFgroup(scoid,hdf_group_datatype);
-      hdf_group_sobject->CreateOnDisk();
-      SaveAttributes(SO, hdf_group_sobject);
-      _SaveObject(aStudy,SO, hdf_group_sobject);
-      hdf_group_sobject->CloseOnDisk();
-      hdf_group_sobject =0; // will be deleted by father hdf object destructor
-
+      if(anEmpty)
+       continue;
     }
+
+    CORBA::String_var scoid(aSObject->GetID());
+    hdf_group_sobject = new HDFgroup(scoid,hdf_group_datatype);
+    hdf_group_sobject->CreateOnDisk();
+    SaveAttributes(aSObject, hdf_group_sobject);
+    _SaveObject(theStudy,aSObject, hdf_group_sobject);
+    hdf_group_sobject->CloseOnDisk();
+    hdf_group_sobject =0; // will be deleted by father hdf object destructor
+  }
 }
 
 //============================================================================
index 7b11df5ef50a226b62f88858c04b485411fb05bc..a6e4c9e6cb748880cb0603ead29b89cdb3090187 100644 (file)
@@ -87,13 +87,13 @@ private:
                       CORBA::Boolean theMultiFile,
                       CORBA::Boolean theASCII);
   // _SaveObject private function called by _SaveAs
-  virtual void _SaveObject(SALOMEDS::Study_ptr aStudy, 
-                          SALOMEDS::SObject_ptr SC, 
-                          HDFgroup *hdf_group_datatype);
+  void _SaveObject(SALOMEDS_Study_i* theStudy, 
+                  SALOMEDS::SObject_ptr SC, 
+                  HDFgroup *hdf_group_datatype);
   // _SubstituteSlash function called by Open and GetStudyByName
   virtual std::string _SubstituteSlash(const char *aUrl);
 
-  virtual void _SaveProperties(SALOMEDS::Study_ptr aStudy, HDFgroup *hdf_group);
+  void _SaveProperties(SALOMEDS_Study_i* theStudy, HDFgroup *hdf_group);
 
 public:
   //! standard constructor
@@ -106,6 +106,8 @@ public:
 
   PortableServer::POA_var GetPOA() const { return _poa; }
 
+  SALOMEDS_Study_i* DownCast(SALOMEDS::Study_ptr theStudy) const;
+
  //! method to Register study Manager in the naming service
   /*!
     \param char* arguments, the context to register the study manager in the NS
index 9345988002fe8e82905ff5da059c27f7be3da5f9..1f8e0aa75067bc52597819a1a6e0a3bb702dd13a 100644 (file)
@@ -162,6 +162,19 @@ PortableServer::POA_var SALOMEDS_Study_i::GetPOA() const
   return _StudyManager->GetPOA();
 }
 
+
+SALOMEDS_SObject_i* 
+SALOMEDS_Study_i::DownCast(SALOMEDS::SObject_ptr theSObject) const
+{
+  if(!CORBA::is_nil(theSObject)){
+    PortableServer::POA_var aPOA = GetPOA();
+    PortableServer::ServantBase_var aServant = SALOMEDS::GetServant(theSObject,aPOA);
+    if(aServant.in())
+      return dynamic_cast<SALOMEDS_SObject_i*>(aServant.in());
+  }
+  return NULL;
+}
+
 //============================================================================
 /*! Function : SetOnAddSObject
  *  Purpose  : 
@@ -443,14 +456,18 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectIOR(const char* theObjectIOR)
 {
   // firstly searching in the datamap for optimization
   char* anIOR = const_cast<char*>(theObjectIOR);
-  if (myIORLabels.IsBound(anIOR)) {
-    SALOMEDS::SObject_var aResult = SALOMEDS_SObject_i::NewRef(this,myIORLabels.Find(anIOR));
+  if(myIORLabels.IsBound(anIOR)){
+    TDF_Label aLabel = myIORLabels.Find(anIOR);
+    TSObjectHolder aSObjectHolder = SALOMEDS_SObject_i::New(this,aLabel);
+    SALOMEDS_SObject_i* aSObjectPtr = aSObjectHolder.first;
+    SALOMEDS::SObject_var aSObject = aSObjectHolder.second;
     // 11 oct 2002: forbidden attributes must be checked here
     SALOMEDS::GenericAttribute_var anAttr;
-    if (!aResult->FindAttribute(anAttr,"AttributeIOR")) {
+    if(!aSObjectPtr->FindAttribute(anAttr,"AttributeIOR")){
       myIORLabels.UnBind(anIOR);
-    } else 
-      return aResult._retn();
+    }else{
+      return aSObject._retn();
+    }
   }
 
   // Iterate to all components defined in the study
@@ -782,29 +799,43 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theCont
  *  Purpose  : Create a ChildIterator from an SObject
  */
 //============================================================================
-SALOMEDS::ChildIterator_ptr SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject_ptr aSO)
+SALOMEDS::ChildIterator_ptr 
+SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject_ptr theSObject)
 {
-  //Convert aSO->GetID in TDF_Label.
-  TDF_Label Lab;
-  TDF_Tool::Label(_doc->GetData(), aSO->GetID(), Lab);
+  SALOMEDS_ChildIterator_i* aServant = 
+    new SALOMEDS_ChildIterator_i(GetChildIterator(theSObject));
 
-  //Create iterator
-  SALOMEDS_ChildIterator_i* aServant = new SALOMEDS_ChildIterator_i(this,Lab);
   return aServant->_this();
 }
 
+SALOMEDS_ChildIterator_i 
+SALOMEDS_Study_i::GetChildIterator(SALOMEDS::SObject_ptr theSObject)
+{
+  TDF_Label aLab;
+  TDF_Tool::Label(_doc->GetData(),theSObject->GetID(),aLab);
+  return SALOMEDS_ChildIterator_i(this,aLab);
+}
 
 //============================================================================
 /*! Function : NewComponentIterator
  *  Purpose  : Create a SComponentIterator
  */
 //============================================================================
-SALOMEDS::SComponentIterator_ptr SALOMEDS_Study_i::NewComponentIterator()
+SALOMEDS::SComponentIterator_ptr 
+SALOMEDS_Study_i::NewComponentIterator()
 {
-  SALOMEDS_SComponentIterator_i* aServant = new SALOMEDS_SComponentIterator_i(this,_doc);
+  SALOMEDS_SComponentIterator_i* aServant = 
+    new SALOMEDS_SComponentIterator_i(GetComponentIterator());
+
   return aServant->_this();
 }
 
+SALOMEDS_SComponentIterator_i 
+SALOMEDS_Study_i::GetComponentIterator()
+{
+  return SALOMEDS_SComponentIterator_i(this,_doc);
+}
+
 //============================================================================
 /*! Function : GetUseCaseBuilder
  *  Purpose  : Returns a UseCase builder
@@ -820,9 +851,14 @@ SALOMEDS::UseCaseBuilder_ptr SALOMEDS_Study_i::GetUseCaseBuilder()
  *  Purpose  : Create a StudyBuilder
  */
 //============================================================================
+SALOMEDS_StudyBuilder_i* SALOMEDS_Study_i::GetBuilder()
+{
+  return _Builder;
+}
 SALOMEDS::StudyBuilder_ptr SALOMEDS_Study_i::NewBuilder()
 {
-  return _Builder->_this();
+  return GetBuilder()->_this();
 }
  
 //============================================================================
@@ -994,25 +1030,11 @@ void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR,const char* anEntry)
   myIORLabels.Bind(TCollection_ExtendedString(IOR), aLabel);
 }
 
-SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb) {
-  Handle(SALOMEDS_IORAttribute) Att;
-  if (theLabel.Root().FindAttribute(SALOMEDS_IORAttribute::GetID(),Att)){
-    char* IOR = CORBA::string_dup(TCollection_AsciiString(Att->Get()).ToCString());
-    CORBA::Object_var obj = orb->string_to_object(IOR);
-    SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ;
-    ASSERT(!CORBA::is_nil(aStudy));
-    return SALOMEDS::Study::_duplicate(aStudy);
-  } else {
-    MESSAGE("GetStudy: Problem to get study");
-  }
-  return SALOMEDS::Study::_nil();
-}
-
-void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute, CORBA::ORB_ptr orb) {
+void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute) {
   TCollection_AsciiString aString;
-  TDF_Tool::Entry(theAttribute->Label(), aString);
-  GetStudy(theAttribute->Label(), orb)->UpdateIORLabelMap(TCollection_AsciiString(theAttribute->Get()).ToCString(),
-                                                         aString.ToCString());
+  TDF_Tool::Entry(theAttribute->Label(),aString);
+  TCollection_AsciiString aValue(theAttribute->Get());
+  UpdateIORLabelMap(aValue.ToCString(),aString.ToCString());
 }
 
 SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindDependances(SALOMEDS::SObject_ptr anObject) {
@@ -1026,9 +1048,12 @@ SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindDependances(SALOMEDS::SObj
 }
 
 
-SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties() {
-  SALOMEDS::GenericAttribute_ptr anAttr =  NewBuilder()->FindOrCreateAttribute(FindObjectID("0:1"),
-                                                                              "AttributeStudyProperties");
+SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties(){
+  SALOMEDS::SObject_var aSObject = FindObjectID("0:1");
+
+  SALOMEDS::GenericAttribute_var anAttr =  
+    GetBuilder()->FindOrCreateAttribute(aSObject,"AttributeStudyProperties");
+
   return SALOMEDS::AttributeStudyProperties::_narrow(anAttr);
 }
 
@@ -1111,7 +1136,7 @@ void SALOMEDS_Study_i::Close()
  */
  //============================================================================
 void SALOMEDS_Study_i::AddPostponed(const char* theIOR) {
-  if (!NewBuilder()->HasOpenCommand()) return;
+  if (!GetBuilder()->HasOpenCommand()) return;
   try {
     CORBA::Object_var obj = GetORB()->string_to_object(theIOR);
     if (!CORBA::is_nil(obj)) {
@@ -1127,7 +1152,7 @@ void SALOMEDS_Study_i::AddPostponed(const char* theIOR) {
 }
 
 void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR) {
-  if (!NewBuilder()->HasOpenCommand()) return;
+  if (!GetBuilder()->HasOpenCommand()) return;
   try {
     CORBA::Object_var obj = GetORB()->string_to_object(theIOR);
     if (!CORBA::is_nil(obj)) {
index bbb151bab04ff7965017292d30b06ac7ee5c6a40..18b9ef8fbc2cbbdb74eb7b0205374440bcc3d092 100644 (file)
@@ -49,6 +49,9 @@
 #include "SALOMEDS_DataMapStringLabel.hxx"
 #include "SALOMEDS_IORAttribute.hxx"
 
+#include "SALOMEDS_SComponentIterator_i.hxx"
+#include "SALOMEDS_ChildIterator_i.hxx"
+
 class SALOMEDS_StudyManager_i;
 class SALOMEDS_UseCaseBuilder_i;
 class SALOMEDS_StudyBuilder_i;
@@ -82,7 +85,9 @@ public:
   CORBA::ORB_var GetORB() const;
 
   PortableServer::POA_var GetPOA() const;
-  
+
+  SALOMEDS_SObject_i* DownCast(SALOMEDS::SObject_ptr theSObject) const;
+
   SALOMEDS::Callback_ptr SetOnAddSObject(SALOMEDS::Callback_ptr theCallback);
 
   SALOMEDS::Callback_ptr SetOnRemoveSObject(SALOMEDS::Callback_ptr theCallback);
@@ -220,17 +225,20 @@ public:
     \return ChildIterator_ptr arguments, the created ChildIterator
   */  
   virtual SALOMEDS::ChildIterator_ptr NewChildIterator(SALOMEDS::SObject_ptr aSO);
+  SALOMEDS_ChildIterator_i GetChildIterator(SALOMEDS::SObject_ptr theSObject);
 
   //! method to Create a SComponentIterator 
   /*!
     \return SComponentIterator_ptr arguments, the created SComponentIterator
   */  
   virtual SALOMEDS::SComponentIterator_ptr NewComponentIterator();
+  SALOMEDS_SComponentIterator_i GetComponentIterator();
 
   //! method to Create a StudyBuilder
   /*!
     \return StudyBuilder_ptr arguments, the created StudyBuilder
   */  
+  SALOMEDS_StudyBuilder_i* GetBuilder();
   virtual SALOMEDS::StudyBuilder_ptr NewBuilder();
  
   //! method to get study name
@@ -278,9 +286,7 @@ public:
   virtual CORBA::Short StudyId();
   virtual void  StudyId(CORBA::Short id);
 
-  static SALOMEDS::Study_ptr GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb);
-
-  static void IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute, CORBA::ORB_ptr orb);
+  void IORUpdated(const Handle(SALOMEDS_IORAttribute) theAttribute);
 
   virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
   
index 6b3b993b98bce684b800891fa58b82b86925ca39..a4695f62bf2fa7231773d973157558d4fc9e6bff 100644 (file)
@@ -20,7 +20,7 @@ msgstr ""
 #---------------
 
 msgid "INF_VERSION"
-msgstr "Version 2.1.0"
+msgstr "Version 2.2.0"
 
 msgid "INF_COPYRIGHT"
 msgstr "Copyright (C) 2003-2004 OPEN CASCADE, EADS/CCR, LIP6,\nCEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS"
@@ -38,8 +38,8 @@ msgstr "salome"
 
 #: QAD_Application.cxx:133
 msgid "QAD_Application::APP_DEFAULTTITLE"
-msgstr "SALOME 2.1.0"
+msgstr "SALOME 2.2.0"
 
 #: QAD_Desktop.cxx:424
 msgid "QAD_Desktop::DESK_DEFAULTTITLE"
-msgstr "SALOME 2.1.0"
+msgstr "SALOME 2.2.0"
index f3d426d18d24633015ac993cd35a94f151986899..d3acbc362e7ce15c251fab2e8f125528c97e74ca 100644 (file)
@@ -218,6 +218,7 @@ LIB_CLIENT_IDL = SALOMEDS.idl \
                  SALOMEDS_Attributes.idl \
                 SALOME_ModuleCatalog.idl \
                 SALOME_Component.idl \
+                SALOME_ContainerManager.idl \
                 SALOME_Exception.idl
 
 CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES)
index 199381a547aec1c97baca02d3585a2f4ce0eb045..d54652baab1c943970ab2425ad67204871b49287 100644 (file)
@@ -253,6 +253,16 @@ int PyInterp_base::run(const char *command)
       _atFirst = false;
       return ret;
     }
+    ret = simpleRun("from salome import salome_init");
+    if (ret) { 
+      _atFirst = false;
+      return ret;
+    }
+    ret = simpleRun("salome_init()");
+    if (ret) { 
+      _atFirst = false;
+      return ret;
+    }
     ret = simpleRun("import salome");
     if (ret) { 
       _atFirst = false;
index 8d2beb1d55106531213902af2129b8f1f5d5fa61..7894a23c02dcdfd1a908141e9e0ad337af6ede74 100644 (file)
@@ -47,6 +47,8 @@ LIB = libSALOMELocalTrace.la
 LIB_SRC = LocalTraceCollector.cxx \
          LocalTraceBufferPool.cxx
 
-LDFLAGS+= 
+LIBS= @LIBS@ 
+#LDFLAGS+= 
+
 
 @CONCLUDE@
index f99d2e4ed6ab488c201eea7a1a32b897e6873960..9b8cf7e33cb26f7e68552d44dacc8c47cf9cd5fc 100644 (file)
@@ -41,6 +41,7 @@ LIB_SRC = SalomePy.cxx
 
 LIB_CLIENT_IDL = SALOMEDS.idl \
                  SALOMEDS_Attributes.idl \
+                SALOME_ContainerManager.idl \
                 SALOME_Exception.idl
 
 CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) -DHAVE_CONFIG_H
index 7c1de51a1d385650d549891ef80a05b961d98177..6797d4dbf28384b5ed16f8f555535438e688bc03 100644 (file)
@@ -47,7 +47,7 @@ LIB_MOC = SALOME_PYQT_GUI.h
 
 EXPORT_SHAREDPYSCRIPTS = SalomePyQt.py
 
-LIB_CLIENT_IDL = SALOME_Exception.idl
+LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_ContainerManager.idl
 
 CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(SIP_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES)
 LIBS+= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(OGL_LIBS)
index 0beae634331c022c0a59c116e6d86ae2f6877734..25ccbfbaa342e9a301fad0966cf8f340dd710ed9 100755 (executable)
@@ -28,5 +28,16 @@ from salome_kernel import *
 from salome_study import *
 from salome_iapp import *
 
-IN_SALOME_GUI=sg.hasDesktop()
+salome_initial=1
+def salome_init():
+    global salome_initial
+    global orb, lcc, naming_service, cm
+    global sg
+    global myStudyManager, myStudyId, myStudy, myStudyName
+    
+    if salome_initial:
+        salome_initial=0
+        orb, lcc, naming_service, cm = salome_kernel_init()
+        sg = salome_iapp_init()
+        myStudyManager, myStudyId, myStudy, myStudyName =salome_study_init()
 
index d89536cffabef537964426ebccc0ae92893cfc9a..33e47811eab3475a0e65bf940d2018213c99947b 100644 (file)
@@ -51,6 +51,16 @@ class SalomeGUI(SALOMEGUI_Swig):
     
     #--------------------------------------------------------------------------
 
-# create an SALOMEGUI_Swig instance
-sg = SalomeGUI()
+salome_iapp_initial = 1
 
+def salome_iapp_init():
+    global salome_iapp_initial
+    global sg,IN_SALOME_GUI
+
+    if salome_iapp_initial:
+        salome_iapp_initial=0
+        
+        # create an SALOMEGUI_Swig instance
+        sg = SalomeGUI()
+        IN_SALOME_GUI=sg.hasDesktop()
+    return sg
index 27c4e58b04464838a75dbf2b3b9bc60ff697399b..93be05fb16ea23a76c916b304a117ca4e4379370 100644 (file)
@@ -28,12 +28,28 @@ from omniORB import CORBA
 from LifeCycleCORBA import *
 from SALOME_NamingServicePy import *
 from SALOME_utilities import *
+import Engines
 
-# initialise the ORB
-orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+salome_kernel_initial=1
 
-# create an LifeCycleCORBA instance
-lcc = LifeCycleCORBA(orb)
+def salome_kernel_init():
+    global salome_kernel_initial
+    global orb, lcc, naming_service, cm
+    
+    if salome_kernel_initial:
+        salome_kernel_initial = 0
+        
+        # initialise the ORB
+        orb = CORBA.ORB_init([''], CORBA.ORB_ID)
 
-#create an naming service instance
-naming_service = SALOME_NamingServicePy_i(orb)
+        # create an LifeCycleCORBA instance
+        lcc = LifeCycleCORBA(orb)
+
+        #create an naming service instance
+        naming_service = SALOME_NamingServicePy_i(orb)
+
+        # get Container Manager
+        obj = naming_service.Resolve('/ContainerManager')
+        cm = obj._narrow(Engines.ContainerManager)
+
+    return orb, lcc, naming_service, cm
index 954830e24641b6a7c638d331529b41e2edb5f2a8..ecc76728c7dd5e92ecff1f50fff10e357c26f7cb 100644 (file)
@@ -24,9 +24,9 @@
 #  Module : SALOME
 #  $Header$
 
-from salome_iapp import sg
-from salome_kernel import *
+import salome_kernel
 import SALOMEDS
+import salome_iapp
 
 #--------------------------------------------------------------------------
 
@@ -106,7 +106,9 @@ salome_study_ID = -1
 
 def getActiveStudy():
     global salome_study_ID
+    
     print "getActiveStudy"
+    sg = salome_iapp.salome_iapp_init()
     if salome_study_ID == -1:
         if sg.hasDesktop():
             print "---in gui"
@@ -132,6 +134,7 @@ def createNewStudy():
             nameAlreadyInUse=0
         else:
             i = i+1
+
     theStudy = myStudyManager.NewStudy(aStudyName)
     theStudyId = theStudy._get_StudyId()
     print aStudyName, theStudyId
@@ -139,17 +142,29 @@ def createNewStudy():
             
     #--------------------------------------------------------------------------
 
-# get Study Manager reference
-print "looking for studyManager ..."
-obj = naming_service.Resolve('myStudyManager')
-myStudyManager = obj._narrow(SALOMEDS.StudyManager)
-print "studyManager found"
-
-# get active study Id, ref and name
-myStudyId = getActiveStudy()
-print "myStudyId",myStudyId
-myStudy = myStudyManager.GetStudyByID(myStudyId)
-myStudyName = myStudy._get_Name()
-
+salome_study_initial = 1
 
+def salome_study_init():
+    global salome_study_initial
+    global myStudyManager, myStudyId, myStudy, myStudyName
+    global orb, lcc, naming_service, cm
+    
+    if salome_study_initial:
+        salome_study_initial = 0
+        
+        orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init()
+        
+        # get Study Manager reference
+        print "looking for studyManager ..."
+        obj = naming_service.Resolve('myStudyManager')
+        myStudyManager = obj._narrow(SALOMEDS.StudyManager)
+        print "studyManager found"
+
+        # get active study Id, ref and name
+        myStudyId = getActiveStudy()
+        print "myStudyId",myStudyId
+        myStudy = myStudyManager.GetStudyByID(myStudyId)
+        myStudyName = myStudy._get_Name()
+
+    return myStudyManager, myStudyId, myStudy, myStudyName
 
index 3edb511e4e4516883d038cda6d42df6053903dee..b108204d715869b8006c540b721a64b16050ee99 100644 (file)
@@ -22,6 +22,7 @@ LIB_MOC =       SUPERVGraph_moc.cxx \
 LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_ModuleCatalog.idl \
                 SALOME_Component.idl \
+                SALOME_ContainerManager.idl \
                 SALOME_Exception.idl
 
 
index 45ce4c82b7ea57224c6bb960a9cc70d5562af5f4..499b7705f0cbfdbebdb7c38a8e51d16556a53612 100644 (file)
@@ -49,12 +49,12 @@ LIB_SRC=\
 BIN = SALOME_Session_Server
 BIN_SRC = 
 BIN_SERVER_IDL = SALOME_Session.idl
-BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOME_Registry.idl SALOME_ModuleCatalog.idl SALOME_Exception.idl
+BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOME_ContainerManager.idl SALOME_Registry.idl SALOME_ModuleCatalog.idl SALOME_Exception.idl
 
 CPPFLAGS+=$(QT_MT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(HDF5_INCLUDES)
 CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+=$(QT_MT_LIBS) $(HDF5_LIBS) -lSalomeHDFPersist -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lPlot2d -lSalomeVTKFilter -lSALOMELocalTrace -lSALOMETraceCollector -lSalomeContainer -lRegistry -lSalomeNotification -lSalomeDS -lTOOLSDS -lSalomeGenericObj -lSalomeCatalog -lEvent -lSalomePrs $(CAS_LDPATH) -lTKBO -lCASCatch
-
+LDFLAGS+=$(QT_MT_LIBS) $(HDF5_LIBS) -lSalomeHDFPersist -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lPlot2d -lSalomeVTKFilter -lSALOMELocalTrace -lSalomeContainer -lRegistry -lSalomeNotification -lSalomeDS -lTOOLSDS -lSalomeGenericObj -lSalomeCatalog -lEvent -lSalomePrs $(CAS_LDPATH) -lTKBO -lCASCatch -lSalomeResourcesManager
+LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
 
 @CONCLUDE@
 
index 82a8c6733661d6212acd001a39b00ef5afe144ef..6b9f4b92e456c4fa0d5533524d721f5874e55881 100644 (file)
@@ -181,6 +181,17 @@ void Session_ServerLauncher::CheckArgs()
 
 void Session_ServerLauncher::ActivateAll()
 {
+  
+  // Always launch ContainerManager
+
+  char** argv = new char* [1];
+  argv[0] = "ContainerManager";
+  Session_SessionThread* aServerThread2
+    = new Session_SessionThread(1, argv, _orb,_root_poa,_GUIMutex,_ServerLaunch);
+  _serverThreads.push_front(aServerThread2);
+
+  aServerThread2->Init();
+
   list<ServArg>::iterator itServ;
   for (itServ = _argServToLaunch.begin(); itServ !=_argServToLaunch.end(); itServ++)
     {
@@ -205,7 +216,7 @@ void Session_ServerLauncher::ActivateAll()
   // Always launch Session Server
 
   int argc=1;
-  char** argv = new char*[argc];
+  argv = new char*[argc];
   argv[0] = "Session";
   Session_SessionThread* aServerThread
     = new Session_SessionThread(argc, argv, _orb,_root_poa,_GUIMutex,_ServerLaunch);
index a4fb054cc63898788ceb807d0c12fe67163b3d0d..9fa3e76afd30117dfd1da03f5eabbaabb062a595 100644 (file)
@@ -33,6 +33,7 @@
 #include "Session_ServerThread.hxx"
 
 #include "SALOME_Container_i.hxx"
+#include "SALOME_ContainerManager.hxx"
 #include "SALOMEDS_StudyManager_i.hxx"
 #include "SALOME_ModuleCatalog_impl.hxx"
 #include "RegistryService.hxx"
 
 using namespace std;
 
-const int Session_ServerThread::NB_SRV_TYP = 5;
+const int Session_ServerThread::NB_SRV_TYP = 6;
 const char* Session_ServerThread::_serverTypes[NB_SRV_TYP] = {"Container",
                                                              "ModuleCatalog",
                                                              "Registry",
                                                              "SALOMEDS",
-                                                             "Session"};
+                                                             "Session",
+                                                              "ContainerManager"};
 
 //=============================================================================
 /*! 
@@ -124,6 +126,7 @@ void Session_ServerThread::Init()
          case 0:  // Container
            {
              NamingService_WaitForServerReadiness(_NS,"/Registry");
+             NamingService_WaitForServerReadiness(_NS,"/ContainerManager");
              ActivateContainer(_argc, _argv);
              break;
            }
@@ -155,6 +158,12 @@ void Session_ServerThread::Init()
              ActivateSession(_argc, _argv);
              break;
            }
+         case 5: // Container Manager
+           {
+             NamingService_WaitForServerReadiness(_NS,"");
+             ActivateContainerManager(_argc, _argv);
+             break;
+           }
          default:
            {
              ASSERT(0);
@@ -324,6 +333,44 @@ void Session_ServerThread::ActivateRegistry(int argc,
  */
 //=============================================================================
 
+void Session_ServerThread::ActivateContainerManager(int argc,
+                                            char ** argv)
+{
+  try
+    {
+      PortableServer::POA_var root_poa=PortableServer::POA::_the_root_poa();
+      cout << "ActivateContainerManager ......!!!! " << endl;
+      SALOME_ContainerManager * myContainer 
+       = new SALOME_ContainerManager(_orb);
+    }
+  catch(CORBA::SystemException&)
+    {
+      INFOS("Caught CORBA::SystemException.");
+    }
+  catch(PortableServer::POA::WrongPolicy&)
+    {
+      INFOS("Caught CORBA::WrongPolicyException.");
+    }
+  catch(PortableServer::POA::ServantAlreadyActive&)
+    {
+      INFOS("Caught CORBA::ServantAlreadyActiveException");
+    }
+  catch(CORBA::Exception&)
+    {
+      INFOS("Caught CORBA::Exception.");
+    }
+  catch(...)
+    {
+      INFOS("Caught unknown exception.");
+    }
+}
+
+//=============================================================================
+/*! 
+ *  
+ */
+//=============================================================================
+
 void Session_ServerThread::ActivateContainer(int argc,
                                             char ** argv)
 {
index e67ee7fe805751a8ff947867bec6d408c51b6fa1..9293cd4d2fea534a73d25b5177919d6abac8a463 100644 (file)
@@ -58,6 +58,8 @@ protected:
                        char ** argv);
   void ActivateContainer(int argc,
                        char ** argv);
+  void ActivateContainerManager(int argc,
+                               char ** argv);
   virtual void ActivateSession(int argc,
                        char ** argv);
 
index 73a914c7f129b2700f886db4d357c150ab462e5b..d41cb372447115944b61bb9d768d29edd2238549 100644 (file)
@@ -51,7 +51,7 @@ LIB_SRC = ToolsGUI.cxx \
 LIB_MOC = ToolsGUI_CatalogGeneratorDlg_moc.cxx
 
 LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl \
-                 SALOME_Component.idl SALOME_Exception.idl 
+                 SALOME_Component.idl SALOME_ContainerManager.idl SALOME_Exception.idl 
 
 # additionnal information to compil and link file
 
index b16797b1f79cb20a82f36d66f7c04801975c76c6..c5b22b104f1f706e98b5f5ade45b54e521f1f37a 100644 (file)
@@ -45,7 +45,8 @@ LIB_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl
 BIN = TestContainer TestLogger
 BIN_SRC = 
 
-LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector
+LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace -lSalomeResourcesManager
+LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector
 
 
 @CONCLUDE@
index 43786ab25d0bb887e7a021e31f92d837e603f84c..f5e06c1ede10c8e3513d604cfd1c0678853131c1 100644 (file)
@@ -69,11 +69,12 @@ LIB_MOC = \
 LIB_CLIENT_IDL = SALOMEDS.idl \
                 SALOME_ModuleCatalog.idl \
                 SALOME_Component.idl \
+                SALOME_ContainerManager.idl \
                 SALOME_Exception.idl
 
 CPPFLAGS+=$(QT_INCLUDES) $(OGL_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES)
 
-LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS) -lSalomePrs -lSalomeGUI
+LDFLAGS+=$(VTK_LIBS) $(OGL_LIBS) $(QT_MT_LIBS) -lSalomePrs -lSalomeGUI -lToolsGUI
 
 @CONCLUDE@