# Control objects¶

Abstract base classes for Control objects, which govern the iteration of Z2Pack runs.

class z2pack._control.AbstractControl[source]

ABC for all control objects. Instances must also have a ‘state’ attribute to work correctly, which is not enforced by the ABC.

class z2pack._control.ControlContainer(*, controls, categories, valid_type)[source]

Container for controls, giving simple access to the different types of controls.

class z2pack._control.ConvergenceControl[source]

ABC for convergence tester objects. Enforces the existence of an update method, and the converged property. For LineControl objects, the converged property must be valid (False) also before the first update() call. This is not required for SurfaceControl objects.

class z2pack._control.DataControl[source]

ABC for control objects which can be updated with data.

class z2pack._control.IterationControl[source]

ABC for iteration control objects. Enforces the existence of …

class z2pack._control.LineControl[source]

Specializes AbstractControl for Line objects

class z2pack._control.StatefulControl(*, state=None, **kwargs)[source]

ABC for control objects which have a state. The state must not depend on the given convergence parameters.

Concepts:

Constructor: StatefulControl(state=s).state == s for any valid state s.

State: The state must be sufficient to uniquely determine the behaviour of the Control, for a given set of input parameters of the constructor. That is, given two equivalent StatefulControl objects, when applying

sc1 = StatefulControl(*args, **kwargs)
sc2 = StatefulControl(*args, **kwargs)
...working with sc1 and/or sc2...
sc2.state = sc1.state


sc1 and sc2 are again equivalent. In particular, it is not necessary to use update() on sc2 in the case of a DataControl.

abstract property state

Returns the state of the Control.

class z2pack._control.SurfaceControl[source]

Specializes AbstractControl for Surface objects

class z2pack._control.VolumeControl[source]

Specializes AbstractControl for Volume objects