fields.tensors.DenseTensorField.validate_component#

DenseTensorField.validate_component(index: ComponentIndex, component: Any) None#

Validate a single field component and its index.

Checks that:

  • the component is a FieldComponent,

  • the component’s grid matches the field’s grid,

  • the index is of the correct type (int or tuple of ints).

Parameters:
  • index (int or tuple of int) – The index key for the component in the field.

  • component (Any) – The component object to validate.

Raises:
  • TypeError – If the component is not a FieldComponent or index is not valid.

  • ValueError – If the component uses a different grid or index format is incorrect.