#!/usr/bin/env python
#
-# Copyright (C) 2009-2011 EDF R&D
+# Copyright (C) 2009-2013 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
prerequisites_script_path = "/path/to/prerequisites.sh"
kernel_path = "/path/to/KERNEL_install"
openturns_module_path = "/path/to/OPENTURNS_install"
+eficas_module_path = "/path/to/EFICAS_install"
c1 = PYComponent("EXAMPLE_COMPONENT",
services=[
Service("Exec",
inport=[("paramInput", "SALOME_TYPES/ParametricInput"),],
outport=[("paramOutput", "SALOME_TYPES/ParametricOutput")],
- defs = "import SALOME_TYPES",
+ defs = "from salome.kernel.parametric.compo_utils import \
+ create_input_dict, create_normal_parametric_output, create_error_parametric_output",
body="""
-# This section creates the point to evaluate "evalPoint"
-evalPoint = self.deterministicValues
-for i in range(len(paramInput.inputVarList)):
- evalPoint[paramInput.inputVarList[i]] = paramInput.inputValues[i][0][0]
+# This section creates the point to evaluate "inputDict"
+inputDict = create_input_dict(self.deterministicValues, paramInput)
# This section should be modified according to your needs (it's the evaluation itself)
-if evalPoint["L"] <= 0: # Test for an invalid parameter and return an error in this case
- paramOutput = SALOME_TYPES.ParametricOutput(
- outputValues = [],
- specificOutputInfos = [],
- returnCode = 1,
- errorMessage = "Invalid value: L must be positive")
+if inputDict["L"] <= 0: # Test for an invalid parameter and return an error in this case
+ paramOutput = create_error_parametric_output("Invalid value: L must be positive")
else:
- resDict = {}
- resDict["dev"] = (evalPoint["F"] * evalPoint["L"] * evalPoint["L"] * evalPoint["L"]) / \
- (3. * evalPoint["E"] * evalPoint["I"])
+ outputDict = {}
+ outputDict["dev"] = (inputDict["F"] * inputDict["L"] * inputDict["L"] * inputDict["L"]) / \
+ (3. * inputDict["E"] * inputDict["I"])
# This section builds the returned object
- outputValues = []
- for outputVar in paramInput.outputVarList:
- outputValues.append([[resDict[outputVar]]])
- paramOutput = SALOME_TYPES.ParametricOutput(outputValues,
- specificOutputInfos = [],
- returnCode = 0,
- errorMessage = "")
+ paramOutput = create_normal_parametric_output(outputDict, paramInput)
""",
),
Service("Finalize"),
+ Service("GetFilesToTransfer",
+ inport=[("studyID", "long"),
+ ("detCaseEntry", "string")],
+ outport=[("inputFiles", "stringvec"),
+ ("outputFiles", "stringvec")],
+ body="""
+inputFiles = []
+outputFiles = []
+return (inputFiles, outputFiles)
+""",
+ ),
]
)
g.make()
g.install()
g.make_appli("example_appli",
- altmodules={"OPENTURNS":openturns_module_path})
+ altmodules={"OPENTURNS":openturns_module_path,
+ "EFICAS":eficas_module_path})