Salome HOME
Fix bug when creating JobParameters in Python (due to previous evolutions)
[modules/kernel.git] / src / NamingService / SALOME_NamingService.cxx
index b58acc6611277bf707875c8e3c8719f769c6175c..638fee21eada1792d5ae1b6c3aa13751a4acc6d9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -36,7 +36,7 @@
 #include <string>
 #include <cstdio>
 
-#ifdef WNT
+#ifdef WIN32
 #define strdup _strdup
 #endif
 
@@ -587,48 +587,18 @@ std::string SALOME_NamingService::ContainerName(const char *containerName)
 }
 
 // ============================================================================
-/*! \brief build a container name, given a MachineParameters struct.
+/*! \brief build a container name, given a ContainerParameters struct.
  *
- *  Build a container name with a MachineParameters struct. In case of multi
- *  processor machine, container name is suffixed with _nbproc. nproc equals
- *  (number of nodes)*(number of processor per nodes).
- * \param params struct from which we get container name (may be
- *               empty),  number of nodes and number of processor
- *               per node.
+ *  Build a container name with a ContainerParameters struct. In case of multi
+ *  processor machine, container name is suffixed with number of processors.
+ * \param params struct from which we get container name (may be empty) and
+ *               number of processors.
  * \return a container name without the path.
- * \sa BuildContainerNameForNS(const Engines::MachineParameters& params,
+ * \sa BuildContainerNameForNS(const Engines::ContainerParameters& params,
  *                             const char *hostname)
  */
 // ============================================================================
 
-std::string 
-SALOME_NamingService::ContainerName(const Engines::MachineParameters& params)
-{
-  int nbproc;
-
-  if ( !params.isMPI )
-    nbproc = 0;
-  else if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
-    nbproc = 1;
-  else if ( params.nb_node == 0 )
-    nbproc = params.nb_proc_per_node;
-  else if ( params.nb_proc_per_node == 0 )
-    nbproc = params.nb_node;
-  else
-    nbproc = params.nb_node * params.nb_proc_per_node;
-
-  std::string ret = ContainerName(params.container_name);
-
-  if ( nbproc >= 1 )
-    {
-      char *suffix = new char[8];
-      sprintf(suffix, "_%d", nbproc);
-      ret += suffix;
-    }
-
-  return ret;
-}
-
 std::string 
 SALOME_NamingService::ContainerName(const Engines::ContainerParameters& params)
 {
@@ -690,19 +660,6 @@ std::string SALOME_NamingService::BuildContainerNameForNS(const char *containerN
  */
 // ============================================================================
 
-std::string
-SALOME_NamingService::
-BuildContainerNameForNS(const Engines::MachineParameters& params,
-                        const char *hostname)
-{
-  std::string ret = "/Containers/";
-  ret += hostname;
-  ret += "/";
-  ret += ContainerName(params);
-
-  return ret;
-}
-
 std::string
 SALOME_NamingService::
 BuildContainerNameForNS(const Engines::ContainerParameters& params,