SparseField#

class fields.base.SparseField(*args, **kwargs)[source]#

Field class for sparse, multi-component representations on structured grids.

SparseField represents a field composed of multiple independent FieldComponent objects, each identified by a unique index (typically an integer or a tuple of integers). This class is designed to support fields with:

  • Explicitly indexed tensor components (e.g., Tᵢⱼ)

  • Direction-dependent or variably-defined field data

  • Sparse physical quantities (e.g., only select components are populated)

Unlike DenseField, which wraps a single component and assumes uniform structure, SparseField allows for heterogeneous or partially defined field data across multiple indexed subfields.

Methods

__init__(*args, **kwargs)

items()

Return a view of (index, component) pairs in the field.

keys()

Return a view of the component indices in the field.

validate_component(index, component)

Validate a single field component and its index.

validate_components(components)

Validate all components in a dictionary for consistency with the field.

values()

Return a view of the field components.

Attributes

component_list

List of all component indices present in the field.

components

Read-only dictionary of field components.

coordinate_system

The coordinate system (e.g. a subclass of OrthogonalCoordinateSystem) which underlies this grid.

grid

The structured grid associated with this field.

num_components

Total number of components in the sparse field.