flatten_components_along_sets
(function from pyomo.dae.flatten)
- pyomo.dae.flatten.flatten_components_along_sets(m, sets, ctype, indices=None, active=None)[source]
This function iterates over components (recursively) contained in a block and partitions their data objects into components indexed only by the specified sets.
- Parameters:
m (BlockData) – Block whose components (and their sub-components) will be partitioned
sets (Tuple of Pyomo Sets) – Sets to be sliced. Returned components will be indexed by some combination of these sets, if at all.
ctype (Subclass of Component) – Type of component to identify and partition
indices (Iterable or ComponentMap) – Indices of sets to use when descending into subblocks. If an iterable is provided, the order corresponds to the order in
sets. If aComponentMapis provided, the keys must be insets.active (Bool or None) – If not None, this is a boolean flag used to filter component objects by their active status. A reference-to-slice is returned if any data object defined by the slice matches this flag.
- Returns:
The first entry is a list of tuples of Pyomo Sets. The second is a list of lists of Components, indexed by the corresponding sets in the first list. If the components are unindexed, ComponentData are returned and the tuple of sets contains only UnindexedComponent_set. If the components are indexed, they are references-to-slices.
- Return type:
List of tuples of Sets, list of lists of Components