checkpoint#
- ScalarReal.checkpoint(name: str | None = None) FieldExpression#
Register this expression and return a single-entry reference to it.
Combining a sub-expression with itself duplicates its operations every time (for example
dot(a, a)repeatsa), so heavy reuse can grow the operation stack very quickly and overflow the calculator. Checkpoint the sub-expression once, then continue from the returned reference, whose operation stack is a singleNameOfExpressionentry. This mirrors the calculator’s own named-expression /CopyToStackmechanism.- Parameters:
- name
str,optional Named-expression name. A unique one is generated when not provided.
- name
- Returns:
FieldExpressionA new expression of the same kind referencing the registered name.
Examples
Reuse a named sub-expression through a single entry.
>>> calc = type( ... "Calc", ... (), ... { ... "design_type": "HFSS", ... "add_expression": staticmethod(lambda *args, **kwargs: kwargs["name"]), ... }, ... )() >>> from ansys.aedt.core.visualization.post.field_calculator_expressions import FieldExpressions >>> fx = FieldExpressions(calc) >>> ref = fx.vector("E").magnitude().checkpoint("e_mag") >>> ref.operations ["NameOfExpression('e_mag')"]