fields.tensors.DenseTensorField.__init__#
- DenseTensorField.__init__(grid: GridBase, component: FieldComponent, signature: Sequence[Literal[1, -1]] | None = None)[source]#
Initialize a dense tensor field over a structured coordinate grid.
- Parameters:
grid (
GridBase
) – The structured grid over which the field is defined. This determines the spatial axes, metric, and chunking behavior.component (
FieldComponent
) –The single component storing the field data. The component must have trailing element dimensions that match the expected tensor shape: one dimension per tensor index, each of size equal to grid.ndim.
For example, a rank-2 tensor field in 3D requires component.element_shape = (3, 3).
signature (
list
of{+1,-1}
, optional) –Tensor signature indicating the variance of each index:
+1 → contravariant index (superscript)
-1 → covariant index (subscript)
If not specified, a default signature of all +1 (fully contravariant) is assumed.
- Raises:
ValueError – If the component’s element shape is not consistent with the tensor rank or the grid dimensionality, or if the signature is invalid.