-
#include "tensorstore/chunk_layout.h"
-
template <Usage U>
struct tensorstore::ChunkLayout::ChunkAspectRatioFor
: public ChunkAspectRatioBase; Constrains the aspect ratio of the chunk shape for the specified usage
U
.Example:
tensorstore::ChunkLayout constraints; // Sets a hard constraint on the aspect ratio for dimensions 0 and 1 TENSORSTORE_RETURN_IF_ERROR(constraints.Set( tensorstore::ChunkLayout::ReadChunkAspectRatio{ {1, 1, 0}, /*hard_constraint=*/true}));
This type inherits from
tensorstore::span<const double>
.The aspect ratio for each dimension is specified as a non-negative
double
. A value of0
for a given dimension indicates no constraint (which means the default aspect ratio of1
will be used). A rank of 0 indicates no constraints. It is an error to specify negative values.The actual chunk shape is determined as follows:
If the chunk size for a given dimension is explicitly constrained, either by the
Grid::shape
property or by a driver-specific constraint, that size is used and the aspect ratio value is ignored.The chunk size of all dimensions
i
not otherwise constrained is equal toclip(round(factor * aspect_ratio[i]), 1, domain.shape()[i])
, wherefactor
is the number that makes the total number of elements per chunk closest to the target number given by theGrid::elements
constraint.