OMget_array_dims


Synopsis


int  OMget_array_dims (
OMobj_id  object_id,
int  *ndims,
int  *size_of_each_dimension  );

Description

OMget_array_dims returns the dimensions of the specified object.

Arguments

object_id

The id of an array object.

ndims

An output argument, set to the number of dimensions in the array.

size_of_each_dimension

An array output argument indicating the size in each dimension. The first element of the array is set to fastest varying dimension which is the size of the rightmost dimension, and so forth.

size_of_each_dimension should be an integer array large enough for the maximum number of dimensions that can be returned. The constant OM_ARRAY_MAXDIM specifies the maximum number of dimensions allowed by AVS/Express.

If you do not care about each dimensions's size, you can set size_of_each_dimension to NULL.

Returned value

The status code (see Return Status ).

Example

Assume you have an integer array object defined as follows in the V code:


int ndims = 100, mdims = 200;
int my_array[ndims][mdims];

You can then query the array's dimensions and size in each dimension. In the code below, assume that parent_id contains the id of my_array's parent object:


OMobj_id parent_id, my_array;
int i, ndims;
int dim_sizes[OM_ARRAY_MAXDIM];
...
my_array = OMfind_subobj(parent_id,
OMstr_to_name("my_array"),
OM_OBJ_RD);
status = OMget_array_dims(my_array, &ndims, &dim_sizes);
if (status == 1) {
printf("Number of dimensions: %d\n", ndims);
printf("Dimensions:  ");
for (i=0; i<ndims; i++)
printf("[%d]", dim_sizes[i]);
printf("\n");
};