#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 of 0 for a given dimension indicates no constraint (which means the default aspect ratio of 1 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:

  1. 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.

  2. The chunk size of all dimensions i not otherwise constrained is equal to clip(round(factor * aspect_ratio[i]), 1, domain.shape()[i]), where factor is the number that makes the total number of elements per chunk closest to the target number given by the Grid::elements constraint.