generate_sliced_components

(function from pyomo.dae.flatten)

pyomo.dae.flatten.generate_sliced_components(b, index_stack, slice_, sets, ctype, index_map, active=None)[source]

Recursively generate slices of the specified ctype along the specified sets

Parameters:
  • b (BlockData) – Block whose components will be sliced

  • index_stack (list) – Sets above b in the block hierarchy, including on its parent component, that have been sliced. This is necessary to return the sets that have been sliced.

  • slice (IndexedComponent_slice or BlockData) – Slice generated so far. This function will yield extensions to this slice at the current level of the block hierarchy.

  • sets (ComponentSet of Pyomo sets) – Sets that will be sliced

  • ctype (Subclass of Component) – Type of components to generate

  • index_map (ComponentMap) – Map from (some of) the specified sets to a “representative index” to use when descending into subblocks. While this map does not need to contain every set in the sliced sets, it must not contain any sets that will not be sliced.

  • active (Bool or None) – If not None, this is a boolean flag used to filter component objects by their active status.

Yields:

Tuple of Sets and an IndexedComponent_slice or ComponentData – The sets indexing the returned component or slice. If the component is indexed, an IndexedComponent_slice is returned. Otherwise, a ComponentData is returned.