fields.mixins.base.DTensorFieldCoreMixin.ones#
- classmethod DTensorFieldCoreMixin.ones(*args, signature: SignatureInput | None = None, **kwargs) _SupDTFieldCore [source]#
Create a dense field filled with ones.
This is a convenience constructor that builds a ones-initialized
FieldComponent
using the provided grid and axes, then wraps it in aDenseField
.- Parameters:
grid (
GridBase
) – The structured grid over which the field is defined.axes (
list
ofstr
) – The spatial axes of the underlying coordinate system over which the field is defined. This must be some subset of the axes available in the coordinate system of grid.rank (
int
, optional) – The rank of the tensor field being generated. This can be supplemented by specifying the signature below to determine the variance of each rank index.*args – Additional positional arguments forwarded to the buffer constructor. The specific available args will depend on
buffer_class
andbuffer_registry
.signature (
int
orlist
ofint
, optional) – The signature of the tensor field being generated. This should be a sequence of 1 and -1 with 1 marking a contravariant index and -1 a covariant index. The length must match that of rank. If not specified, signature defaults to a fully contravariant form.buffer_class (
str
orBufferBase
, optional) –The buffer class to use for holding the data. This may be specified as a string, in which case the
buffer_registry
is queried for a matching class or it may be a specific buffer class.The relevant
*args
and**kwargs
arguments will be passed underlying buffer class’s.ones()
method.buffer_registry (
BufferRegistry
, optional) – Custom registry to use for resolving buffer class strings. By default, the standard registry is used.**kwargs – Additional keyword arguments forwarded to the buffer constructor (e.g., dtype, units).
- Returns:
A new field object filled with ones and defined over the specified grid and axes.
- Return type: