Salome HOME
add a Python function to change the container name to use for GEOM: parametric and...
authorPaul RASCLE <paul.rascle@edf.fr>
Wed, 10 Jul 2019 08:13:18 +0000 (10:13 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Wed, 10 Jul 2019 08:13:18 +0000 (10:13 +0200)
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CalculationCase.h
src/HYDROData/HYDROData_GeomTool.cxx
src/HYDROData/HYDROData_GeomTool.h
src/HYDROPy/HYDROData_CalculationCase.sip

index e6a640f6c8b44ea6435bc97998cee6208fe77e36..80d8592130930abb7b468649139a754cdc926ee5 100755 (executable)
@@ -1290,6 +1290,13 @@ Handle(HYDROData_SplitShapesGroup) HYDROData_CalculationCase::addNewSplitGroup(
   return aNewGroup;
 }
 
+void HYDROData_CalculationCase::SetContainerName( const QString& theContainerName )
+{
+#ifndef LIGHT_MODE
+  HYDROData_GeomTool::SetContainerName( theContainerName );
+#endif
+}
+
 QString HYDROData_CalculationCase::Export() const
 {
 #ifdef LIGHT_MODE
index 5ac3d069d3c1eb32dafee4faf8b8d4afbf69e631..479e49e5a464fe90015494d3fae6b8c6c8c37cb2 100644 (file)
@@ -285,6 +285,13 @@ public:
 
   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetBoundaryPolygons() const;
 
+  /**
+   * \brief Set the Container Name to use when not default (FactoryServer).
+   * \param theContainerName the name of the container used for GEOM 
+   *        (to be used by scripts for distributed execution)
+   */
+  HYDRODATA_EXPORT virtual void SetContainerName( const QString& theContainerName );
+  
   /**
    * Exports the calculation case data (shell and groups) to GEOM module.
    * \return the entry of the GEOM object (empty string in the case of error)
index 23c7b9a86e3d9002c88e94e1f351cf99b1b95a0a..54273a429b2f3f5fd34da10956d4fd479708d088 100644 (file)
@@ -49,6 +49,13 @@ static SALOME_NamingService _NS( _ORB );
 static SALOME_LifeCycleCORBA _LCC( &_NS );
 static SALOMEDS::Study_var _STUDY = SALOMEDS::Study::_nil();
 
+QString HYDROData_GeomTool::myContainerName = "FactoryServer";
+
+void HYDROData_GeomTool::SetContainerName( const QString& theContainerName )
+{
+  myContainerName = theContainerName;
+}
+
 TopoDS_Shape HYDROData_GeomTool::GetShapeFromIOR( const QString& theIOR )
 {
   // Note that GEOMBase::GetShape() cause crash in batch mode
@@ -60,7 +67,7 @@ TopoDS_Shape HYDROData_GeomTool::GetShapeFromIOR( const QString& theIOR )
     GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( aCorbaObj );
 
     Engines::EngineComponent_var aComp =
-      _LCC.FindOrLoad_Component( "FactoryServer", "GEOM" );
+      _LCC.FindOrLoad_Component( myContainerName.toStdString().c_str(), "GEOM" );
     GEOM::GEOM_Gen_var aComponentGeom = GEOM::GEOM_Gen::_narrow( aComp );
 
     aResShape = GEOM_Client::get_client().GetShape( aComponentGeom, aGeomObj );
@@ -71,7 +78,7 @@ TopoDS_Shape HYDROData_GeomTool::GetShapeFromIOR( const QString& theIOR )
 
 GEOM::GEOM_Gen_var HYDROData_GeomTool::GetGeomGen()
 {
-  Engines::EngineComponent_var aComponent = _LCC.FindOrLoad_Component( "FactoryServer", "GEOM" );
+  Engines::EngineComponent_var aComponent = _LCC.FindOrLoad_Component( myContainerName.toStdString().c_str(), "GEOM" );
   GEOM::GEOM_Gen_var aGEOMEngine = GEOM::GEOM_Gen::_narrow( aComponent );
 
   return aGEOMEngine._retn();
index 419c49c6ed6fb21e316b339f95ee08d4b6b34b6e..9f7d85ff25e3bb2b8c093dce80406ffab4d2fa75 100644 (file)
@@ -41,6 +41,13 @@ class HYDRODATA_EXPORT HYDROData_GeomTool {
 
 public:
 
+  /**
+   * \brief Set the Container Name to use when not default (FactoryServer).
+   * \param theContainerName the name of the container used for GEOM 
+   *        (to be used by scripts for distributed execution)
+   */
+  static void SetContainerName( const QString& theContainerName );
+  
   /**
    * \brief Get shape by the specified IOR.
    * \param theIOR the GEOM object IOR
@@ -112,6 +119,8 @@ public:
                                                       const QString& theName,
                                                       QString& theGeomObjEntry);
 
+protected:
+  static QString myContainerName;
 };
 
 #endif
index 10532be631e36330539c1b34b5a726e9cca54832..b46ac06e9fae3f101d947f93f57c42df27666c33 100644 (file)
@@ -374,6 +374,12 @@ public:
    */
   void RemoveSplitGroups();
 
+  /**
+   * \brief Set the Container Name to use when not default (FactoryServer).
+   * \param theContainerName the name of the container used for GEOM 
+   *        (to be used by scripts for distributed execution)
+   */
+  void SetContainerName( const QString& theContainerName );
 
   /**
    * Exports the calculation case data (shell and groups) to GEOM module.