Back to index

salome-kernel  6.5.0
Functions
KERNEL_PY.kernel.parametric.compo_utils Namespace Reference

Functions

def create_input_dict
def create_normal_parametric_output
def create_error_parametric_output

Function Documentation

This function returns a structure describing the output of the computation
code in parametric studies in case of error.

:type  error_message: string
:param error_message: the error message.

:return: a structure of type SALOME_TYPES/ParametricOutput describing the
         error.

Definition at line 83 of file compo_utils.py.

00083 
00084 def create_error_parametric_output(error_message):
00085     """
00086     This function returns a structure describing the output of the computation
00087     code in parametric studies in case of error.
00088     
00089     :type  error_message: string
00090     :param error_message: the error message.
00091 
00092     :return: a structure of type SALOME_TYPES/ParametricOutput describing the
00093              error.
00094     """
00095     return SALOME_TYPES.ParametricOutput(outputValues = [],
00096                                          specificOutputInfos = [],
00097                                          returnCode = 1,
00098                                          errorMessage = error_message)
def KERNEL_PY.kernel.parametric.compo_utils.create_input_dict (   deterministic_dict,
  parametric_input 
)
This function returns a dictionary containing the input values to be used
in the computation code.

:type  deterministic_dict: dict
:param deterministic_dict: dictionary containing the fixed values (i.e.
                           non-parametric). This dictionary can be empty
                           if all variables are parametric.

:type  parametric_input: SALOME_TYPES/ParametricInput
:param parametric_input: structure containing the description and values
                         of the parametric variables.

:return: a dictionary containing the input values for the computation code.

Definition at line 30 of file compo_utils.py.

00030 
00031 def create_input_dict(deterministic_dict, parametric_input):
00032     """
00033     This function returns a dictionary containing the input values to be used
00034     in the computation code.
00035     
00036     :type  deterministic_dict: dict
00037     :param deterministic_dict: dictionary containing the fixed values (i.e.
00038                                non-parametric). This dictionary can be empty
00039                                if all variables are parametric.
00040 
00041     :type  parametric_input: SALOME_TYPES/ParametricInput
00042     :param parametric_input: structure containing the description and values
00043                              of the parametric variables.
00044 
00045     :return: a dictionary containing the input values for the computation code.
00046     """
00047     # Simply get the first point from input (no time series, single observation)
00048     input_point = parametric_input.inputValues[0][0]
00049 
00050     if len(input_point) != len(parametric_input.inputVarList):
00051         raise Exception("Size mismatch between inputVarList and point to evaluate")
00052 
00053     input_dict = deterministic_dict.copy()
00054     for i in range(len(input_point)):
00055         input_dict[parametric_input.inputVarList[i]] = input_point[i][0]
00056 
00057     return input_dict

def KERNEL_PY.kernel.parametric.compo_utils.create_normal_parametric_output (   output_dict,
  parametric_input 
)
This function returns a structure describing the output of the computation
code in parametric studies.

:type  output_dict: dict
:param output_dict: dictionary containing the output values of the
                    computation code (the keys are the variable names, the
                    values are the variable values).

:type  parametric_input: SALOME_TYPES/ParametricInput
:param parametric_input: structure containing the description and values
                         of the parametric variables.

:return: a structure of type SALOME_TYPES/ParametricOutput containing the
         output of the computation code.

Definition at line 58 of file compo_utils.py.

00058 
00059 def create_normal_parametric_output(output_dict, parametric_input):
00060     """
00061     This function returns a structure describing the output of the computation
00062     code in parametric studies.
00063     
00064     :type  output_dict: dict
00065     :param output_dict: dictionary containing the output values of the
00066                         computation code (the keys are the variable names, the
00067                         values are the variable values).
00068 
00069     :type  parametric_input: SALOME_TYPES/ParametricInput
00070     :param parametric_input: structure containing the description and values
00071                              of the parametric variables.
00072 
00073     :return: a structure of type SALOME_TYPES/ParametricOutput containing the
00074              output of the computation code.
00075     """
00076     output_values = [[[]]]
00077     for output_var in parametric_input.outputVarList:
00078         output_values[0][0].append([output_dict[output_var]])
00079     return SALOME_TYPES.ParametricOutput(outputValues = output_values,
00080                                          specificOutputInfos = [],
00081                                          returnCode = 0,
00082                                          errorMessage = "")