Template:CMI Example CMI get grid shape C

From CSDMS
    struct edu_csdms_models_Sedflux3D__data *this =
      edu_csdms_models_Sedflux3D__get_data (self);
    struct sidl_int__array* sidl_shape;
    int * shape;
    int n_dims;

    shape = BMI_Get_grid_shape (this->state, long_var_name, &n_dims);
    sidl_shape = sidl_int__array_create1d (n_dims);

    {
      int i;
      for (i=0; i<n_dims; i++)
        sidl_int__array_set1 (sidl_shape, i, shape[i]);
    }

    g_free (shape);
    return sidl_shape;