# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+## \defgroup study_exchange_vars study_exchange_vars
+# \{
+# \details
+# This module provides classes and functions to handle "Exchange Variables",
+# i.e. description of variables to be exchanged between a supervision code and a
+# computation code. These Exchange Variables can be stored in a SObject in
+# Salome study.
+# \}
+
"""
This module provides classes and functions to handle "Exchange Variables",
i.e. description of variables to be exchanged between a supervision code and a
OUTPUT_VAR_NAMES = "ExchangeVariables.OutputVarNames"
REF_ENTRY = "ExchangeVariables.RefEntry"
+## This class describes a single variable. For now, it is only described by
+# its name. Other attributes are reserved for future use.
+# \ingroup study_exchange_vars
class Variable:
"""
This class describes a single variable. For now, it is only described by
its name. Other attributes are reserved for future use.
"""
- def __init__(self, name, dimension = [], minValue = None, maxValue = None,
+ def __init__(self, name, dimension = None, minValue = None, maxValue = None,
initialValue = None):
+ if dimension is None:
+ dimension = []
self.name = name
# Reserved for future use
self.maxValue = maxValue
self.initialValue = initialValue
-
+## This class describes "Exchange Variables", i.e. a structure containing all
+# the necessary information to exchange variables between a supervision code
+# and a computation code.
+#
+# \param inputVarList This instance attribute is a list of \b Variable objects,
+# describing the input variables for the computation code.
+#
+# \param outputVarList This instance attribute is a list of \b Variable objects,
+# describing the output variables for the computation code.
+#
+# \param refEntry This instance attribute is optional and can be used to store a
+# reference to a Salome entry containing an "Exchange Variable" SObject
+# that was used to build this one (when the current object has been built
+# by selecting variables of interest in a list of potential variables).
+# \ingroup study_exchange_vars
class ExchangeVariables:
"""
This class describes "Exchange Variables", i.e. a structure containing all
"""
- def __init__(self, inputVarList = [], outputVarList = [],
+ def __init__(self, inputVarList = None, outputVarList = None,
refEntry = None):
+ if inputVarList is None:
+ inputVarList = []
+ if outputVarList is None:
+ outputVarList = []
self.inputVarList = inputVarList
self.outputVarList = outputVarList
self.refEntry = refEntry
+ ## Save this object to an XML file.
+ #
+ # \param filepath (string) path of the XML file.
def saveToXmlFile(self, filepath):
"""
Save this object to an XML file.
f.write(doc.toprettyxml(indent = " "))
f.close()
+## Create a SObject to store an \b ExchangeVariables instance.
+#
+# \param fatherSobj (SObject) parent of the SObject to create.
+#
+# \param exchangeVariables (ExchangeVariables) \b ExchangeVariables instance to store in
+# Salome study.
+#
+# \param name (string) name of the SObject to create.
+#
+# \param icon (string) icon of the SObject to create.
+#
+# \param typeId (integer) type of the SObject to create.
+#
+# \return the newly created SObject.
+# \ingroup study_exchange_vars
def createSObjectForExchangeVariables(fatherSobj, exchangeVariables,
name = DEFAULT_NAME,
icon = None, typeId = None):
typeId = typeId)
_setSObjectForExchangeVariables(editor, sobj, exchangeVariables)
+## Update an existing SObject storing an \b ExchangeVariables instance.
+#
+# \param sobj (SObject) the SObject to update.
+#
+# See \b createSObjectForExchangeVariables() for the description of the
+# other parameters.
+# \ingroup study_exchange_vars
def updateSObjectForExchangeVariables(sobj, exchangeVariables,
name = DEFAULT_NAME,
icon = None, typeId = None):
if exchangeVariables.refEntry is not None:
attr.SetString(REF_ENTRY, exchangeVariables.refEntry)
+## Get an \b ExchangeVariables instance from a SObject that stores it.
+#
+# \param sobj (SObject) the SObject from which to read the \b ExchangeVariables
+# instance.
+#
+# \return the newly created \b ExchangeVariables instance.
+# \ingroup study_exchange_vars
def getExchangeVariablesFromSObject(sobj):
"""
Get an :class:`ExchangeVariables` instance from a SObject that stores it.
[Variable(name) for name in attr.GetStrArray(OUTPUT_VAR_NAMES)],
refEntry)
+## Load an \b ExchangeVariables instance from an XML file.
+#
+# \param filepath (string) path of the XML file to load.
+#
+# \return the newly created \b ExchangeVariables instance.
+# \ingroup study_exchange_vars
def loadExchangeVariablesFromXmlFile(filepath):
"""
Load an :class:`ExchangeVariables` instance from an XML file.