/* Set up slab for this process. */
start[0] = 0;
start[1] = mpi_rank * DIMSIZE/mpi_size;
count[0] = DIMSIZE2;
count[1] = DIMSIZE/mpi_size;
/* Create some test data. */
data = malloc(sizeof(int)*count[1]*count[0]);
tempdata = data;
for (j = 0; j < count[0];j++){
for (i=0; i < count[1]; i++){
*tempdata = mpi_rank*(j+1);
tempdata ++;
}
}
/* Write two dimensional integer data */
if ((res = nc_put_vara_int(ncid, nvid, start, count, data))){
free(data);
BAIL(res);
}