allocator
QuantityFactory
__init__(sizer, *, backend)
Initialize a QuantityFactory from a GridSizer and a NDSL backend name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sizer
|
GridSizer
|
GridSizer object that determines the array sizes. |
required |
backend
|
Backend
|
NDSL backend name used for performance-optimized allocation. |
required |
add_data_dimensions(data_dimension_descriptions)
empty(dims, units, dtype=Float, *, allow_mismatch_float_precision=False)
Allocate a Quantity and fill it with uninitialized (undefined) values.
Equivalent to numpy.empty
from_array(data, dims, units, *, allow_mismatch_float_precision=False)
Create a Quantity from values in the data array.
This copies the values of data into the resulting Quantity. The data
array thus must correspond to the correct shape and extent for the given dims.
from_compute_array(data, dims, units, *, allow_mismatch_float_precision=False)
Create a Quantity from values of the compute domain.
This function will allocate the full Quantity (including potential
halo points) to zero. The values of data are then copied into
the compute domain. That numpy array must correspond to the correct
shape and extent of the compute domain for the given dims.
full(dims, units, value, dtype=Float, *, allow_mismatch_float_precision=False)
Allocate a Quantity and fill it with the given value.
Equivalent to numpy.full
get_quantity_halo_spec(dims, n_halo=None, dtype=Float)
ones(dims, units, dtype=Float, *, allow_mismatch_float_precision=False)
Allocate a Quantity and fill it with the value 1.
Equivalent to numpy.ones
update_data_dimensions(data_dimension_descriptions)
zeros(dims, units, dtype=Float, *, allow_mismatch_float_precision=False)
Allocate a Quantity and fill it with the value 0.
Equivalent to numpy.zeros