]> SALOME platform Git repositories - samples/genericsolver.git/commitdiff
Salome HOME
Use new SALOME_Parametric types for execution method
authorRenaud Barate <renaud.barate@edf.fr>
Wed, 29 Sep 2010 16:07:26 +0000 (16:07 +0000)
committerRenaud Barate <renaud.barate@edf.fr>
Wed, 29 Sep 2010 16:07:26 +0000 (16:07 +0000)
idl/DEVIATION_Gen.idl
resources/GENERICSOLVERCatalog.xml.in
src/GENERICSOLVER/DEVIATION.py

index bdeaeddfe4c0f350178e50e31219bf5f510b9a4d..306406c7ad262b8564fe329bd7cd8e7c122ad47f 100644 (file)
 #include "SALOME_Component.idl"
 #include "SALOMEDS.idl"
 #include "SALOME_Exception.idl"
+#include "SALOME_Parametric.idl"
 
 module GENERICSOLVER_ORB
 {
-
-  typedef sequence<double> Value;
-  typedef sequence<string> VarList;
-  typedef sequence<Value> ValueList;
-
-  struct InputDescription {
-    VarList inputVarList;
-    VarList outputVarList;
-    ValueList inputValues;
-  };
-
   interface DEVIATION_Gen : Engines::Component, SALOMEDS::Driver
   {
 
@@ -69,7 +59,8 @@ module GENERICSOLVER_ORB
      *                      of the output variables.
      * @param outputValues  the result of the computation
      */
-    void Exec(in InputDescription inputDesc, out ValueList outputValues)
+    void Exec(in SALOME_Parametric::ParametricInput paramInput,
+              out SALOME_Parametric::ParametricOutput paramOutput)
       raises (SALOME::SALOME_Exception);
 
     /**
index 27b3f0b941c6c5980ef0dddba01c20d6d58fcbdd..620d104f9a2f16e606cd27e00eec58d2b7ca05d7 100644 (file)
        <type-list>
                <sequence name="Point" content="double"/>
                <objref name="pyobj" id="python:obj:1.0"/>
-
-        <sequence content="double" name="GENERICSOLVER_ORB/Value"></sequence>
-        <sequence content="string" name="GENERICSOLVER_ORB/VarList"></sequence>
-        <sequence content="GENERICSOLVER_ORB/Value" name="GENERICSOLVER_ORB/ValueList"></sequence>
-        <struct name="GENERICSOLVER_ORB/InputDescription">
-            <member type="GENERICSOLVER_ORB/VarList" name="inputVarList"></member>
-            <member type="GENERICSOLVER_ORB/VarList" name="outputVarList"></member>
-            <member type="GENERICSOLVER_ORB/ValueList" name="inputValues"></member>
+        <struct name="SALOME_Parametric/Parameter">
+            <member type="string" name="name"></member>
+            <member type="string" name="value"></member>
+        </struct>
+        <sequence content="SALOME_Parametric/Parameter" name="SALOME_Parametric/ParameterList"></sequence>
+        <sequence content="double" name="Value1D"></sequence>
+        <sequence content="Value1D" name="SALOME_Parametric/Value"></sequence>
+        <sequence content="string" name="SALOME_Parametric/VarList"></sequence>
+        <sequence content="SALOME_Parametric/Value" name="SALOME_Parametric/ValueList"></sequence>
+        <struct name="SALOME_Parametric/ParametricInput">
+            <member type="SALOME_Parametric/VarList" name="inputVarList"></member>
+            <member type="SALOME_Parametric/VarList" name="outputVarList"></member>
+            <member type="SALOME_Parametric/ValueList" name="inputValues"></member>
+            <member type="SALOME_Parametric/ParameterList" name="specificParameters"></member>
+        </struct>
+        <struct name="SALOME_Parametric/ParametricOutput">
+            <member type="SALOME_Parametric/ValueList" name="outputValues"></member>
+            <member type="SALOME_Parametric/ParameterList" name="specificOutputInfos"></member>
+            <member type="long" name="returnCode"></member>
+            <member type="string" name="errorMessage"></member>
         </struct>
-       </type-list>
+    </type-list>
 
        <!-- Component list -->
        <component-list>
                                                <!-- service-connexion -->
                         <inParameter-list>
                             <inParameter>
-                                <inParameter-name>inputDesc</inParameter-name>
-                                <inParameter-type>GENERICSOLVER_ORB/InputDescription</inParameter-type>
+                                <inParameter-name>paramInput</inParameter-name>
+                                <inParameter-type>SALOME_Parametric/ParametricInput</inParameter-type>
                             </inParameter>
                         </inParameter-list>
                         <outParameter-list>
                             <outParameter>
-                                <outParameter-name>outputValues</outParameter-name>
-                                <outParameter-type>GENERICSOLVER_ORB/ValueList</outParameter-type>
+                                <outParameter-name>paramOutput</outParameter-name>
+                                <outParameter-type>SALOME_Parametric/ParametricOutput</outParameter-type>
                             </outParameter>
                         </outParameter-list>
                                        </component-service>
index 0ab7c8a8bcbfaddfc7634016a932f8920d509b53..369cabb06ab204623207bb4fdbdd956f0a3c7c5c 100644 (file)
@@ -29,6 +29,7 @@ import GENERICSOLVER_ORB__POA
 import SALOME_ComponentPy
 import SALOME_DriverPy
 import SALOME
+import SALOME_Parametric
 
 from salome.kernel.logger import Logger
 from salome.kernel import termcolor
@@ -142,32 +143,35 @@ class DEVIATION(GENERICSOLVER_ORB__POA.DEVIATION_Gen,
         except:
             self._raiseSalomeError()
 
-    def Exec(self, inputDesc):
+    def Exec(self, paramInput):
         """
         This method is an example for the execution of a computation component for
         use with OpenTURNS in SALOME 5.1.5 and later (for YACS integration)
         """
         try:
             logger.info("Exec: " + self._containerName + ' ; ' + self._instanceName)
-            logger.debug("inputVarList: %s" % inputDesc.inputVarList)
-            logger.debug("outputVarList: %s" % inputDesc.outputVarList)
-            logger.debug("inputValues: %s" % inputDesc.inputValues)
-            if len(inputDesc.inputValues) != len(inputDesc.inputVarList):
+            logger.debug("inputVarList: %s" % paramInput.inputVarList)
+            logger.debug("outputVarList: %s" % paramInput.outputVarList)
+            logger.debug("inputValues: %s" % paramInput.inputValues)
+            if len(paramInput.inputValues) != len(paramInput.inputVarList):
                 raise Exception("Size mismatch between inputVarList and point to evaluate")
 
             evalPoint = self.deterministicValues
-            for i in range(len(inputDesc.inputVarList)):
-                evalPoint[inputDesc.inputVarList[i]] = inputDesc.inputValues[i][0]
+            for i in range(len(paramInput.inputVarList)):
+                evalPoint[paramInput.inputVarList[i]] = paramInput.inputValues[i][0][0]
             logger.debug("evalPoint = %s" % evalPoint)
 
             resDict = {}
             resDict["dev"] = self.BeamModel(**evalPoint)
 
             outputValues = []
-            for outputVar in inputDesc.outputVarList:
-                outputValues.append([resDict[outputVar]])
-            logger.debug("outputValues: %s" % outputValues)
-            return outputValues
+            for outputVar in paramInput.outputVarList:
+                outputValues.append([[resDict[outputVar]]])
+            logger.debug("paramOutput: %s" % outputValues)
+            return SALOME_Parametric.ParametricOutput(outputValues,
+                                                      specificOutputInfos = [],
+                                                      returnCode = 0,
+                                                      errorMessage = "")
         except:
             self._raiseSalomeError()