Operator declaration#
Signature#
Operator interface declaration, found in module interface.
- class ansys.scadeone.core.swan.Signature(id: Identifier, is_inlined: bool, is_node: bool, inputs: List[Variable], outputs: List[Variable], sizes: List[Identifier] | None = None, constraints: List[TypeConstraint] | None = None, specialization: PathIdentifier | None = None, pragmas: List[Pragma] | None = None)#
Bases:
OperatorSignatureBase
,SignatureCreator
Operator interface definition.
Used in module body or interface.
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None #
Helper to set owner as the owner of each item in the Iterable items.
- property constraints: List[TypeConstraint]#
Return constraints as a list.
- property id: Identifier#
Language item identifier.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property is_text: bool#
True when operator is given from {text%…%text} markup, or an interface is given from {text%…%text} markup (body) or {signature%…%signature} markup (interface).
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
or None if the object is itself a module.
- property sizes: List[Identifier]#
Return sizes as a list.
- property specialization: PathIdentifier | None#
Return specialization path_id or None.
Operator#
Operator definition, found in module body.
- class ansys.scadeone.core.swan.Operator(id: Identifier, is_inlined: bool, is_node: bool, inputs: List[Variable], outputs: List[Variable], body: Scope | Equation | Callable | None = None, sizes: List[Identifier] | None = None, constraints: List[TypeConstraint] | None = None, specialization: PathIdentifier | None = None, pragmas: List[Pragma] | None = None)#
Bases:
OperatorSignatureBase
,OperatorCreator
Operator definition, with a body.
Used in modules. The body may be empty.
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None #
Helper to set owner as the owner of each item in the Iterable items.
- property constraints: List[TypeConstraint]#
Return constraints as a list.
- property id: Identifier#
Language item identifier.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property is_text: bool#
True when operator is given from {text%…%text} markup, or an interface is given from {text%…%text} markup (body) or {signature%…%signature} markup (interface).
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
or None if the object is itself a module.
- property sizes: List[Identifier]#
Return sizes as a list.
- property specialization: PathIdentifier | None#
Return specialization path_id or None.
Constraints#
Constraint that can be applied to generic types.
- class ansys.scadeone.core.swan.TypeConstraint(type_vars: List[VariableTypeExpression] | str, kind: NumericKind)#
Bases:
SwanItem
Type constraint for operator. A constraint is:
where_decl ::= where typevar {{ , typevar }} numeric_kind
The typevar list can be protected and represented with string.
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None #
Helper to set owner as the owner of each item in the Iterable items.
- property kind: NumericKind#
Constraint numeric kind.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
or None if the object is itself a module.
- property type_vars: List[VariableTypeExpression] | str#
Return type variable names of constraints.
- Returns:
Union
[List
[VariableTypeExpression
],str
]Returns the list of type names, if not protected, or the constraint names as a string.
Scopes#
Scope contains scope sections which define variables, equations, diagrams and other sections.
- class ansys.scadeone.core.swan.Scope(sections: List[ScopeSection] | None = None, pragmas: List[Pragma] | None = None)#
Bases:
SwanItem
,PragmaBase
Scope definition:
data_def ::= scopescope ::= { {{scope_section}} }- get_declaration(name: str)#
Returns the type, global, operator or variable declaration searching by namespace.
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None #
Helper to set owner as the owner of each item in the Iterable items.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
or None if the object is itself a module.
- property sections: List[ScopeSection]#
Scope sections.
- class ansys.scadeone.core.swan.ScopeSection#
Bases:
SwanItem
Base class for scopes.
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None #
Helper to set owner as the owner of each item in the Iterable items.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
or None if the object is itself a module.
- class ansys.scadeone.core.swan.ProtectedSection(data: str)#
Bases:
ScopeSection
,ProtectedItem
Protected section, meaning a syntactically incorrect section construct.
- static set_owner(owner: SwanItem | IProject | None, children: SwanItem | Iterable[SwanItem]) None #
Helper to set owner as the owner of each item in the Iterable items.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
or None if the object is itself a module.