digraph inheritancef2daa6d287 { bgcolor=transparent; rankdir=TB; size=""; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "AbstractProcessModel" [URL="../lava.magma.core.model.html#lava.magma.core.model.model.AbstractProcessModel",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents a model that implements the behavior of a Process."]; "ABC" -> "AbstractProcessModel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractSubProcessModel" [URL="../lava/lava.magma.core.model.sub.html#lava.magma.core.model.sub.model.AbstractSubProcessModel",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for any ProcessModel that derives the behavior of"]; "AbstractProcessModel" -> "AbstractSubProcessModel" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class lava.magma.core.model.sub.model.AbstractSubProcessModel(_)

Bases: AbstractProcessModel

Abstract base class for any ProcessModel that derives the behavior of the Process it implements from other sub processes.

Sub classes must implement the __init__ method which must accept the Process, that the SubProcessModel implements, as an argument. This allows SubProcessModel to access all process attributes such as Vars, Ports or initialization arguments passed to the Process constructor via proc.init_args.

Within the ProcessModel constructor, other sub processes can be instantiated and connected to each other or the the ports of the parent process. In addition, Vars of sub processes can be exposed as Vars of the parent process by defining an ‘alias’ relationship between parent process and sub process Vars.


>>> class SubProcessModel(AbstractSubProcessModel):
>>>     def __init__(self, proc: AbstractProcess):
>>>         # Create one or more sub processes
>>>         self.proc1 = Proc1(**proc.init_args)
>>>         self.proc2 = Proc2(**proc.init_args)
>>>         # Connect one or more ports of sub processes
>>>         self.proc1.out_ports.out1.connect(self.proc2.in_ports.input1)
>>>         # Connect one or more ports of parent port with ports of sub
>>>         # processes
>>>         proc.in_ports.input1.connect(self.proc1.in_ports.input1)
>>>         self.proc2.out_ports.output1.connect(proc.out_ports.output1)
>>>         self.proc1.ref_ports.ref1.connect(proc.ref_ports.ref1)
>>>         # Define one or more alias relationships between Vars of parent
>>>         # and sub processes
>>>         proc.vars.var1.alias(self.proc2.vars.var3)

Finds and returns all sub processes of ProcessModel.

Return type:

Dict[str, AbstractProcess]