msml.model¶
MSML – Meta model.
defines classes for:
- operators
- environments
- scene elements
- msml-files
Functions
Classes
-
class
msml.model.Alphabet(elements=[])[source]¶ Bases:
object`Alphabet`holds the information about defined :py:class:`Operator`s and :py:class:`ObjectAttribute`s
Normally it will created from a bunch of xml files.
-
get(obj)[source]¶ Parameters: obj (str) – an identifier for an Operatoror anObjectAttribute
-
static
load(filename)[source]¶ loads a pickled alphabet from the given filename :param filename: :type filename: str
-
object_attributes¶ a dictionary of all available object attributes :type: OrderedDict
-
operators¶ dictionary of defined operators :type: OrderedDict
-
-
class
msml.model.Constant(value)[source]¶ Bases:
objectA constant value within attribute values.
This class will be created py
parse_attribute_value()See also
parse_parse_attribute_value()-
value¶ the value of this constant, readonly
-
-
class
msml.model.ContactGeometry(type='linear', id=None, value=None, exportFile='')[source]¶ Bases:
objectRepresent the given contact surface within the <object> node:
<contactsurface id="" surface=""/>
-
surface¶ legacy support
-
-
class
msml.model.DiGraph(data=None, **attr)[source]¶ Bases:
networkx.classes.multidigraph.MultiDiGraphA networkx.MultiDiGraph but extends this by to methods:
self.toporderself.show
-
class
msml.model.IndexGroup(id, indices)[source]¶ Bases:
objectThe indexgroup element
<indexgroup id="" indices="" />
-
class
msml.model.MSMLEnvironment(solver=None, steps=None)[source]¶ Bases:
object
-
class
msml.model.MSMLFile(variables=None, workflow=None, scene=None, env=None, output=None)[source]¶ Bases:
objectMain model of this project.
It holds the datastructure for an whole file. Consists of variables, workflow, scene and environment settings. It provides function for validation and reference bind between workflow, scene and variables.
-
add_variable(var)[source]¶ adds the given
varto the list of variables This call replaces a variable with the same name. :param var: a new variable :type var: MSMLVariable :return: None
-
env¶ Type: msml.model.base.MSMLEnvironment Returns:
-
exists_var(name)[source]¶ checks if variable with
nameexistsParameters: name (str) – name of a variable Returns: Return type: bool
-
exporter¶
-
find_simulation_step(name)[source]¶ Tries to find the simulation step with the given name
Parameters: name (str) – name of the simulation step Return type: NoneType or msml.model.base.Environment.Simulation.Step
-
lookup(ref, outarg=True)[source]¶ Lookup a
reference. Inreferencethetaskhas to be set. The user get a warnung if the reference is ambiguous. The lookup order is: task, variable, exporter.Parameters: Returns: the closed reference or None
Return type: Reference or None
-
output¶ Type: list[ObjectElement] Returns:
-
scene¶ Type: list[ SceneObject ] Returns:
-
validate(alphabet=None)[source]¶ validates the given MSMLFile. Delegate this to his children.
Parameters: alphabet – Return type: bool Returns:
-
variables¶ Type: dict[str, MSMLVariable] Returns:
-
workflow¶ Type: Workflow Returns:
-
-
class
msml.model.MSMLFileVariable(name, format=None, typ=None, location=None)[source]¶ Bases:
object
-
class
msml.model.MSMLVariable(name, physical=None, logical=None, value=None, role=None)[source]¶ Bases:
objectRepresents an MSMLVariable. An execution of an variable results in setting the appropriate value into
the exectioner’s memory.
-
class
msml.model.MaterialRegion(id, indices, elements=None)[source]¶ Bases:
msml.model.base.IndexGroup,listRepresents an material region from an MSMLFile within an SceneObject
<material> <region id="" indices=""> [object elements] </region> </material>
See also
-
class
msml.model.Mesh(type='linear', id=None, value=None)[source]¶ Bases:
objectRepresent the given mesh within the <object> node:
<mesh> <*type* id="" mesh="" /> <mesh>-
mesh¶ legacy support
-
-
class
msml.model.OAConstraint(name, quantity='single', description='documentation N/A', parameters=None, inputs=None)[source]¶ Bases:
msml.model.alphabet.ObjectAttribute
-
class
msml.model.OAMaterial(name, quantity='single', description='documentation N/A', parameters=None, inputs=None)[source]¶ Bases:
msml.model.alphabet.ObjectAttribute
-
class
msml.model.OAOutput(name, quantity='single', description='documentation N/A', parameters=None, inputs=None)[source]¶ Bases:
msml.model.alphabet.ObjectAttribute
-
class
msml.model.ObjectAttribute(name, quantity='single', description='documentation N/A', parameters=None, inputs=None)[source]¶ Bases:
objectClass of all user-defineable constraints, outputs, materials.
-
class
msml.model.ObjectConstraints(name, forStep='initial', constraints=None)[source]¶ Bases:
objectConstraints for a timestep (
for_step)-
add_constraint(*constraints)[source]¶ add
constraintsto this object ;type constraints: ObjectElement :param constraints: :return:
-
bind(alphabet)[source]¶ binds all constraints to the given
alphabet:type alphabet: msml.model.alphabet.Alphabet :return: None
-
constraints¶ Type: list[ObjectElement] Returns:
-
for_step¶ Type: str Returns:
-
index_group¶
-
name¶ Type: str Returns:
-
-
class
msml.model.ObjectElement(attrib={}, meta=None)[source]¶ Bases:
objectThis class describe an instance of an
ObjectAttribute-
meta¶
-
tag¶ Returns: the element (tag) name, this is the same as the ObjectAttribute.name in self.meta
-
-
class
msml.model.Operator(name, input=None, output=None, parameters=None, runtime=None, settings=None, meta=None)[source]¶ Bases:
objectOperator hold all slots, runtime information and meta data
-
class
msml.model.PythonOperator(name, input=None, output=None, parameters=None, runtime=None, meta=None, settings=None)[source]¶ Bases:
msml.model.alphabet.operator.base.OperatorOperator for Python functions.
-
class
msml.model.Reference(task, out=None)[source]¶ Bases:
objectDescribes a connection from an input slot to an output slot.
-
linked¶ Returns True iff. the Reference is closed iff. input and output slot found and set. :return: bool
-
class
ref(task, name, arginfo)¶ Bases:
tuple-
arginfo¶ Alias for field number 2
-
name¶ Alias for field number 1
-
task¶ Alias for field number 0
-
-
Reference.valid¶ Returns True iff. the input and output slot are physical type compatible :return: bool
-
-
class
msml.model.SceneObject(oid, mesh=None, sets=SceneObjectSets(elements=[], nodes=[], surfaces=[]), material=None, constraints=None)[source]¶ Bases:
object-
constraints¶
-
contactGeometry¶ Type: ContactGeometry Returns:
-
hasContactGeometry¶
-
id¶
-
material¶
-
mesh¶ Type: Mesh Returns:
-
output¶
-
sets¶ Type: msml.model.base.SceneObjectSets Returns: the current sets
-
Bases:
msml.model.alphabet.operator.python.PythonOperatorShared Object Call via ctype
-
class
msml.model.ShellOperator(name, input=None, output=None, parameters=None, runtime=None, meta=None, settings=None)[source]¶ Bases:
msml.model.alphabet.operator.python.PythonOperator
-
class
msml.model.Slot(name, physical, logical=None, required=True, default=None, meta=None, parent=None)[source]¶ Bases:
objectAn input, parameter or output slot of an operator or an element Consists of name, physical and logical type.
Proxy for meta data.
-
SLOT_TYPE_INPUT= 0¶
-
SLOT_TYPE_OUTPUT= 1¶
-
SLOT_TYPE_PARAMETER= 2¶
-
SLOT_TYPE_UNKNOWN= -1¶
-
-
class
msml.model.Task(name, attrib)[source]¶ Bases:
objectA task object is a node in the execution graph. It holds his input arguments and the corresponding operator from the alphabet. It can be called with an **kwargs argument of the input parameters form
self.arguments.-
ID_ATTRIB= 'id'¶
-
bound¶
-
id¶ idof this task if set, If noneìdis set, it will generate one. :returns: :rtype: str
-
-
class
msml.model.Workflow(tasks=[])[source]¶ Bases:
object-
link(alphabet, msmlfile)[source]¶ Link all tasks input and paramters slots to output slots and variables form the given msml file.
Parameters: - alphabet (msml.model.alphabet.Alphabet) – the current alphabet
- msmlfile (MSMLFile) – the msmlfile, to which the workflow belongs
Returns:
-
tasks¶ Type: dict[str,Task] Returns:
-
-
msml.model.is_generated_name(name)[source]¶ True iff. the given name is a generated name :param str name: :return: bool