#include "tensorstore/chunk_layout.h"
template <Usage U>
absl::Status
tensorstore::ChunkLayout::Set(const GridViewFor<U>value);

Sets the grid constraints for the specified usage.

For example, to specify constraints on write chunks:

tensorstore::ChunkLayout constraints;
TENSORSTORE_RETURN_IF_ERROR(constraints.Set(
    tensorstore::ChunkLayout::WriteChunk(
      tensorstore::ChunkLayout::ChunkShape({100, 200}))));

Equivalently, specifying the usage at run time:

TENSORSTORE_RETURN_IF_ERROR(constraints.Set(
    tensorstore::ChunkLayout::Chunk(
      tensorstore::ChunkLayout::ChunkShapeBase({100, 200}),
      tensorstore::ChunkLayout::kWrite)));

To specify common constraints for write, read, and codec chunks:

TENSORSTORE_RETURN_IF_ERROR(constraints.Set(
    tensorstore::ChunkLayout::Chunk(
      tensorstore::ChunkLayout::ChunkAspectRatio({1, 2}),
      tensorstore::ChunkLayout::ChunkElements(5000000))));

Note that the aspect ratio of {1, 2} applies to write, read, and codec chunks, but a target number of elements of 5000000 is set only for write and read chunks.