From c3e08942f0996fcd79339b2be486acc0a1dd43c3 Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Wed, 29 Sep 2010 16:07:26 +0000 Subject: [PATCH] Use new SALOME_Parametric types for execution method --- idl/DEVIATION_Gen.idl | 15 +++-------- resources/GENERICSOLVERCatalog.xml.in | 38 ++++++++++++++++++--------- src/GENERICSOLVER/DEVIATION.py | 26 ++++++++++-------- 3 files changed, 43 insertions(+), 36 deletions(-) diff --git a/idl/DEVIATION_Gen.idl b/idl/DEVIATION_Gen.idl index bdeaedd..306406c 100644 --- a/idl/DEVIATION_Gen.idl +++ b/idl/DEVIATION_Gen.idl @@ -25,20 +25,10 @@ #include "SALOME_Component.idl" #include "SALOMEDS.idl" #include "SALOME_Exception.idl" +#include "SALOME_Parametric.idl" module GENERICSOLVER_ORB { - - typedef sequence Value; - typedef sequence VarList; - typedef sequence 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); /** diff --git a/resources/GENERICSOLVERCatalog.xml.in b/resources/GENERICSOLVERCatalog.xml.in index 27b3f0b..620d104 100644 --- a/resources/GENERICSOLVERCatalog.xml.in +++ b/resources/GENERICSOLVERCatalog.xml.in @@ -33,16 +33,28 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + @@ -177,14 +189,14 @@ - inputDesc - GENERICSOLVER_ORB/InputDescription + paramInput + SALOME_Parametric/ParametricInput - outputValues - GENERICSOLVER_ORB/ValueList + paramOutput + SALOME_Parametric/ParametricOutput diff --git a/src/GENERICSOLVER/DEVIATION.py b/src/GENERICSOLVER/DEVIATION.py index 0ab7c8a..369cabb 100644 --- a/src/GENERICSOLVER/DEVIATION.py +++ b/src/GENERICSOLVER/DEVIATION.py @@ -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() -- 2.39.2